Skip to content

Commit 606a9be

Browse files
authored
[PS] Migrate Peering module to autorest v4 (Azure#27453)
1 parent 710604b commit 606a9be

File tree

111 files changed

+2828
-448
lines changed

Some content is hidden

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

111 files changed

+2828
-448
lines changed
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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 - Peering")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.4.2")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("0.4.2")]
25+
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
26+
[assembly: System.CLSCompliantAttribute(false)]
27+

Diff for: src/Peering/Peering.Autorest/README.md

+25-16
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,37 @@ module-version: 0.1.0
4444
title: Peering
4545
subject-prefix: $(service-name)
4646

47-
# If there are post APIs for some kinds of actions in the RP, you may need to
48-
# uncomment following line to support viaIdentity for these post APIs
49-
resourcegroup-append: true
50-
identity-correction-for-post: true
51-
nested-object-to-string: true
52-
53-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
54-
use-extension:
55-
"@autorest/powershell": "3.x"
56-
5747
directive:
5848
# Following is two common directive which are normally required in all the RPs
5949
# 1. Remove the unexpanded parameter set
6050
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
6151
- where:
62-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
52+
variant: ^(Create|Update)(?!.*?Expanded)
53+
remove: true
54+
- where:
55+
variant: ^CreateViaIdentity.*$
6356
remove: true
64-
6557
# Remove the set-* cmdlet
6658
- where:
6759
verb: Set
6860
remove: true
61+
# remove update cmdlets directive, if need please add back
62+
# - where:
63+
# subject: PeerAsn
64+
# verb: Update
65+
# remove: true
66+
# - where:
67+
# subject: ConnectionMonitorTest
68+
# verb: Update
69+
# remove: true
70+
# - where:
71+
# subject: RegisteredAsn
72+
# verb: Update
73+
# remove: true
74+
# - where:
75+
# subject: RegisteredPrefix
76+
# verb: Update
77+
# remove: true
6978
# Change cmdlet verb: Invoke-AzPeeringInvokeLookingGlass -> Start-AzPeeringInvokeLookingGlass
7079
- where:
7180
verb: Invoke
@@ -107,10 +116,10 @@ directive:
107116
# $directConnection = New-AzPeeringDirectConnectionObject ......
108117
# New-AzPeering -DirectConnection $directConnection ......
109118
- model-cmdlet:
110-
- ExchangeConnection
111-
- DirectConnection
112-
- ContactDetail
113-
- CheckServiceProviderAvailabilityInput
119+
- model-name: ExchangeConnection
120+
- model-name: DirectConnection
121+
- model-name: ContactDetail
122+
- model-name: CheckServiceProviderAvailabilityInput
114123

115124
# Change all parameters named SkuName(SkuName -> Sku) and add the alias SkuName to Sku
116125
- where:

Diff for: src/Peering/Peering.Autorest/custom/autogen-model-cmdlets/New-AzPeeringCheckServiceProviderAvailabilityInputObject.ps1

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ Create an in-memory object for CheckServiceProviderAvailabilityInput.
2121
Create an in-memory object for CheckServiceProviderAvailabilityInput.
2222
2323
.Outputs
24-
Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput
24+
Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.CheckServiceProviderAvailabilityInput
2525
.Link
26-
https://learn.microsoft.com/powershell/module/Az.Peering/new-AzPeeringCheckServiceProviderAvailabilityInputObject
26+
https://learn.microsoft.com/powershell/module/Az.Peering/new-azpeeringcheckserviceprovideravailabilityinputobject
2727
#>
2828
function New-AzPeeringCheckServiceProviderAvailabilityInputObject {
29-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput')]
29+
[Microsoft.Azure.PowerShell.Cmdlets.Peering.ModelCmdletAttribute()]
30+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.CheckServiceProviderAvailabilityInput')]
3031
[CmdletBinding(PositionalBinding=$false)]
3132
Param(
3233

@@ -39,7 +40,7 @@ function New-AzPeeringCheckServiceProviderAvailabilityInputObject {
3940
)
4041

4142
process {
42-
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput]::New()
43+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.CheckServiceProviderAvailabilityInput]::New()
4344

4445
if ($PSBoundParameters.ContainsKey('PeeringServiceLocation')) {
4546
$Object.PeeringServiceLocation = $PeeringServiceLocation

Diff for: src/Peering/Peering.Autorest/custom/autogen-model-cmdlets/New-AzPeeringContactDetailObject.ps1

+7-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ Create an in-memory object for ContactDetail.
2121
Create an in-memory object for ContactDetail.
2222
2323
.Outputs
24-
Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail
24+
Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.ContactDetail
2525
.Link
26-
https://learn.microsoft.com/powershell/module/Az.Peering/new-AzPeeringContactDetailObject
26+
https://learn.microsoft.com/powershell/module/Az.Peering/new-azpeeringcontactdetailobject
2727
#>
2828
function New-AzPeeringContactDetailObject {
29-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail')]
29+
[Microsoft.Azure.PowerShell.Cmdlets.Peering.ModelCmdletAttribute()]
30+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.ContactDetail')]
3031
[CmdletBinding(PositionalBinding=$false)]
3132
Param(
3233

@@ -37,13 +38,13 @@ function New-AzPeeringContactDetailObject {
3738
[string]
3839
$Phone,
3940
[Parameter(HelpMessage="The role of the contact.")]
40-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role])]
41-
[Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role]
41+
[Microsoft.Azure.PowerShell.Cmdlets.Peering.PSArgumentCompleterAttribute("Noc", "Policy", "Technical", "Service", "Escalation", "Other")]
42+
[string]
4243
$Role
4344
)
4445

4546
process {
46-
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail]::New()
47+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.ContactDetail]::New()
4748

4849
if ($PSBoundParameters.ContainsKey('Email')) {
4950
$Object.Email = $Email

Diff for: src/Peering/Peering.Autorest/custom/autogen-model-cmdlets/New-AzPeeringDirectConnectionObject.ps1

+7-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ Create an in-memory object for DirectConnection.
2121
Create an in-memory object for DirectConnection.
2222
2323
.Outputs
24-
Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection
24+
Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.DirectConnection
2525
.Link
26-
https://learn.microsoft.com/powershell/module/Az.Peering/new-AzPeeringDirectConnectionObject
26+
https://learn.microsoft.com/powershell/module/Az.Peering/new-azpeeringdirectconnectionobject
2727
#>
2828
function New-AzPeeringDirectConnectionObject {
29-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection')]
29+
[Microsoft.Azure.PowerShell.Cmdlets.Peering.ModelCmdletAttribute()]
30+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.DirectConnection')]
3031
[CmdletBinding(PositionalBinding=$false)]
3132
Param(
3233

@@ -67,16 +68,16 @@ function New-AzPeeringDirectConnectionObject {
6768
[int]
6869
$PeeringDbFacilityId,
6970
[Parameter(HelpMessage="The field indicating if Microsoft provides session ip addresses.")]
70-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider])]
71-
[Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider]
71+
[Microsoft.Azure.PowerShell.Cmdlets.Peering.PSArgumentCompleterAttribute("Microsoft", "Peer")]
72+
[string]
7273
$SessionAddressProvider,
7374
[Parameter(HelpMessage="The flag that indicates whether or not the connection is used for peering service.")]
7475
[bool]
7576
$UseForPeeringService
7677
)
7778

7879
process {
79-
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection]::New()
80+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.DirectConnection]::New()
8081

8182
if ($PSBoundParameters.ContainsKey('BandwidthInMbps')) {
8283
$Object.BandwidthInMbps = $BandwidthInMbps

Diff for: src/Peering/Peering.Autorest/custom/autogen-model-cmdlets/New-AzPeeringExchangeConnectionObject.ps1

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ Create an in-memory object for ExchangeConnection.
2121
Create an in-memory object for ExchangeConnection.
2222
2323
.Outputs
24-
Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection
24+
Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.ExchangeConnection
2525
.Link
26-
https://learn.microsoft.com/powershell/module/Az.Peering/new-AzPeeringExchangeConnectionObject
26+
https://learn.microsoft.com/powershell/module/Az.Peering/new-azpeeringexchangeconnectionobject
2727
#>
2828
function New-AzPeeringExchangeConnectionObject {
29-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection')]
29+
[Microsoft.Azure.PowerShell.Cmdlets.Peering.ModelCmdletAttribute()]
30+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.ExchangeConnection')]
3031
[CmdletBinding(PositionalBinding=$false)]
3132
Param(
3233

@@ -66,7 +67,7 @@ function New-AzPeeringExchangeConnectionObject {
6667
)
6768

6869
process {
69-
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection]::New()
70+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.ExchangeConnection]::New()
7071

7172
if ($PSBoundParameters.ContainsKey('BgpSessionMaxPrefixesAdvertisedV4')) {
7273
$Object.BgpSessionMaxPrefixesAdvertisedV4 = $BgpSessionMaxPrefixesAdvertisedV4

Diff for: src/Peering/Peering.Autorest/docs/Az.Peering.md

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.Peering
3-
Module Guid: 78c6a853-5ea3-4374-9c5f-5b532d62c892
3+
Module Guid: ce52109a-e66b-4a81-8749-638d97fc0a97
44
Download Help Link: https://learn.microsoft.com/powershell/module/az.peering
55
Help Version: 1.0.0.0
66
Locale: en-US
@@ -60,16 +60,16 @@ Lists all of the available peering service locations for the specified kind of p
6060
Initialize Peering Service for Connection Monitor functionality
6161

6262
### [New-AzPeering](New-AzPeering.md)
63-
Creates a new peering or updates an existing peering with the specified name under the given subscription and resource group.
63+
create a new peering or create an existing peering with the specified name under the given subscription and resource group.
6464

6565
### [New-AzPeeringAsn](New-AzPeeringAsn.md)
66-
Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription.
66+
create a new peer ASN or create an existing peer ASN with the specified name under the given subscription.
6767

6868
### [New-AzPeeringCheckServiceProviderAvailabilityInputObject](New-AzPeeringCheckServiceProviderAvailabilityInputObject.md)
6969
Create an in-memory object for CheckServiceProviderAvailabilityInput.
7070

7171
### [New-AzPeeringConnectionMonitorTest](New-AzPeeringConnectionMonitorTest.md)
72-
Creates or updates a connection monitor test with the specified name under the given subscription, resource group and peering service.
72+
create a connection monitor test with the specified name under the given subscription, resource group and peering service.
7373

7474
### [New-AzPeeringContactDetailObject](New-AzPeeringContactDetailObject.md)
7575
Create an in-memory object for ContactDetail.
@@ -81,16 +81,16 @@ Create an in-memory object for DirectConnection.
8181
Create an in-memory object for ExchangeConnection.
8282

8383
### [New-AzPeeringRegisteredAsn](New-AzPeeringRegisteredAsn.md)
84-
Creates a new registered ASN with the specified name under the given subscription, resource group and peering.
84+
create a new registered ASN with the specified name under the given subscription, resource group and peering.
8585

8686
### [New-AzPeeringRegisteredPrefix](New-AzPeeringRegisteredPrefix.md)
87-
Creates a new registered prefix with the specified name under the given subscription, resource group and peering.
87+
create a new registered prefix with the specified name under the given subscription, resource group and peering.
8888

8989
### [New-AzPeeringService](New-AzPeeringService.md)
90-
Creates a new peering service or updates an existing peering with the specified name under the given subscription and resource group.
90+
create a new peering service or create an existing peering with the specified name under the given subscription and resource group.
9191

9292
### [New-AzPeeringServicePrefix](New-AzPeeringServicePrefix.md)
93-
Creates a new prefix with the specified name under the given subscription, resource group and peering service.
93+
create a new prefix with the specified name under the given subscription, resource group and peering service.
9494

9595
### [Remove-AzPeering](Remove-AzPeering.md)
9696
Deletes an existing peering with the specified name under the given subscription and resource group.
@@ -123,8 +123,20 @@ Validates an existing registered prefix with the specified name under the given
123123
Checks if the peering service provider is present within 1000 miles of customer's location
124124

125125
### [Update-AzPeering](Update-AzPeering.md)
126-
Updates tags for a peering with the specified name under the given subscription and resource group.
126+
update tags for a peering with the specified name under the given subscription and resource group.
127+
128+
### [Update-AzPeeringAsn](Update-AzPeeringAsn.md)
129+
update a new peer ASN or update an existing peer ASN with the specified name under the given subscription.
130+
131+
### [Update-AzPeeringConnectionMonitorTest](Update-AzPeeringConnectionMonitorTest.md)
132+
update a connection monitor test with the specified name under the given subscription, resource group and peering service.
133+
134+
### [Update-AzPeeringRegisteredAsn](Update-AzPeeringRegisteredAsn.md)
135+
update a new registered ASN with the specified name under the given subscription, resource group and peering.
136+
137+
### [Update-AzPeeringRegisteredPrefix](Update-AzPeeringRegisteredPrefix.md)
138+
update a new registered prefix with the specified name under the given subscription, resource group and peering.
127139

128140
### [Update-AzPeeringService](Update-AzPeeringService.md)
129-
Updates tags for a peering service with the specified name under the given subscription and resource group.
141+
update tags for a peering service with the specified name under the given subscription and resource group.
130142

Diff for: src/Peering/Peering.Autorest/docs/Get-AzPeering.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ Accept wildcard characters: False
9292
9393
### -InputObject
9494
Identity Parameter
95-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
9695
9796
```yaml
9897
Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity
@@ -160,7 +159,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
160159
161160
## OUTPUTS
162161
163-
### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering
162+
### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeering
164163
165164
## NOTES
166165

Diff for: src/Peering/Peering.Autorest/docs/Get-AzPeeringAsn.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ Accept wildcard characters: False
7979
8080
### -InputObject
8181
Identity Parameter
82-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8382
8483
```yaml
8584
Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity
@@ -132,7 +131,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
132131
133132
## OUTPUTS
134133
135-
### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn
134+
### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeerAsn
136135
137136
## NOTES
138137

Diff for: src/Peering/Peering.Autorest/docs/Get-AzPeeringCdnPrefix.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
9797
9898
## OUTPUTS
9999
100-
### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix
100+
### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.ICdnPeeringPrefix
101101
102102
## NOTES
103103

Diff for: src/Peering/Peering.Autorest/docs/Get-AzPeeringConnectionMonitorTest.md

+23-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ Get-AzPeeringConnectionMonitorTest -InputObject <IPeeringIdentity> [-DefaultProf
3030
[<CommonParameters>]
3131
```
3232

33+
### GetViaIdentityPeeringService
34+
```
35+
Get-AzPeeringConnectionMonitorTest -Name <String> -PeeringServiceInputObject <IPeeringIdentity>
36+
[-DefaultProfile <PSObject>] [<CommonParameters>]
37+
```
38+
3339
## DESCRIPTION
3440
Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service.
3541

@@ -82,7 +88,6 @@ Accept wildcard characters: False
8288
8389
### -InputObject
8490
Identity Parameter
85-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8691
8792
```yaml
8893
Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity
@@ -101,7 +106,7 @@ The name of the connection monitor test
101106
102107
```yaml
103108
Type: System.String
104-
Parameter Sets: Get
109+
Parameter Sets: Get, GetViaIdentityPeeringService
105110
Aliases: ConnectionMonitorTestName
106111

107112
Required: True
@@ -111,6 +116,21 @@ Accept pipeline input: False
111116
Accept wildcard characters: False
112117
```
113118
119+
### -PeeringServiceInputObject
120+
Identity Parameter
121+
122+
```yaml
123+
Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity
124+
Parameter Sets: GetViaIdentityPeeringService
125+
Aliases:
126+
127+
Required: True
128+
Position: Named
129+
Default value: None
130+
Accept pipeline input: True (ByValue)
131+
Accept wildcard characters: False
132+
```
133+
114134
### -PeeringServiceName
115135
The name of the peering service.
116136
@@ -165,7 +185,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
165185
166186
## OUTPUTS
167187
168-
### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest
188+
### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IConnectionMonitorTest
169189
170190
## NOTES
171191

0 commit comments

Comments
 (0)