Skip to content

Commit de33153

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

26 files changed

+258
-72
lines changed
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

+13-11
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

+2-2
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

+5-5
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

+1-1
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

+1-2
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

+1-2
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

+1-1
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

+2-3
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

+1-1
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

src/Subscription/Subscription.Autorest/docs/Invoke-AzSubscriptionAcceptOwnership.md

+46-5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ Invoke-AzSubscriptionAcceptOwnership -InputObject <ISubscriptionIdentity> [-Mana
2626
[-Confirm] [-WhatIf] [<CommonParameters>]
2727
```
2828

29+
### AcceptViaJsonFilePath
30+
```
31+
Invoke-AzSubscriptionAcceptOwnership -SubscriptionId <String> -JsonFilePath <String>
32+
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
33+
```
34+
35+
### AcceptViaJsonString
36+
```
37+
Invoke-AzSubscriptionAcceptOwnership -SubscriptionId <String> -JsonString <String>
38+
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
39+
```
40+
2941
## DESCRIPTION
3042
Accept subscription ownership.
3143

@@ -77,7 +89,6 @@ Accept wildcard characters: False
7789
7890
### -InputObject
7991
Identity Parameter
80-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8192
8293
```yaml
8394
Type: Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity
@@ -91,12 +102,42 @@ Accept pipeline input: True (ByValue)
91102
Accept wildcard characters: False
92103
```
93104
105+
### -JsonFilePath
106+
Path of Json file supplied to the Accept operation
107+
108+
```yaml
109+
Type: System.String
110+
Parameter Sets: AcceptViaJsonFilePath
111+
Aliases:
112+
113+
Required: True
114+
Position: Named
115+
Default value: None
116+
Accept pipeline input: False
117+
Accept wildcard characters: False
118+
```
119+
120+
### -JsonString
121+
Json string supplied to the Accept operation
122+
123+
```yaml
124+
Type: System.String
125+
Parameter Sets: AcceptViaJsonString
126+
Aliases:
127+
128+
Required: True
129+
Position: Named
130+
Default value: None
131+
Accept pipeline input: False
132+
Accept wildcard characters: False
133+
```
134+
94135
### -ManagementGroupId
95136
Management group Id for the subscription.
96137
97138
```yaml
98139
Type: System.String
99-
Parameter Sets: (All)
140+
Parameter Sets: AcceptExpanded, AcceptViaIdentityExpanded
100141
Aliases:
101142

102143
Required: False
@@ -141,7 +182,7 @@ Subscription Id.
141182
142183
```yaml
143184
Type: System.String
144-
Parameter Sets: AcceptExpanded
185+
Parameter Sets: AcceptExpanded, AcceptViaJsonFilePath, AcceptViaJsonString
145186
Aliases:
146187

147188
Required: True
@@ -156,7 +197,7 @@ The friendly name of the subscription.
156197
157198
```yaml
158199
Type: System.String
159-
Parameter Sets: (All)
200+
Parameter Sets: AcceptExpanded, AcceptViaIdentityExpanded
160201
Aliases: DisplayName
161202

162203
Required: False
@@ -171,7 +212,7 @@ Tags for the subscription
171212
172213
```yaml
173214
Type: System.Collections.Hashtable
174-
Parameter Sets: (All)
215+
Parameter Sets: AcceptExpanded, AcceptViaIdentityExpanded
175216
Aliases:
176217

177218
Required: False

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ New-AzSubscriptionAlias -AliasName <String> -SubscriptionId <String> [-Tag <Hash
2121
### WorkloadCreateExpanded
2222
```
2323
New-AzSubscriptionAlias -AliasName <String> -BillingScope <String> -SubscriptionName <String>
24-
-Workload <Workload> [-ManagementGroupId <String>] [-ResellerId <String>] [-SubscriptionOwnerId <String>]
24+
-Workload <String> [-ManagementGroupId <String>] [-ResellerId <String>] [-SubscriptionOwnerId <String>]
2525
[-SubscriptionTenantId <String>] [-Tag <Hashtable>] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait]
2626
[-Confirm] [-WhatIf] [<CommonParameters>]
2727
```
@@ -246,7 +246,7 @@ The workload type of the subscription.
246246
It can be either Production or DevTest.
247247
248248
```yaml
249-
Type: Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload
249+
Type: System.String
250250
Parameter Sets: WorkloadCreateExpanded
251251
Aliases:
252252

@@ -295,7 +295,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
295295
296296
## OUTPUTS
297297
298-
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse
298+
### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionAliasResponse
299299
300300
## NOTES
301301

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

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ Accept wildcard characters: False
7272
7373
### -InputObject
7474
Identity Parameter
75-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
7675
7776
```yaml
7877
Type: Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"generate_Id": "b296973d-7948-499c-b0ec-3e2c022ae446"
2+
"generate_Id": "9306fe1b-e223-480c-8c0f-3a4194277804"
33
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Resources
2+
This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `..\custom` folder.
3+
4+
## Info
5+
- Modifiable: yes
6+
- Generated: no
7+
- Committed: yes
8+
- Packaged: no
9+
10+
## Purpose
11+
Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact.

0 commit comments

Comments
 (0)