Skip to content

[PS] Migrate Relay module to autorest v4 #27894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/Relay/Relay.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the ""License"");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an ""AS IS"" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Relay")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.1.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.1.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
41 changes: 10 additions & 31 deletions src/Relay/Relay.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ require:

title: Relay

identity-correction-for-post: true
resourcegroup-append: true
nested-object-to-string: true
inlining-threshold: 50

# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
use-extension:
"@autorest/powershell": "3.x"

directive:
# Namespace Authorization Rule
- from: swagger-document
Expand Down Expand Up @@ -140,12 +131,6 @@ directive:
variant: ^Create$
remove: true

- where:
verb: New
subject: ^NamespaceNetworkRuleSet$
variant: ^CreateViaIdentity$
hide: true

- where:
verb: Set
subject: ^NamespaceNetworkRuleSet$
Expand All @@ -159,13 +144,13 @@ directive:

# Custom Set-AzRelayAuthorizationRule
- where:
verb: Set
verb: Set|Update
subject: ^AuthorizationRule$
hide: true

# Custom Set-AzRelayHybridConnection
- where:
verb: Set
verb: Set|Update
subject: ^HybridConnection$
hide: true

Expand All @@ -186,37 +171,30 @@ directive:
subject: Relay

- where:
verb: New
subject: ^Namespace$
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$
remove: true

- where:
verb: Update
subject: ^Namespace$
variant: ^Update$|^UpdateViaIdentity$
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true

- where:
verb: New
subject: ^HybridConnection$|^Relay$
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$|^CreateViaIdentityNamespace$
remove: true

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

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

- where:
verb: Test
subject: ^Name$
variant: ^Check$|^CheckViaIdentity$|^CheckViaIdentityExpanded$
variant: ^(Check)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true

- where:
Expand Down Expand Up @@ -359,8 +337,9 @@ directive:
parameter-name: SkuTier
hide: true

# - model-cmdlet:
# - NwRuleSetIPRules
- model-cmdlet:
- model-name: NwRuleSetIPRules
cmdlet-name: New-AzRelayNetworkRuleSetIPRuleObject

- where:
model-name: RelayNamespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Authorization rule for a namespace by name.
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IRelayIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule
.Notes
COMPLEX PARAMETER PROPERTIES

Expand All @@ -47,7 +47,7 @@ INPUTOBJECT <IRelayIdentity>: Identity Parameter
https://learn.microsoft.com/powershell/module/az.relay/get-azrelayauthorizationrule
#>
function Get-AzRelayAuthorizationRule {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule])]
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='Get', Mandatory)]
Expand Down
12 changes: 6 additions & 6 deletions src/Relay/Relay.Autorest/custom/Set-AzRelayAuthorizationRule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ $authRule.Rights += 'Send'
Set-AzRelayAuthorizationRule -ResourceGroupName lucas-relay-rg -Namespace namespace-pwsh01 -WcfRelay wcf-01 -Name authRule-01 -InputObject $authRule | fl

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule
.Notes
COMPLEX PARAMETER PROPERTIES

Expand All @@ -59,7 +59,7 @@ INPUTOBJECT <IAuthorizationRule>: Single item in a List or Get AuthorizationRule
https://learn.microsoft.com/powershell/module/az.relay/set-azrelayauthorizationrule
#>
function Set-AzRelayAuthorizationRule {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule])]
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
Expand Down Expand Up @@ -107,7 +107,7 @@ param(
[Parameter(ParameterSetName='Update1', Mandatory, ValueFromPipeline)]
[Parameter(ParameterSetName='Update2', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule]
# Single item in a List or Get AuthorizationRule operation
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
${InputObject},
Expand All @@ -116,9 +116,9 @@ param(
[Parameter(ParameterSetName='UpdateExpanded1')]
[Parameter(ParameterSetName='UpdateExpanded2')]
[AllowEmptyCollection()]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.AccessRights])]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.PSArgumentCompleterAttribute("Manage", "Send", "Listen")]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.AccessRights[]]
[System.String[]]
# The rights associated with the rule.
${Rights},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ $connection.UserMetadata = "testHybirdConnection"
Set-AzRelayHybridConnection -ResourceGroupName lucas-relay-rg -Namespace namespace-pwsh01 -Name connection-01 -InputObject $connection

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IHybridConnection
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IHybridConnection
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IHybridConnection
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IHybridConnection
.Notes
COMPLEX PARAMETER PROPERTIES

Expand All @@ -50,7 +50,7 @@ INPUTOBJECT <IHybridConnection>: Description of hybrid connection resource.
https://learn.microsoft.com/powershell/module/az.relay/set-azrelayhybridconnection
#>
function Set-AzRelayHybridConnection {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IHybridConnection])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IHybridConnection])]
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
Expand Down Expand Up @@ -82,7 +82,7 @@ param(

[Parameter(ParameterSetName='Update', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IHybridConnection]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IHybridConnection]
# Description of hybrid connection resource.
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
${InputObject},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Update NetworkRuleSet for a Namespace.
{{ Add code here }}

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.INetworkRuleSet
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.INetworkRuleSet
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IRelayIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.INetworkRuleSet
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.INetworkRuleSet
.Notes
COMPLEX PARAMETER PROPERTIES

Expand Down Expand Up @@ -66,7 +66,7 @@ PARAMETER <INetworkRuleSet>: Description of topic resource.
https://learn.microsoft.com/powershell/module/az.relay/set-azrelaynamespacenetworkruleset
#>
function Set-AzRelayNamespaceNetworkRuleSet {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.INetworkRuleSet])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.INetworkRuleSet])]
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(ParameterSetName='UpdateExpanded', Mandatory)]
Expand Down Expand Up @@ -98,26 +98,26 @@ param(

[Parameter(ParameterSetName='UpdateExpanded')]
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.DefaultAction])]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.PSArgumentCompleterAttribute("Allow", "Deny")]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.DefaultAction]
[System.String]
# Default Action for Network Rule Set
${DefaultAction},

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

[Parameter(ParameterSetName='UpdateExpanded')]
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.PublicNetworkAccess])]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.PSArgumentCompleterAttribute("Enabled", "Disabled", "SecuredByPerimeter")]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.PublicNetworkAccess]
[System.String]
# This determines if traffic is allowed over public network.
# By default it is enabled
${PublicNetworkAccess},
Expand Down
12 changes: 6 additions & 6 deletions src/Relay/Relay.Autorest/custom/Set-AzWcfRelay.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ This operation is idempotent.
{{ Add code here }}

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IWcfRelay
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IWcfRelay
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IWcfRelay
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IWcfRelay
.Notes
COMPLEX PARAMETER PROPERTIES

Expand All @@ -50,7 +50,7 @@ INPUTOBJECT <IWcfRelay>: Description of the WCF relay resource.
https://learn.microsoft.com/powershell/module/az.relay/set-azwcfrelay
#>
function Set-AzWcfRelay {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IWcfRelay])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IWcfRelay])]
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
Expand Down Expand Up @@ -81,7 +81,7 @@ param(

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

[Parameter(ParameterSetName='UpdateExpanded')]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.Relaytype])]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.PSArgumentCompleterAttribute("NetTcp", "Http")]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.Relaytype]
[System.String]
# WCF relay type.
${WcfRelayType},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,27 @@ Create an in-memory object for NwRuleSetIPRules.
Create an in-memory object for NwRuleSetIPRules.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.NwRuleSetIPRules
Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.NwRuleSetIPRules
.Link
https://learn.microsoft.com/powershell/module/az.Relay/new-AzRelayNetworkRuleSetIPRuleObject
https://learn.microsoft.com/powershell/module/Az.Relay/new-azrelaynetworkrulesetipruleobject
#>
function New-AzRelayNetworkRuleSetIPRuleObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.NwRuleSetIPRules')]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.ModelCmdletAttribute()]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.NwRuleSetIPRules')]
[CmdletBinding(PositionalBinding=$false)]
Param(

[Parameter(HelpMessage="The IP Filter Action.")]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.NetworkRuleIPAction])]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.Support.NetworkRuleIPAction]
[Microsoft.Azure.PowerShell.Cmdlets.Relay.PSArgumentCompleterAttribute("Allow")]
[string]
$Action,
[Parameter(HelpMessage="IP Mask.")]
[string]
$IPMask
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.NwRuleSetIPRules]::New()
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.NwRuleSetIPRules]::New()

if ($PSBoundParameters.ContainsKey('Action')) {
$Object.Action = $Action
Expand Down
10 changes: 5 additions & 5 deletions src/Relay/Relay.Autorest/docs/Az.Relay.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: Az.Relay
Module Guid: 4bf8fb16-5644-49f6-85ac-c4c6573a2ecd
Module Guid: 8255faf9-3ba7-48f7-a2f5-bce38ad11823
Download Help Link: https://learn.microsoft.com/powershell/module/az.relay
Help Version: 1.0.0.0
Locale: en-US
Expand Down Expand Up @@ -30,10 +30,10 @@ Gets NetworkRuleSet for a Namespace.
Returns the description for the specified WCF relay.

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

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

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

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.Api20211101.IAuthorizationRule
### Microsoft.Azure.PowerShell.Cmdlets.Relay.Models.IAuthorizationRule

## NOTES

Expand Down
Loading