/** * @return the LUN value of the data disk image if this disk or snapshot is created from * a data disk image, -1 otherwise */ public int sourceDataDiskImageLun() { if (this.type() == CreationSourceType.FROM_DATA_DISK_IMAGE) { return this.creationData.imageReference().lun(); } return -1; } }
/** * @return the image reference */ public ImageReference imageReference() { return new ImageReference() .withPublisher(publisher()) .withOffer(offer()) .withSku(sku()) .withVersion("latest"); } }
/** * Checks whether the OS disk is directly attached to a unmanaged VHD. * * @param osDisk the osDisk value in the storage profile * @return true if the OS disk is attached to a unmanaged VHD, false otherwise */ private boolean isOSDiskAttachedUnmanaged(OSDisk osDisk) { return osDisk.createOption() == DiskCreateOptionTypes.ATTACH && osDisk.vhd() != null && osDisk.vhd().uri() != null; }
@Override public VirtualMachineImpl withWindowsCustomImage(String customImageId) { ImageReference imageReferenceInner = new ImageReference(); imageReferenceInner.withId(customImageId); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().withImageReference(imageReferenceInner); this.inner().osProfile().withWindowsConfiguration(new WindowsConfiguration()); // sets defaults for "Stored(User)Image", "VM(Platform | Custom | Gallery)Image" this.inner().osProfile().windowsConfiguration().withProvisionVMAgent(true); this.inner().osProfile().windowsConfiguration().withEnableAutomaticUpdates(true); return this; }
@Override public VirtualMachineImpl withLinuxCustomImage(String customImageId) { ImageReference imageReferenceInner = new ImageReference(); imageReferenceInner.withId(customImageId); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().withImageReference(imageReferenceInner); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
/** * @return the image reference */ public ImageReference imageReference() { return new ImageReference() .withPublisher(publisher()) .withOffer(offer()) .withSku(sku()) .withVersion("latest"); } }
@Override public Observable<VirtualMachine> call(final VirtualMachineExtension encryptionExtension) { final HashMap<String, Object> publicSettings = encryptConfig.extensionPublicSettings(); return virtualMachine.update() .updateExtension(encryptionExtension.name()) .withPublicSettings(publicSettings) .withProtectedSettings(encryptConfig.extensionProtectedSettings()) .parent() .applyAsync(); } });
@Override public String osDiskId() { if (!isManagedDiskEnabled()) { return null; } return this.storageProfile().osDisk().managedDisk().id(); }
@Override public String osDiskId() { if (this.storageProfile().osDisk().managedDisk() != null) { return this.storageProfile().osDisk().managedDisk().id(); } return null; }
/** * Parses into a VMSS SKU type and creates a new VMSS SKU type instance if not found among the existing ones. * @param skuName a SKU name * @param skuTier a SKU tier * @return a VMSS SKU type */ public static VirtualMachineScaleSetSkuTypes fromSkuNameAndTier(String skuName, String skuTier) { return fromSku(new Sku().withName(skuName).withTier(skuTier)); }
/** * Checks whether the OS disk is directly attached to a managed disk. * * @param osDisk the osDisk value in the storage profile * @return true if the OS disk is attached to a managed disk, false otherwise */ private boolean isOSDiskAttachedManaged(OSDisk osDisk) { return osDisk.createOption() == DiskCreateOptionTypes.ATTACH && osDisk.managedDisk() != null && osDisk.managedDisk().id() != null; }
/** * 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 Boolean call(ComputeSku computeSku) { return computeSku.resourceType() != null && computeSku.resourceType().equals(resourceType); } });
@Override public VirtualMachineImpl withLinuxCustomImage(String customImageId) { ImageReference imageReferenceInner = new ImageReference(); imageReferenceInner.withId(customImageId); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().withImageReference(imageReferenceInner); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
/** * @return the image reference */ public ImageReference imageReference() { return new ImageReference() .withPublisher(publisher()) .withOffer(offer()) .withSku(sku()) .withVersion("latest"); } }
/** * Checks whether the OS disk is directly attached to a unmanaged VHD. * * @param osDisk the osDisk value in the storage profile * @return true if the OS disk is attached to a unmanaged VHD, false otherwise */ private boolean isOSDiskAttachedUnmanaged(OSDisk osDisk) { return osDisk.createOption() == DiskCreateOptionTypes.ATTACH && osDisk.vhd() != null && osDisk.vhd().uri() != null; }
/** * Parses into a VMSS SKU type and creates a new VMSS SKU type instance if not found among the existing ones. * @param skuName a SKU name * @param skuTier a SKU tier * @return a VMSS SKU type */ public static VirtualMachineScaleSetSkuTypes fromSkuNameAndTier(String skuName, String skuTier) { return fromSku(new Sku().withName(skuName).withTier(skuTier)); }
/** * @return the LUN value of the data disk image if this disk or snapshot is created from * a data disk image, -1 otherwise */ public int sourceDataDiskImageLun() { if (this.type() == CreationSourceType.FROM_DATA_DISK_IMAGE) { return this.creationData.imageReference().lun(); } return -1; } }
/** * 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 Boolean call(ComputeSku computeSku) { return computeSku.resourceType() != null && computeSku.resourceType().equals(resourceType); } });