Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions src/ServiceBus/ServiceBus.Autorest/Properties/AssemblyInfo.cs
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 - ServiceBus")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("4.1.1")]
[assembly: System.Reflection.AssemblyVersionAttribute("4.1.1")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.0.0")]
Comment thread
schaudhari6254888 marked this conversation as resolved.
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
29 changes: 15 additions & 14 deletions src/ServiceBus/ServiceBus.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,12 @@ For information on how to develop for `Az.ServiceBus`, see [how-to.md](how-to.md
> see https://aka.ms/autorest

``` yaml
# Please specify the commit id that includes your features to make sure generated codes stable.
commit: 1e790cfc5ee4e7ff98f99dd19a3174c4dd58432b
require:
# readme.azure.noprofile.md is the common configuration file
- $(this-folder)/../../readme.azure.noprofile.md
input-file:
# You need to specify your swagger files here.
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/Queue.json
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/topics.json
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/namespace-preview.json
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/AuthorizationRules.json
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/CheckNameAvailability.json
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/DisasterRecoveryConfig.json
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/migrationconfigs.json
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/networksets.json
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/operations.json
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/Rules.json
- $(repo)/specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/subscriptions.json
- https://github.com/Azure/azure-rest-api-specs/blob/main/specification/servicebus/resource-manager/Microsoft.ServiceBus/ServiceBus/stable/2026-01-01/servicebus.json
# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally
Comment thread
schaudhari6254888 marked this conversation as resolved.
Comment thread
schaudhari6254888 marked this conversation as resolved.
Comment on lines 33 to 36
# - (this-folder)/relative-path-to-your-swagger

Expand Down Expand Up @@ -72,11 +60,19 @@ directive:
hide: true
- where:
verb: Set
remove: true
hide: true
- where:
verb: Update
remove: true

# Rename the swagger schema 'FailOverProperties' (POST failover action body) to avoid
# a case-only collision with 'FailoverProperties' (inner properties of NamespaceFailoverProperties),
# which the PowerShell generator collapses into a single type and causes CS0234 in
# generated/api/Models/NamespaceFailoverProperties.cs.
- rename-model:
from: FailOverProperties
to: ServiceBusFailOverProperties

# Migration Configs
- where:
verb: New
Expand Down Expand Up @@ -525,4 +521,9 @@ directive:
- model-cmdlet:
- model-name: KeyVaultProperties
cmdlet-name: New-AzServiceBusKeyVaultPropertiesObject

- model-cmdlet:
- model-name: NamespaceReplicaLocation
cmdlet-name: New-AzServiceBusLocationsNameObject

```
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "namespaces/disasterRecoveryConfigs",
"apiVersion": "2022-10-01-preview",
"apiVersion": "2026-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "namespaces/migrationConfigurations",
"apiVersion": "2022-10-01-preview",
"apiVersion": "2026-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"resourceType": "namespaces/networkSecurityPerimeterConfigurations",
"apiVersion": "2026-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus"
},
"commands": [
{
"name": "Get-AzServiceBusNetworkSecurityPerimeterConfigurationResourceAssociationName",
"description": "Return a NetworkSecurityPerimeterConfigurations resourceAssociationName",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkSecurityPerimeterConfigurations/{resourceAssociationName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus/get-azservicebusnetworksecurityperimeterconfigurationresourceassociationname"
},
"parameterSets": [
{
"parameters": [
"-NamespaceName <String>",
"-ResourceAssociationName <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String[]>]"
]
}
]
},
"examples": [
{
"description": "Return a NetworkSecurityPerimeterConfigurations resourceAssociationName",
"parameters": [
{
"name": "-NamespaceName",
"value": "[Path.namespaceName]"
},
{
"name": "-ResourceAssociationName",
"value": "[Path.resourceAssociationName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
},
{
"name": "Invoke-AzServiceBusReconcileNetworkSecurityPerimeterConfiguration",
"description": "Refreshes any information about the association.",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkSecurityPerimeterConfigurations/{resourceAssociationName}/reconcile",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus/invoke-azservicebusreconcilenetworksecurityperimeterconfiguration"
},
"parameterSets": [
{
"parameters": [
"-NamespaceName <String>",
"-ResourceAssociationName <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String>]"
]
}
]
},
"examples": [
{
"description": "Refreshes any information about the association.",
"parameters": [
{
"name": "-NamespaceName",
"value": "[Path.namespaceName]"
},
{
"name": "-ResourceAssociationName",
"value": "[Path.resourceAssociationName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "namespaces/privateEndpointConnections",
"apiVersion": "2022-10-01-preview",
"apiVersion": "2026-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "namespaces/queues",
"apiVersion": "2022-10-01-preview",
"apiVersion": "2026-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "namespaces/topics/subscriptions/rules",
"apiVersion": "2022-10-01-preview",
"apiVersion": "2026-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "namespaces/topics/subscriptions",
"apiVersion": "2022-10-01-preview",
"apiVersion": "2026-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "namespaces/topics",
"apiVersion": "2022-10-01-preview",
"apiVersion": "2026-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "namespaces",
"apiVersion": "2022-10-01-preview",
"apiVersion": "2026-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.servicebus"
},
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.ServiceBus.private.dll')
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.ServiceBus.private.dll')

# Load the internal module
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.ServiceBus.internal.psm1'
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.ServiceBus.internal.psm1'
if(Test-Path $internalModulePath) {
$null = Import-Module -Name $internalModulePath
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,21 @@ function New-AzServiceBusNamespace{
[Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
${ProxyUseDefaultCredentials},

[Parameter(HelpMessage = "The maximum acceptable lag for data replication operations from the primary replica to a quorum of secondary replicas. When the lag exceeds the configured amount, operations on the primary replica will be failed. The allowed values are 0 and 5 minutes to 1 day.")]
[Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.Category('Body')]
[System.Int64]
${GeoDataReplicationMaxReplicationLagDurationInSecond},

[Parameter(HelpMessage = "Properties for User Assigned Identities")]
[Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.Models.INamespaceReplicaLocation[]]
${GeoDataReplicationLocation},
Comment thread
schaudhari6254888 marked this conversation as resolved.
Outdated
Comment thread
schaudhari6254888 marked this conversation as resolved.
Outdated
Comment on lines +177 to +179

[Parameter(HelpMessage = "The IP address type for the namespace. Determines whether the namespace supports IPv4 only or both IPv4 and IPv6.")]
[Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.Category('Body')]
[System.String]
${IPAddressType}
)
process{
try{
Expand Down
8 changes: 4 additions & 4 deletions src/ServiceBus/ServiceBus.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.ServiceBus` 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.ServiceBus.custom.psm1`. This file should not be modified.
This directory contains custom implementation for non-generated cmdlets for the `Az.ServiceBus` 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.ServiceBus.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.ServiceBus.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.ServiceBus.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.ServiceBus`.
- `Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.InternalExportAttribute`
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.ServiceBus`. 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.ServiceBus`. For more information, see [README.md](../internal/README.md) in the `../internal` folder.
- `Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.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 @@ -159,7 +159,22 @@ function Set-AzServiceBusNamespace{
[Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
${ProxyUseDefaultCredentials},

[Parameter(HelpMessage = "The maximum acceptable lag for data replication operations from the primary replica to a quorum of secondary replicas. When the lag exceeds the configured amount, operations on the primary replica will be failed. The allowed values are 0 and 5 minutes to 1 day.")]
[Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.Category('Body')]
[System.Int64]
${GeoDataReplicationMaxReplicationLagDurationInSecond},

[Parameter(HelpMessage = "Properties for User Assigned Identities")]
[Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.Models.INamespaceReplicaLocation[]]
${GeoDataReplicationLocation},
Comment thread
schaudhari6254888 marked this conversation as resolved.
Comment thread
schaudhari6254888 marked this conversation as resolved.
Comment thread
schaudhari6254888 marked this conversation as resolved.

[Parameter(HelpMessage = "The IP address type for the namespace. Determines whether the namespace supports IPv4 only or both IPv4 and IPv6.")]
[Microsoft.Azure.PowerShell.Cmdlets.ServiceBus.Category('Body')]
[System.String]
${IPAddressType}
)
process{
try{
Expand All @@ -173,6 +188,9 @@ function Set-AzServiceBusNamespace{
$hasPublicNetworkAccess = $PSBoundParameters.Remove('PublicNetworkAccess')
$hasSkuCapacity = $PSBoundParameters.Remove('SkuCapacity')
$hasTag = $PSBoundParameters.Remove('Tag')
$hasGeoDataReplicationMaxReplicationLagDurationInSecond = $PSBoundParameters.Remove('GeoDataReplicationMaxReplicationLagDurationInSecond')
$hasGeoDataReplicationLocation = $PSBoundParameters.Remove('GeoDataReplicationLocation')
$hasIPAddressType = $PSBoundParameters.Remove('IPAddressType')
$hasDefaultProfile = $PSBoundParameters.Remove('DefaultProfile')
$hasAsJob = $PSBoundParameters.Remove('AsJob')
$hasNoWait = $PSBoundParameters.Remove('NoWait')
Expand Down Expand Up @@ -224,6 +242,15 @@ function Set-AzServiceBusNamespace{
if ($hasTag) {
$serviceBusNamespace.Tag = $Tag
}
if ($hasGeoDataReplicationMaxReplicationLagDurationInSecond) {
$serviceBusNamespace.GeoDataReplicationMaxReplicationLagDurationInSecond = $GeoDataReplicationMaxReplicationLagDurationInSecond
}
if ($hasGeoDataReplicationLocation) {
$serviceBusNamespace.GeoDataReplicationLocation = $GeoDataReplicationLocation
}
if($hasIPAddressType){
$serviceBusNamespace.IPAddressType = $IPAddressType
}
if ($hasAsJob) {
$PSBoundParameters.Add('AsJob', $true)
}
Expand Down
Loading