Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - NetworkCloud")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.2.0")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.0.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
88 changes: 14 additions & 74 deletions src/NetworkCloud/NetworkCloud.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ For information on how to develop for `Az.NetworkCloud`, see [how-to.md](how-to.

```yaml
# pin the swagger version by using the commit id instead of branch name : https://github.com/Azure/azure-rest-api-specs/
# the 2025-02-01 stable in a commit: 08973141b0d31a7e75d4dc43a5224a1814a0994f
commit: 08973141b0d31a7e75d4dc43a5224a1814a0994f
# the 2025-09-01 stable in a commit: ccd751d5bf9d1457426de7fe6d857a4cfe890cd5
commit: ccd751d5bf9d1457426de7fe6d857a4cfe890cd5
require:
# readme.azure.noprofile.md is the common configuration file
- $(this-folder)/../../readme.azure.noprofile.md
- $(repo)/specification/networkcloud/resource-manager/readme.md
input-file:
# You need to specify your swagger files here.
- $(repo)/specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-02-01/networkcloud.json
- $(repo)/specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/networkcloud.json

# For new RP, the version is 0.1.0
module-version: 0.1.0
Expand All @@ -45,32 +45,24 @@ title: NetworkCloud
service-name: NetworkCloud
subject-prefix: NetworkCloud

# If there are post APIs for some kinds of actions in the RP, you may need to
# uncomment following line to support viaIdentity for these post APIs
identity-correction-for-post: true
resourcegroup-append: true
nested-object-to-string: true
flatten-userassignedidentity: false
disable-transform-identity-type: true

directive:
# Fix model definition line break replacement issue
- from: swagger-document
where: $.definitions.L3NetworkProperties.properties.ipv4ConnectedPrefix
transform: $['description'] = 'The IPV4 prefix (CIDR) assigned to this L3 network. Required when the IP allocation type is IPV4 or DualStack.'
- from: swagger-document
where: $.definitions.L3NetworkProperties.properties.ipv6ConnectedPrefix
transform: $['description'] = 'The IPV6 prefix (CIDR) assigned to this L3 network. Required when the IP allocation type is IPV6 or DualStack.'
- from: swagger-document
where: $.definitions.BareMetalMachinePatchProperties.properties.machineDetails
transform: $['description'] = 'The details provided by the customer during the creation of rack manifests that allows for custom data to be associated with this machine.'
- from: swagger-document
where: $.definitions.ClusterProperties.properties.computeRackDefinitions
transform: $['description'] = 'The list of rack definitions for the compute racks in a multi-rack cluster, or an empty list in a single-rack cluster.'
# Following is two common directive which are normally required in all the RPs
# 1. Remove the unexpanded parameter set
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
- where:
variant: ^(Create|Update|Cordon|Deploy|Enable|Replace|Run|PowerOff)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true
- where:
variant: ^CreateViaIdentityExpanded$
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$|^Cordon$|^CordonViaIdentity$|^DeployViaIdentity$|^Deploy$|^Enable$|^EnableViaIdentity$|^Replace$|^ReplaceViaIdentity$|^Run$|^RunViaIdentity$|^PowerOff$|^PowerOffViaIdentity$
remove: true
- where:
subject: KuberneteClusterNode
variant: ^(Restart)(?!.*?(Expanded|JsonFilePath|JsonString))
variant: ^Restart$|^RestartViaIdentity$
remove: true
# Remove the set-* cmdlet
- where:
Expand Down Expand Up @@ -293,59 +285,7 @@ directive:
- from: swagger-document
where: $.definitions.ServicePrincipalInformation.properties.password
transform: $.format = "password"
# Fix required property missing mutability
- from: swagger-document
where: $.definitions.BgpAdvertisement.properties.ipAddressPools
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.ControlPlaneNodeConfiguration.properties.vmSkuName
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.InitialAgentPoolConfiguration.properties.count
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.InitialAgentPoolConfiguration.properties.mode
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.InitialAgentPoolConfiguration.properties.vmSkuName
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.InitialAgentPoolConfiguration.properties.name
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.IpAddressPool.properties.name
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.L3NetworkAttachmentConfiguration.properties.networkId
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.NetworkAttachment.properties.attachedNetworkId
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.NetworkAttachment.properties.ipAllocationMethod
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.ServiceLoadBalancerBgpPeer.properties.name
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.ServiceLoadBalancerBgpPeer.properties.peerAddress
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.ServiceLoadBalancerBgpPeer.properties.peerAsn
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.VirtualMachinePlacementHint.properties.hintType
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.VirtualMachinePlacementHint.properties.schedulingExecution
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.VirtualMachinePlacementHint.properties.resourceId
transform: $['x-ms-mutability'] = ["read", "update", "create"]
- from: swagger-document
where: $.definitions.VirtualMachinePlacementHint.properties.scope
transform: $['x-ms-mutability'] = ["read", "update", "create"]


# Add model-cmdlet for any properties/sub-properties of complex type
- model-cmdlet:
- model-name: BareMetalMachineConfigurationData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "bareMetalMachines",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "cloudServicesNetworks",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "clusterManagers",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "clusters/bareMetalMachineKeySets",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "clusters/bmcKeySets",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "clusters/metricsConfigurations",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "clusters",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "kubernetesClusters/agentPools",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "kubernetesClusters/features",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "kubernetesClusters",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "l2Networks",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "l3Networks",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "rackSkus",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "racks",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "storageAppliances",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "trunkedNetworks",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "virtualMachines/consoles",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "virtualMachines",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "volumes",
"apiVersion": "2025-02-01",
"apiVersion": "2025-09-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.networkcloud"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# region Generated
# Load the private module dll
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.NetworkCloud.private.dll')
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.NetworkCloud.private.dll')

# Load the internal module
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.NetworkCloud.internal.psm1'
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.NetworkCloud.internal.psm1'
if(Test-Path $internalModulePath) {
$null = Import-Module -Name $internalModulePath
}
Expand Down
8 changes: 4 additions & 4 deletions src/NetworkCloud/NetworkCloud.Autorest/custom/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Custom
This directory contains custom implementation for non-generated cmdlets for the `Az.NetworkCloud` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.NetworkCloud.custom.psm1`. This file should not be modified.
This directory contains custom implementation for non-generated cmdlets for the `Az.NetworkCloud` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `../exports` folder. The only generated file into this folder is the `Az.NetworkCloud.custom.psm1`. This file should not be modified.

## Info
- Modifiable: yes
Expand All @@ -15,10 +15,10 @@ For C# cmdlets, they are compiled with the rest of the generated low-level cmdle
For script cmdlets, these are loaded via the `Az.NetworkCloud.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.

## Purpose
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder.
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder.

## Usage
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `../exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
- Break
- DefaultProfile
- HttpPipelineAppend
Expand All @@ -36,6 +36,6 @@ For processing the cmdlets, we've created some additional attributes:
- `Microsoft.Azure.PowerShell.Cmdlets.NetworkCloud.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.NetworkCloud`.
- `Microsoft.Azure.PowerShell.Cmdlets.NetworkCloud.InternalExportAttribute`
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.NetworkCloud`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
- Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.NetworkCloud`. For more information, see [README.md](../internal/README.md) in the `../internal` folder.
- `Microsoft.Azure.PowerShell.Cmdlets.NetworkCloud.ProfileAttribute`
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ function New-AzNetworkCloudBareMetalMachineConfigurationDataObject {
[Parameter(HelpMessage="The free-form additional information about the machine, e.g. an asset tag.")]
[string]
$MachineDetail,
[Parameter(HelpMessage="The user-provided name for the bare metal machine created from this specification.
If not provided, the machine name will be generated programmatically.")]
[Parameter(HelpMessage="The user-provided name for the bare metal machine created from this specification. If not provided, the machine name will be generated programmatically.")]
[string]
$MachineName,
[Parameter(Mandatory, HelpMessage="The slot the physical machine is in the rack based on the BOM configuration.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function New-AzNetworkCloudBgpAdvertisementObject {
[Parameter(HelpMessage="The names of the BGP communities to be associated with the announcement, utilizing a BGP community string in 1234:1234 format.")]
[string[]]
$Community,
[Parameter(Mandatory, HelpMessage="The names of the IP address pools associated with this announcement.")]
[Parameter(HelpMessage="The names of the IP address pools associated with this announcement.")]
[string[]]
$IPAddressPool,
[Parameter(HelpMessage="The names of the BGP peers to limit this advertisement to. If no values are specified, all BGP peers will receive this advertisement.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function New-AzNetworkCloudControlPlaneNodeConfigurationObject {
[Parameter(Mandatory, HelpMessage="The number of virtual machines that use this configuration.")]
[long]
$Count,
[Parameter(Mandatory, HelpMessage="The name of the VM SKU supplied during creation.")]
[Parameter(HelpMessage="The name of the VM SKU supplied during creation.")]
[string]
$VMSkuName
)
Expand Down
Loading