@Override public UnmanagedDataDiskImpl withExistingVhd(String storageAccountName, String containerName, String vhdName) { this.inner() .withCreateOption(DiskCreateOptionTypes.ATTACH) .withVhd(new VirtualHardDisk() .withUri(blobUrl(storageAccountName, containerName, vhdName))); return this; }
@Override public UnmanagedDataDiskImpl withExistingVhd(String storageAccountName, String containerName, String vhdName) { this.inner() .withCreateOption(DiskCreateOptionTypes.ATTACH) .withVhd(new VirtualHardDisk() .withUri(blobUrl(storageAccountName, containerName, vhdName))); return this; }
@Override public UnmanagedDataDiskImpl storeAt(String storageAccountName, String containerName, String vhdName) { this.inner().withVhd(new VirtualHardDisk()); // URL points to where the underlying vhd needs to be stored this.inner().vhd().withUri(blobUrl(storageAccountName, containerName, vhdName)); return this; }
@Override public UnmanagedDataDiskImpl storeAt(String storageAccountName, String containerName, String vhdName) { this.inner().withVhd(new VirtualHardDisk()); // URL points to where the underlying vhd needs to be stored this.inner().vhd().withUri(blobUrl(storageAccountName, containerName, vhdName)); return this; }
protected static void ensureDisksVhdUri(List<VirtualMachineUnmanagedDataDisk> dataDisks, StorageAccount storageAccount, String namePrefix) { for (VirtualMachineUnmanagedDataDisk dataDisk : dataDisks) { if (dataDisk.creationMethod() == DiskCreateOptionTypes.EMPTY || dataDisk.creationMethod() == DiskCreateOptionTypes.FROM_IMAGE) { //New empty and from image data disk requires Vhd Uri to be set if (dataDisk.inner().vhd() == null) { dataDisk.inner().withVhd(new VirtualHardDisk()); dataDisk.inner().vhd().withUri(storageAccount.endPoints().primary().blob() + "vhds/" + namePrefix + "-data-disk-" + dataDisk.lun() + "-" + UUID.randomUUID().toString() + ".vhd"); } } } }
protected static void ensureDisksVhdUri(List<VirtualMachineUnmanagedDataDisk> dataDisks, StorageAccount storageAccount, String namePrefix) { for (VirtualMachineUnmanagedDataDisk dataDisk : dataDisks) { if (dataDisk.creationMethod() == DiskCreateOptionTypes.EMPTY || dataDisk.creationMethod() == DiskCreateOptionTypes.FROM_IMAGE) { //New empty and from image data disk requires Vhd Uri to be set if (dataDisk.inner().vhd() == null) { dataDisk.inner().withVhd(new VirtualHardDisk()); dataDisk.inner().vhd().withUri(storageAccount.endPoints().primary().blob() + "vhds/" + namePrefix + "-data-disk-" + dataDisk.lun() + "-" + UUID.randomUUID().toString() + ".vhd"); } } } }
protected static void ensureDisksVhdUri(List<VirtualMachineUnmanagedDataDisk> dataDisks, String namePrefix) { String containerUrl = null; for (VirtualMachineUnmanagedDataDisk dataDisk : dataDisks) { if (dataDisk.creationMethod() == DiskCreateOptionTypes.EMPTY && dataDisk.inner().vhd() != null) { int idx = dataDisk.inner().vhd().uri().lastIndexOf('/'); containerUrl = dataDisk.inner().vhd().uri().substring(0, idx); break; } } if (containerUrl != null) { for (VirtualMachineUnmanagedDataDisk dataDisk : dataDisks) { if (dataDisk.creationMethod() == DiskCreateOptionTypes.EMPTY) { //New data disk requires Vhd Uri to be set if (dataDisk.inner().vhd() == null) { dataDisk.inner().withVhd(new VirtualHardDisk()); dataDisk.inner().vhd().withUri(containerUrl + namePrefix + "-data-disk-" + dataDisk.lun() + "-" + UUID.randomUUID().toString() + ".vhd"); } } } } }
protected static void ensureDisksVhdUri(List<VirtualMachineUnmanagedDataDisk> dataDisks, String namePrefix) { String containerUrl = null; for (VirtualMachineUnmanagedDataDisk dataDisk : dataDisks) { if (dataDisk.creationMethod() == DiskCreateOptionTypes.EMPTY && dataDisk.inner().vhd() != null) { int idx = dataDisk.inner().vhd().uri().lastIndexOf('/'); containerUrl = dataDisk.inner().vhd().uri().substring(0, idx); break; } } if (containerUrl != null) { for (VirtualMachineUnmanagedDataDisk dataDisk : dataDisks) { if (dataDisk.creationMethod() == DiskCreateOptionTypes.EMPTY) { //New data disk requires Vhd Uri to be set if (dataDisk.inner().vhd() == null) { dataDisk.inner().withVhd(new VirtualHardDisk()); dataDisk.inner().vhd().withUri(containerUrl + namePrefix + "-data-disk-" + dataDisk.lun() + "-" + UUID.randomUUID().toString() + ".vhd"); } } } } }
@Override public VirtualMachineImpl withSpecializedOSUnmanagedDisk(String osDiskUrl, OperatingSystemTypes osType) { VirtualHardDisk osVhd = new VirtualHardDisk(); osVhd.withUri(osDiskUrl); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.ATTACH); this.inner().storageProfile().osDisk().withVhd(osVhd); this.inner().storageProfile().osDisk().withOsType(osType); this.inner().storageProfile().osDisk().withManagedDisk(null); return this; }
@Override public VirtualMachineImpl withSpecializedOSUnmanagedDisk(String osDiskUrl, OperatingSystemTypes osType) { VirtualHardDisk osVhd = new VirtualHardDisk(); osVhd.withUri(osDiskUrl); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.ATTACH); this.inner().storageProfile().osDisk().withVhd(osVhd); this.inner().storageProfile().osDisk().withOsType(osType); this.inner().storageProfile().osDisk().withManagedDisk(null); return this; }
@Override public VirtualMachineImpl withStoredLinuxImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().osDisk().withImage(userImageVhd); // For platform | custom image osType will be null, azure will pick it from the image metadata. // But for stored image, osType needs to be specified explicitly // this.inner().storageProfile().osDisk().withOsType(OperatingSystemTypes.LINUX); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); return this; }
@Override public VirtualMachineImpl withStoredLinuxImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().osDisk().withImage(userImageVhd); // For platform | custom image osType will be null, azure will pick it from the image metadata. // But for stored image, osType needs to be specified explicitly // this.inner().storageProfile().osDisk().withOsType(OperatingSystemTypes.LINUX); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); return this; }
.osDisk().vhd().uri() .replaceFirst("\\{storage-base-url}", storageAccount.endPoints().primary().blob()); inner().storageProfile().osDisk().vhd().withUri(uri);
.osDisk().vhd().uri() .replaceFirst("\\{storage-base-url}", storageAccount.endPoints().primary().blob()); inner().storageProfile().osDisk().vhd().withUri(uri);
@Override public VirtualMachineScaleSetImpl withStoredLinuxImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withImage(userImageVhd); // For platform image osType will be null, azure will pick it from the image metadata. this.inner() .virtualMachineProfile() .storageProfile().osDisk().withOsType(OperatingSystemTypes.LINUX); this.inner() .virtualMachineProfile() .osProfile().withLinuxConfiguration(new LinuxConfiguration()); return this; }
@Override public VirtualMachineScaleSetImpl withStoredLinuxImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withImage(userImageVhd); // For platform image osType will be null, azure will pick it from the image metadata. this.inner() .virtualMachineProfile() .storageProfile().osDisk().withOsType(OperatingSystemTypes.LINUX); this.inner() .virtualMachineProfile() .osProfile().withLinuxConfiguration(new LinuxConfiguration()); return this; }
@Override public VirtualMachineImpl withStoredWindowsImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().osDisk().withImage(userImageVhd); // For platform image osType will be null, azure will pick it from the image metadata. this.inner().storageProfile().osDisk().withOsType(OperatingSystemTypes.WINDOWS); this.inner().osProfile().withWindowsConfiguration(new WindowsConfiguration()); // sets defaults for "Stored(User)Image" or "VM(Platform)Image" this.inner().osProfile().windowsConfiguration().withProvisionVMAgent(true); this.inner().osProfile().windowsConfiguration().withEnableAutomaticUpdates(true); return this; }
@Override public VirtualMachineImpl withStoredWindowsImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().osDisk().withImage(userImageVhd); // For platform image osType will be null, azure will pick it from the image metadata. this.inner().storageProfile().osDisk().withOsType(OperatingSystemTypes.WINDOWS); this.inner().osProfile().withWindowsConfiguration(new WindowsConfiguration()); // sets defaults for "Stored(User)Image" or "VM(Platform)Image" this.inner().osProfile().windowsConfiguration().withProvisionVMAgent(true); this.inner().osProfile().windowsConfiguration().withEnableAutomaticUpdates(true); return this; }
@Override public VirtualMachineScaleSetImpl withStoredWindowsImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withImage(userImageVhd); // For platform image osType will be null, azure will pick it from the image metadata. this.inner() .virtualMachineProfile() .storageProfile().osDisk().withOsType(OperatingSystemTypes.WINDOWS); this.inner() .virtualMachineProfile() .osProfile().withWindowsConfiguration(new WindowsConfiguration()); // sets defaults for "Stored(Custom)Image" or "VM(Platform)Image" this.inner() .virtualMachineProfile() .osProfile().windowsConfiguration().withProvisionVMAgent(true); this.inner() .virtualMachineProfile() .osProfile().windowsConfiguration().withEnableAutomaticUpdates(true); return this; }
@Override public VirtualMachineScaleSetImpl withStoredWindowsImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withImage(userImageVhd); // For platform image osType will be null, azure will pick it from the image metadata. this.inner() .virtualMachineProfile() .storageProfile().osDisk().withOsType(OperatingSystemTypes.WINDOWS); this.inner() .virtualMachineProfile() .osProfile().withWindowsConfiguration(new WindowsConfiguration()); // sets defaults for "Stored(Custom)Image" or "VM(Platform)Image" this.inner() .virtualMachineProfile() .osProfile().windowsConfiguration().withProvisionVMAgent(true); this.inner() .virtualMachineProfile() .osProfile().windowsConfiguration().withEnableAutomaticUpdates(true); return this; }