Skip to content

Commit 6ad5ef8

Browse files
authored
[PS] migrate GuestConfiguration module to autorest v4 (Azure#27611)
1 parent 216edce commit 6ad5ef8

22 files changed

+1085
-91
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 - GuestConfiguration")]
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/GuestConfiguration/GuestConfiguration.Autorest/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,16 @@ input-file:
3535
module-version: 0.10.8
3636
title: GuestConfiguration
3737
subject-prefix: $(service-name)
38-
identity-correction-for-post: true
39-
nested-object-to-string: true
40-
resourcegroup-append: true
41-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
42-
use-extension:
43-
"@autorest/powershell": "3.x"
4438

4539
directive:
4640
# Following is two common directive which are normally required in all the RPs
4741
# 1. Remove the unexpanded parameter set
4842
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
4943
- where:
50-
variant: ^Create$|^Create1$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
44+
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
45+
remove: true
46+
- where:
47+
variant: ^CreateViaIdentityExpanded$|^CreateViaIdentityExpanded1$|^UpdateViaIdentityGuestConfigurationAssignmentExpanded$
5148
remove: true
5249
# Remove the set-* cmdlet
5350
- where:
@@ -72,6 +69,7 @@ directive:
7269
variant: ^GetViaIdentity.*|^CreateViaIdentity.*|^DeleteViaIdentity.*
7370
remove: true
7471
# Hide Remove-AzGuestConfigurationAssignment to customize InputObject case
72+
# Hide V4 parent resource variant
7573
- where:
7674
verb: Remove
7775
subject: GuestConfigurationAssignment

src/GuestConfiguration/GuestConfiguration.Autorest/custom/Remove-AzGuestConfigurationAssignment.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Get-AzGuestConfigurationAssignment -ResourceGroupName test-rg -VMName test-vm -N
2727
.Inputs
2828
Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationIdentity
2929
.Outputs
30-
Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.Api20220125.IGuestConfigurationAssignment
30+
Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationAssignment
3131
.Outputs
3232
System.Boolean
3333
.Notes
@@ -49,7 +49,7 @@ INPUTOBJECT <IGuestConfigurationIdentity>: Identity Parameter
4949
https://learn.microsoft.com/powershell/module/az.guestconfiguration/remove-azguestconfigurationassignment
5050
#>
5151
function Remove-AzGuestConfigurationAssignment {
52-
[OutputType([System.Boolean], [Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.Api20220125.IGuestConfigurationAssignment])]
52+
[OutputType([System.Boolean], [Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationAssignment])]
5353
[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
5454
param(
5555
[Parameter(ParameterSetName='Delete', Mandatory)]
@@ -101,15 +101,15 @@ param(
101101
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Path')]
102102
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationIdentity]
103103
# Identity Parameter
104-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
105104
${InputObject},
106-
105+
107106
[Parameter()]
108107
[Alias('AzureRMContext', 'AzureCredential')]
109108
[ValidateNotNull()]
110109
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Azure')]
111110
[System.Management.Automation.PSObject]
112-
# The credentials, account, tenant, and subscription used for communication with Azure.
111+
# The DefaultProfile parameter is not functional.
112+
# Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
113113
${DefaultProfile},
114114

115115
[Parameter(DontShow)]

src/GuestConfiguration/GuestConfiguration.Autorest/docs/Az.GuestConfiguration.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.GuestConfiguration
3-
Module Guid: f2042330-dd50-496f-aac0-69f27fd54f2a
3+
Module Guid: 4afd08fc-b997-4356-8118-ed62d7ce1ce1
44
Download Help Link: https://learn.microsoft.com/powershell/module/az.guestconfiguration
55
Help Version: 1.0.0.0
66
Locale: en-US
@@ -18,8 +18,11 @@ Get information about a guest configuration assignment
1818
Get a report for the guest configuration assignment, by reportId.
1919

2020
### [New-AzGuestConfigurationAssignment](New-AzGuestConfigurationAssignment.md)
21-
Creates an association between a VM and guest configuration
21+
create an association between a VM and guest configuration
2222

2323
### [Remove-AzGuestConfigurationAssignment](Remove-AzGuestConfigurationAssignment.md)
2424
Delete a guest configuration assignment
2525

26+
### [Update-AzGuestConfigurationAssignment](Update-AzGuestConfigurationAssignment.md)
27+
update an association between a ARC machine and guest configuration
28+

src/GuestConfiguration/GuestConfiguration.Autorest/docs/Get-AzGuestConfigurationAssignment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
276276
277277
## OUTPUTS
278278
279-
### Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.Api20220125.IGuestConfigurationAssignment
279+
### Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationAssignment
280280
281281
## NOTES
282282

src/GuestConfiguration/GuestConfiguration.Autorest/docs/Get-AzGuestConfigurationAssignmentReport.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
216216
217217
## OUTPUTS
218218
219-
### Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.Api20220125.IGuestConfigurationAssignmentReport
219+
### Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationAssignmentReport
220+
221+
### Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationAssignmentReportList
220222
221223
## NOTES
222224

src/GuestConfiguration/GuestConfiguration.Autorest/docs/New-AzGuestConfigurationAssignment.md

Lines changed: 80 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ schema: 2.0.0
88
# New-AzGuestConfigurationAssignment
99

1010
## SYNOPSIS
11-
Creates an association between a VM and guest configuration
11+
create an association between a VM and guest configuration
1212

1313
## SYNTAX
1414

@@ -17,7 +17,7 @@ Creates an association between a VM and guest configuration
1717
New-AzGuestConfigurationAssignment -GuestConfigurationAssignmentName <String> -ResourceGroupName <String>
1818
-VMName <String> -GuestConfigurationContentHash <String> -GuestConfigurationContentUri <String>
1919
-GuestConfigurationName <String> -GuestConfigurationVersion <String> [-SubscriptionId <String>]
20-
[-Context <String>] [-GuestConfigurationAssignmentType <AssignmentType>] [-GuestConfigurationKind <Kind>]
20+
[-Context <String>] [-GuestConfigurationAssignmentType <String>] [-GuestConfigurationKind <String>]
2121
[-GuestConfigurationParameter <IConfigurationParameter[]>]
2222
[-GuestConfigurationProtectedParameter <IConfigurationParameter[]>] [-Location <String>] [-Name <String>]
2323
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
@@ -28,14 +28,42 @@ New-AzGuestConfigurationAssignment -GuestConfigurationAssignmentName <String> -R
2828
New-AzGuestConfigurationAssignment -GuestConfigurationAssignmentName <String> -MachineName <String>
2929
-ResourceGroupName <String> -GuestConfigurationContentHash <String> -GuestConfigurationContentUri <String>
3030
-GuestConfigurationName <String> -GuestConfigurationVersion <String> [-SubscriptionId <String>]
31-
[-Context <String>] [-GuestConfigurationAssignmentType <AssignmentType>] [-GuestConfigurationKind <Kind>]
31+
[-Context <String>] [-GuestConfigurationAssignmentType <String>] [-GuestConfigurationKind <String>]
3232
[-GuestConfigurationParameter <IConfigurationParameter[]>]
3333
[-GuestConfigurationProtectedParameter <IConfigurationParameter[]>] [-Location <String>] [-Name <String>]
3434
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
3535
```
3636

37+
### CreateViaJsonFilePath
38+
```
39+
New-AzGuestConfigurationAssignment -GuestConfigurationAssignmentName <String> -ResourceGroupName <String>
40+
-VMName <String> -JsonFilePath <String> [-SubscriptionId <String>] [-DefaultProfile <PSObject>] [-Confirm]
41+
[-WhatIf] [<CommonParameters>]
42+
```
43+
44+
### CreateViaJsonFilePath1
45+
```
46+
New-AzGuestConfigurationAssignment -GuestConfigurationAssignmentName <String> -MachineName <String>
47+
-ResourceGroupName <String> -JsonFilePath <String> [-SubscriptionId <String>] [-DefaultProfile <PSObject>]
48+
[-Confirm] [-WhatIf] [<CommonParameters>]
49+
```
50+
51+
### CreateViaJsonString
52+
```
53+
New-AzGuestConfigurationAssignment -GuestConfigurationAssignmentName <String> -ResourceGroupName <String>
54+
-VMName <String> -JsonString <String> [-SubscriptionId <String>] [-DefaultProfile <PSObject>] [-Confirm]
55+
[-WhatIf] [<CommonParameters>]
56+
```
57+
58+
### CreateViaJsonString1
59+
```
60+
New-AzGuestConfigurationAssignment -GuestConfigurationAssignmentName <String> -MachineName <String>
61+
-ResourceGroupName <String> -JsonString <String> [-SubscriptionId <String>] [-DefaultProfile <PSObject>]
62+
[-Confirm] [-WhatIf] [<CommonParameters>]
63+
```
64+
3765
## DESCRIPTION
38-
Creates an association between a VM and guest configuration
66+
create an association between a VM and guest configuration
3967

4068
## EXAMPLES
4169

@@ -73,7 +101,7 @@ Ex: Azure Policy
73101

74102
```yaml
75103
Type: System.String
76-
Parameter Sets: (All)
104+
Parameter Sets: CreateExpanded, CreateExpanded1
77105
Aliases:
78106

79107
Required: False
@@ -119,8 +147,8 @@ Specifies the assignment type and execution of the configuration.
119147
Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor.
120148
121149
```yaml
122-
Type: Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Support.AssignmentType
123-
Parameter Sets: (All)
150+
Type: System.String
151+
Parameter Sets: CreateExpanded, CreateExpanded1
124152
Aliases:
125153

126154
Required: False
@@ -135,7 +163,7 @@ Combined hash of the guest configuration package and configuration parameters.
135163
136164
```yaml
137165
Type: System.String
138-
Parameter Sets: (All)
166+
Parameter Sets: CreateExpanded, CreateExpanded1
139167
Aliases:
140168

141169
Required: True
@@ -150,7 +178,7 @@ Uri of the storage where guest configuration package is uploaded.
150178
151179
```yaml
152180
Type: System.String
153-
Parameter Sets: (All)
181+
Parameter Sets: CreateExpanded, CreateExpanded1
154182
Aliases:
155183

156184
Required: True
@@ -165,8 +193,8 @@ Kind of the guest configuration.
165193
For example:DSC
166194
167195
```yaml
168-
Type: Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Support.Kind
169-
Parameter Sets: (All)
196+
Type: System.String
197+
Parameter Sets: CreateExpanded, CreateExpanded1
170198
Aliases:
171199

172200
Required: False
@@ -181,7 +209,7 @@ Name of the guest configuration.
181209
182210
```yaml
183211
Type: System.String
184-
Parameter Sets: (All)
212+
Parameter Sets: CreateExpanded, CreateExpanded1
185213
Aliases:
186214

187215
Required: True
@@ -193,11 +221,10 @@ Accept wildcard characters: False
193221
194222
### -GuestConfigurationParameter
195223
The configuration parameters for the guest configuration.
196-
To construct, see NOTES section for GUESTCONFIGURATIONPARAMETER properties and create a hash table.
197224
198225
```yaml
199-
Type: Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.Api20220125.IConfigurationParameter[]
200-
Parameter Sets: (All)
226+
Type: Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IConfigurationParameter[]
227+
Parameter Sets: CreateExpanded, CreateExpanded1
201228
Aliases:
202229

203230
Required: False
@@ -209,11 +236,10 @@ Accept wildcard characters: False
209236
210237
### -GuestConfigurationProtectedParameter
211238
The protected configuration parameters for the guest configuration.
212-
To construct, see NOTES section for GUESTCONFIGURATIONPROTECTEDPARAMETER properties and create a hash table.
213239
214240
```yaml
215-
Type: Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.Api20220125.IConfigurationParameter[]
216-
Parameter Sets: (All)
241+
Type: Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IConfigurationParameter[]
242+
Parameter Sets: CreateExpanded, CreateExpanded1
217243
Aliases:
218244

219245
Required: False
@@ -228,7 +254,37 @@ Version of the guest configuration.
228254
229255
```yaml
230256
Type: System.String
231-
Parameter Sets: (All)
257+
Parameter Sets: CreateExpanded, CreateExpanded1
258+
Aliases:
259+
260+
Required: True
261+
Position: Named
262+
Default value: None
263+
Accept pipeline input: False
264+
Accept wildcard characters: False
265+
```
266+
267+
### -JsonFilePath
268+
Path of Json file supplied to the Create operation
269+
270+
```yaml
271+
Type: System.String
272+
Parameter Sets: CreateViaJsonFilePath, CreateViaJsonFilePath1
273+
Aliases:
274+
275+
Required: True
276+
Position: Named
277+
Default value: None
278+
Accept pipeline input: False
279+
Accept wildcard characters: False
280+
```
281+
282+
### -JsonString
283+
Json string supplied to the Create operation
284+
285+
```yaml
286+
Type: System.String
287+
Parameter Sets: CreateViaJsonString, CreateViaJsonString1
232288
Aliases:
233289

234290
Required: True
@@ -243,7 +299,7 @@ Region where the VM is located.
243299
244300
```yaml
245301
Type: System.String
246-
Parameter Sets: (All)
302+
Parameter Sets: CreateExpanded, CreateExpanded1
247303
Aliases:
248304

249305
Required: False
@@ -258,7 +314,7 @@ The name of the ARC machine.
258314
259315
```yaml
260316
Type: System.String
261-
Parameter Sets: CreateExpanded1
317+
Parameter Sets: CreateExpanded1, CreateViaJsonFilePath1, CreateViaJsonString1
262318
Aliases:
263319

264320
Required: True
@@ -273,7 +329,7 @@ Name of the guest configuration assignment.
273329
274330
```yaml
275331
Type: System.String
276-
Parameter Sets: (All)
332+
Parameter Sets: CreateExpanded, CreateExpanded1
277333
Aliases:
278334

279335
Required: False
@@ -319,7 +375,7 @@ The name of the virtual machine.
319375
320376
```yaml
321377
Type: System.String
322-
Parameter Sets: CreateExpanded
378+
Parameter Sets: CreateExpanded, CreateViaJsonFilePath, CreateViaJsonString
323379
Aliases:
324380

325381
Required: True
@@ -367,7 +423,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
367423
368424
## OUTPUTS
369425
370-
### Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.Api20220125.IGuestConfigurationAssignment
426+
### Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationAssignment
371427
372428
## NOTES
373429

src/GuestConfiguration/GuestConfiguration.Autorest/docs/Remove-AzGuestConfigurationAssignment.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ Delete a guest configuration assignment named test-assignment by piping
6666
## PARAMETERS
6767

6868
### -DefaultProfile
69-
The credentials, account, tenant, and subscription used for communication with Azure.
69+
The DefaultProfile parameter is not functional.
70+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
7071

7172
```yaml
7273
Type: System.Management.Automation.PSObject
@@ -82,7 +83,6 @@ Accept wildcard characters: False
8283
8384
### -InputObject
8485
Identity Parameter
85-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8686
8787
```yaml
8888
Type: Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationIdentity
@@ -242,7 +242,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
242242
243243
## OUTPUTS
244244
245-
### Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.Api20220125.IGuestConfigurationAssignment
245+
### Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationAssignment
246246
247247
### System.Boolean
248248

0 commit comments

Comments
 (0)