Skip to content

[PS] migrate MobileNetwork module to autorest v4 #27813

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

Merged
merged 3 commits into from
May 22, 2025
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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 - MobileNetwork")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.4.2")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.4.2")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]

53 changes: 28 additions & 25 deletions src/MobileNetwork/MobileNetwork.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ module-version: 0.1.0
title: MobileNetwork
subject-prefix: $(service-name)

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

# 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:
# Change interopSettings type from <IAny> to <HashTable>
- from: swagger-document
Expand Down Expand Up @@ -92,7 +84,7 @@ directive:
transform: return $.replace(/\`any\`/g, "'any'")

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

- where:
Expand Down Expand Up @@ -148,17 +140,22 @@ directive:
parameter-name: DefaultSlouseId
set:
parameter-name: DefaultSliceId

# Due to business requirements, the logic of some commands is customized and they need to be hidden

# Due to business requirements, the update of some customized commands is using Get and PUT operation and they need to be replaced
- remove-operation: AttachedDataNetworks_UpdateTags
- remove-operation: DataNetworks_UpdateTags
- remove-operation: PacketCoreControlPlanes_UpdateTags
- remove-operation: PacketCoreDataPlanes_UpdateTags
- remove-operation: Services_UpdateTags
- remove-operation: SimGroups_UpdateTags
- remove-operation: SimPolicies_UpdateTags
- remove-operation: Slices_UpdateTags
# parameter set ServicePrecedence, SnssaiSst to be required
- where:
verb: Update
subject: ^AttachedDataNetwork$|^DataNetwork$|^PacketCoreControlPlane$|^PacketCoreDataPlane$|^Service$|^SimGroup$|^SimPolicy$|^Slice$
variant: ^UpdateViaIdentityExpanded$
remove: true
- where:
verb: Update
subject: ^AttachedDataNetwork$|^DataNetwork$|^PacketCoreControlPlane$|^PacketCoreDataPlane$|^Service$|^SimGroup$|^SimPolicy$|^Slice$
subject: ^Service$|^Slice$
hide: true

- where:
verb: New
subject: ^Site$
Expand Down Expand Up @@ -201,18 +198,24 @@ directive:
subject: ^RollbackPacketCoreControlPlane$
set:
verb: Deploy
# - where:
# subject:
# parameter-name: PacketCoreDataPlaneName PacketCoreControlPlaneName ServiceName
# set:
# parameter-name: Name
# alias: PacketCoreDataPlaneName

# Some of the parameters are of type Object and need to be expanded into a command for the convenience of the user
# The following are commented out and their generated cmdlets may be renamed and custom logic
# Do not delete this code
# - model-cmdlet:
# - SliceConfiguration # SlouseId -> SliceId
# - DataNetworkConfiguration
# - ServiceResourceId
# - SiteResourceId
# - SimStaticIPProperties # SlouseId -> SliceId
# - PccRuleConfiguration
# - ServiceDataFlowTemplate
- model-cmdlet:
# - model-name: SliceConfiguration # SlouseId -> SliceId
- model-name: DataNetworkConfiguration
- model-name: ServiceResourceId
- model-name: SiteResourceId
# - model-name: SimStaticIPProperties # SlouseId -> SliceId
- model-name: PccRuleConfiguration
- model-name: ServiceDataFlowTemplate

- where:
model-name: MobileNetwork
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ Create an in-memory object for SimStaticIPProperties.
Create an in-memory object for SimStaticIPProperties.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SimStaticIPProperties
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SimStaticIPProperties
.Link
https://learn.microsoft.com/powershell/module/az.MobileNetwork/new-AzMobileNetworkSimStaticIPPropertiesObject
#>
function New-AzMobileNetworkSimStaticIPPropertiesObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SimStaticIPProperties')]
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.ModelCmdletAttribute()]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SimStaticIPProperties')]
[CmdletBinding(PositionalBinding=$false)]
Param(

Expand All @@ -42,7 +43,7 @@ function New-AzMobileNetworkSimStaticIPPropertiesObject {
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SimStaticIPProperties]::New()
$Object = [Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SimStaticIPProperties]::New()

if ($PSBoundParameters.ContainsKey('AttachedDataNetworkId')) {
$Object.AttachedDataNetworkId = $AttachedDataNetworkId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ Must be created in the same location as its parent mobile network.
New-AzMobileNetworkSite -MobileNetworkName azps-mn -Name azps-mn-site -ResourceGroupName azps_test_group -Location eastus -Tag @{"site"="123"}

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.ISite
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.ISite
.Link
https://learn.microsoft.com/powershell/module/az.mobilenetwork/new-azmobilenetworksite
#>
function New-AzMobileNetworkSite {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.ISite])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.ISite])]
[CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(Mandatory)]
Expand Down Expand Up @@ -68,16 +68,16 @@ function New-AzMobileNetworkSite {

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api30.ITrackedResourceTags]))]
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.ITrackedResourceTags]))]
[System.Collections.Hashtable]
# Resource tags.
${Tag},

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

Expand Down Expand Up @@ -119,23 +119,23 @@ function New-AzMobileNetworkSite {
${AzureStackEdgeDeviceId},

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

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

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

Expand Down Expand Up @@ -175,9 +175,9 @@ function New-AzMobileNetworkSite {
${DnsAddress},

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ Create an in-memory object for SliceConfiguration.
Create an in-memory object for SliceConfiguration.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SliceConfiguration
Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SliceConfiguration
.Link
https://learn.microsoft.com/powershell/module/az.MobileNetwork/new-AzMobileNetworkSliceConfigurationObject
#>
function New-AzMobileNetworkSliceConfigurationObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SliceConfiguration')]
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.ModelCmdletAttribute()]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SliceConfiguration')]
[CmdletBinding(PositionalBinding=$false)]
Param(

[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.")]
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.IDataNetworkConfiguration[]]
[Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.IDataNetworkConfiguration[]]
$DataNetworkConfiguration,
[Parameter(Mandatory, HelpMessage="Data network resource ID.")]
[string]
Expand All @@ -42,7 +43,7 @@ function New-AzMobileNetworkSliceConfigurationObject {
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.Api20221101.SliceConfiguration]::New()
$Object = [Microsoft.Azure.PowerShell.Cmdlets.MobileNetwork.Models.SliceConfiguration]::New()

if ($PSBoundParameters.ContainsKey('DataNetworkConfiguration')) {
$Object.DataNetworkConfiguration = $DataNetworkConfiguration
Expand Down
Loading