private void Run() { // EncryptionSettings EncryptionSettings vEncryptionSettings = null; // Sku DiskSku vSku = null; if (this.MyInvocation.BoundParameters.ContainsKey("EncryptionSettingsEnabled")) { if (vEncryptionSettings == null) { vEncryptionSettings = new EncryptionSettings(); } vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled; } if (this.MyInvocation.BoundParameters.ContainsKey("DiskEncryptionKey")) { if (vEncryptionSettings == null) { vEncryptionSettings = new EncryptionSettings(); } vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey; } if (this.MyInvocation.BoundParameters.ContainsKey("KeyEncryptionKey")) { if (vEncryptionSettings == null) { vEncryptionSettings = new EncryptionSettings(); } vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey; } if (this.MyInvocation.BoundParameters.ContainsKey("SkuName")) { if (vSku == null) { vSku = new DiskSku(); } vSku.Name = this.SkuName; } var vDiskUpdate = new PSDiskUpdate { OsType = this.MyInvocation.BoundParameters.ContainsKey("OsType") ? this.OsType : (OperatingSystemTypes?)null, DiskSizeGB = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null, DiskIOPSReadWrite = this.MyInvocation.BoundParameters.ContainsKey("DiskIOPSReadWrite") ? this.DiskIOPSReadWrite : (int?)null, DiskMBpsReadWrite = this.MyInvocation.BoundParameters.ContainsKey("DiskMBpsReadWrite") ? this.DiskMBpsReadWrite : (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(vDiskUpdate); }
private void Run() { // 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-AzureRmDiskUpdateConfig: 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 vDiskUpdate = new PSDiskUpdate { 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(vDiskUpdate); }
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); }
protected PSArgument[] CreateDiskUpdateParameters() { string resourceGroupName = string.Empty; string diskName = string.Empty; PSDiskUpdate disk = new PSDiskUpdate(); return(ConvertFromObjectsToArguments( new string[] { "ResourceGroupName", "DiskName", "Disk" }, new object[] { resourceGroupName, diskName, disk })); }
protected void ExecuteDiskUpdateMethod(object[] invokeMethodInputParameters) { string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]); string diskName = (string)ParseParameter(invokeMethodInputParameters[1]); PSDiskUpdate disk = (PSDiskUpdate)ParseParameter(invokeMethodInputParameters[2]); PSDisk diskOrg = (PSDisk)ParseParameter(invokeMethodInputParameters[3]); var result = (disk == null) ? DisksClient.CreateOrUpdate(resourceGroupName, diskName, diskOrg) : DisksClient.Update(resourceGroupName, diskName, disk); WriteObject(result); }
protected override void ProcessRecord() { ExecuteClientAction(() => { if (ShouldProcess(this.ResourceGroupName, VerbsData.Update)) { string resourceGroupName = this.ResourceGroupName; string diskName = this.DiskName; PSDiskUpdate disk = this.DiskUpdate; PSDisk diskOrg = this.Disk; var result = (disk == null) ? DisksClient.CreateOrUpdate(resourceGroupName, diskName, diskOrg) : DisksClient.Update(resourceGroupName, diskName, disk); var psObject = new PSDisk(); Mapper.Map <Disk, PSDisk>(result, psObject); WriteObject(psObject); } }); }
private void Run() { // EncryptionSettingsCollection EncryptionSettingsCollection vEncryptionSettingsCollection = null; // EncryptionSettingsCollection EncryptionSettingsElement vEncryptionSettingsElement = null; // Encryption Encryption vEncryption = null; // Sku DiskSku vSku = null; // SupportedCapabilities SupportedCapabilities vSupportedCapabilities = null; if (this.IsParameterBound(c => c.EncryptionSettingsEnabled)) { if (vEncryptionSettingsCollection == null) { vEncryptionSettingsCollection = new EncryptionSettingsCollection(); } vEncryptionSettingsCollection.Enabled = (bool)this.EncryptionSettingsEnabled; } if (this.IsParameterBound(c => c.DiskEncryptionKey)) { if (vEncryptionSettingsCollection == null) { vEncryptionSettingsCollection = new EncryptionSettingsCollection(); } if (vEncryptionSettingsCollection.EncryptionSettings == null) { vEncryptionSettingsCollection.EncryptionSettings = new List <EncryptionSettingsElement>(); } if (vEncryptionSettingsElement == null) { vEncryptionSettingsElement = new EncryptionSettingsElement(); vEncryptionSettingsCollection.EncryptionSettings.Add(vEncryptionSettingsElement); } vEncryptionSettingsCollection.EncryptionSettings[0].DiskEncryptionKey = this.DiskEncryptionKey; } if (this.IsParameterBound(c => c.KeyEncryptionKey)) { if (vEncryptionSettingsCollection == null) { vEncryptionSettingsCollection = new EncryptionSettingsCollection(); } if (vEncryptionSettingsCollection.EncryptionSettings == null) { vEncryptionSettingsCollection.EncryptionSettings = new List <EncryptionSettingsElement>(); } if (vEncryptionSettingsElement == null) { vEncryptionSettingsElement = new EncryptionSettingsElement(); vEncryptionSettingsCollection.EncryptionSettings.Add(vEncryptionSettingsElement); } vEncryptionSettingsCollection.EncryptionSettings[0].KeyEncryptionKey = this.KeyEncryptionKey; } if (this.IsParameterBound(c => c.DiskEncryptionSetId)) { if (vEncryption == null) { vEncryption = new Encryption(); } vEncryption.DiskEncryptionSetId = this.DiskEncryptionSetId; } if (this.IsParameterBound(c => c.EncryptionType)) { if (vEncryption == null) { vEncryption = new Encryption(); } vEncryption.Type = this.EncryptionType; } if (this.IsParameterBound(c => c.SkuName)) { if (vSku == null) { vSku = new DiskSku(); } vSku.Name = this.SkuName; } if (this.IsParameterBound(c => c.AcceleratedNetwork)) { if (vSupportedCapabilities == null) { vSupportedCapabilities = new SupportedCapabilities(); } vSupportedCapabilities.AcceleratedNetwork = AcceleratedNetwork; } if (this.IsParameterBound(c => c.Architecture)) { if (vSupportedCapabilities == null) { vSupportedCapabilities = new SupportedCapabilities(); } vSupportedCapabilities.Architecture = this.Architecture; } var vDiskUpdate = new PSDiskUpdate { OsType = this.IsParameterBound(c => c.OsType) ? this.OsType : (OperatingSystemTypes?)null, DiskSizeGB = this.IsParameterBound(c => c.DiskSizeGB) ? this.DiskSizeGB : (int?)null, DiskIOPSReadWrite = this.IsParameterBound(c => c.DiskIOPSReadWrite) ? this.DiskIOPSReadWrite : (int?)null, DiskMBpsReadWrite = this.IsParameterBound(c => c.DiskMBpsReadWrite) ? this.DiskMBpsReadWrite : (int?)null, DiskIOPSReadOnly = this.IsParameterBound(c => c.DiskIOPSReadOnly) ? this.DiskIOPSReadOnly : null, DiskMBpsReadOnly = this.IsParameterBound(c => c.DiskMBpsReadOnly) ? this.DiskMBpsReadOnly : null, MaxShares = this.IsParameterBound(c => c.MaxSharesCount) ? this.MaxSharesCount : null, Tags = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null, NetworkAccessPolicy = this.IsParameterBound(c => c.NetworkAccessPolicy) ? this.NetworkAccessPolicy: null, DiskAccessId = this.IsParameterBound(c => c.DiskAccessId) ? this.DiskAccessId: null, EncryptionSettingsCollection = vEncryptionSettingsCollection, Encryption = vEncryption, Sku = vSku, Tier = this.IsParameterBound(c => c.Tier) ? this.Tier : null, BurstingEnabled = this.IsParameterBound(c => c.BurstingEnabled) ? this.BurstingEnabled : null, PurchasePlan = this.IsParameterBound(c => c.PurchasePlan) ? this.PurchasePlan : null, SupportsHibernation = this.IsParameterBound(c => c.SupportsHibernation) ? SupportsHibernation : null, SupportedCapabilities = vSupportedCapabilities, PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null, DataAccessAuthMode = this.IsParameterBound(c => c.DataAccessAuthMode) ? DataAccessAuthMode : null }; WriteObject(vDiskUpdate); }
private void Run() { // EncryptionSettingsCollection EncryptionSettingsCollection vEncryptionSettingsCollection = null; // EncryptionSettingsCollection EncryptionSettingsElement vEncryptionSettingsElement = null; // Encryption Encryption vEncryption = null; // Sku DiskSku vSku = null; if (this.IsParameterBound(c => c.EncryptionSettingsEnabled)) { if (vEncryptionSettingsCollection == null) { vEncryptionSettingsCollection = new EncryptionSettingsCollection(); } vEncryptionSettingsCollection.Enabled = (bool)this.EncryptionSettingsEnabled; } if (this.IsParameterBound(c => c.DiskEncryptionKey)) { if (vEncryptionSettingsCollection == null) { vEncryptionSettingsCollection = new EncryptionSettingsCollection(); } if (vEncryptionSettingsCollection.EncryptionSettings == null) { vEncryptionSettingsCollection.EncryptionSettings = new List <EncryptionSettingsElement>(); } if (vEncryptionSettingsElement == null) { vEncryptionSettingsElement = new EncryptionSettingsElement(); vEncryptionSettingsCollection.EncryptionSettings.Add(vEncryptionSettingsElement); } vEncryptionSettingsCollection.EncryptionSettings[0].DiskEncryptionKey = this.DiskEncryptionKey; } if (this.IsParameterBound(c => c.KeyEncryptionKey)) { if (vEncryptionSettingsCollection == null) { vEncryptionSettingsCollection = new EncryptionSettingsCollection(); } if (vEncryptionSettingsCollection.EncryptionSettings == null) { vEncryptionSettingsCollection.EncryptionSettings = new List <EncryptionSettingsElement>(); } if (vEncryptionSettingsElement == null) { vEncryptionSettingsElement = new EncryptionSettingsElement(); vEncryptionSettingsCollection.EncryptionSettings.Add(vEncryptionSettingsElement); } vEncryptionSettingsCollection.EncryptionSettings[0].KeyEncryptionKey = this.KeyEncryptionKey; } if (this.IsParameterBound(c => c.DiskEncryptionSetId)) { if (vEncryption == null) { vEncryption = new Encryption(); } vEncryption.DiskEncryptionSetId = this.DiskEncryptionSetId; } if (this.IsParameterBound(c => c.EncryptionType)) { if (vEncryption == null) { vEncryption = new Encryption(); } vEncryption.Type = this.EncryptionType; } if (this.IsParameterBound(c => c.SkuName)) { if (vSku == null) { vSku = new DiskSku(); } vSku.Name = this.SkuName; } var vDiskUpdate = new PSDiskUpdate { OsType = this.IsParameterBound(c => c.OsType) ? this.OsType : (OperatingSystemTypes?)null, DiskSizeGB = this.IsParameterBound(c => c.DiskSizeGB) ? this.DiskSizeGB : (int?)null, DiskIOPSReadWrite = this.IsParameterBound(c => c.DiskIOPSReadWrite) ? this.DiskIOPSReadWrite : (int?)null, DiskMBpsReadWrite = this.IsParameterBound(c => c.DiskMBpsReadWrite) ? this.DiskMBpsReadWrite : (int?)null, DiskIOPSReadOnly = this.IsParameterBound(c => c.DiskIOPSReadOnly) ? this.DiskIOPSReadOnly : null, DiskMBpsReadOnly = this.IsParameterBound(c => c.DiskMBpsReadOnly) ? this.DiskMBpsReadOnly : null, MaxShares = this.IsParameterBound(c => c.MaxSharesCount) ? this.MaxSharesCount : null, Tags = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null, NetworkAccessPolicy = this.IsParameterBound(c => c.NetworkAccessPolicy) ? this.NetworkAccessPolicy: null, DiskAccessId = this.IsParameterBound(c => c.DiskAccessId) ? this.DiskAccessId: null, EncryptionSettingsCollection = vEncryptionSettingsCollection, Encryption = vEncryption, Sku = vSku, Tier = this.IsParameterBound(c => c.Tier) ? this.Tier : null, }; WriteObject(vDiskUpdate); }