Skip to content

Commit 548da54

Browse files
author
Zhenyu Zhou
committed
Add -Schedule parameter to schedule related parameter sets
1 parent 857043f commit 548da54

File tree

7 files changed

+38
-11
lines changed

7 files changed

+38
-11
lines changed

src/HDInsight/HDInsight.Test/ScenarioTests/HDInsightAutoscaleTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function Test-AutoscaleRelatedCommands{
5656
$condition2=New-AzHDInsightClusterAutoscaleScheduleCondition -Time 08:00 -WorkerNodeCount 4 -Day Friday
5757

5858
$scheduleAutoscaleCluster=Set-AzHDInsightClusterAutoscaleConfiguration -ResourceGroupName $cluster.ResourceGroup `
59-
-ClusterName $cluster.Name -TimeZone "Pacific Standard Time" -Condition $condition1,$condition2
59+
-ClusterName $cluster.Name -Schedule -TimeZone "Pacific Standard Time" -Condition $condition1,$condition2
6060

6161
Assert-AreEqual $scheduleAutoscaleCluster.ComputeProfile.Roles[1].AutoscaleConfiguration.Recurrence.TimeZone "Pacific Standard Time"
6262
Assert-AreEqual $scheduleAutoscaleCluster.ComputeProfile.Roles[1].AutoscaleConfiguration.Recurrence.Condition[0].WorkerNodeCount 5

src/HDInsight/HDInsight.Test/ScenarioTests/HDInsightClusterTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ function Test-CreateClusterWithScheduleBasedAutoscale{
257257
$autoscaleConfiguration=New-AzHDInsightClusterAutoscaleConfiguration -TimeZone ([System.TimeZoneInfo]::Local).Id `
258258
-Condition $condition1,$condition2
259259

260-
# create cluster with load-based autoscale
260+
# create cluster with schedule-based autoscale
261261
$cluster=New-AzHDInsightCluster -Location $params.location -ResourceGroupName $params.resourceGroupName `
262262
-ClusterName $params.clusterName -ClusterSizeInNodes $params.clusterSizeInNodes -ClusterType $params.clusterType `
263263
-DefaultStorageAccountName $params.storageAccountName -DefaultStorageAccountKey $params.storageAccountKey `

src/HDInsight/HDInsight/ManagementCommands/SetAzureHDInsightClusterAutoscaleConfigurationCommand.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,20 @@ public class SetAzureHDInsightClusterAutoscaleConfigurationCommand : HDInsightCm
189189
[ValidateNotNullOrEmpty]
190190
public AzureHDInsightAutoscale AutoscaleConfiguration { get; set; }
191191

192+
[Parameter(
193+
Mandatory = true,
194+
HelpMessage = "Set schedule-based parameters",
195+
ParameterSetName = ScheduleAutoscaleByNameParameterSet)]
196+
[Parameter(
197+
Mandatory = true,
198+
HelpMessage = "Set schedule-based parameters",
199+
ParameterSetName = ScheduleAutoscaleByResourceIdParameterSet)]
200+
[Parameter(
201+
Mandatory = true,
202+
HelpMessage = "Set schedule-based parameters",
203+
ParameterSetName = ScheduleAutoscaleByInputObjectParameterSet)]
204+
public SwitchParameter Schedule { get; set; }
205+
192206
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
193207
public SwitchParameter AsJob { get; set; }
194208

src/HDInsight/HDInsight/help/New-AzHDInsightClusterAutoscaleConfiguration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
142142
143143
[Set-AzHDInsightClusterAutoscaleConfiguration](./Set-AzHDInsightClusterAutoscaleConfiguration.md)
144144
[Get-AzHDInsightClusterAutoscaleConfiguration](./Get-AzHDInsightClusterAutoscaleConfiguration.md)
145-
[Remove-AzHDInsightClusterAutoscaleConfiguration](./New-AzHDInsightClusterAutoscaleConfiguration.md)
145+
[Remove-AzHDInsightClusterAutoscaleConfiguration](./Remove-AzHDInsightClusterAutoscaleConfiguration.md)

src/HDInsight/HDInsight/help/New-AzHDInsightClusterAutoscaleScheduleCondition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PS C:\> $condition=New-AzHDInsightClusterAutoscaleScheduleCondition -Time 09:00
3838
# Set the cluster autoscale configuration
3939
PS C:\> $clusterResourceGroup="group"
4040
PS C:\> $clusterName="MyCluster"
41-
PS C:\> Set-AzHDInsightClusterAutoscaleConfiguration -ResourceGroupName $clusterResourceGroup -ClusterName $clusterName -TimeZone "Pacific Standard Time" -Condition $condition
41+
PS C:\> Set-AzHDInsightClusterAutoscaleConfiguration -ResourceGroupName $clusterResourceGroup -ClusterName $clusterName -Schedule -TimeZone "Pacific Standard Time" -Condition $condition
4242
```
4343

4444
This command creates a condition where cluster autoscale to 5 worker nodes at 09:00 every Monday, Wednesday.

src/HDInsight/HDInsight/help/Set-AzHDInsightClusterAutoscaleConfiguration.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Set-AzHDInsightClusterAutoscaleConfiguration [[-ResourceGroupName] <String>] [-C
2525
Set-AzHDInsightClusterAutoscaleConfiguration [[-ResourceGroupName] <String>] [-ClusterName] <String>
2626
[-TimeZone <String>]
2727
[-Condition <System.Collections.Generic.List`1[Microsoft.Azure.Commands.HDInsight.Models.AzureHDInsightAutoscaleCondition]>]
28-
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
28+
[-Schedule] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2929
```
3030

3131
### AutoscaleConfigurationByNameParameterSet
@@ -46,7 +46,7 @@ Set-AzHDInsightClusterAutoscaleConfiguration [-ResourceId] <String> [-MinWorkerN
4646
```
4747
Set-AzHDInsightClusterAutoscaleConfiguration [-ResourceId] <String> [-TimeZone <String>]
4848
[-Condition <System.Collections.Generic.List`1[Microsoft.Azure.Commands.HDInsight.Models.AzureHDInsightAutoscaleCondition]>]
49-
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
49+
[-Schedule] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
5050
```
5151

5252
### AutoscaleConfigurationByResourceIdParameterSet
@@ -67,7 +67,7 @@ Set-AzHDInsightClusterAutoscaleConfiguration [-InputObject] <AzureHDInsightClust
6767
```
6868
Set-AzHDInsightClusterAutoscaleConfiguration [-InputObject] <AzureHDInsightCluster> [-TimeZone <String>]
6969
[-Condition <System.Collections.Generic.List`1[Microsoft.Azure.Commands.HDInsight.Models.AzureHDInsightAutoscaleCondition]>]
70-
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
70+
[-Schedule] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
7171
```
7272

7373
### AutoscaleConfigurationByInputObjectParameterSet
@@ -101,7 +101,7 @@ PS C:\> $condition2=New-AzHDInsightClusterAutoscaleScheduleCondition -Time 09:00
101101
# Set autoscale configuration
102102
PS C:\> $clusterResourceGroup="group"
103103
PS C:\> $clusterName="MyCluster"
104-
PS C:\> Set-AzHDInsightClusterAutoscaleConfiguration -ResourceGroupName $clusterResourceGroup -ClusterName $clusterName -TimeZone "Pacific Standard Time" -Condition $condition1,$condition2
104+
PS C:\> Set-AzHDInsightClusterAutoscaleConfiguration -ResourceGroupName $clusterResourceGroup -ClusterName $clusterName -Schedule -TimeZone "Pacific Standard Time" -Condition $condition1,$condition2
105105
```
106106

107107
This command sets the Schedule-based autoscale configuration of the HDInsight cluster.
@@ -274,6 +274,21 @@ Accept pipeline input: True (ByPropertyName)
274274
Accept wildcard characters: False
275275
```
276276
277+
### -Schedule
278+
Set schedule-based parameters
279+
280+
```yaml
281+
Type: System.Management.Automation.SwitchParameter
282+
Parameter Sets: ScheduleAutoscaleByNameParameterSet, ScheduleAutoscaleByResourceIdParameterSet, ScheduleAutoscaleByInputObjectParameterSet
283+
Aliases:
284+
285+
Required: True
286+
Position: Named
287+
Default value: None
288+
Accept pipeline input: False
289+
Accept wildcard characters: False
290+
```
291+
277292
### -TimeZone
278293
Gets or sets the time zone of schedule-based autoscale.
279294
@@ -339,4 +354,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
339354
340355
[New-AzHDInsightClusterAutoscaleConfiguration](./New-AzHDInsightClusterAutoscaleConfiguration.md)
341356
[Get-AzHDInsightClusterAutoscaleConfiguration](./Get-AzHDInsightClusterAutoscaleConfiguration.md)
342-
[Remove-AzHDInsightClusterAutoscaleConfiguration](./Set-AzHDInsightClusterAutoscaleConfiguration.md)
357+
[Remove-AzHDInsightClusterAutoscaleConfiguration](./Remove-AzHDInsightClusterAutoscaleConfiguration.md)

tools/StaticAnalysis/Exceptions/Az.HDInsight/SignatureIssues.csv

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,3 @@
7070
"Microsoft.Azure.PowerShell.Cmdlets.HDInsight.dll","Microsoft.Azure.Commands.HDInsight.NewAzureHDInsightClusterCommand","New-AzHDInsightCluster","1","8700","Parameter set '__AllParameterSets', 'CertificateFilePath', 'CertificateFileContents' of cmdlet 'New-AzHDInsightCluster' have the same mandatory parameters, and both of them are not default parameter set which may cause confusion.","Merge these parameter sets into one parameter set."
7171
"Microsoft.Azure.PowerShell.Cmdlets.HDInsight.dll","Microsoft.Azure.Commands.HDInsight.NewAzureHDInsightClusterAutoscaleScheduleConditionCommand","New-AzHDInsightClusterAutoscaleScheduleCondition","1","8100","New-AzHDInsightClusterAutoscaleScheduleCondition Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue"
7272
"Microsoft.Azure.PowerShell.Cmdlets.HDInsight.dll","Microsoft.Azure.Commands.HDInsight.NewAzureHDInsightClusterAutoscaleConfiguration","New-AzHDInsightClusterAutoscaleConfiguration","1","8100","New-AzHDInsightClusterAutoscaleConfiguration Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue"
73-
"Microsoft.Azure.PowerShell.Cmdlets.HDInsight.dll","Microsoft.Azure.Commands.HDInsight.SetAzureHDInsightClusterAutoscaleConfigurationCommand","Set-AzHDInsightClusterAutoscaleConfiguration","1","8700","Parameter set 'LoadAutoscaleByResourceIdParameterSet', 'ScheduleAutoscaleByResourceIdParameterSet' of cmdlet 'Set-AzHDInsightClusterAutoscaleConfiguration' have the same mandatory parameters, and both of them are not default parameter set which may cause confusion.","Merge these parameter sets into one parameter set."
74-
"Microsoft.Azure.PowerShell.Cmdlets.HDInsight.dll","Microsoft.Azure.Commands.HDInsight.SetAzureHDInsightClusterAutoscaleConfigurationCommand","Set-AzHDInsightClusterAutoscaleConfiguration","1","8700","Parameter set 'LoadAutoscaleByInputObjectParameterSet', 'ScheduleAutoscaleByInputObjectParameterSet' of cmdlet 'Set-AzHDInsightClusterAutoscaleConfiguration' have the same mandatory parameters, and both of them are not default parameter set which may cause confusion.","Merge these parameter sets into one parameter set."

0 commit comments

Comments
 (0)