Skip to content

Commit 5ceae56

Browse files
committed
Ensure serialized values are being used in places AutoMapper isn't used, minor change to PSArgumentCompleter values
1 parent 3bdfc25 commit 5ceae56

15 files changed

+52
-14
lines changed

src/ResourceManager/Compute/Commands.Compute/Common/StorageAccountTypesExtensions.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Microsoft.Azure.Management.Compute.Models;
1516
using System;
1617
using System.Collections.Generic;
1718
using System.Text;
@@ -61,5 +62,39 @@ public static string ToUnserializedValue(this string storageAccountType)
6162

6263
return storageAccountType;
6364
}
65+
66+
public static StorageProfile ToSerializedStorageProfile(this StorageProfile storageProfile)
67+
{
68+
if (storageProfile != null &&
69+
storageProfile.DataDisks != null)
70+
{
71+
foreach (var disk in storageProfile.DataDisks)
72+
{
73+
if (disk != null && disk.ManagedDisk != null)
74+
{
75+
disk.ManagedDisk.StorageAccountType = disk.ManagedDisk.StorageAccountType.ToSerializedValue();
76+
}
77+
}
78+
}
79+
80+
return storageProfile;
81+
}
82+
83+
public static StorageProfile ToUnserializedStorageProfile(this StorageProfile storageProfile)
84+
{
85+
if (storageProfile != null &&
86+
storageProfile.DataDisks != null)
87+
{
88+
foreach (var disk in storageProfile.DataDisks)
89+
{
90+
if (disk != null && disk.ManagedDisk != null)
91+
{
92+
disk.ManagedDisk.StorageAccountType = disk.ManagedDisk.StorageAccountType.ToUnserializedValue();
93+
}
94+
}
95+
}
96+
97+
return storageProfile;
98+
}
6499
}
65100
}

src/ResourceManager/Compute/Commands.Compute/Generated/Disk/Config/NewAzureRmDiskConfigCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public partial class NewAzureRmDiskConfigCommand : Microsoft.Azure.Commands.Reso
4141
Position = 0,
4242
ValueFromPipelineByPropertyName = true)]
4343
[Alias("AccountType")]
44-
[PSArgumentCompleter("StandardLRS", "PremiumLRS")]
44+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS")]
4545
public string SkuName { get; set; }
4646

4747
[Parameter(

src/ResourceManager/Compute/Commands.Compute/Generated/Disk/Config/NewAzureRmDiskUpdateConfigCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public partial class NewAzureRmDiskUpdateConfigCommand : Microsoft.Azure.Command
4141
Position = 0,
4242
ValueFromPipelineByPropertyName = true)]
4343
[Alias("AccountType")]
44-
[PSArgumentCompleter("StandardLRS", "PremiumLRS")]
44+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS")]
4545
public string SkuName { get; set; }
4646

4747
[Parameter(

src/ResourceManager/Compute/Commands.Compute/Generated/Image/Config/AddAzureRmImageDataDiskCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public partial class AddAzureRmImageDataDiskCommand : Microsoft.Azure.Commands.R
6969
[Parameter(
7070
Mandatory = false,
7171
ValueFromPipelineByPropertyName = true)]
72-
[PSArgumentCompleter("StandardLRS", "PremiumLRS")]
72+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS")]
7373
public string StorageAccountType { get; set; }
7474

7575
[Parameter(

src/ResourceManager/Compute/Commands.Compute/Generated/Image/Config/SetAzureRmImageOsDiskCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public partial class SetAzureRmImageOsDiskCommand : Microsoft.Azure.Commands.Res
7474
[Parameter(
7575
Mandatory = false,
7676
ValueFromPipelineByPropertyName = true)]
77-
[PSArgumentCompleter("StandardLRS", "PremiumLRS")]
77+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS")]
7878
public string StorageAccountType { get; set; }
7979

8080
[Parameter(

src/ResourceManager/Compute/Commands.Compute/Generated/Snapshot/Config/NewAzureRmSnapshotConfigCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public partial class NewAzureRmSnapshotConfigCommand : Microsoft.Azure.Commands.
4141
Position = 0,
4242
ValueFromPipelineByPropertyName = true)]
4343
[Alias("AccountType")]
44-
[PSArgumentCompleter("StandardLRS", "PremiumLRS", "StandardZRS")]
44+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS", "Standard_ZRS")]
4545
public string SkuName { get; set; }
4646

4747
[Parameter(

src/ResourceManager/Compute/Commands.Compute/Generated/Snapshot/Config/NewAzureRmSnapshotUpdateConfigCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public partial class NewAzureRmSnapshotUpdateConfigCommand : Microsoft.Azure.Com
4141
Position = 0,
4242
ValueFromPipelineByPropertyName = true)]
4343
[Alias("AccountType")]
44-
[PSArgumentCompleter("StandardLRS", "PremiumLRS", "StandardZRS")]
44+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS", "Standard_ZRS")]
4545
public string SkuName { get; set; }
4646

4747
[Parameter(

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/AddAzureRmVmssDataDiskCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public partial class AddAzureRmVmssDataDiskCommand : Microsoft.Azure.Commands.Re
7878
[Parameter(
7979
Mandatory = false,
8080
ValueFromPipelineByPropertyName = true)]
81-
[PSArgumentCompleter("StandardLRS", "PremiumLRS")]
81+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS")]
8282
public string StorageAccountType { get; set; }
8383

8484
protected override void ProcessRecord()

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/SetAzureRmVmssStorageProfileCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public partial class SetAzureRmVmssStorageProfileCommand : Microsoft.Azure.Comma
116116
[Parameter(
117117
Mandatory = false,
118118
ValueFromPipelineByPropertyName = true)]
119-
[PSArgumentCompleter("StandardLRS", "PremiumLRS")]
119+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS")]
120120
public string ManagedDisk { get; set; }
121121

122122
[Parameter(

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public override void ExecuteCmdlet()
192192
[Parameter(
193193
Mandatory = false)]
194194
[ValidateNotNullOrEmpty]
195-
[PSArgumentCompleter("StandardLRS", "PremiumLRS")]
195+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS")]
196196
public string ManagedDiskStorageAccountType { get; set; }
197197

198198
[Parameter(
@@ -1006,6 +1006,9 @@ private void BuildPutObject()
10061006

10071007
if (this.MyInvocation.BoundParameters.ContainsKey("ManagedDiskStorageAccountType"))
10081008
{
1009+
WriteWarning("Update-AzureRmVmss: The accepted values for parameter ManagedDiskStorageAccountType will change in an upcoming breaking change release " +
1010+
"from StandardLRS and PremiumLRS to Standard_LRS and Premium_LRS, respectively.");
1011+
10091012
if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
10101013
{
10111014
this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/AddAzureVMDataDiskCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public class AddAzureVMDataDiskCommand : Microsoft.Azure.Commands.ResourceManage
104104
ValueFromPipelineByPropertyName = true,
105105
HelpMessage = HelpMessages.VMManagedDiskAccountType)]
106106
[ValidateNotNullOrEmpty]
107-
[PSArgumentCompleter("StandardLRS", "PremiumLRS")]
107+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS")]
108108
public string StorageAccountType { get; set; }
109109

110110
[Parameter(

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMDataDiskCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public class SetAzureVMDataDiskCommand : Microsoft.Azure.Commands.ResourceManage
8181
ValueFromPipelineByPropertyName = true,
8282
HelpMessage = HelpMessages.VMManagedDiskAccountType)]
8383
[ValidateNotNullOrEmpty]
84-
[PSArgumentCompleter("StandardLRS", "PremiumLRS")]
84+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS")]
8585
public string StorageAccountType { get; set; }
8686

8787
[Parameter(

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMOSDiskCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public class SetAzureVMOSDiskCommand : Microsoft.Azure.Commands.ResourceManager.
162162
Mandatory = false,
163163
HelpMessage = HelpMessages.VMManagedDiskAccountType)]
164164
[ValidateNotNullOrEmpty]
165-
[PSArgumentCompleter("StandardLRS", "PremiumLRS")]
165+
[PSArgumentCompleter("Standard_LRS", "Premium_LRS")]
166166
public string StorageAccountType { get; set; }
167167

168168
[Parameter(

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ public void DefaultExecuteCmdlet()
461461
{
462462
DiagnosticsProfile = this.VM.DiagnosticsProfile,
463463
HardwareProfile = this.VM.HardwareProfile,
464-
StorageProfile = this.VM.StorageProfile,
464+
StorageProfile = this.VM.StorageProfile.ToSerializedStorageProfile(),
465465
NetworkProfile = this.VM.NetworkProfile,
466466
OsProfile = this.VM.OSProfile,
467467
Plan = this.VM.Plan,

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public override void ExecuteCmdlet()
119119
{
120120
DiagnosticsProfile = this.VM.DiagnosticsProfile,
121121
HardwareProfile = this.VM.HardwareProfile,
122-
StorageProfile = this.VM.StorageProfile,
122+
StorageProfile = this.VM.StorageProfile.ToSerializedStorageProfile(),
123123
NetworkProfile = this.VM.NetworkProfile,
124124
OsProfile = this.VM.OSProfile,
125125
Plan = this.VM.Plan,

0 commit comments

Comments
 (0)