Skip to content

Commit a9bb83e

Browse files
authored
[PS] migrate MobileNetwork module to autorest v4 (#27813)
1 parent 0689863 commit a9bb83e

File tree

143 files changed

+6741
-2964
lines changed

Some content is hidden

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

143 files changed

+6741
-2964
lines changed
Lines changed: 27 additions & 0 deletions
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 - MobileNetwork")]
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+

src/MobileNetwork/MobileNetwork.Autorest/README.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,6 @@ module-version: 0.1.0
5050
title: MobileNetwork
5151
subject-prefix: $(service-name)
5252

53-
resourcegroup-append: true
54-
identity-correction-for-post: true
55-
nested-object-to-string: true
56-
57-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
58-
use-extension:
59-
"@autorest/powershell": "3.x"
60-
6153
directive:
6254
# Change interopSettings type from <IAny> to <HashTable>
6355
- from: swagger-document
@@ -92,7 +84,7 @@ directive:
9284
transform: return $.replace(/\`any\`/g, "'any'")
9385

9486
- where:
95-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$|^BulkViaIdentity$|^Bulk$|^Collect$|^CollectViaIdentity$
87+
variant: ^(Create|Update|Bulk|Collect)(?!.*?(Expanded|JsonFilePath|JsonString))
9688
remove: true
9789

9890
- where:
@@ -148,17 +140,22 @@ directive:
148140
parameter-name: DefaultSlouseId
149141
set:
150142
parameter-name: DefaultSliceId
151-
152-
# Due to business requirements, the logic of some commands is customized and they need to be hidden
143+
144+
# Due to business requirements, the update of some customized commands is using Get and PUT operation and they need to be replaced
145+
- remove-operation: AttachedDataNetworks_UpdateTags
146+
- remove-operation: DataNetworks_UpdateTags
147+
- remove-operation: PacketCoreControlPlanes_UpdateTags
148+
- remove-operation: PacketCoreDataPlanes_UpdateTags
149+
- remove-operation: Services_UpdateTags
150+
- remove-operation: SimGroups_UpdateTags
151+
- remove-operation: SimPolicies_UpdateTags
152+
- remove-operation: Slices_UpdateTags
153+
# parameter set ServicePrecedence, SnssaiSst to be required
153154
- where:
154155
verb: Update
155-
subject: ^AttachedDataNetwork$|^DataNetwork$|^PacketCoreControlPlane$|^PacketCoreDataPlane$|^Service$|^SimGroup$|^SimPolicy$|^Slice$
156-
variant: ^UpdateViaIdentityExpanded$
157-
remove: true
158-
- where:
159-
verb: Update
160-
subject: ^AttachedDataNetwork$|^DataNetwork$|^PacketCoreControlPlane$|^PacketCoreDataPlane$|^Service$|^SimGroup$|^SimPolicy$|^Slice$
156+
subject: ^Service$|^Slice$
161157
hide: true
158+
162159
- where:
163160
verb: New
164161
subject: ^Site$
@@ -201,18 +198,24 @@ directive:
201198
subject: ^RollbackPacketCoreControlPlane$
202199
set:
203200
verb: Deploy
201+
# - where:
202+
# subject:
203+
# parameter-name: PacketCoreDataPlaneName PacketCoreControlPlaneName ServiceName
204+
# set:
205+
# parameter-name: Name
206+
# alias: PacketCoreDataPlaneName
204207

205208
# Some of the parameters are of type Object and need to be expanded into a command for the convenience of the user
206209
# The following are commented out and their generated cmdlets may be renamed and custom logic
207210
# Do not delete this code
208-
# - model-cmdlet:
209-
# - SliceConfiguration # SlouseId -> SliceId
210-
# - DataNetworkConfiguration
211-
# - ServiceResourceId
212-
# - SiteResourceId
213-
# - SimStaticIPProperties # SlouseId -> SliceId
214-
# - PccRuleConfiguration
215-
# - ServiceDataFlowTemplate
211+
- model-cmdlet:
212+
# - model-name: SliceConfiguration # SlouseId -> SliceId
213+
- model-name: DataNetworkConfiguration
214+
- model-name: ServiceResourceId
215+
- model-name: SiteResourceId
216+
# - model-name: SimStaticIPProperties # SlouseId -> SliceId
217+
- model-name: PccRuleConfiguration
218+
- model-name: ServiceDataFlowTemplate
216219

217220
- where:
218221
model-name: MobileNetwork

src/MobileNetwork/MobileNetwork.Autorest/custom/New-AzMobileNetworkSimStaticIPPropertiesObject.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ Create an in-memory object for SimStaticIPProperties.
2121
Create an in-memory object for SimStaticIPProperties.
2222
2323
.Outputs
24-
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SimStaticIPProperties
24+
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SimStaticIPProperties
2525
.Link
2626
https://learn.microsoft.com/powershell/module/az.MobileNetwork/new-AzMobileNetworkSimStaticIPPropertiesObject
2727
#>
2828
function New-AzMobileNetworkSimStaticIPPropertiesObject {
29-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SimStaticIPProperties')]
29+
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.ModelCmdletAttribute()]
30+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SimStaticIPProperties')]
3031
[CmdletBinding(PositionalBinding=$false)]
3132
Param(
3233

@@ -42,7 +43,7 @@ function New-AzMobileNetworkSimStaticIPPropertiesObject {
4243
)
4344

4445
process {
45-
$Object = [Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SimStaticIPProperties]::New()
46+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SimStaticIPProperties]::New()
4647

4748
if ($PSBoundParameters.ContainsKey('AttachedDataNetworkId')) {
4849
$Object.AttachedDataNetworkId = $AttachedDataNetworkId

src/MobileNetwork/MobileNetwork.Autorest/custom/New-AzMobileNetworkSite.ps1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ Must be created in the same location as its parent mobile network.
2525
New-AzMobileNetworkSite -MobileNetworkName azps-mn -Name azps-mn-site -ResourceGroupName azps_test_group -Location eastus -Tag @{"site"="123"}
2626
2727
.Outputs
28-
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.ISite
28+
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.ISite
2929
.Link
3030
https://learn.microsoft.com/powershell/module/az.mobilenetwork/new-azmobilenetworksite
3131
#>
3232
function New-AzMobileNetworkSite {
33-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.ISite])]
33+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.ISite])]
3434
[CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
3535
param(
3636
[Parameter(Mandatory)]
@@ -68,16 +68,16 @@ function New-AzMobileNetworkSite {
6868

6969
[Parameter()]
7070
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Category('Body')]
71-
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api30.ITrackedResourceTags]))]
71+
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.ITrackedResourceTags]))]
7272
[System.Collections.Hashtable]
7373
# Resource tags.
7474
${Tag},
7575

7676
# New-AzMobileNetworkPacketCoreControlPlane
7777
[Parameter()]
78-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Support.PlatformType])]
78+
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.PSArgumentCompleterAttribute("AKS-HCI", "3P-AZURE-STACK-HCI")]
7979
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Category('Body')]
80-
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Support.PlatformType]
80+
[System.String]
8181
# The platform type where packet core is deployed.
8282
${PlatformType},
8383

@@ -119,23 +119,23 @@ function New-AzMobileNetworkSite {
119119
${AzureStackEdgeDeviceId},
120120

121121
[Parameter()]
122-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Support.AuthenticationType])]
122+
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.PSArgumentCompleterAttribute("AAD", "Password")]
123123
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Category('Body')]
124-
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Support.AuthenticationType]
124+
[System.String]
125125
# How to authenticate users who access local diagnostics APIs.
126126
${LocalDiagnosticAccessAuthenticationType},
127127

128128
[Parameter()]
129-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Support.CoreNetworkType])]
129+
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.PSArgumentCompleterAttribute("5GC", "EPC")]
130130
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Category('Body')]
131-
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Support.CoreNetworkType]
131+
[System.String]
132132
# The core network technology generation (5G core or EPC / 4G core).
133133
${CoreNetworkTechnology},
134134

135135
[Parameter()]
136-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Support.BillingSku])]
136+
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.PSArgumentCompleterAttribute("G0", "G1", "G2", "G5", "G10")]
137137
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Category('Body')]
138-
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Support.BillingSku]
138+
[System.String]
139139
# The SKU defining the throughput and SIM allowances for this packet core control plane deployment.
140140
${Sku},
141141

@@ -175,9 +175,9 @@ function New-AzMobileNetworkSite {
175175
${DnsAddress},
176176

177177
[Parameter()]
178-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Support.NaptEnabled])]
178+
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.PSArgumentCompleterAttribute("Enabled", "Disabled")]
179179
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Category('Body')]
180-
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Support.NaptEnabled]
180+
[System.String]
181181
# Whether NAPT is enabled for connections to this attached data network.
182182
${NaptConfigurationEnabled},
183183

src/MobileNetwork/MobileNetwork.Autorest/custom/New-AzMobileNetworkSliceConfigurationObject.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,18 @@ Create an in-memory object for SliceConfiguration.
2121
Create an in-memory object for SliceConfiguration.
2222
2323
.Outputs
24-
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SliceConfiguration
24+
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SliceConfiguration
2525
.Link
2626
https://learn.microsoft.com/powershell/module/az.MobileNetwork/new-AzMobileNetworkSliceConfigurationObject
2727
#>
2828
function New-AzMobileNetworkSliceConfigurationObject {
29-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SliceConfiguration')]
29+
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.ModelCmdletAttribute()]
30+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SliceConfiguration')]
3031
[CmdletBinding(PositionalBinding=$false)]
3132
Param(
3233

3334
[Parameter(Mandatory, HelpMessage="The allowed data networks and the settings to use for them. The list must not contain duplicate items and must contain at least one item.")]
34-
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.IDataNetworkConfiguration[]]
35+
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.IDataNetworkConfiguration[]]
3536
$DataNetworkConfiguration,
3637
[Parameter(Mandatory, HelpMessage="Data network resource ID.")]
3738
[string]
@@ -42,7 +43,7 @@ function New-AzMobileNetworkSliceConfigurationObject {
4243
)
4344

4445
process {
45-
$Object = [Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SliceConfiguration]::New()
46+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SliceConfiguration]::New()
4647

4748
if ($PSBoundParameters.ContainsKey('DataNetworkConfiguration')) {
4849
$Object.DataNetworkConfiguration = $DataNetworkConfiguration

0 commit comments

Comments
 (0)