Skip to content

Commit 063dc4c

Browse files
authored
Merge pull request Azure#7 from viananth/AzureStack
Fix bug in ShouldProcess prompt
2 parents d4f0b01 + 09bab4d commit 063dc4c

File tree

6 files changed

+95
-96
lines changed

6 files changed

+95
-96
lines changed

src/StackAdmin/Azs.AzureBridge.Admin/Module/Azs.AzureBridge.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Remove-AzsAzureBridgeDownloadedProduct.ps1

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,25 @@ function Remove-AzsAzureBridgeDownloadedProduct {
9494

9595
$AzureBridgeAdminClient = New-ServiceClient @NewServiceClient_params
9696

97-
if ($PSCmdlet.ShouldProcess("$Name" , "Delete the downloaded product")) {
98-
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete the downloaded product?", "Performing operation DeleteWithHttpMessagesAsync on $Name."))) {
97+
if ('InputObject_DownloadedProducts_Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId_DownloadedProducts_Delete' -eq $PsCmdlet.ParameterSetName) {
98+
$GetArmResourceIdParameterValue_params = @{
99+
IdTemplate = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}/providers/Microsoft.AzureBridge.Admin/activations/{activationName}/downloadedProducts/{productName}'
100+
}
99101

100-
if ('InputObject_DownloadedProducts_Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId_DownloadedProducts_Delete' -eq $PsCmdlet.ParameterSetName) {
101-
$GetArmResourceIdParameterValue_params = @{
102-
IdTemplate = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}/providers/Microsoft.AzureBridge.Admin/activations/{activationName}/downloadedProducts/{productName}'
103-
}
102+
if ('ResourceId_DownloadedProducts_Delete' -eq $PsCmdlet.ParameterSetName) {
103+
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
104+
} else {
105+
$GetArmResourceIdParameterValue_params['Id'] = $InputObject.Id
106+
}
107+
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
104108

105-
if ('ResourceId_DownloadedProducts_Delete' -eq $PsCmdlet.ParameterSetName) {
106-
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
107-
} else {
108-
$GetArmResourceIdParameterValue_params['Id'] = $InputObject.Id
109-
}
110-
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
109+
$ResourceGroupName = $ArmResourceIdParameterValues['resourceGroup']
110+
$activationName = $ArmResourceIdParameterValues['activationName']
111+
$Name = $ArmResourceIdParameterValues['productName']
112+
}
111113

112-
$ResourceGroupName = $ArmResourceIdParameterValues['resourceGroup']
113-
$activationName = $ArmResourceIdParameterValues['activationName']
114-
$Name = $ArmResourceIdParameterValues['productName']
115-
}
114+
if ($PSCmdlet.ShouldProcess("$Name" , "Delete the downloaded product")) {
115+
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete the downloaded product?", "Performing operation DeleteWithHttpMessagesAsync on $Name."))) {
116116

117117
if ('DownloadedProducts_Delete' -eq $PsCmdlet.ParameterSetName -or 'InputObject_DownloadedProducts_Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId_DownloadedProducts_Delete' -eq $PsCmdlet.ParameterSetName) {
118118
Write-Verbose -Message 'Performing operation DeleteWithHttpMessagesAsync on $AzureBridgeAdminClient.'

src/StackAdmin/Azs.Compute.Admin/Module/Azs.Compute.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Remove-AzsComputeQuota.ps1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,22 @@ function Remove-AzsComputeQuota {
8484

8585
$ComputeAdminClient = New-ServiceClient @NewServiceClient_params
8686

87-
if ($PSCmdlet.ShouldProcess("$Name" , "Delete compute quota")) {
88-
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete compute quota?", "Performing operation DeleteWithHttpMessagesAsync on $Name."))) {
87+
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
88+
$GetArmResourceIdParameterValue_params = @{
89+
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute.Admin/locations/{locationName}/quotas/{quotaName}'
90+
}
8991

90-
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
91-
$GetArmResourceIdParameterValue_params = @{
92-
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute.Admin/locations/{locationName}/quotas/{quotaName}'
93-
}
92+
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
93+
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
9494

95-
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
96-
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
95+
$Location = $ArmResourceIdParameterValues['locationName']
96+
$Name = $ArmResourceIdParameterValues['quotaName']
97+
} elseif ( -not $PSBoundParameters.ContainsKey('Location')) {
98+
$Location = (Get-AzureRMLocation).Location
99+
}
97100

98-
$Location = $ArmResourceIdParameterValues['locationName']
99-
$Name = $ArmResourceIdParameterValues['quotaName']
100-
} elseif ( -not $PSBoundParameters.ContainsKey('Location')) {
101-
$Location = (Get-AzureRMLocation).Location
102-
}
101+
if ($PSCmdlet.ShouldProcess("$Name" , "Delete compute quota")) {
102+
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete compute quota?", "Performing operation DeleteWithHttpMessagesAsync on $Name."))) {
103103

104104
if ('Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId' -eq $PsCmdlet.ParameterSetName) {
105105
Write-Verbose -Message 'Performing operation DeleteWithHttpMessagesAsync on $ComputeAdminClient.'

src/StackAdmin/Azs.Compute.Admin/Module/Azs.Compute.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Remove-AzsPlatformImage.ps1

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,26 +100,25 @@ function Remove-AzsPlatformImage {
100100

101101
$ComputeAdminClient = New-ServiceClient @NewServiceClient_params
102102

103-
if ($PSCmdlet.ShouldProcess("$sku" , "Delete platform image")) {
104-
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete platform image?", "Performing operation DeleteWithHttpMessagesAsync on $sku."))) {
105-
106-
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
107-
$GetArmResourceIdParameterValue_params = @{
108-
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute.Admin/locations/{locationName}/artifactTypes/platformImage/publishers/{publisher}/offers/{offer}/skus/{sku}/versions/{version}'
109-
}
103+
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
104+
$GetArmResourceIdParameterValue_params = @{
105+
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute.Admin/locations/{locationName}/artifactTypes/platformImage/publishers/{publisher}/offers/{offer}/skus/{sku}/versions/{version}'
106+
}
110107

111-
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
112-
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
108+
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
109+
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
113110

114-
$Location = $ArmResourceIdParameterValues['locationName']
115-
$publisher = $ArmResourceIdParameterValues['publisher']
116-
$offer = $ArmResourceIdParameterValues['offer']
117-
$sku = $ArmResourceIdParameterValues['sku']
118-
$version = $ArmResourceIdParameterValues['version']
119-
} elseif ( -not $PSBoundParameters.ContainsKey('Location')) {
120-
$Location = (Get-AzureRMLocation).Location
121-
}
111+
$Location = $ArmResourceIdParameterValues['locationName']
112+
$publisher = $ArmResourceIdParameterValues['publisher']
113+
$offer = $ArmResourceIdParameterValues['offer']
114+
$sku = $ArmResourceIdParameterValues['sku']
115+
$version = $ArmResourceIdParameterValues['version']
116+
} elseif ( -not $PSBoundParameters.ContainsKey('Location')) {
117+
$Location = (Get-AzureRMLocation).Location
118+
}
122119

120+
if ($PSCmdlet.ShouldProcess("$sku" , "Delete platform image")) {
121+
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete platform image?", "Performing operation DeleteWithHttpMessagesAsync on $sku."))) {
123122

124123
if ('Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId' -eq $PsCmdlet.ParameterSetName) {
125124
Write-Verbose -Message 'Performing operation DeleteWithHttpMessagesAsync on $ComputeAdminClient.'

src/StackAdmin/Azs.Compute.Admin/Module/Azs.Compute.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Remove-AzsVMExtension.ps1

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,25 +91,24 @@ function Remove-AzsVMExtension {
9191

9292
$ComputeAdminClient = New-ServiceClient @NewServiceClient_params
9393

94-
if ($PSCmdlet.ShouldProcess("$Publisher" , "Delete the VM extension")) {
95-
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete the VM extension?", "Performing operation DeleteWithHttpMessagesAsync on $Publisher."))) {
96-
97-
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
98-
$GetArmResourceIdParameterValue_params = @{
99-
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute.Admin/locations/{locationName}/artifactTypes/VMExtension/publishers/{publisher}/types/{type}/versions/{version}'
100-
}
94+
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
95+
$GetArmResourceIdParameterValue_params = @{
96+
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute.Admin/locations/{locationName}/artifactTypes/VMExtension/publishers/{publisher}/types/{type}/versions/{version}'
97+
}
10198

102-
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
103-
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
99+
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
100+
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
104101

105-
$Location = $ArmResourceIdParameterValues['locationName']
106-
$publisher = $ArmResourceIdParameterValues['publisher']
107-
$type = $ArmResourceIdParameterValues['type']
108-
$version = $ArmResourceIdParameterValues['version']
109-
} elseif ( -not $PSBoundParameters.ContainsKey('Location')) {
110-
$Location = (Get-AzureRMLocation).Location
111-
}
102+
$Location = $ArmResourceIdParameterValues['locationName']
103+
$publisher = $ArmResourceIdParameterValues['publisher']
104+
$type = $ArmResourceIdParameterValues['type']
105+
$version = $ArmResourceIdParameterValues['version']
106+
} elseif ( -not $PSBoundParameters.ContainsKey('Location')) {
107+
$Location = (Get-AzureRMLocation).Location
108+
}
112109

110+
if ($PSCmdlet.ShouldProcess("$Publisher" , "Delete the VM extension")) {
111+
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete the VM extension?", "Performing operation DeleteWithHttpMessagesAsync on $Publisher."))) {
113112

114113
if ('Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId' -eq $PsCmdlet.ParameterSetName) {
115114
Write-Verbose -Message 'Performing operation DeleteWithHttpMessagesAsync on $ComputeAdminClient.'

src/StackAdmin/Azs.Network.Admin/Module/Azs.Network.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Remove-AzsNetworkQuota.ps1

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,26 @@ function Remove-AzsNetworkQuota {
8888

8989
$NetworkAdminClient = New-ServiceClient @NewServiceClient_params
9090

91-
if ($PSCmdlet.ShouldProcess("$Name" , "Delete the network quota")) {
92-
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete the network quota?", "Performing operation DeleteWithHttpMessagesAsync on $Name."))) {
93-
if ('InputObject_Quotas_Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId_Quotas_Delete' -eq $PsCmdlet.ParameterSetName) {
94-
$GetArmResourceIdParameterValue_params = @{
95-
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Network.Admin/locations/{location}/quotas/{resourceName}'
96-
}
91+
if ('InputObject_Quotas_Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId_Quotas_Delete' -eq $PsCmdlet.ParameterSetName) {
92+
$GetArmResourceIdParameterValue_params = @{
93+
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Network.Admin/locations/{location}/quotas/{resourceName}'
94+
}
9795

98-
if ('ResourceId_Quotas_Delete' -eq $PsCmdlet.ParameterSetName) {
99-
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
100-
} else {
101-
$GetArmResourceIdParameterValue_params['Id'] = $InputObject.Id
102-
}
103-
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
104-
$location = $ArmResourceIdParameterValues['location']
96+
if ('ResourceId_Quotas_Delete' -eq $PsCmdlet.ParameterSetName) {
97+
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
98+
} else {
99+
$GetArmResourceIdParameterValue_params['Id'] = $InputObject.Id
100+
}
101+
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
102+
$location = $ArmResourceIdParameterValues['location']
105103

106-
$Name = $ArmResourceIdParameterValues['resourceName']
107-
} elseif (-not $PSBoundParameters.ContainsKey('Location')) {
108-
$Location = (Get-AzureRMLocation).Location
109-
}
104+
$Name = $ArmResourceIdParameterValues['resourceName']
105+
} elseif (-not $PSBoundParameters.ContainsKey('Location')) {
106+
$Location = (Get-AzureRMLocation).Location
107+
}
108+
109+
if ($PSCmdlet.ShouldProcess("$Name" , "Delete the network quota")) {
110+
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete the network quota?", "Performing operation DeleteWithHttpMessagesAsync on $Name."))) {
110111

111112
if ('Quotas_Delete' -eq $PsCmdlet.ParameterSetName -or 'InputObject_Quotas_Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId_Quotas_Delete' -eq $PsCmdlet.ParameterSetName) {
112113
Write-Verbose -Message 'Performing operation DeleteWithHttpMessagesAsync on $NetworkAdminClient.'

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Remove-AzsStorageQuota.ps1

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,26 @@ function Remove-AzsStorageQuota {
8080

8181
$StorageAdminClient = New-ServiceClient @NewServiceClient_params
8282

83-
if ($PSCmdlet.ShouldProcess("$Name" , "Delete the storage quota")) {
84-
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete the storage quota?", "Performing operation DeleteWithHttpMessagesAsync on $Name."))) {
85-
if ('InputObject_StorageQuotas_Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId_StorageQuotas_Delete' -eq $PsCmdlet.ParameterSetName) {
86-
$GetArmResourceIdParameterValue_params = @{
87-
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage.Admin/locations/{location}/quotas/{quotaName}'
88-
}
83+
if ('InputObject_StorageQuotas_Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId_StorageQuotas_Delete' -eq $PsCmdlet.ParameterSetName) {
84+
$GetArmResourceIdParameterValue_params = @{
85+
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage.Admin/locations/{location}/quotas/{quotaName}'
86+
}
8987

90-
if ('ResourceId_StorageQuotas_Delete' -eq $PsCmdlet.ParameterSetName) {
91-
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
92-
} else {
93-
$GetArmResourceIdParameterValue_params['Id'] = $InputObject.Id
94-
}
95-
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
96-
$location = $ArmResourceIdParameterValues['location']
88+
if ('ResourceId_StorageQuotas_Delete' -eq $PsCmdlet.ParameterSetName) {
89+
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
90+
} else {
91+
$GetArmResourceIdParameterValue_params['Id'] = $InputObject.Id
92+
}
93+
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
94+
$location = $ArmResourceIdParameterValues['location']
9795

98-
$Name = $ArmResourceIdParameterValues['quotaName']
99-
} elseif (-not $PSBoundParameters.ContainsKey('Location')) {
100-
$Location = (Get-AzureRMLocation).Location
101-
}
96+
$Name = $ArmResourceIdParameterValues['quotaName']
97+
} elseif (-not $PSBoundParameters.ContainsKey('Location')) {
98+
$Location = (Get-AzureRMLocation).Location
99+
}
102100

101+
if ($PSCmdlet.ShouldProcess("$Name" , "Delete the storage quota")) {
102+
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete the storage quota?", "Performing operation DeleteWithHttpMessagesAsync on $Name."))) {
103103

104104
if ('StorageQuotas_Delete' -eq $PsCmdlet.ParameterSetName -or 'InputObject_StorageQuotas_Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId_StorageQuotas_Delete' -eq $PsCmdlet.ParameterSetName) {
105105
Write-Verbose -Message 'Performing operation DeleteWithHttpMessagesAsync on $StorageAdminClient.'

0 commit comments

Comments
 (0)