/** * Parses a value into a disk SKU type and creates a new DiskSkuType instance if not found among the existing ones. * * @param value a disk SKU type name * @return the parsed or created disk SKU type */ public static DiskSkuTypes fromStorageAccountType(StorageAccountTypes value) { if (value == null) { return null; } DiskSkuTypes result = VALUES_BY_NAME.get(value.toString().toLowerCase()); if (result != null) { return result; } else { return new DiskSkuTypes(value); } }
@Override public DiskSkuTypes sku() { return DiskSkuTypes.fromDiskSku(this.inner().sku()); }
/** * Parses a value into a disk SKU type and creates a new DiskSkuType instance if not found among the existing ones. * * @param diskSku a disk SKU type name * @return the parsed or created disk SKU type */ public static DiskSkuTypes fromDiskSku(DiskSku diskSku) { if (diskSku == null) { return null; } return fromStorageAccountType(diskSku.name()); }
@Override public GalleryImageImpl withUnsupportedDiskTypes(List<DiskSkuTypes> diskTypes) { if (this.inner().disallowed() == null) { this.inner().withDisallowed(new Disallowed()); } this.inner().disallowed().withDiskTypes(new ArrayList<String>()); for (DiskSkuTypes diskType : diskTypes) { this.inner().disallowed().diskTypes().add(diskType.toString()); } return this; }
@Override public DiskImpl withSku(DiskSkuTypes sku) { this.inner().withSku((new DiskSku()).withName(sku.accountType())); return this; }
@Override public GalleryImageImpl withUnsupportedDiskTypes(List<DiskSkuTypes> diskTypes) { if (this.inner().disallowed() == null) { this.inner().withDisallowed(new Disallowed()); } this.inner().disallowed().withDiskTypes(new ArrayList<String>()); for (DiskSkuTypes diskType : diskTypes) { this.inner().disallowed().diskTypes().add(diskType.toString()); } return this; }
@Override public DiskImpl withSku(DiskSkuTypes sku) { this.inner().withSku((new DiskSku()).withName(sku.accountType())); return this; }
/** * Parses a value into a disk SKU type and creates a new DiskSkuType instance if not found among the existing ones. * * @param diskSku a disk SKU type name * @return the parsed or created disk SKU type */ public static DiskSkuTypes fromDiskSku(DiskSku diskSku) { if (diskSku == null) { return null; } return fromStorageAccountType(diskSku.name()); }
@Override public GalleryImageImpl withUnsupportedDiskType(DiskSkuTypes diskType) { if (this.inner().disallowed() == null) { this.inner().withDisallowed(new Disallowed()); } if (this.inner().disallowed().diskTypes() == null) { this.inner().disallowed().withDiskTypes(new ArrayList<String>()); } boolean found = false; String newDiskTypeStr = diskType.toString(); for (String diskTypeStr : this.inner().disallowed().diskTypes()) { if (diskTypeStr.equalsIgnoreCase(newDiskTypeStr)) { found = true; break; } } if (!found) { this.inner().disallowed().diskTypes().add(diskType.toString()); } return this; }
@Override public SnapshotImpl withSku(DiskSkuTypes sku) { SnapshotSku snapshotSku = new SnapshotSku(); snapshotSku.withName(SnapshotStorageAccountTypes.fromString(sku.accountType().toString())); this.inner().withSku(snapshotSku); return this; }
@Override public DiskSkuTypes sku() { return DiskSkuTypes.fromDiskSku(this.inner().sku()); }
/** * Parses a value into a disk SKU type and creates a new DiskSkuType instance if not found among the existing ones. * * @param value a disk SKU type name * @return the parsed or created disk SKU type */ public static DiskSkuTypes fromStorageAccountType(StorageAccountTypes value) { if (value == null) { return null; } DiskSkuTypes result = VALUES_BY_NAME.get(value.toString().toLowerCase()); if (result != null) { return result; } else { return new DiskSkuTypes(value); } }
@Override public List<DiskSkuTypes> unsupportedDiskTypes() { if (this.inner().disallowed() == null || this.inner().disallowed().diskTypes() == null) { return Collections.unmodifiableList(new ArrayList<DiskSkuTypes>()); } else { List<DiskSkuTypes> diskTypes = new ArrayList<DiskSkuTypes>(); for (String diskTypeStr : this.inner().disallowed().diskTypes()) { diskTypes.add(DiskSkuTypes.fromStorageAccountType(StorageAccountTypes.fromString(diskTypeStr))); } return Collections.unmodifiableList(diskTypes); } }
@Override public GalleryImageImpl withUnsupportedDiskType(DiskSkuTypes diskType) { if (this.inner().disallowed() == null) { this.inner().withDisallowed(new Disallowed()); } if (this.inner().disallowed().diskTypes() == null) { this.inner().disallowed().withDiskTypes(new ArrayList<String>()); } boolean found = false; String newDiskTypeStr = diskType.toString(); for (String diskTypeStr : this.inner().disallowed().diskTypes()) { if (diskTypeStr.equalsIgnoreCase(newDiskTypeStr)) { found = true; break; } } if (!found) { this.inner().disallowed().diskTypes().add(diskType.toString()); } return this; }
@Override public SnapshotImpl withSku(DiskSkuTypes sku) { SnapshotSku snapshotSku = new SnapshotSku(); snapshotSku.withName(SnapshotStorageAccountTypes.fromString(sku.accountType().toString())); this.inner().withSku(snapshotSku); return this; }
@Override public List<DiskSkuTypes> unsupportedDiskTypes() { if (this.inner().disallowed() == null || this.inner().disallowed().diskTypes() == null) { return Collections.unmodifiableList(new ArrayList<DiskSkuTypes>()); } else { List<DiskSkuTypes> diskTypes = new ArrayList<DiskSkuTypes>(); for (String diskTypeStr : this.inner().disallowed().diskTypes()) { diskTypes.add(DiskSkuTypes.fromStorageAccountType(StorageAccountTypes.fromString(diskTypeStr))); } return Collections.unmodifiableList(diskTypes); } }
@Override public GalleryImageImpl withoutUnsupportedDiskType(DiskSkuTypes diskType) { if (this.inner().disallowed() != null && this.inner().disallowed().diskTypes() != null) { int foundIndex = -1; int i = 0; String diskTypeToRemove = diskType.toString(); for (String diskTypeStr : this.inner().disallowed().diskTypes()) { if (diskTypeStr.equalsIgnoreCase(diskTypeToRemove)) { foundIndex = i; break; } i++; } if (foundIndex != -1) { this.inner().disallowed().diskTypes().remove(foundIndex); } } return this; }
@Override public DiskSkuTypes diskSkuType() { if (this.inner.resourceType() != null && (this.inner.resourceType().equalsIgnoreCase("disks") || this.inner.resourceType().equalsIgnoreCase("snapshots")) && this.inner.name() != null) { return DiskSkuTypes.fromStorageAccountType(StorageAccountTypes.fromString(this.inner.name())); } else { return null; } }
@Override public GalleryImageImpl withoutUnsupportedDiskType(DiskSkuTypes diskType) { if (this.inner().disallowed() != null && this.inner().disallowed().diskTypes() != null) { int foundIndex = -1; int i = 0; String diskTypeToRemove = diskType.toString(); for (String diskTypeStr : this.inner().disallowed().diskTypes()) { if (diskTypeStr.equalsIgnoreCase(diskTypeToRemove)) { foundIndex = i; break; } i++; } if (foundIndex != -1) { this.inner().disallowed().diskTypes().remove(foundIndex); } } return this; }
@Override public DiskSkuTypes diskSkuType() { if (this.inner.resourceType() != null && (this.inner.resourceType().equalsIgnoreCase("disks") || this.inner.resourceType().equalsIgnoreCase("snapshots")) && this.inner.name() != null) { return DiskSkuTypes.fromStorageAccountType(StorageAccountTypes.fromString(this.inner.name())); } else { return null; } }