Skip to content

Commit b6ba152

Browse files
Migrate SignalR from generation to main (Azure#20230)
* Move SignalR to main * Update ChangeLog.md * Update SignatureIssues.csv * Update SignatureIssues.csv Co-authored-by: Beisi Zhou <[email protected]>
1 parent a6ab979 commit b6ba152

File tree

551 files changed

+34183
-11157
lines changed

Some content is hidden

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

551 files changed

+34183
-11157
lines changed

src/SignalR/SignalR.Autorest/Az.SignalR.format.ps1xml

Lines changed: 360 additions & 100 deletions
Large diffs are not rendered by default.

src/SignalR/SignalR.Autorest/Az.SignalR.psm1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525
}
2626
}
2727
if(-not $accountsModule) {
28-
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.2.3' } | Measure-Object).Count -gt 0
28+
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0
2929
if($hasAdequateVersion) {
30-
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.2.3 -Scope Global -PassThru
30+
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru
3131
}
3232
}
3333
}
3434

3535
if(-not $accountsModule) {
36-
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. For installation instructions, please see: https://docs.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
37-
} elseif (($accountsModule.Version -lt [System.Version]'2.2.3') -and (-not $localAccounts)) {
38-
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
36+
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://docs.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
37+
} elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) {
38+
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
3939
}
4040
Write-Information "Loaded Module '$($accountsModule.Name)'"
4141

@@ -50,6 +50,10 @@
5050

5151
# Tweaks the pipeline on module load
5252
$instance.OnModuleLoad = $VTable.OnModuleLoad
53+
54+
# Following two delegates are added for telemetry
55+
$instance.GetTelemetryId = $VTable.GetTelemetryId
56+
$instance.Telemetry = $VTable.Telemetry
5357

5458

5559
# Tweaks the pipeline per call
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Reflection;
17+
using System.Runtime.InteropServices;
18+
19+
[assembly: AssemblyTitle("Microsoft Azure Powershell - SignalR")]
20+
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
21+
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
22+
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
23+
24+
[assembly: ComVisible(false)]
25+
[assembly: CLSCompliant(false)]
26+
[assembly: Guid("d62fc115-2d5e-4d8c-8093-a52013cd999e")]
27+
[assembly: AssemblyVersion("0.1.0")]
28+
[assembly: AssemblyFileVersion("0.1.0")]

src/SignalR/SignalR.Autorest/README.md

Lines changed: 68 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This directory contains the PowerShell module for the WebPubSub service.
1717
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.
1818

1919
## Module Requirements
20-
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.2.3 or greater
20+
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater
2121

2222
## Authentication
2323
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
@@ -36,7 +36,7 @@ require:
3636
sanitize-names: true
3737
input-file:
3838
# You need to specify your swagger files here.
39-
- $(repo)/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/webpubsub.json
39+
- $(repo)/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/webpubsub.json
4040
# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally
4141
# - (this-folder)/relative-path-to-your-swagger
4242

@@ -49,7 +49,8 @@ psm1-custom: custom/Az.SignalR.custom.psm1
4949
# Normally, title is the service name
5050
title: WebPubSub
5151
subject-prefix: ''
52-
branch: ab0c850713dcb87f906e8f38f73d43099668a60f
52+
# When updating the commit hash, please update all occurrences in the file
53+
branch: 492cf91751be945ceae53cfdd53b1ff2fb878703
5354

5455
# If there are post APIs for some kinds of actions in the RP, you may need to
5556
# uncomment following line to support viaIdentity for these post APIs
@@ -97,6 +98,11 @@ directive:
9798
variant: ^Check$|^CheckViaIdentity$|^CheckViaIdentityExpanded$
9899
subject: WebPubSubNameAvailability
99100
remove: true
101+
# Get the custom domain after 'new' complete
102+
- where:
103+
verb: New
104+
subject: WebPubSubCustomDomain
105+
hide: true
100106
# Hide parameters
101107
- where:
102108
verb: Update
@@ -129,7 +135,7 @@ directive:
129135
"default": {
130136
"description": "Error response describing why the operation failed.",
131137
"schema": {
132-
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/ab0c850713dcb87f906e8f38f73d43099668a60f/specification/common-types/resource-management/v2/types.json#/definitions/ErrorResponse"
138+
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/492cf91751be945ceae53cfdd53b1ff2fb878703/specification/common-types/resource-management/v2/types.json#/definitions/ErrorResponse"
133139
}
134140
}
135141
}
@@ -149,7 +155,27 @@ directive:
149155
"default": {
150156
"description": "Error response describing why the operation failed.",
151157
"schema": {
152-
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/ab0c850713dcb87f906e8f38f73d43099668a60f/specification/common-types/resource-management/v2/types.json#/definitions/ErrorResponse"
158+
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/492cf91751be945ceae53cfdd53b1ff2fb878703/specification/common-types/resource-management/v2/types.json#/definitions/ErrorResponse"
159+
}
160+
}
161+
}
162+
- from: swagger-document
163+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customDomains/{name}"].put.responses
164+
transform: >-
165+
return {
166+
"201": {
167+
"description": "Created. The response describes the custom domain and contains a Location header to query the operation result.",
168+
"schema": {
169+
"$ref": "#/definitions/CustomDomain"
170+
}
171+
},
172+
"200": {
173+
"description": "The async operation to restart is finished.",
174+
},
175+
"default": {
176+
"description": "Error response describing why the operation failed.",
177+
"schema": {
178+
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/492cf91751be945ceae53cfdd53b1ff2fb878703/specification/common-types/resource-management/v2/types.json#/definitions/ErrorResponse"
153179
}
154180
}
155181
}
@@ -162,10 +188,6 @@ directive:
162188
where: $.definitions.EventHandler.properties.systemEvents.description
163189
transform: >-
164190
return "Gets ot sets the list of system events. Valid values contain: 'connect', 'connected', 'disconnected'."
165-
- from: swagger-document
166-
where: $.definitions.RegenerateKeyParameters.properties.keyType.description
167-
transform: >-
168-
return "Must be either 'primary', 'secondary' or 'salt'(case-insensitive)."
169191
# format output
170192
- where:
171193
model-name: WebPubSubResource
@@ -212,6 +234,24 @@ directive:
212234
- CapacityMinimum
213235
- CapacityMaximum
214236
- CapacityScaleType
237+
- where:
238+
model-name: CustomCertificate
239+
set:
240+
format-table:
241+
properties:
242+
- Name
243+
- KeyVaultBaseUri
244+
- KeyVaultSecretName
245+
- KeyVaultSecretVersion
246+
- ProvisioningState
247+
- where:
248+
model-name: CustomDomain
249+
set:
250+
format-table:
251+
properties:
252+
- Name
253+
- DomainName
254+
- ProvisioningState
215255
# rename parameters
216256
- where:
217257
parameter-name: IdentityUserAssignedIdentity
@@ -269,20 +309,34 @@ directive:
269309
set:
270310
property-name: ResourceLogCategory
271311
# remove the subject before the 'Name' when multiple *Name parameter exist
272-
- where:
273-
subject: WebPubSubEventHandler
274-
parameter-name: EventHandlerName
275-
set:
276-
parameter-name: Name
277312
- where:
278313
subject: WebPubSubHub
279314
parameter-name: HubName
280315
set:
281316
parameter-name: Name
317+
alias: HubName
282318
- where:
283319
subject: WebPubSub
284320
parameter-name: ResourceName
285321
set:
286322
parameter-name: Name
287323
alias: ResourceName
324+
- where:
325+
subject: WebPubSubCustomCertificate
326+
parameter-name: CertificateName
327+
set:
328+
parameter-name: Name
329+
alias: CertificateName
330+
# Disable Inline on the Baseclass(Model).
331+
- no-inline:
332+
- EventListenerEndpoint
333+
- EventListenerFilter
288334
```
335+
336+
## Azure Web PubSub custom development guidance
337+
338+
This chapter contains development guidance specific to Azure Web PubSub service.
339+
340+
### Generate error handling customization code
341+
342+
The default error handling logic only prints the message field of the `ErrorResponse`. However, it's usually not enough for our services where we have to combine the `target` and `message` fields to figure out how to fix the error. Therefore, we should run the script "resources\GenerateCustomErrorHandling.ps1" to generate error handling customization code for each cmdlets. If you have written other csharp customization logic, take care because the script overrides the current files.

src/SignalR/SignalR.Autorest/check-dependencies.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if(-not $Isolated) {
2525
function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) {
2626
if($predicate) {
2727
$module = Get-Module -ListAvailable -Name $moduleName
28-
if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0)) {
28+
if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0) -or ($requiredVersion -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -eq [System.Version]$requiredVersion } | Measure-Object).Count -eq 0)) {
2929
$null = New-Item -ItemType Directory -Force -Path $path
3030
Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..."
3131
if ($requiredVersion) {
@@ -47,7 +47,7 @@ if(Test-Path -Path $localModulesPath) {
4747
$env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
4848
}
4949

50-
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.2.3'
50+
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.7.5'
5151
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1'
5252

5353
$tools = Join-Path $PSScriptRoot 'tools'

src/SignalR/SignalR.Autorest/create-model-cmdlets.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function CreateModelCmdlet {
2323
}
2424

2525
$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models'
26-
$ModuleName = 'Az.SignalR'.Split(".")[1]
26+
$ModuleName = ''
2727
$OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets'
2828
$null = New-Item -ItemType Directory -Force -Path $OutputDir
2929

@@ -115,7 +115,9 @@ function CreateModelCmdlet {
115115
# check whether completer is needed
116116
$completer = '';
117117
if($Type.Split('.').Split('.')[-2] -eq 'Support') {
118-
$completer += "`n [ArgumentCompleter([${Type}])]"
118+
# If Type is an array, need to strip []
119+
$strippedType = $Type.Replace('[]', '')
120+
$completer += "`n [ArgumentCompleter([${strippedType}])]"
119121
}
120122
$ParameterDefineScript = "
121123
[Parameter($ParameterDefineProperty)]${completer}
@@ -156,7 +158,7 @@ Create an in-memory object for ${ObjectType}.
156158
.Outputs
157159
${ObjectTypeWithNamespace}
158160
.Link
159-
https://docs.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
161+
https://learn.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
160162
#>
161163
function New-Az${ModulePrefix}${ObjectType}Object {
162164
[OutputType('${ObjectTypeWithNamespace}')]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using System.Net.Http;
5+
using System.Threading.Tasks;
6+
using Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Models.Api20;
7+
8+
namespace Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Cmdlets
9+
{
10+
public partial class GetAzOperation_List
11+
{
12+
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
13+
{
14+
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
15+
}
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using System.Net.Http;
5+
using System.Threading.Tasks;
6+
using Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Models.Api20;
7+
8+
namespace Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Cmdlets
9+
{
10+
public partial class GetAzWebPubSubCustomCertificate_Get
11+
{
12+
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
13+
{
14+
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
15+
}
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using System.Net.Http;
5+
using System.Threading.Tasks;
6+
using Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Models.Api20;
7+
8+
namespace Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Cmdlets
9+
{
10+
public partial class GetAzWebPubSubCustomCertificate_GetViaIdentity
11+
{
12+
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
13+
{
14+
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
15+
}
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using System.Net.Http;
5+
using System.Threading.Tasks;
6+
using Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Models.Api20;
7+
8+
namespace Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Cmdlets
9+
{
10+
public partial class GetAzWebPubSubCustomCertificate_List
11+
{
12+
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
13+
{
14+
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
15+
}
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using System.Net.Http;
5+
using System.Threading.Tasks;
6+
using Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Models.Api20;
7+
8+
namespace Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Cmdlets
9+
{
10+
public partial class GetAzWebPubSubCustomDomain_Get
11+
{
12+
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
13+
{
14+
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
15+
}
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using System.Net.Http;
5+
using System.Threading.Tasks;
6+
using Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Models.Api20;
7+
8+
namespace Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Cmdlets
9+
{
10+
public partial class GetAzWebPubSubCustomDomain_GetViaIdentity
11+
{
12+
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
13+
{
14+
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
15+
}
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using System.Net.Http;
5+
using System.Threading.Tasks;
6+
using Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Models.Api20;
7+
8+
namespace Microsoft.Azure.PowerShell.Cmdlets.WebPubSub.Cmdlets
9+
{
10+
public partial class GetAzWebPubSubCustomDomain_List
11+
{
12+
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
13+
{
14+
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)