Skip to content

Commit 2f92848

Browse files
authored
[PS] Migrate Relay module to autorest v4 (#27894)
1 parent b7b80e4 commit 2f92848

File tree

65 files changed

+2693
-1292
lines changed

Some content is hidden

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

65 files changed

+2693
-1292
lines changed

src/Relay/Relay.Autorest/README.md

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ require:
3434

3535
title: Relay
3636

37-
identity-correction-for-post: true
38-
resourcegroup-append: true
39-
nested-object-to-string: true
40-
inlining-threshold: 50
41-
42-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
43-
use-extension:
44-
"@autorest/powershell": "3.x"
45-
4637
directive:
4738
- where:
4839
verb: Get
@@ -165,12 +156,6 @@ directive:
165156
variant: ^Create$
166157
remove: true
167158

168-
- where:
169-
verb: New
170-
subject: ^NamespaceNetworkRuleSet$
171-
variant: ^CreateViaIdentity$
172-
hide: true
173-
174159
- where:
175160
verb: Set
176161
subject: ^NamespaceNetworkRuleSet$
@@ -184,13 +169,13 @@ directive:
184169

185170
# Custom Set-AzRelayAuthorizationRule
186171
- where:
187-
verb: Set
172+
verb: Set|Update
188173
subject: ^AuthorizationRule$
189174
hide: true
190175

191176
# Custom Set-AzRelayHybridConnection
192177
- where:
193-
verb: Set
178+
verb: Set|Update
194179
subject: ^HybridConnection$
195180
hide: true
196181

@@ -211,37 +196,30 @@ directive:
211196
subject: Relay
212197

213198
- where:
214-
verb: New
215-
subject: ^Namespace$
216-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$
217-
remove: true
218-
219-
- where:
220-
verb: Update
221199
subject: ^Namespace$
222-
variant: ^Update$|^UpdateViaIdentity$
200+
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
223201
remove: true
224202

225203
- where:
226204
verb: New
227205
subject: ^HybridConnection$|^Relay$
228-
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
206+
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$|^CreateViaIdentityNamespace$
229207
remove: true
230208

231209
- where:
232210
subject: ^Key$
233-
variant: ^Regenerate$|^RegenerateViaIdentityExpanded$|^RegenerateViaIdentity$|^Regenerate1$|^RegenerateViaIdentityExpanded1$|^RegenerateViaIdentity1$|^Regenerate2$|^RegenerateViaIdentityExpanded2$|^RegenerateViaIdentity2$
211+
variant: (^Regenerate.*ViaIdentity.*$)|(^Regenerate(?!.*(Expanded|JsonFilePath|JsonString)).*$)
234212
remove: true
235213

236214
- where:
237215
subject: ^AuthorizationRule$
238-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Create1$|^^CreateViaIdentity1$|^CreateViaIdentityExpanded1$|^Create2$|^^CreateViaIdentity2$|^CreateViaIdentityExpanded2$
216+
variant: (^Create.*ViaIdentity.*$)|(^Create(?!.*(Expanded|JsonFilePath|JsonString)).*$)
239217
remove: true
240218

241219
- where:
242220
verb: Test
243221
subject: ^Name$
244-
variant: ^Check$|^CheckViaIdentity$|^CheckViaIdentityExpanded$
222+
variant: ^(Check)(?!.*?(Expanded|JsonFilePath|JsonString))
245223
remove: true
246224

247225
- where:
@@ -384,8 +362,9 @@ directive:
384362
parameter-name: SkuTier
385363
hide: true
386364

387-
# - model-cmdlet:
388-
# - NwRuleSetIPRules
365+
- model-cmdlet:
366+
- model-name: NwRuleSetIPRules
367+
cmdlet-name: New-AzRelayNetworkRuleSetIPRuleObject
389368

390369
- where:
391370
model-name: RelayNamespace

src/Relay/Relay.Autorest/custom/Get-AzRelayAuthorizationRule.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Authorization rule for a namespace by name.
2727
.Inputs
2828
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IRelayIdentity
2929
.Outputs
30-
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule
30+
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule
3131
.Notes
3232
COMPLEX PARAMETER PROPERTIES
3333
@@ -47,7 +47,7 @@ INPUTOBJECT <IRelayIdentity>: Identity Parameter
4747
https://learn.microsoft.com/powershell/module/az.relay/get-azrelayauthorizationrule
4848
#>
4949
function Get-AzRelayAuthorizationRule {
50-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule])]
50+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule])]
5151
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
5252
param(
5353
[Parameter(ParameterSetName='Get', Mandatory)]

src/Relay/Relay.Autorest/custom/Set-AzRelayAuthorizationRule.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ $authRule.Rights += 'Send'
3939
Set-AzRelayAuthorizationRule -ResourceGroupName lucas-relay-rg -Namespace namespace-pwsh01 -WcfRelay wcf-01 -Name authRule-01 -InputObject $authRule | fl
4040
4141
.Inputs
42-
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule
42+
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule
4343
.Outputs
44-
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule
44+
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule
4545
.Notes
4646
COMPLEX PARAMETER PROPERTIES
4747
@@ -59,7 +59,7 @@ INPUTOBJECT <IAuthorizationRule>: Single item in a List or Get AuthorizationRule
5959
https://learn.microsoft.com/powershell/module/az.relay/set-azrelayauthorizationrule
6060
#>
6161
function Set-AzRelayAuthorizationRule {
62-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule])]
62+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule])]
6363
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
6464
param(
6565
[Parameter(Mandatory)]
@@ -107,7 +107,7 @@ param(
107107
[Parameter(ParameterSetName='Update1', Mandatory, ValueFromPipeline)]
108108
[Parameter(ParameterSetName='Update2', Mandatory, ValueFromPipeline)]
109109
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
110-
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule]
110+
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule]
111111
# Single item in a List or Get AuthorizationRule operation
112112
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
113113
${InputObject},
@@ -116,9 +116,9 @@ param(
116116
[Parameter(ParameterSetName='UpdateExpanded1')]
117117
[Parameter(ParameterSetName='UpdateExpanded2')]
118118
[AllowEmptyCollection()]
119-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.AccessRights])]
119+
[Microsoft.Azure.PowerShell.Cmdlets.Relay.PSArgumentCompleterAttribute("Manage", "Send", "Listen")]
120120
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
121-
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.AccessRights[]]
121+
[System.String[]]
122122
# The rights associated with the rule.
123123
${Rights},
124124

src/Relay/Relay.Autorest/custom/Set-AzRelayHybridConnection.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ $connection.UserMetadata = "testHybirdConnection"
2929
Set-AzRelayHybridConnection -ResourceGroupName lucas-relay-rg -Namespace namespace-pwsh01 -Name connection-01 -InputObject $connection
3030
3131
.Inputs
32-
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IHybridConnection
32+
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IHybridConnection
3333
.Outputs
34-
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IHybridConnection
34+
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IHybridConnection
3535
.Notes
3636
COMPLEX PARAMETER PROPERTIES
3737
@@ -50,7 +50,7 @@ INPUTOBJECT <IHybridConnection>: Description of hybrid connection resource.
5050
https://learn.microsoft.com/powershell/module/az.relay/set-azrelayhybridconnection
5151
#>
5252
function Set-AzRelayHybridConnection {
53-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IHybridConnection])]
53+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IHybridConnection])]
5454
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
5555
param(
5656
[Parameter(Mandatory)]
@@ -82,7 +82,7 @@ param(
8282

8383
[Parameter(ParameterSetName='Update', Mandatory, ValueFromPipeline)]
8484
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
85-
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IHybridConnection]
85+
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IHybridConnection]
8686
# Description of hybrid connection resource.
8787
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8888
${InputObject},

src/Relay/Relay.Autorest/custom/Set-AzRelayNamespaceNetworkRuleSet.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ Update NetworkRuleSet for a Namespace.
2525
{{ Add code here }}
2626
2727
.Inputs
28-
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.INetworkRuleSet
28+
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.INetworkRuleSet
2929
.Inputs
3030
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IRelayIdentity
3131
.Outputs
32-
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.INetworkRuleSet
32+
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.INetworkRuleSet
3333
.Notes
3434
COMPLEX PARAMETER PROPERTIES
3535
@@ -66,7 +66,7 @@ PARAMETER <INetworkRuleSet>: Description of topic resource.
6666
https://learn.microsoft.com/powershell/module/az.relay/set-azrelaynamespacenetworkruleset
6767
#>
6868
function Set-AzRelayNamespaceNetworkRuleSet {
69-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.INetworkRuleSet])]
69+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.INetworkRuleSet])]
7070
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
7171
param(
7272
[Parameter(ParameterSetName='UpdateExpanded', Mandatory)]
@@ -98,26 +98,26 @@ param(
9898

9999
[Parameter(ParameterSetName='UpdateExpanded')]
100100
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
101-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.DefaultAction])]
101+
[Microsoft.Azure.PowerShell.Cmdlets.Relay.PSArgumentCompleterAttribute("Allow", "Deny")]
102102
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
103-
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.DefaultAction]
103+
[System.String]
104104
# Default Action for Network Rule Set
105105
${DefaultAction},
106106

107107
[Parameter(ParameterSetName='UpdateExpanded')]
108108
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
109109
[AllowEmptyCollection()]
110110
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
111-
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.INwRuleSetIPRules[]]
111+
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.INwRuleSetIPRules[]]
112112
# List of IpRules
113113
# To construct, see NOTES section for IPRULE properties and create a hash table.
114114
${IPRule},
115115

116116
[Parameter(ParameterSetName='UpdateExpanded')]
117117
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
118-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.PublicNetworkAccess])]
118+
[Microsoft.Azure.PowerShell.Cmdlets.Relay.PSArgumentCompleterAttribute("Enabled", "Disabled", "SecuredByPerimeter")]
119119
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
120-
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.PublicNetworkAccess]
120+
[System.String]
121121
# This determines if traffic is allowed over public network.
122122
# By default it is enabled
123123
${PublicNetworkAccess},

src/Relay/Relay.Autorest/custom/Set-AzWcfRelay.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ This operation is idempotent.
2727
{{ Add code here }}
2828
2929
.Inputs
30-
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IWcfRelay
30+
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IWcfRelay
3131
.Outputs
32-
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IWcfRelay
32+
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IWcfRelay
3333
.Notes
3434
COMPLEX PARAMETER PROPERTIES
3535
@@ -50,7 +50,7 @@ INPUTOBJECT <IWcfRelay>: Description of the WCF relay resource.
5050
https://learn.microsoft.com/powershell/module/az.relay/set-azwcfrelay
5151
#>
5252
function Set-AzWcfRelay {
53-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IWcfRelay])]
53+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IWcfRelay])]
5454
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
5555
param(
5656
[Parameter(Mandatory)]
@@ -81,7 +81,7 @@ param(
8181

8282
[Parameter(ParameterSetName='Update', Mandatory, ValueFromPipeline)]
8383
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
84-
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IWcfRelay]
84+
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IWcfRelay]
8585
# Description of the WCF relay resource.
8686
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8787
${InputObject},
@@ -95,9 +95,9 @@ param(
9595
${UserMetadata},
9696

9797
[Parameter(ParameterSetName='UpdateExpanded')]
98-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.Relaytype])]
98+
[Microsoft.Azure.PowerShell.Cmdlets.Relay.PSArgumentCompleterAttribute("NetTcp", "Http")]
9999
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
100-
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.Relaytype]
100+
[System.String]
101101
# WCF relay type.
102102
${WcfRelayType},
103103

src/Relay/Relay.Autorest/custom/New-AzRelayNetworkRuleSetIPRuleObject.ps1 renamed to src/Relay/Relay.Autorest/custom/autogen-model-cmdlets/New-AzRelayNetworkRuleSetIPRuleObject.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,27 @@ Create an in-memory object for NwRuleSetIPRules.
2121
Create an in-memory object for NwRuleSetIPRules.
2222
2323
.Outputs
24-
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.NwRuleSetIPRules
24+
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.NwRuleSetIPRules
2525
.Link
26-
https://learn.microsoft.com/powershell/module/az.Relay/new-AzRelayNetworkRuleSetIPRuleObject
26+
https://learn.microsoft.com/powershell/module/Az.Relay/new-azrelaynetworkrulesetipruleobject
2727
#>
2828
function New-AzRelayNetworkRuleSetIPRuleObject {
29-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.NwRuleSetIPRules')]
29+
[Microsoft.Azure.PowerShell.Cmdlets.Relay.ModelCmdletAttribute()]
30+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.NwRuleSetIPRules')]
3031
[CmdletBinding(PositionalBinding=$false)]
3132
Param(
3233

3334
[Parameter(HelpMessage="The IP Filter Action.")]
34-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.NetworkRuleIPAction])]
35-
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.NetworkRuleIPAction]
35+
[Microsoft.Azure.PowerShell.Cmdlets.Relay.PSArgumentCompleterAttribute("Allow")]
36+
[string]
3637
$Action,
3738
[Parameter(HelpMessage="IP Mask.")]
3839
[string]
3940
$IPMask
4041
)
4142

4243
process {
43-
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.NwRuleSetIPRules]::New()
44+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.NwRuleSetIPRules]::New()
4445

4546
if ($PSBoundParameters.ContainsKey('Action')) {
4647
$Object.Action = $Action

src/Relay/Relay.Autorest/docs/Az.Relay.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.Relay
3-
Module Guid: fc75e4f5-af4d-4046-b098-0c3dc2f5ed69
3+
Module Guid: 8255faf9-3ba7-48f7-a2f5-bce38ad11823
44
Download Help Link: https://learn.microsoft.com/powershell/module/az.relay
55
Help Version: 1.0.0.0
66
Locale: en-US
@@ -30,10 +30,10 @@ Gets NetworkRuleSet for a Namespace.
3030
Returns the description for the specified WCF relay.
3131

3232
### [New-AzRelayAuthorizationRule](New-AzRelayAuthorizationRule.md)
33-
Creates or updates an authorization rule for a namespace.
33+
Create an authorization rule for a namespace.
3434

3535
### [New-AzRelayHybridConnection](New-AzRelayHybridConnection.md)
36-
Creates or updates a service hybrid connection.
36+
Create a service hybrid connection.
3737
This operation is idempotent.
3838

3939
### [New-AzRelayKey](New-AzRelayKey.md)
@@ -46,7 +46,7 @@ Create Azure Relay namespace.
4646
Create an in-memory object for NwRuleSetIPRules.
4747

4848
### [New-AzWcfRelay](New-AzWcfRelay.md)
49-
Creates or updates a WCF relay.
49+
Create a WCF relay.
5050
This operation is idempotent.
5151

5252
### [Remove-AzRelayAuthorizationRule](Remove-AzRelayAuthorizationRule.md)
@@ -80,7 +80,7 @@ This operation is idempotent.
8080
Check the specified namespace name availability.
8181

8282
### [Update-AzRelayNamespace](Update-AzRelayNamespace.md)
83-
Creates or updates a namespace.
83+
Update a namespace.
8484
Once created, this namespace's resource manifest is immutable.
8585
This operation is idempotent.
8686

src/Relay/Relay.Autorest/docs/Get-AzRelayAuthorizationRule.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
314314
315315
## OUTPUTS
316316
317-
### Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule
317+
### Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule
318318
319319
## NOTES
320320

0 commit comments

Comments
 (0)