Skip to content

Commit b2af9d5

Browse files
committed
Updated Cmdlets
1 parent 55a1f45 commit b2af9d5

File tree

114 files changed

+3100
-3232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+3100
-3232
lines changed

build.proj

Lines changed: 80 additions & 130 deletions
Large diffs are not rendered by default.

src/StackAdmin/Azs.AzureBridge.Admin/Module/Azs.AzureBridge.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsAzureBridgeActivation.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ function Get-AzsAzureBridgeActivation {
109109
$Name = $ArmResourceIdParameterValues['activationName']
110110
}
111111

112-
113112
if ('List' -eq $PsCmdlet.ParameterSetName) {
114113
Write-Verbose -Message 'Performing operation ListWithHttpMessagesAsync on $AzureBridgeAdminClient.'
115114
$TaskResult = $AzureBridgeAdminClient.Activations.ListWithHttpMessagesAsync($ResourceGroupName)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ function Get-AzsAzureBridgeDownloadedProduct {
119119
$Name = $ArmResourceIdParameterValues['productName']
120120
}
121121

122-
123122
if ('List' -eq $PsCmdlet.ParameterSetName) {
124123
Write-Verbose -Message 'Performing operation ListWithHttpMessagesAsync on $AzureBridgeAdminClient.'
125124
$TaskResult = $AzureBridgeAdminClient.DownloadedProducts.ListWithHttpMessagesAsync($ResourceGroupName, $ActivationName)

src/StackAdmin/Azs.AzureBridge.Admin/Module/Azs.AzureBridge.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Invoke-AzsAzureBridgeProductDownload.ps1

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,6 @@ function Invoke-AzsAzureBridgeProductDownload {
7777

7878
$ErrorActionPreference = 'Stop'
7979

80-
$NewServiceClient_params = @{
81-
FullClientTypeName = 'Microsoft.AzureStack.Management.AzureBridge.Admin.AzureBridgeAdminClient'
82-
}
83-
84-
$GlobalParameterHashtable = @{}
85-
$NewServiceClient_params['GlobalParameterHashtable'] = $GlobalParameterHashtable
86-
87-
$GlobalParameterHashtable['SubscriptionId'] = $null
88-
if ($PSBoundParameters.ContainsKey('SubscriptionId')) {
89-
$GlobalParameterHashtable['SubscriptionId'] = $PSBoundParameters['SubscriptionId']
90-
}
91-
92-
$AzureBridgeAdminClient = New-ServiceClient @NewServiceClient_params
93-
9480
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
9581
$GetArmResourceIdParameterValue_params = @{
9682
IdTemplate = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}/providers/Microsoft.AzureBridge.Admin/activations/{activationName}/Products/{productName}'
@@ -104,13 +90,26 @@ function Invoke-AzsAzureBridgeProductDownload {
10490
}
10591

10692
if ($PSCmdlet.ShouldProcess("$ProductName" , "Start product download")) {
107-
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Start the product download?", "Performing operation DownloadWithHttpMessagesAsync on $ProductName."))) {
93+
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Start the product download?", "Performing operation download $ProductName."))) {
94+
95+
$NewServiceClient_params = @{
96+
FullClientTypeName = 'Microsoft.AzureStack.Management.AzureBridge.Admin.AzureBridgeAdminClient'
97+
}
98+
99+
$GlobalParameterHashtable = @{}
100+
$NewServiceClient_params['GlobalParameterHashtable'] = $GlobalParameterHashtable
101+
102+
$GlobalParameterHashtable['SubscriptionId'] = $null
103+
if ($PSBoundParameters.ContainsKey('SubscriptionId')) {
104+
$GlobalParameterHashtable['SubscriptionId'] = $PSBoundParameters['SubscriptionId']
105+
}
106+
107+
$AzureBridgeAdminClient = New-ServiceClient @NewServiceClient_params
108108

109109
if ('Products_Download' -eq $PsCmdlet.ParameterSetName -or 'ResourceId' -eq $PsCmdlet.ParameterSetName) {
110110
Write-Verbose -Message 'Performing operation DownloadWithHttpMessagesAsync on $AzureBridgeAdminClient.'
111111
$TaskResult = $AzureBridgeAdminClient.Products.DownloadWithHttpMessagesAsync($ResourceGroupName, $ActivationName, $ProductName)
112-
}
113-
else {
112+
} else {
114113
Write-Verbose -Message 'Failed to map parameter set to operation method.'
115114
throw 'Module failed to find operation to execute.'
116115
}
@@ -152,8 +151,7 @@ function Invoke-AzsAzureBridgeProductDownload {
152151
-CallerPSBoundParameters $ScriptBlockParameters `
153152
-CallerPSCmdlet $PSCmdlet `
154153
@PSCommonParameters
155-
}
156-
else {
154+
} else {
157155
Invoke-Command -ScriptBlock $PSSwaggerJobScriptBlock `
158156
-ArgumentList $TaskResult, $TaskHelperFilePath `
159157
@PSCommonParameters

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

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,8 @@ function Remove-AzsAzureBridgeDownloadedProduct {
7777

7878
Process {
7979

80-
8180
$ErrorActionPreference = 'Stop'
8281

83-
$NewServiceClient_params = @{
84-
FullClientTypeName = 'Microsoft.AzureStack.Management.AzureBridge.Admin.AzureBridgeAdminClient'
85-
}
86-
87-
$GlobalParameterHashtable = @{}
88-
$NewServiceClient_params['GlobalParameterHashtable'] = $GlobalParameterHashtable
89-
90-
$GlobalParameterHashtable['SubscriptionId'] = $null
91-
if ($PSBoundParameters.ContainsKey('SubscriptionId')) {
92-
$GlobalParameterHashtable['SubscriptionId'] = $PSBoundParameters['SubscriptionId']
93-
}
94-
95-
$AzureBridgeAdminClient = New-ServiceClient @NewServiceClient_params
96-
9782
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
9883
$GetArmResourceIdParameterValue_params = @{
9984
IdTemplate = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}/providers/Microsoft.AzureBridge.Admin/activations/{activationName}/downloadedProducts/{productName}'
@@ -108,7 +93,21 @@ function Remove-AzsAzureBridgeDownloadedProduct {
10893
}
10994

11095
if ($PSCmdlet.ShouldProcess("$Name" , "Delete the downloaded product")) {
111-
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete the downloaded product?", "Performing operation DeleteWithHttpMessagesAsync on $Name."))) {
96+
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Delete the downloaded product?", "Performing operation delete on $Name."))) {
97+
98+
$NewServiceClient_params = @{
99+
FullClientTypeName = 'Microsoft.AzureStack.Management.AzureBridge.Admin.AzureBridgeAdminClient'
100+
}
101+
102+
$GlobalParameterHashtable = @{}
103+
$NewServiceClient_params['GlobalParameterHashtable'] = $GlobalParameterHashtable
104+
105+
$GlobalParameterHashtable['SubscriptionId'] = $null
106+
if ($PSBoundParameters.ContainsKey('SubscriptionId')) {
107+
$GlobalParameterHashtable['SubscriptionId'] = $PSBoundParameters['SubscriptionId']
108+
}
109+
110+
$AzureBridgeAdminClient = New-ServiceClient @NewServiceClient_params
112111

113112
if ('Delete' -eq $PsCmdlet.ParameterSetName -or 'ResourceId' -eq $PsCmdlet.ParameterSetName) {
114113
Write-Verbose -Message 'Performing operation DeleteWithHttpMessagesAsync on $AzureBridgeAdminClient.'
@@ -119,7 +118,6 @@ function Remove-AzsAzureBridgeDownloadedProduct {
119118
throw 'Module failed to find operation to execute.'
120119
}
121120

122-
123121
Write-Verbose -Message "Waiting for the operation to complete."
124122

125123
$PSSwaggerJobScriptBlock = {

src/StackAdmin/Azs.Backup.Admin/Module/Azs.Backup.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsBackup.ps1

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Licensed under the MIT License. See License.txt in the project root for license
2222
.PARAMETER ResourceGroupName
2323
Name of the resource group.
2424
25+
.PARAMETER ParentResource
26+
Passing a backup location will return the list of all backups at that backup location.
27+
2528
.EXAMPLE
2629
2730
PS C:\> Get-AzsBackup
@@ -61,17 +64,17 @@ function Get-AzsBackup {
6164
[System.String]
6265
$ResourceGroupName,
6366

64-
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'ParentObject')]
67+
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'ParentResource')]
6568
[ValidateNotNullOrEmpty()]
6669
[Microsoft.AzureStack.Management.Backup.Admin.Models.BackupLocation]
67-
$ParentObject,
70+
$ParentResource,
6871

69-
[Parameter(Mandatory = $false, ParameterSetName = 'ParentObject')]
72+
[Parameter(Mandatory = $false, ParameterSetName = 'ParentResource')]
7073
[Parameter(Mandatory = $false, ParameterSetName = 'List')]
7174
[int]
7275
$Top = -1,
7376

74-
[Parameter(Mandatory = $false, ParameterSetName = 'ParentObject')]
77+
[Parameter(Mandatory = $false, ParameterSetName = 'ParentResource')]
7578
[Parameter(Mandatory = $false, ParameterSetName = 'List')]
7679
[int]
7780
$Skip = -1
@@ -105,7 +108,6 @@ function Get-AzsBackup {
105108
}
106109

107110
$BackupAdminClient = New-ServiceClient @NewServiceClient_params
108-
109111
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
110112
$GetArmResourceIdParameterValue_params = @{
111113
IdTemplate = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}/providers/Microsoft.Backup.Admin/backupLocations/{location}/backups/{backup}'
@@ -116,30 +118,29 @@ function Get-AzsBackup {
116118
$ResourceGroupName = $ArmResourceIdParameterValues['resourceGroup']
117119
$Location = $ArmResourceIdParameterValues['location']
118120
$Name = $ArmResourceIdParameterValues['backup']
119-
} else {
120-
if (-not $PSBoundParameters.ContainsKey('Location')) {
121-
$Location = (Get-AzureRMLocation).Location
122-
}
123-
124-
if (-not $PSBoundParameters.ContainsKey('ResourceGroupName')) {
125-
$ResourceGroupName = "System.$Location"
126-
}
127-
}
128-
129-
if ('ParentObject' -eq $PsCmdlet.ParameterSetName) {
121+
} elseif ('ParentResource' -eq $PsCmdlet.ParameterSetName) {
130122

131123
$GetArmResourceIdParameterValue_params = @{
132124
IdTemplate = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}/providers/Microsoft.Backup.Admin/backupLocations/{location}'
133125
}
134126

135-
$GetArmResourceIdParameterValue_params['Id'] = $ParentObject.Id
127+
$GetArmResourceIdParameterValue_params['Id'] = $ParentResource.Id
136128

137129
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
138130
$ResourceGroupName = $ArmResourceIdParameterValues['resourceGroup']
139131
$Location = $ArmResourceIdParameterValues['location']
132+
} else {
133+
134+
if ([String]::IsNullOrEmpty($Location)) {
135+
$Location = (Get-AzureRMLocation).Location
136+
}
137+
138+
if ([String]::IsNullOrEmpty($ResourceGroupName)) {
139+
$ResourceGroupName = "System.$Location"
140+
}
140141
}
141142

142-
if ('List' -eq $PsCmdlet.ParameterSetName -or 'ParentObject' -eq $PsCmdlet.ParameterSetName) {
143+
if ('List' -eq $PsCmdlet.ParameterSetName -or 'ParentResource' -eq $PsCmdlet.ParameterSetName) {
143144
Write-Verbose -Message 'Performing operation ListWithHttpMessagesAsync on $BackupAdminClient.'
144145
$TaskResult = $BackupAdminClient.Backups.ListWithHttpMessagesAsync($ResourceGroupName, $Location)
145146
} elseif ('Get' -eq $PsCmdlet.ParameterSetName -or 'ResourceId' -eq $PsCmdlet.ParameterSetName) {

src/StackAdmin/Azs.Backup.Admin/Module/Azs.Backup.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsBackupLocation.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ function Get-AzsBackupLocation {
101101
$ResourceGroupName = $ArmResourceIdParameterValues['resourceGroup']
102102
$Location = $ArmResourceIdParameterValues['location']
103103
} else {
104-
if (-not $PSBoundParameters.ContainsKey('Location')) {
104+
if ([String]::IsNullOrEmpty($Location)) {
105105
$Location = (Get-AzureRMLocation).Location
106106
}
107107

108-
if (-not $PSBoundParameters.ContainsKey('ResourceGroupName')) {
108+
if ([String]::IsNullOrEmpty($ResourceGroupName)) {
109109
$ResourceGroupName = "System.$Location"
110110
}
111111
}

0 commit comments

Comments
 (0)