Skip to content

Commit e29d0ae

Browse files
committed
Update param. sets for OS/Disk config cmdlets
1 parent 2ee0652 commit e29d0ae

File tree

2 files changed

+39
-28
lines changed

2 files changed

+39
-28
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/DiskRepository/SetAzureVMImageDataDiskConfig.cs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS
2121
{
2222
[Cmdlet(
2323
VerbsCommon.Set,
24-
AzureDataDiskConfigurationNoun),
24+
AzureDataDiskConfigurationNoun,
25+
DefaultParameterSetName = UpdateAzureVMImageParamSet),
2526
OutputType(
2627
typeof(VirtualMachineImageDiskConfigSet))]
2728
public class SetAzureVMImageDataDiskConfig : PSCmdlet
2829
{
2930
protected const string AzureDataDiskConfigurationNoun = "AzureVMImageDataDiskConfig";
31+
protected const string UpdateAzureVMImageParamSet = "UpdateAzureVMImageParamSet";
32+
protected const string AddAzureVMImageParamSet = "AddAzureVMImageParamSet";
3033

3134
[Parameter(
3235
Position = 0,
@@ -38,6 +41,7 @@ public class SetAzureVMImageDataDiskConfig : PSCmdlet
3841
public VirtualMachineImageDiskConfigSet DiskConfig { get; set; }
3942

4043
[Parameter(
44+
ParameterSetName = UpdateAzureVMImageParamSet,
4145
Position = 1,
4246
Mandatory = true,
4347
ValueFromPipelineByPropertyName = true,
@@ -46,38 +50,45 @@ public class SetAzureVMImageDataDiskConfig : PSCmdlet
4650
public string DataDiskName { get; set; }
4751

4852
[Parameter(
53+
ParameterSetName = UpdateAzureVMImageParamSet,
4954
Position = 2,
5055
Mandatory = true,
5156
ValueFromPipelineByPropertyName = true,
5257
HelpMessage = "Lun")]
58+
[Parameter(
59+
ParameterSetName = AddAzureVMImageParamSet,
60+
Position = 1,
61+
Mandatory = true,
62+
ValueFromPipelineByPropertyName = true,
63+
HelpMessage = "Lun")]
5364
[ValidateNotNullOrEmpty]
5465
public int Lun { get; set; }
5566

5667
[Parameter(
68+
ParameterSetName = UpdateAzureVMImageParamSet,
5769
Position = 3,
5870
Mandatory = true,
5971
ValueFromPipelineByPropertyName = true,
6072
HelpMessage = "Controls the platform caching behavior of the data disk blob for read efficiency.")]
73+
[Parameter(
74+
ParameterSetName = AddAzureVMImageParamSet,
75+
Position = 2,
76+
Mandatory = true,
77+
ValueFromPipelineByPropertyName = true,
78+
HelpMessage = "Controls the platform caching behavior of the data disk blob for read efficiency.")]
6179
[ValidateNotNullOrEmpty]
6280
[ValidateSet("ReadOnly", "ReadWrite", "None", IgnoreCase = true)]
6381
public string HostCaching { get; set; }
6482

6583
[Parameter(
66-
Position = 4,
67-
Mandatory = false,
84+
ParameterSetName = AddAzureVMImageParamSet,
85+
Position = 3,
86+
Mandatory = true,
6887
ValueFromPipelineByPropertyName = true,
6988
HelpMessage = "The media link.")]
7089
[ValidateNotNullOrEmpty]
7190
public Uri MediaLink { get; set; }
7291

73-
[Parameter(
74-
Position = 5,
75-
Mandatory = false,
76-
ValueFromPipelineByPropertyName = true,
77-
HelpMessage = "The logical disk size in GB.")]
78-
[ValidateNotNullOrEmpty]
79-
public int LogicalDiskSizeInGB { get; set; }
80-
8192
protected override void ProcessRecord()
8293
{
8394
ServiceManagementProfile.Initialize();
@@ -100,7 +111,6 @@ protected override void ProcessRecord()
100111
diskConfig.HostCaching = this.HostCaching;
101112
diskConfig.Lun = this.Lun;
102113
diskConfig.MediaLink = this.MediaLink;
103-
diskConfig.LogicalDiskSizeInGB = this.LogicalDiskSizeInGB;
104114

105115
WriteObject(DiskConfig);
106116
}

src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/DiskRepository/SetAzureVMImageOSDiskConfig.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,25 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using System.Management.Automation;
1617
using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;
17-
using System;
1818

1919
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS
2020
{
2121
[Cmdlet(
2222
VerbsCommon.Set,
23-
AzureOSDiskConfigurationNoun),
23+
AzureOSDiskConfigurationNoun,
24+
DefaultParameterSetName = UpdateAzureVMImageParamSet),
2425
OutputType(
2526
typeof(VirtualMachineImageDiskConfigSet))]
2627
public class SetAzureVMImageOSDiskConfig : PSCmdlet
2728
{
2829
protected const string AzureOSDiskConfigurationNoun = "AzureVMImageOSDiskConfig";
30+
protected const string UpdateAzureVMImageParamSet = "UpdateAzureVMImageParamSet";
31+
protected const string AddAzureVMImageParamSet = "AddAzureVMImageParamSet";
32+
protected const string GeneralizedStr = "Generalized";
33+
protected const string SpecializedStr = "Specialized";
2934

3035
[Parameter(
3136
Position = 0,
@@ -45,37 +50,34 @@ public class SetAzureVMImageOSDiskConfig : PSCmdlet
4550
public string HostCaching { get; set; }
4651

4752
[Parameter(
53+
ParameterSetName = AddAzureVMImageParamSet,
54+
Mandatory = true,
4855
Position = 2,
49-
Mandatory = false,
5056
ValueFromPipelineByPropertyName = true,
5157
HelpMessage = "The media link.")]
5258
[ValidateNotNullOrEmpty]
5359
public Uri MediaLink { get; set; }
5460

5561
[Parameter(
62+
ParameterSetName = AddAzureVMImageParamSet,
63+
Mandatory = true,
5664
Position = 3,
57-
Mandatory = false,
5865
ValueFromPipelineByPropertyName = true,
59-
HelpMessage = "The logical disk size in GB.")]
66+
HelpMessage = "The OS state.")]
6067
[ValidateNotNullOrEmpty]
68+
[ValidateSet(GeneralizedStr, SpecializedStr, IgnoreCase = true)]
6169
public string OSState { get; set; }
6270

6371
[Parameter(
72+
ParameterSetName = AddAzureVMImageParamSet,
73+
Mandatory = true,
6474
Position = 4,
65-
Mandatory = false,
6675
ValueFromPipelineByPropertyName = true,
67-
HelpMessage = "The OS.")]
76+
HelpMessage = "The OS type.")]
6877
[ValidateNotNullOrEmpty]
78+
[ValidateSet("Windows", "Linux", IgnoreCase = true)]
6979
public string OS { get; set; }
7080

71-
[Parameter(
72-
Position = 5,
73-
Mandatory = false,
74-
ValueFromPipelineByPropertyName = true,
75-
HelpMessage = "The logical disk size in GB.")]
76-
[ValidateNotNullOrEmpty]
77-
public int LogicalDiskSizeInGB { get; set; }
78-
7981
protected override void ProcessRecord()
8082
{
8183
ServiceManagementProfile.Initialize();
@@ -87,7 +89,6 @@ protected override void ProcessRecord()
8789

8890
DiskConfig.OSDiskConfiguration.HostCaching = this.HostCaching;
8991
DiskConfig.OSDiskConfiguration.MediaLink = this.MediaLink;
90-
DiskConfig.OSDiskConfiguration.LogicalDiskSizeInGB = this.LogicalDiskSizeInGB;
9192
DiskConfig.OSDiskConfiguration.OS = this.OS;
9293
DiskConfig.OSDiskConfiguration.OSState = this.OSState;
9394

0 commit comments

Comments
 (0)