Esempio n. 1
0
 internal ImageDisk(SubResource snapshot, SubResource managedDisk, string blobUri, CachingTypes?caching, int?diskSizeGB, StorageAccountTypes?storageAccountType, SubResource diskEncryptionSet)
 {
     Snapshot           = snapshot;
     ManagedDisk        = managedDisk;
     BlobUri            = blobUri;
     Caching            = caching;
     DiskSizeGB         = diskSizeGB;
     StorageAccountType = storageAccountType;
     DiskEncryptionSet  = diskEncryptionSet;
 }
 /// <summary>
 /// Initializes a new instance of the SnapshotUpdate class.
 /// </summary>
 /// <param name="tags">Resource tags</param>
 /// <param name="accountType">the storage account type of the disk.
 /// Possible values include: 'Standard_LRS', 'Premium_LRS'</param>
 /// <param name="osType">the Operating System type. Possible values
 /// include: 'Windows', 'Linux'</param>
 /// <param name="creationData">disk source information. CreationData
 /// information cannot be changed after the disk has been
 /// created.</param>
 /// <param name="diskSizeGB">If creationData.createOption is Empty,
 /// this field is mandatory and it indicates the size of the VHD to
 /// create. If this field is present for updates or creation with other
 /// options, it indicates a resize. Resizes are only allowed if the
 /// disk is not attached to a running VM, and can only increase the
 /// disk's size.</param>
 /// <param name="encryptionSettings">Encryption settings for disk or
 /// snapshot</param>
 public SnapshotUpdate(IDictionary <string, string> tags = default(IDictionary <string, string>), StorageAccountTypes?accountType = default(StorageAccountTypes?), OperatingSystemTypes?osType = default(OperatingSystemTypes?), CreationData creationData = default(CreationData), int?diskSizeGB = default(int?), EncryptionSettings encryptionSettings = default(EncryptionSettings))
     : base(tags)
 {
     AccountType        = accountType;
     OsType             = osType;
     CreationData       = creationData;
     DiskSizeGB         = diskSizeGB;
     EncryptionSettings = encryptionSettings;
     CustomInit();
 }
 /// <summary>
 /// Initializes a new instance of the ImageDataDisk class.
 /// </summary>
 /// <param name="lun">Specifies the logical unit number of the data
 /// disk. This value is used to identify data disks within the VM and
 /// therefore must be unique for each data disk attached to a
 /// VM.</param>
 /// <param name="snapshot">The snapshot.</param>
 /// <param name="managedDisk">The managedDisk.</param>
 /// <param name="blobUri">The Virtual Hard Disk.</param>
 /// <param name="caching">Specifies the caching requirements.
 /// &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&gt;&lt;br&gt;
 /// **None** &lt;br&gt;&lt;br&gt; **ReadOnly** &lt;br&gt;&lt;br&gt;
 /// **ReadWrite** &lt;br&gt;&lt;br&gt; Default: **None for Standard
 /// storage. ReadOnly for Premium storage**. Possible values include:
 /// 'None', 'ReadOnly', 'ReadWrite'</param>
 /// <param name="diskSizeGB">Specifies the size of empty data disks in
 /// gigabytes. This element can be used to overwrite the name of the
 /// disk in a virtual machine image. &lt;br&gt;&lt;br&gt; This value
 /// cannot be larger than 1023 GB</param>
 /// <param name="storageAccountType">Specifies the storage account type
 /// for the managed disk. Possible values are: Standard_LRS or
 /// Premium_LRS. Possible values include: 'Standard_LRS',
 /// 'Premium_LRS'</param>
 public ImageDataDisk(int lun, Microsoft.Azure.Management.ResourceManager.Fluent.SubResource snapshot = default(Microsoft.Azure.Management.ResourceManager.Fluent.SubResource), Microsoft.Azure.Management.ResourceManager.Fluent.SubResource managedDisk = default(Microsoft.Azure.Management.ResourceManager.Fluent.SubResource), string blobUri = default(string), CachingTypes?caching = default(CachingTypes?), int?diskSizeGB = default(int?), StorageAccountTypes?storageAccountType = default(StorageAccountTypes?))
 {
     Lun                = lun;
     Snapshot           = snapshot;
     ManagedDisk        = managedDisk;
     BlobUri            = blobUri;
     Caching            = caching;
     DiskSizeGB         = diskSizeGB;
     StorageAccountType = storageAccountType;
     CustomInit();
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the ImageOSDisk class.
 /// </summary>
 /// <param name="osType">This property allows you to specify the type
 /// of the OS that is included in the disk if creating a VM from a
 /// custom image. &lt;br&gt;&lt;br&gt; Possible values are:
 /// &lt;br&gt;&lt;br&gt; **Windows** &lt;br&gt;&lt;br&gt; **Linux**.
 /// Possible values include: 'Windows', 'Linux'</param>
 /// <param name="osState">The OS State. Possible values include:
 /// 'Generalized', 'Specialized'</param>
 /// <param name="snapshot">The snapshot.</param>
 /// <param name="managedDisk">The managedDisk.</param>
 /// <param name="blobUri">The Virtual Hard Disk.</param>
 /// <param name="caching">Specifies the caching requirements.
 /// &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&gt;&lt;br&gt;
 /// **None** &lt;br&gt;&lt;br&gt; **ReadOnly** &lt;br&gt;&lt;br&gt;
 /// **ReadWrite** &lt;br&gt;&lt;br&gt; Default: **None for Standard
 /// storage. ReadOnly for Premium storage**. Possible values include:
 /// 'None', 'ReadOnly', 'ReadWrite'</param>
 /// <param name="diskSizeGB">Specifies the size of empty data disks in
 /// gigabytes. This element can be used to overwrite the name of the
 /// disk in a virtual machine image. &lt;br&gt;&lt;br&gt; This value
 /// cannot be larger than 1023 GB</param>
 /// <param name="storageAccountType">Specifies the storage account type
 /// for the managed disk. Possible values are: Standard_LRS or
 /// Premium_LRS. Possible values include: 'Standard_LRS',
 /// 'Premium_LRS'</param>
 public ImageOSDisk(OperatingSystemTypes osType, OperatingSystemStateTypes osState, Microsoft.Azure.Management.ResourceManager.Fluent.SubResource snapshot = default(Microsoft.Azure.Management.ResourceManager.Fluent.SubResource), Microsoft.Azure.Management.ResourceManager.Fluent.SubResource managedDisk = default(Microsoft.Azure.Management.ResourceManager.Fluent.SubResource), string blobUri = default(string), CachingTypes?caching = default(CachingTypes?), int?diskSizeGB = default(int?), StorageAccountTypes?storageAccountType = default(StorageAccountTypes?))
 {
     OsType             = osType;
     OsState            = osState;
     Snapshot           = snapshot;
     ManagedDisk        = managedDisk;
     BlobUri            = blobUri;
     Caching            = caching;
     DiskSizeGB         = diskSizeGB;
     StorageAccountType = storageAccountType;
     CustomInit();
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the Disk class.
 /// </summary>
 /// <param name="location">Resource location</param>
 /// <param name="creationData">Disk source information. CreationData
 /// information cannot be changed after the disk has been
 /// created.</param>
 /// <param name="id">Resource Id</param>
 /// <param name="name">Resource name</param>
 /// <param name="type">Resource type</param>
 /// <param name="tags">Resource tags</param>
 /// <param name="accountType">the storage account type of the disk.
 /// Possible values include: 'Standard_LRS', 'Premium_LRS'</param>
 /// <param name="timeCreated">The time when the disk was
 /// created.</param>
 /// <param name="osType">The Operating System type. Possible values
 /// include: 'Windows', 'Linux'</param>
 /// <param name="diskSizeGB">If creationData.createOption is Empty,
 /// this field is mandatory and it indicates the size of the VHD to
 /// create. If this field is present for updates or creation with other
 /// options, it indicates a resize. Resizes are only allowed if the
 /// disk is not attached to a running VM, and can only increase the
 /// disk's size.</param>
 /// <param name="encryptionSettings">Encryption settings for disk or
 /// snapshot</param>
 /// <param name="ownerId">A relative URI containing the VM id that has
 /// the disk attached.</param>
 /// <param name="provisioningState">The disk provisioning
 /// state.</param>
 public Disk(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), StorageAccountTypes?accountType = default(StorageAccountTypes?), System.DateTime?timeCreated = default(System.DateTime?), OperatingSystemTypes?osType = default(OperatingSystemTypes?), int?diskSizeGB = default(int?), EncryptionSettings encryptionSettings = default(EncryptionSettings), string ownerId = default(string), string provisioningState = default(string))
     : base(location, id, name, type, tags)
 {
     AccountType        = accountType;
     TimeCreated        = timeCreated;
     OsType             = osType;
     CreationData       = creationData;
     DiskSizeGB         = diskSizeGB;
     EncryptionSettings = encryptionSettings;
     OwnerId            = ownerId;
     ProvisioningState  = provisioningState;
     CustomInit();
 }
Esempio n. 6
0
        public static string toStorageString(this StorageAccountTypes?storageAccountTypes)
        {
            if (StorageAccountTypes.PremiumLRS.Equals(storageAccountTypes))
            {
                return(Constants.Premium_LRS);
            }

            if (StorageAccountTypes.StandardLRS.Equals(storageAccountTypes))
            {
                return(Constants.Standard_LRS);
            }

            return(null);
        }
Esempio n. 7
0
 internal ImageDataDisk(WritableSubResource snapshot, WritableSubResource managedDisk, Uri blobUri, CachingTypes?caching, int?diskSizeGB, StorageAccountTypes?storageAccountType, WritableSubResource diskEncryptionSet, int lun) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet)
 {
     Lun = lun;
 }
Esempio n. 8
0
 internal ImageOSDisk(WritableSubResource snapshot, WritableSubResource managedDisk, string blobUri, CachingTypes?caching, int?diskSizeGB, StorageAccountTypes?storageAccountType, WritableSubResource diskEncryptionSet, OperatingSystemTypes osType, OperatingSystemStateTypes osState) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet)
 {
     OsType  = osType;
     OsState = osState;
 }
Esempio n. 9
0
 internal static string ToSerializedValue(this StorageAccountTypes?value)
 {
     return(value == null ? null : ((StorageAccountTypes)value).ToSerializedValue());
 }
Esempio n. 10
0
 internal ManagedDiskParameters(string id, StorageAccountTypes?storageAccountType, WritableSubResource diskEncryptionSet) : base(id)
 {
     StorageAccountType = storageAccountType;
     DiskEncryptionSet  = diskEncryptionSet;
 }
Esempio n. 11
0
        public StorageAccountTypes?changeType(DiskStorageAccountTypes?DiskStorageAccountTypes)
        {
            StorageAccountTypes?storageAccountTypes = new StorageAccountTypes?(DiskStorageAccountTypes.ToString());

            return(storageAccountTypes);
        }
 internal ImageDataDisk(SubResource snapshot, SubResource managedDisk, string blobUri, CachingTypes?caching, int?diskSizeGB, StorageAccountTypes?storageAccountType, DiskEncryptionSetParameters diskEncryptionSet, int lun) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet)
 {
     Lun = lun;
 }
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the DiskSku class.
 /// </summary>
 /// <param name="name">The sku name. Possible values include:
 /// 'Standard_LRS', 'Premium_LRS'</param>
 /// <param name="tier">The sku tier.</param>
 public DiskSku(StorageAccountTypes?name = default(StorageAccountTypes?), string tier = default(string))
 {
     Name = name;
     Tier = tier;
     CustomInit();
 }
Esempio n. 14
0
 internal VirtualMachineScaleSetManagedDiskParameters(StorageAccountTypes?storageAccountType, DiskEncryptionSetParameters diskEncryptionSet)
 {
     StorageAccountType = storageAccountType;
     DiskEncryptionSet  = diskEncryptionSet;
 }
Esempio n. 15
0
 internal VirtualMachineScaleSetManagedDiskParameters(StorageAccountTypes?storageAccountType, WritableSubResource diskEncryptionSet, VmDiskSecurityProfile securityProfile)
 {
     StorageAccountType = storageAccountType;
     DiskEncryptionSet  = diskEncryptionSet;
     SecurityProfile    = securityProfile;
 }
Esempio n. 16
0
 /// <summary>
 /// Initializes a new instance of the
 /// VirtualMachineScaleSetManagedDiskParameters class.
 /// </summary>
 /// <param name="storageAccountType">Specifies the storage account type
 /// for the managed disk. Possible values are: Standard_LRS or
 /// Premium_LRS. Possible values include: 'Standard_LRS',
 /// 'Premium_LRS'</param>
 public VirtualMachineScaleSetManagedDiskParameters(StorageAccountTypes?storageAccountType = default(StorageAccountTypes?))
 {
     StorageAccountType = storageAccountType;
     CustomInit();
 }
Esempio n. 17
0
 internal ManagedDiskParameters(string id, StorageAccountTypes?storageAccountType, DiskEncryptionSetParameters diskEncryptionSet) : base(id)
 {
     StorageAccountType = storageAccountType;
     DiskEncryptionSet  = diskEncryptionSet;
 }
Esempio n. 18
0
 internal ManagedDiskParameters(ResourceIdentifier id, StorageAccountTypes?storageAccountType, WritableSubResource diskEncryptionSet, VmDiskSecurityProfile securityProfile) : base(id)
 {
     StorageAccountType = storageAccountType;
     DiskEncryptionSet  = diskEncryptionSet;
     SecurityProfile    = securityProfile;
 }
 /// <summary>
 /// Initializes a new instance of the ManagedDiskParametersInner class.
 /// </summary>
 /// <param name="storageAccountType">Specifies the storage account type
 /// for the managed disk. Possible values are: Standard_LRS or
 /// Premium_LRS. Possible values include: 'Standard_LRS',
 /// 'Premium_LRS'</param>
 public ManagedDiskParametersInner(string id = default(string), StorageAccountTypes?storageAccountType = default(StorageAccountTypes?))
     : base(id)
 {
     StorageAccountType = storageAccountType;
     CustomInit();
 }
Esempio n. 20
0
 internal VirtualMachineScaleSetManagedDiskParameters(StorageAccountTypes?storageAccountType, WritableSubResource diskEncryptionSet)
 {
     StorageAccountType = storageAccountType;
     DiskEncryptionSet  = diskEncryptionSet;
 }
        public override void ExecuteCmdlet()
        {
            if (this.VM.StorageProfile == null)
            {
                this.VM.StorageProfile = new StorageProfile();
            }

            if ((string.IsNullOrEmpty(this.KeyEncryptionKeyVaultId) && !string.IsNullOrEmpty(this.KeyEncryptionKeyUrl)) ||
                (!string.IsNullOrEmpty(this.KeyEncryptionKeyVaultId) && string.IsNullOrEmpty(this.KeyEncryptionKeyUrl)))
            {
                WriteError(new ErrorRecord(
                               new Exception(Properties.Resources.VMOSDiskDiskEncryptionBothKekVaultIdAndKekUrlRequired),
                               string.Empty, ErrorCategory.InvalidArgument, null));
            }

            if (this.VM.StorageProfile.OsDisk == null)
            {
                this.VM.StorageProfile.OsDisk = new OSDisk();
            }

            this.VM.StorageProfile.OsDisk.Name       = this.Name ?? this.VM.StorageProfile.OsDisk.Name;
            this.VM.StorageProfile.OsDisk.Caching    = this.Caching ?? this.VM.StorageProfile.OsDisk.Caching;
            this.VM.StorageProfile.OsDisk.DiskSizeGB = this.DiskSizeInGB ?? this.VM.StorageProfile.OsDisk.DiskSizeGB;

            if (this.Windows.IsPresent)
            {
                this.VM.StorageProfile.OsDisk.OsType = OperatingSystemTypes.Windows;
            }
            else if (this.Linux.IsPresent)
            {
                this.VM.StorageProfile.OsDisk.OsType = OperatingSystemTypes.Linux;
            }

            if (!string.IsNullOrEmpty(this.VhdUri))
            {
                this.VM.StorageProfile.OsDisk.Vhd = new VirtualHardDisk
                {
                    Uri = this.VhdUri
                };
            }

            if (!string.IsNullOrEmpty(this.SourceImageUri))
            {
                this.VM.StorageProfile.OsDisk.Image = new VirtualHardDisk
                {
                    Uri = this.SourceImageUri
                };
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("CreateOption"))
            {
                this.VM.StorageProfile.OsDisk.CreateOption = this.CreateOption;
            }

            if (this.ParameterSetName.Equals(WindowsAndDiskEncryptionParameterSet) || this.ParameterSetName.Equals(LinuxAndDiskEncryptionParameterSet))
            {
                this.VM.StorageProfile.OsDisk.EncryptionSettings = new DiskEncryptionSettings
                {
                    DiskEncryptionKey = new KeyVaultSecretReference
                    {
                        SourceVault = new SubResource
                        {
                            Id = this.DiskEncryptionKeyVaultId
                        },
                        SecretUrl = this.DiskEncryptionKeyUrl
                    },
                    KeyEncryptionKey = (this.KeyEncryptionKeyVaultId == null || this.KeyEncryptionKeyUrl == null)
                    ? null
                    : new KeyVaultKeyReference
                    {
                        KeyUrl      = this.KeyEncryptionKeyUrl,
                        SourceVault = new SubResource
                        {
                            Id = this.KeyEncryptionKeyVaultId
                        },
                    }
                };
            }

            if (!string.IsNullOrEmpty(this.ManagedDiskId) || this.StorageAccountType != null)
            {
                if (this.VM.StorageProfile.OsDisk.ManagedDisk == null)
                {
                    this.VM.StorageProfile.OsDisk.ManagedDisk = new ManagedDiskParameters();
                }

                this.VM.StorageProfile.OsDisk.ManagedDisk.Id = this.ManagedDiskId ?? this.VM.StorageProfile.OsDisk.ManagedDisk.Id;
                this.VM.StorageProfile.OsDisk.ManagedDisk.StorageAccountType = this.StorageAccountType ?? this.VM.StorageProfile.OsDisk.ManagedDisk.StorageAccountType;
            }

            WriteObject(this.VM);
        }