Skip to content

Commit de33153

Browse files
authored
[PS] migrate Subscription module to autorest v4 (#27719)
1 parent 948beed commit de33153

26 files changed

+258
-72
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0 (the ""License"");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an ""AS IS"" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
12+
// is regenerated.
13+
14+
using System;
15+
using System.Reflection;
16+
using System.Runtime.CompilerServices;
17+
using System.Runtime.InteropServices;
18+
19+
[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
20+
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
21+
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
22+
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Subscription")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.11.2")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("0.11.2")]
25+
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
26+
[assembly: System.CLSCompliantAttribute(false)]

src/Subscription/Subscription.Autorest/README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ module-version: 0.3.0
4242
title: Subscription
4343
subject-prefix: $(service-name)
4444

45-
identity-correction-for-post: true
46-
nested-object-to-string: true
47-
48-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
49-
use-extension:
50-
"@autorest/powershell": "3.x"
51-
5245
directive:
5346
- from: swagger-document
5447
where: $.paths["/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Subscription/policies/default"].get.responses
@@ -102,7 +95,7 @@ directive:
10295
variant: AcceptViaIdentityExpanded
10396

10497
- where:
105-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$|^Rename$|^RenameViaIdentity$|^Add$|^Accept$|^AcceptViaIdentity$
98+
variant: ^(Create|Update|Rename|Add|Accept)(?!.*?(Expanded|JsonFilePath|JsonString))
10699
remove: true
107100
- where:
108101
subject: BillingAccountPolicy
@@ -212,7 +205,10 @@ directive:
212205
transform: $ = $.replace('Description =@"",', '');
213206
- from: NewAzSubscriptionAlias_CreateExpanded.cs
214207
where: $
215-
transform: $ = $.replace('Script = @"(Get-AzContext).Subscription.Id")]', '');
208+
transform: $ = $.replace('Script = @"(Get-AzContext).Subscription.Id",', '');
209+
- from: NewAzSubscriptionAlias_CreateExpanded.cs
210+
where: $
211+
transform: $ = $.replace('SetCondition = @"")]', '');
216212

217213
- from: GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs
218214
where: $
@@ -225,7 +221,10 @@ directive:
225221
transform: $ = $.replace('Description =@"",', '');
226222
- from: GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs
227223
where: $
228-
transform: $ = $.replace('Script = @"(Get-AzContext).Subscription.Id")]', '');
224+
transform: $ = $.replace('Script = @"(Get-AzContext).Subscription.Id",', '');
225+
- from: GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs
226+
where: $
227+
transform: $ = $.replace('SetCondition = @"")]', '');
229228
- where:
230229
verb: Get
231230
subject: AcceptOwnershipStatus
@@ -243,7 +242,10 @@ directive:
243242
transform: $ = $.replace('Description =@"",', '');
244243
- from: InvokeAzSubscriptionAcceptOwnership_AcceptExpanded.cs
245244
where: $
246-
transform: $ = $.replace('Script = @"(Get-AzContext).Subscription.Id")]', '');
245+
transform: $ = $.replace('Script = @"(Get-AzContext).Subscription.Id",', '');
246+
- from: InvokeAzSubscriptionAcceptOwnership_AcceptExpanded.cs
247+
where: $
248+
transform: $ = $.replace('SetCondition = @"")]', '');
247249
- where:
248250
verb: Invoke
249251
subject: AcceptOwnership

src/Subscription/Subscription.Autorest/custom/Get-AzSubscriptionAcceptOwnershipStatus.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId $subIdArray
2828
.Inputs
2929
Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity
3030
.Outputs
31-
Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse
31+
Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.IAcceptOwnershipStatusResponse
3232
.Notes
3333
COMPLEX PARAMETER PROPERTIES
3434
@@ -44,7 +44,7 @@ INPUTOBJECT <ISubscriptionIdentity>: Identity Parameter
4444
https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionacceptownershipstatus
4545
#>
4646
function Get-AzSubscriptionAcceptOwnershipStatus {
47-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse])]
47+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.IAcceptOwnershipStatusResponse])]
4848
[CmdletBinding(DefaultParameterSetName = 'AcceptExpanded', PositionalBinding = $false)]
4949
param(
5050
[Parameter(ParameterSetName = 'AcceptExpanded', Mandatory)]

src/Subscription/Subscription.Autorest/custom/New-AzSubscriptionAlias.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XX
2525
New-AzSubscriptionAlias -AliasName test-subscription -DisplayName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production'
2626
2727
.Outputs
28-
Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse
28+
Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionAliasResponse
2929
.Link
3030
https://learn.microsoft.com/powershell/module/az.subscription/new-azsubscriptionalias
3131
#>
3232
function New-AzSubscriptionAlias {
33-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse])]
33+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionAliasResponse])]
3434
[CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
3535
param(
3636
[Parameter(Mandatory)]
@@ -85,15 +85,15 @@ function New-AzSubscriptionAlias {
8585

8686
[Parameter()]
8787
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')]
88-
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IPutAliasRequestAdditionalPropertiesTags]))]
88+
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.IPutAliasRequestAdditionalPropertiesTags]))]
8989
[System.Collections.Hashtable]
9090
# Tags for the subscription
9191
${Tag},
9292

9393
[Parameter(ParameterSetName = 'WorkloadCreateExpanded', Mandatory)]
94-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload])]
94+
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.PSArgumentCompleterAttribute("Production", "DevTest")]
9595
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')]
96-
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload]
96+
[System.String]
9797
# The workload type of the subscription.
9898
# It can be either Production or DevTest.
9999
${Workload},

src/Subscription/Subscription.Autorest/docs/Az.Subscription.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.Subscription
3-
Module Guid: d687e965-0990-42dd-a1cd-a2e30af042c9
3+
Module Guid: a58196e7-1b1a-4697-a96b-8ce5d2b70ec0
44
Download Help Link: https://learn.microsoft.com/powershell/module/az.subscription
55
Help Version: 1.0.0.0
66
Locale: en-US

src/Subscription/Subscription.Autorest/docs/Disable-AzSubscription.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ Accept wildcard characters: False
7171
7272
### -InputObject
7373
Identity Parameter
74-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
7574
7675
```yaml
7776
Type: Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity
@@ -125,7 +124,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
125124
126125
## OUTPUTS
127126
128-
### System.String
127+
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ICanceledSubscriptionId
129128
130129
## NOTES
131130

src/Subscription/Subscription.Autorest/docs/Enable-AzSubscription.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ Accept wildcard characters: False
7171
7272
### -InputObject
7373
Identity Parameter
74-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
7574
7675
```yaml
7776
Type: Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity
@@ -125,7 +124,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
125124
126125
## OUTPUTS
127126
128-
### System.String
127+
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.IEnabledSubscriptionId
129128
130129
## NOTES
131130

src/Subscription/Subscription.Autorest/docs/Get-AzSubscriptionAcceptOwnershipStatus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
100100
101101
## OUTPUTS
102102
103-
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse
103+
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.IAcceptOwnershipStatusResponse
104104
105105
## NOTES
106106

src/Subscription/Subscription.Autorest/docs/Get-AzSubscriptionAlias.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ Accept wildcard characters: False
9595
9696
### -InputObject
9797
Identity Parameter
98-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
9998
10099
```yaml
101100
Type: Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity
@@ -118,9 +117,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
118117
119118
## OUTPUTS
120119
121-
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasListResult
120+
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionAliasListResult
122121
123-
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse
122+
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionAliasResponse
124123
125124
## NOTES
126125

src/Subscription/Subscription.Autorest/docs/Get-AzSubscriptionPolicy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
5959
6060
## OUTPUTS
6161
62-
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IGetTenantPolicyResponse
62+
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.IGetTenantPolicyResponse
6363
6464
## NOTES
6565

0 commit comments

Comments
 (0)