Class OSDisk


  • public final class OSDisk
    extends Object
    Specifies information about the operating system disk used by the virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview).
    • Constructor Detail

      • OSDisk

        public OSDisk()
    • Method Detail

      • osType

        public OperatingSystemTypes osType()
        Get the osType property: This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**.
        Returns:
        the osType value.
      • withOsType

        public OSDisk withOsType​(OperatingSystemTypes osType)
        Set the osType property: This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**.
        Parameters:
        osType - the osType value to set.
        Returns:
        the OSDisk object itself.
      • encryptionSettings

        public DiskEncryptionSettings encryptionSettings()
        Get the encryptionSettings property: Specifies the encryption settings for the OS Disk. <br><br> Minimum api-version: 2015-06-15.
        Returns:
        the encryptionSettings value.
      • withEncryptionSettings

        public OSDisk withEncryptionSettings​(DiskEncryptionSettings encryptionSettings)
        Set the encryptionSettings property: Specifies the encryption settings for the OS Disk. <br><br> Minimum api-version: 2015-06-15.
        Parameters:
        encryptionSettings - the encryptionSettings value to set.
        Returns:
        the OSDisk object itself.
      • name

        public String name()
        Get the name property: The disk name.
        Returns:
        the name value.
      • withName

        public OSDisk withName​(String name)
        Set the name property: The disk name.
        Parameters:
        name - the name value to set.
        Returns:
        the OSDisk object itself.
      • vhd

        public VirtualHardDisk vhd()
        Get the vhd property: The virtual hard disk.
        Returns:
        the vhd value.
      • withVhd

        public OSDisk withVhd​(VirtualHardDisk vhd)
        Set the vhd property: The virtual hard disk.
        Parameters:
        vhd - the vhd value to set.
        Returns:
        the OSDisk object itself.
      • image

        public VirtualHardDisk image()
        Get the image property: The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.
        Returns:
        the image value.
      • withImage

        public OSDisk withImage​(VirtualHardDisk image)
        Set the image property: The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.
        Parameters:
        image - the image value to set.
        Returns:
        the OSDisk object itself.
      • caching

        public CachingTypes caching()
        Get the caching property: Specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None** for Standard storage. **ReadOnly** for Premium storage.
        Returns:
        the caching value.
      • withCaching

        public OSDisk withCaching​(CachingTypes caching)
        Set the caching property: Specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None** for Standard storage. **ReadOnly** for Premium storage.
        Parameters:
        caching - the caching value to set.
        Returns:
        the OSDisk object itself.
      • writeAcceleratorEnabled

        public Boolean writeAcceleratorEnabled()
        Get the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the disk.
        Returns:
        the writeAcceleratorEnabled value.
      • withWriteAcceleratorEnabled

        public OSDisk withWriteAcceleratorEnabled​(Boolean writeAcceleratorEnabled)
        Set the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the disk.
        Parameters:
        writeAcceleratorEnabled - the writeAcceleratorEnabled value to set.
        Returns:
        the OSDisk object itself.
      • diffDiskSettings

        public DiffDiskSettings diffDiskSettings()
        Get the diffDiskSettings property: Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine.
        Returns:
        the diffDiskSettings value.
      • withDiffDiskSettings

        public OSDisk withDiffDiskSettings​(DiffDiskSettings diffDiskSettings)
        Set the diffDiskSettings property: Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine.
        Parameters:
        diffDiskSettings - the diffDiskSettings value to set.
        Returns:
        the OSDisk object itself.
      • createOption

        public DiskCreateOptionTypes createOption()
        Get the createOption property: Specifies how the virtual machine should be created.<br><br> Possible values are:<br><br> **Attach** – This value is used when you are using a specialized disk to create the virtual machine.<br><br> **FromImage** – This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described.
        Returns:
        the createOption value.
      • withCreateOption

        public OSDisk withCreateOption​(DiskCreateOptionTypes createOption)
        Set the createOption property: Specifies how the virtual machine should be created.<br><br> Possible values are:<br><br> **Attach** – This value is used when you are using a specialized disk to create the virtual machine.<br><br> **FromImage** – This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described.
        Parameters:
        createOption - the createOption value to set.
        Returns:
        the OSDisk object itself.
      • diskSizeGB

        public Integer diskSizeGB()
        Get the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB.
        Returns:
        the diskSizeGB value.
      • withDiskSizeGB

        public OSDisk withDiskSizeGB​(Integer diskSizeGB)
        Set the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB.
        Parameters:
        diskSizeGB - the diskSizeGB value to set.
        Returns:
        the OSDisk object itself.
      • managedDisk

        public ManagedDiskParameters managedDisk()
        Get the managedDisk property: The managed disk parameters.
        Returns:
        the managedDisk value.
      • withManagedDisk

        public OSDisk withManagedDisk​(ManagedDiskParameters managedDisk)
        Set the managedDisk property: The managed disk parameters.
        Parameters:
        managedDisk - the managedDisk value to set.
        Returns:
        the OSDisk object itself.
      • deleteOption

        public DiskDeleteOptionTypes deleteOption()
        Get the deleteOption property: Specifies whether OS Disk should be deleted or detached upon VM deletion. <br><br> Possible values: <br><br> **Delete** If this value is used, the OS disk is deleted when VM is deleted.<br><br> **Detach** If this value is used, the os disk is retained after VM is deleted. <br><br> The default value is set to **detach**. For an ephemeral OS Disk, the default value is set to **Delete**. User cannot change the delete option for ephemeral OS Disk.
        Returns:
        the deleteOption value.
      • withDeleteOption

        public OSDisk withDeleteOption​(DiskDeleteOptionTypes deleteOption)
        Set the deleteOption property: Specifies whether OS Disk should be deleted or detached upon VM deletion. <br><br> Possible values: <br><br> **Delete** If this value is used, the OS disk is deleted when VM is deleted.<br><br> **Detach** If this value is used, the os disk is retained after VM is deleted. <br><br> The default value is set to **detach**. For an ephemeral OS Disk, the default value is set to **Delete**. User cannot change the delete option for ephemeral OS Disk.
        Parameters:
        deleteOption - the deleteOption value to set.
        Returns:
        the OSDisk object itself.
      • validate

        public void validate()
        Validates the instance.
        Throws:
        IllegalArgumentException - thrown if the instance is not valid.