private void Run() { WriteWarning("New-AzureRmSnapshotUpdateConfig: A property of the output of this cmdlet will change in an upcoming breaking change release. " + "The Name property for a Sku will return Standard_LRS and Premium_LRS"); // EncryptionSettings Microsoft.Azure.Management.Compute.Models.EncryptionSettings vEncryptionSettings = null; // Sku Microsoft.Azure.Management.Compute.Models.DiskSku vSku = null; if (this.MyInvocation.BoundParameters.ContainsKey("EncryptionSettingsEnabled")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled; } if (this.MyInvocation.BoundParameters.ContainsKey("DiskEncryptionKey")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey; } if (this.MyInvocation.BoundParameters.ContainsKey("KeyEncryptionKey")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey; } if (this.MyInvocation.BoundParameters.ContainsKey("SkuName")) { WriteWarning("New-AzureRmSnapshotUpdateConfig: The accepted values for parameter SkuName will change in an upcoming breaking change release " + "from StandardLRS and PremiumLRS to Standard_LRS and Premium_LRS, respectively."); if (vSku == null) { vSku = new Microsoft.Azure.Management.Compute.Models.DiskSku(); } vSku.Name = this.SkuName; } var vSnapshotUpdate = new PSSnapshotUpdate { OsType = this.MyInvocation.BoundParameters.ContainsKey("OsType") ? this.OsType : (OperatingSystemTypes?)null, DiskSizeGB = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null, Tags = this.MyInvocation.BoundParameters.ContainsKey("Tag") ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null, EncryptionSettings = vEncryptionSettings, Sku = vSku, }; WriteObject(vSnapshotUpdate); }
private void Run() { // EncryptionSettings Microsoft.Azure.Management.Compute.Models.EncryptionSettings vEncryptionSettings = null; // Sku Microsoft.Azure.Management.Compute.Models.SnapshotSku vSku = null; if (this.MyInvocation.BoundParameters.ContainsKey("EncryptionSettingsEnabled")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled; } if (this.MyInvocation.BoundParameters.ContainsKey("DiskEncryptionKey")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey; } if (this.MyInvocation.BoundParameters.ContainsKey("KeyEncryptionKey")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey; } if (this.MyInvocation.BoundParameters.ContainsKey("SkuName")) { if (vSku == null) { vSku = new Microsoft.Azure.Management.Compute.Models.SnapshotSku(); } vSku.Name = this.SkuName; } var vSnapshotUpdate = new PSSnapshotUpdate { OsType = this.MyInvocation.BoundParameters.ContainsKey("OsType") ? this.OsType : (OperatingSystemTypes?)null, DiskSizeGB = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null, Tags = this.MyInvocation.BoundParameters.ContainsKey("Tag") ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null, EncryptionSettings = vEncryptionSettings, Sku = new DiskSku { Name = vSku.Name.ToString() } }; WriteObject(vSnapshotUpdate); }
private void Run() { // EncryptionSettings Microsoft.Azure.Management.Compute.Models.EncryptionSettings vEncryptionSettings = null; // Sku Microsoft.Azure.Management.Compute.Models.DiskSku vSku = null; if (this.EncryptionSettingsEnabled != null) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled; } if (this.DiskEncryptionKey != null) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey; } if (this.KeyEncryptionKey != null) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey; } if (this.SkuName != null) { if (vSku == null) { vSku = new Microsoft.Azure.Management.Compute.Models.DiskSku(); } vSku.Name = this.SkuName; } var vDiskUpdate = new PSDiskUpdate { OsType = this.OsType, DiskSizeGB = this.DiskSizeGB, Tags = (this.Tag == null) ? null : this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value), EncryptionSettings = vEncryptionSettings, Sku = vSku, }; WriteObject(vDiskUpdate); }
private void Run() { // CreationData Microsoft.Azure.Management.Compute.Models.CreationData vCreationData = null; // EncryptionSettings Microsoft.Azure.Management.Compute.Models.EncryptionSettings vEncryptionSettings = null; #pragma warning disable CS0618 // Type or member is obsolete if (this.CreateOption.HasValue) #pragma warning restore CS0618 // Type or member is obsolete { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } #pragma warning disable CS0618 // Type or member is obsolete vCreationData.CreateOption = this.CreateOption.Value; #pragma warning restore CS0618 // Type or member is obsolete } #pragma warning disable CS0618 // Type or member is obsolete if (this.StorageAccountId != null) #pragma warning restore CS0618 // Type or member is obsolete { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } #pragma warning disable CS0618 // Type or member is obsolete vCreationData.StorageAccountId = this.StorageAccountId; #pragma warning restore CS0618 // Type or member is obsolete } #pragma warning disable CS0618 // Type or member is obsolete if (this.ImageReference != null) #pragma warning restore CS0618 // Type or member is obsolete { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } #pragma warning disable CS0618 // Type or member is obsolete vCreationData.ImageReference = this.ImageReference; #pragma warning restore CS0618 // Type or member is obsolete } #pragma warning disable CS0618 // Type or member is obsolete if (this.SourceUri != null) #pragma warning restore CS0618 // Type or member is obsolete { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } #pragma warning disable CS0618 // Type or member is obsolete vCreationData.SourceUri = this.SourceUri; #pragma warning restore CS0618 // Type or member is obsolete } #pragma warning disable CS0618 // Type or member is obsolete if (this.SourceResourceId != null) #pragma warning restore CS0618 // Type or member is obsolete { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } #pragma warning disable CS0618 // Type or member is obsolete vCreationData.SourceResourceId = this.SourceResourceId; #pragma warning restore CS0618 // Type or member is obsolete } if (this.EncryptionSettingsEnabled != null) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled; } if (this.DiskEncryptionKey != null) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey; } if (this.KeyEncryptionKey != null) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey; } var vDiskUpdate = new DiskUpdate { AccountType = this.AccountType, OsType = this.OsType, DiskSizeGB = this.DiskSizeGB, Tags = (this.Tag == null) ? null : this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value), CreationData = vCreationData, EncryptionSettings = vEncryptionSettings, }; WriteObject(vDiskUpdate); }
private void Run() { // Sku Microsoft.Azure.Management.Compute.Models.DiskSku vSku = null; // CreationData Microsoft.Azure.Management.Compute.Models.CreationData vCreationData = null; // EncryptionSettings Microsoft.Azure.Management.Compute.Models.EncryptionSettings vEncryptionSettings = null; if (this.SkuName != null) { if (vSku == null) { vSku = new Microsoft.Azure.Management.Compute.Models.DiskSku(); } vSku.Name = this.SkuName; } if (this.CreateOption.HasValue) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.CreateOption = this.CreateOption.Value; } if (this.StorageAccountId != null) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.StorageAccountId = this.StorageAccountId; } if (this.ImageReference != null) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.ImageReference = this.ImageReference; } if (this.SourceUri != null) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.SourceUri = this.SourceUri; } if (this.SourceResourceId != null) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.SourceResourceId = this.SourceResourceId; } if (this.EncryptionSettingsEnabled != null) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled; } if (this.DiskEncryptionKey != null) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey; } if (this.KeyEncryptionKey != null) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey; } var vDisk = new PSDisk { Zones = this.Zone, OsType = this.OsType, DiskSizeGB = this.DiskSizeGB, Location = this.Location, Tags = (this.Tag == null) ? null : this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value), Sku = vSku, CreationData = vCreationData, EncryptionSettings = vEncryptionSettings, }; WriteObject(vDisk); }
private void Run() { // Sku Microsoft.Azure.Management.Compute.Models.SnapshotSku vSku = null; // CreationData Microsoft.Azure.Management.Compute.Models.CreationData vCreationData = null; // EncryptionSettings Microsoft.Azure.Management.Compute.Models.EncryptionSettings vEncryptionSettings = null; if (this.MyInvocation.BoundParameters.ContainsKey("SkuName")) { if (vSku == null) { vSku = new Microsoft.Azure.Management.Compute.Models.SnapshotSku(); } vSku.Name = this.SkuName; } if (this.MyInvocation.BoundParameters.ContainsKey("CreateOption")) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.CreateOption = this.CreateOption; } if (this.MyInvocation.BoundParameters.ContainsKey("StorageAccountId")) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.StorageAccountId = this.StorageAccountId; } if (this.MyInvocation.BoundParameters.ContainsKey("ImageReference")) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.ImageReference = this.ImageReference; } if (this.MyInvocation.BoundParameters.ContainsKey("SourceUri")) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.SourceUri = this.SourceUri; } if (this.MyInvocation.BoundParameters.ContainsKey("SourceResourceId")) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.SourceResourceId = this.SourceResourceId; } if (this.MyInvocation.BoundParameters.ContainsKey("EncryptionSettingsEnabled")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled; } if (this.MyInvocation.BoundParameters.ContainsKey("DiskEncryptionKey")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey; } if (this.MyInvocation.BoundParameters.ContainsKey("KeyEncryptionKey")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey; } var vSnapshot = new PSSnapshot { OsType = this.MyInvocation.BoundParameters.ContainsKey("OsType") ? this.OsType : (OperatingSystemTypes?)null, DiskSizeGB = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null, Location = this.MyInvocation.BoundParameters.ContainsKey("Location") ? this.Location : null, Tags = this.MyInvocation.BoundParameters.ContainsKey("Tag") ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null, Sku = vSku, CreationData = vCreationData, EncryptionSettings = vEncryptionSettings, }; WriteObject(vSnapshot); }
private void Run() { WriteWarning("New-AzureRmDiskConfig: A property of the output of this cmdlet will change in an upcoming breaking change release. " + "The Name property for a Sku will return Standard_LRS and Premium_LRS"); // Sku Microsoft.Azure.Management.Compute.Models.DiskSku vSku = null; // CreationData Microsoft.Azure.Management.Compute.Models.CreationData vCreationData = null; // EncryptionSettings Microsoft.Azure.Management.Compute.Models.EncryptionSettings vEncryptionSettings = null; if (this.MyInvocation.BoundParameters.ContainsKey("SkuName")) { WriteWarning("New-AzureRmDiskConfig: The accepted values for parameter SkuName will change in an upcoming breaking change release from" + "StandardLRS and PremiumLRS to Standard_LRS and Premium_LRS, respectively."); if (vSku == null) { vSku = new Microsoft.Azure.Management.Compute.Models.DiskSku(); } vSku.Name = this.SkuName; } if (this.MyInvocation.BoundParameters.ContainsKey("CreateOption")) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.CreateOption = this.CreateOption; } if (this.MyInvocation.BoundParameters.ContainsKey("StorageAccountId")) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.StorageAccountId = this.StorageAccountId; } if (this.MyInvocation.BoundParameters.ContainsKey("ImageReference")) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.ImageReference = this.ImageReference; } if (this.MyInvocation.BoundParameters.ContainsKey("SourceUri")) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.SourceUri = this.SourceUri; } if (this.MyInvocation.BoundParameters.ContainsKey("SourceResourceId")) { if (vCreationData == null) { vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData(); } vCreationData.SourceResourceId = this.SourceResourceId; } if (this.MyInvocation.BoundParameters.ContainsKey("EncryptionSettingsEnabled")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled; } if (this.MyInvocation.BoundParameters.ContainsKey("DiskEncryptionKey")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey; } if (this.MyInvocation.BoundParameters.ContainsKey("KeyEncryptionKey")) { if (vEncryptionSettings == null) { vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings(); } vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey; } var vDisk = new PSDisk { Zones = this.MyInvocation.BoundParameters.ContainsKey("Zone") ? this.Zone : null, OsType = this.MyInvocation.BoundParameters.ContainsKey("OsType") ? this.OsType : (OperatingSystemTypes?)null, DiskSizeGB = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null, Location = this.MyInvocation.BoundParameters.ContainsKey("Location") ? this.Location : null, Tags = this.MyInvocation.BoundParameters.ContainsKey("Tag") ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null, Sku = vSku, CreationData = vCreationData, EncryptionSettings = vEncryptionSettings, }; WriteObject(vDisk); }