diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index daa3149f174e..4f67c67c8bdb 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3965,7 +3965,7 @@ packages: dependencies: semver: 7.3.7 shelljs: 0.8.5 - typescript: 4.9.0-dev.20221018 + typescript: 4.9.0-dev.20221019 dev: false /downlevel-dts/0.8.0: @@ -8962,8 +8962,8 @@ packages: hasBin: true dev: false - /typescript/4.9.0-dev.20221018: - resolution: {integrity: sha512-jHigCAzVp9JXy+t9J854z8ooZTtc1luK25iKKFF48w/AfRfTbypn8HkOGWDmb7x7RuAcZxo1zYcYDk4OaUFKjw==} + /typescript/4.9.0-dev.20221019: + resolution: {integrity: sha512-FgRBDKHZQAbayBvRcfFpjtmztLCobGom2k5W5nFqCXDb/XKYn0oG/8s6O9le3lGIt3+1FC7FYMmqvR5qRW50AA==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -15300,7 +15300,7 @@ packages: dev: false file:projects/arm-webpubsub.tgz: - resolution: {integrity: sha512-jFq4xLTmXZ/Dvfp/DRidHpDXuM0COM8zRNEmWqUyIlDm7Z1DoCUuq0Kj+3it+2A3JheLekL9QncbkCANMSsKpQ==, tarball: file:projects/arm-webpubsub.tgz} + resolution: {integrity: sha512-K/V/fEDtzr1kDuBWG77mPmBnrwn7lmGrfcLOymYDBrDSDZvyY9ZyBaNuF2BR2MFis7pgoS22oWEnNcHn6WK3fQ==, tarball: file:projects/arm-webpubsub.tgz} name: '@rush-temp/arm-webpubsub' version: 0.0.0 dependencies: @@ -15309,19 +15309,21 @@ packages: '@microsoft/api-extractor': 7.32.0 '@rollup/plugin-commonjs': 21.1.0_rollup@2.79.1 '@rollup/plugin-json': 4.1.0_rollup@2.79.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@2.79.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@2.79.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.3 + chai: 4.3.6 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@2.79.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 tslib: 2.4.0 - typescript: 4.2.4 + typescript: 4.6.4 uglify-js: 3.17.2 transitivePeerDependencies: - - encoding + - '@types/node' - supports-color dev: false diff --git a/sdk/web-pubsub/arm-webpubsub/CHANGELOG.md b/sdk/web-pubsub/arm-webpubsub/CHANGELOG.md index ee1b0ebf68f0..0e4687044b1e 100644 --- a/sdk/web-pubsub/arm-webpubsub/CHANGELOG.md +++ b/sdk/web-pubsub/arm-webpubsub/CHANGELOG.md @@ -1,15 +1,58 @@ # Release History + +## 1.1.0-beta.1 (2022-10-19) + +**Features** -## 1.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added operation group WebPubSubCustomCertificates + - Added operation group WebPubSubCustomDomains + - Added Interface CustomCertificate + - Added Interface CustomCertificateList + - Added Interface CustomDomain + - Added Interface CustomDomainList + - Added Interface EventHubEndpoint + - Added Interface EventListener_2 + - Added Interface EventListenerEndpoint + - Added Interface EventListenerFilter + - Added Interface EventNameFilter + - Added Interface PrivateEndpointACL + - Added Interface PrivateEndpointConnection + - Added Interface PrivateLinkResource + - Added Interface ProxyResource + - Added Interface ResourceReference + - Added Interface SharedPrivateLinkResource + - Added Interface TrackedResource + - Added Interface WebPubSubCustomCertificatesCreateOrUpdateOptionalParams + - Added Interface WebPubSubCustomCertificatesDeleteOptionalParams + - Added Interface WebPubSubCustomCertificatesGetOptionalParams + - Added Interface WebPubSubCustomCertificatesListNextOptionalParams + - Added Interface WebPubSubCustomCertificatesListOptionalParams + - Added Interface WebPubSubCustomDomainsCreateOrUpdateOptionalParams + - Added Interface WebPubSubCustomDomainsDeleteOptionalParams + - Added Interface WebPubSubCustomDomainsGetOptionalParams + - Added Interface WebPubSubCustomDomainsListNextOptionalParams + - Added Interface WebPubSubCustomDomainsListOptionalParams + - Added Interface WebPubSubHub + - Added Interface WebPubSubResource + - Added Type Alias EventListenerEndpointDiscriminator + - Added Type Alias EventListenerEndpointUnion + - Added Type Alias EventListenerFilterDiscriminator + - Added Type Alias EventListenerFilterUnion + - Added Type Alias WebPubSubCustomCertificatesCreateOrUpdateResponse + - Added Type Alias WebPubSubCustomCertificatesGetResponse + - Added Type Alias WebPubSubCustomCertificatesListNextResponse + - Added Type Alias WebPubSubCustomCertificatesListResponse + - Added Type Alias WebPubSubCustomDomainsCreateOrUpdateResponse + - Added Type Alias WebPubSubCustomDomainsGetResponse + - Added Type Alias WebPubSubCustomDomainsListNextResponse + - Added Type Alias WebPubSubCustomDomainsListResponse + - Interface WebPubSubHubProperties has a new optional parameter eventListeners + - Class WebPubSubManagementClient has a new parameter webPubSubCustomCertificates + - Class WebPubSubManagementClient has a new parameter webPubSubCustomDomains + - Added Enum KnownEventListenerEndpointDiscriminator + - Added Enum KnownEventListenerFilterDiscriminator + + ## 1.0.0 (2021-12-16) - The package of @azure/arm-webpubsub is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/web-pubsub/arm-webpubsub/LICENSE b/sdk/web-pubsub/arm-webpubsub/LICENSE index ccb63b166732..5d1d36e0af80 100644 --- a/sdk/web-pubsub/arm-webpubsub/LICENSE +++ b/sdk/web-pubsub/arm-webpubsub/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 Microsoft +Copyright (c) 2022 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/web-pubsub/arm-webpubsub/README.md b/sdk/web-pubsub/arm-webpubsub/README.md index a6417f9a387d..3b32767350c2 100644 --- a/sdk/web-pubsub/arm-webpubsub/README.md +++ b/sdk/web-pubsub/arm-webpubsub/README.md @@ -6,7 +6,7 @@ REST API for Azure WebPubSub Service [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/web-pubsub/arm-webpubsub) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-webpubsub) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-webpubsub) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-webpubsub?view=azure-node-preview) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started @@ -16,6 +16,8 @@ REST API for Azure WebPubSub Service - [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) - Latest versions of Safari, Chrome, Edge and Firefox. +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + ### Prerequisites - An [Azure subscription][azure_sub]. @@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { WebPubSubManagementClient } = require("@azure/arm-webpubsub"); const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new WebPubSubManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new WebPubSubManagementClient(credential, subscriptionId); ``` diff --git a/sdk/web-pubsub/arm-webpubsub/_meta.json b/sdk/web-pubsub/arm-webpubsub/_meta.json index e2d123d79ee8..ecd522d1b858 100644 --- a/sdk/web-pubsub/arm-webpubsub/_meta.json +++ b/sdk/web-pubsub/arm-webpubsub/_meta.json @@ -1,7 +1,8 @@ { - "commit": "d600759c3516b61a7c353bc8682bccbab85a6f65", + "commit": "307cc50c6ca925d51773420cde8de4e9365cf743", "readme": "specification/webpubsub/resource-manager/readme.md", - "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/webpubsub/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211207.1", + "autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/webpubsub/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.2", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211207.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.4.4", + "use": "@autorest/typescript@6.0.0-rc.2" } \ No newline at end of file diff --git a/sdk/web-pubsub/arm-webpubsub/api-extractor.json b/sdk/web-pubsub/arm-webpubsub/api-extractor.json index 9d1e9de0ae37..4736a4c733e6 100644 --- a/sdk/web-pubsub/arm-webpubsub/api-extractor.json +++ b/sdk/web-pubsub/arm-webpubsub/api-extractor.json @@ -1,18 +1,31 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", - "docModel": { "enabled": true }, - "apiReport": { "enabled": true, "reportFolder": "./review" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-webpubsub.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/web-pubsub/arm-webpubsub/package.json b/sdk/web-pubsub/arm-webpubsub/package.json index 5c1dbc228717..fe9634580e5e 100644 --- a/sdk/web-pubsub/arm-webpubsub/package.json +++ b/sdk/web-pubsub/arm-webpubsub/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for WebPubSubManagementClient.", - "version": "1.0.1", + "version": "1.1.0-beta.1", "engines": { "node": ">=14.0.0" }, @@ -11,9 +11,9 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -30,19 +30,23 @@ "devDependencies": { "@microsoft/api-extractor": "^7.31.1", "@rollup/plugin-commonjs": "^21.0.1", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", "mkdirp": "^1.0.4", - "rollup": "^2.0.0", - "rollup-plugin-sourcemaps": "^0.4.2", - "typescript": "~4.2.0", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~4.6.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", - "cross-env": "^7.0.2" + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/web-pubsub/arm-webpubsub", "repository": { @@ -93,10 +97,17 @@ "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", "unit-test:browser": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", - "integration-test:browser": "echo skipped", - "docs": "echo skipped" + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" }, "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/webPubSubManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, "autoPublish": true -} +} \ No newline at end of file diff --git a/sdk/web-pubsub/arm-webpubsub/review/arm-webpubsub.api.md b/sdk/web-pubsub/arm-webpubsub/review/arm-webpubsub.api.md index ec239f164fc3..3f8f7c0df5c3 100644 --- a/sdk/web-pubsub/arm-webpubsub/review/arm-webpubsub.api.md +++ b/sdk/web-pubsub/arm-webpubsub/review/arm-webpubsub.api.md @@ -16,6 +16,35 @@ export type ACLAction = string; // @public export type CreatedByType = string; +// @public +export interface CustomCertificate extends ProxyResource { + keyVaultBaseUri: string; + keyVaultSecretName: string; + keyVaultSecretVersion?: string; + readonly provisioningState?: ProvisioningState; + readonly systemData?: SystemData; +} + +// @public +export interface CustomCertificateList { + nextLink?: string; + value?: CustomCertificate[]; +} + +// @public +export interface CustomDomain extends ProxyResource { + customCertificate: ResourceReference; + domainName: string; + readonly provisioningState?: ProvisioningState; + readonly systemData?: SystemData; +} + +// @public +export interface CustomDomainList { + nextLink?: string; + value?: CustomDomain[]; +} + // @public export interface Dimension { displayName?: string; @@ -52,137 +81,147 @@ export interface EventHandler { userEventPattern?: string; } +// @public +export interface EventHubEndpoint extends EventListenerEndpoint { + eventHubName: string; + fullyQualifiedNamespace: string; + type: "EventHub"; +} + +// @public +interface EventListener_2 { + endpoint: EventListenerEndpointUnion; + filter: EventListenerFilterUnion; +} +export { EventListener_2 as EventListener } + +// @public +export interface EventListenerEndpoint { + type: "EventHub"; +} + +// @public +export type EventListenerEndpointDiscriminator = string; + +// @public (undocumented) +export type EventListenerEndpointUnion = EventListenerEndpoint | EventHubEndpoint; + +// @public +export interface EventListenerFilter { + type: "EventName"; +} + +// @public +export type EventListenerFilterDiscriminator = string; + +// @public (undocumented) +export type EventListenerFilterUnion = EventListenerFilter | EventNameFilter; + +// @public +export interface EventNameFilter extends EventListenerFilter { + systemEvents?: string[]; + type: "EventName"; + userEventPattern?: string; +} + // @public type KeyType_2 = string; export { KeyType_2 as KeyType } // @public export enum KnownACLAction { - // (undocumented) Allow = "Allow", - // (undocumented) Deny = "Deny" } // @public export enum KnownCreatedByType { - // (undocumented) Application = "Application", - // (undocumented) Key = "Key", - // (undocumented) ManagedIdentity = "ManagedIdentity", - // (undocumented) User = "User" } +// @public +export enum KnownEventListenerEndpointDiscriminator { + EventHub = "EventHub" +} + +// @public +export enum KnownEventListenerFilterDiscriminator { + EventName = "EventName" +} + // @public export enum KnownKeyType { - // (undocumented) Primary = "Primary", - // (undocumented) Salt = "Salt", - // (undocumented) Secondary = "Secondary" } // @public export enum KnownManagedIdentityType { - // (undocumented) None = "None", - // (undocumented) SystemAssigned = "SystemAssigned", - // (undocumented) UserAssigned = "UserAssigned" } // @public export enum KnownPrivateLinkServiceConnectionStatus { - // (undocumented) Approved = "Approved", - // (undocumented) Disconnected = "Disconnected", - // (undocumented) Pending = "Pending", - // (undocumented) Rejected = "Rejected" } // @public export enum KnownProvisioningState { - // (undocumented) Canceled = "Canceled", - // (undocumented) Creating = "Creating", - // (undocumented) Deleting = "Deleting", - // (undocumented) Failed = "Failed", - // (undocumented) Moving = "Moving", - // (undocumented) Running = "Running", - // (undocumented) Succeeded = "Succeeded", - // (undocumented) Unknown = "Unknown", - // (undocumented) Updating = "Updating" } // @public export enum KnownScaleType { - // (undocumented) Automatic = "Automatic", - // (undocumented) Manual = "Manual", - // (undocumented) None = "None" } // @public export enum KnownSharedPrivateLinkResourceStatus { - // (undocumented) Approved = "Approved", - // (undocumented) Disconnected = "Disconnected", - // (undocumented) Pending = "Pending", - // (undocumented) Rejected = "Rejected", - // (undocumented) Timeout = "Timeout" } // @public export enum KnownUpstreamAuthType { - // (undocumented) ManagedIdentity = "ManagedIdentity", - // (undocumented) None = "None" } // @public export enum KnownWebPubSubRequestType { - // (undocumented) ClientConnection = "ClientConnection", - // (undocumented) Restapi = "RESTAPI", - // (undocumented) ServerConnection = "ServerConnection", - // (undocumented) Trace = "Trace" } // @public export enum KnownWebPubSubSkuTier { - // (undocumented) Basic = "Basic", - // (undocumented) Free = "Free", - // (undocumented) Premium = "Premium", - // (undocumented) Standard = "Standard" } @@ -306,18 +345,18 @@ export interface PrivateEndpoint { } // @public -export type PrivateEndpointACL = NetworkACL & { +export interface PrivateEndpointACL extends NetworkACL { name: string; -}; +} // @public -export type PrivateEndpointConnection = ProxyResource & { - readonly systemData?: SystemData; - readonly provisioningState?: ProvisioningState; - privateEndpoint?: PrivateEndpoint; +export interface PrivateEndpointConnection extends ProxyResource { readonly groupIds?: string[]; + privateEndpoint?: PrivateEndpoint; privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; -}; + readonly provisioningState?: ProvisioningState; + readonly systemData?: SystemData; +} // @public export interface PrivateEndpointConnectionList { @@ -326,12 +365,12 @@ export interface PrivateEndpointConnectionList { } // @public -export type PrivateLinkResource = ProxyResource & { +export interface PrivateLinkResource extends ProxyResource { groupId?: string; requiredMembers?: string[]; requiredZoneNames?: string[]; shareablePrivateLinkResourceTypes?: ShareablePrivateLinkResourceType[]; -}; +} // @public export interface PrivateLinkResourceList { @@ -353,7 +392,8 @@ export type PrivateLinkServiceConnectionStatus = string; export type ProvisioningState = string; // @public -export type ProxyResource = Resource & {}; +export interface ProxyResource extends Resource { +} // @public export interface RegenerateKeyParameters { @@ -378,6 +418,11 @@ export interface ResourceLogConfiguration { categories?: ResourceLogCategory[]; } +// @public +export interface ResourceReference { + id?: string; +} + // @public export interface ResourceSku { capacity?: number; @@ -410,14 +455,14 @@ export interface ShareablePrivateLinkResourceType { } // @public -export type SharedPrivateLinkResource = ProxyResource & { - readonly systemData?: SystemData; +export interface SharedPrivateLinkResource extends ProxyResource { groupId?: string; privateLinkResourceId?: string; readonly provisioningState?: ProvisioningState; requestMessage?: string; readonly status?: SharedPrivateLinkResourceStatus; -}; + readonly systemData?: SystemData; +} // @public export interface SharedPrivateLinkResourceList { @@ -482,12 +527,12 @@ export interface SystemData { } // @public -export type TrackedResource = Resource & { +export interface TrackedResource extends Resource { location?: string; tags?: { [propertyName: string]: string; }; -}; +} // @public export interface UpstreamAuthSettings { @@ -559,6 +604,95 @@ export interface WebPubSubCreateOrUpdateOptionalParams extends coreClient.Operat // @public export type WebPubSubCreateOrUpdateResponse = WebPubSubResource; +// @public +export interface WebPubSubCustomCertificates { + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, certificateName: string, parameters: CustomCertificate, options?: WebPubSubCustomCertificatesCreateOrUpdateOptionalParams): Promise, WebPubSubCustomCertificatesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, certificateName: string, parameters: CustomCertificate, options?: WebPubSubCustomCertificatesCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, resourceName: string, certificateName: string, options?: WebPubSubCustomCertificatesDeleteOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, certificateName: string, options?: WebPubSubCustomCertificatesGetOptionalParams): Promise; + list(resourceGroupName: string, resourceName: string, options?: WebPubSubCustomCertificatesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface WebPubSubCustomCertificatesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type WebPubSubCustomCertificatesCreateOrUpdateResponse = CustomCertificate; + +// @public +export interface WebPubSubCustomCertificatesDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface WebPubSubCustomCertificatesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WebPubSubCustomCertificatesGetResponse = CustomCertificate; + +// @public +export interface WebPubSubCustomCertificatesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WebPubSubCustomCertificatesListNextResponse = CustomCertificateList; + +// @public +export interface WebPubSubCustomCertificatesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WebPubSubCustomCertificatesListResponse = CustomCertificateList; + +// @public +export interface WebPubSubCustomDomains { + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, name: string, parameters: CustomDomain, options?: WebPubSubCustomDomainsCreateOrUpdateOptionalParams): Promise, WebPubSubCustomDomainsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, name: string, parameters: CustomDomain, options?: WebPubSubCustomDomainsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, resourceName: string, name: string, options?: WebPubSubCustomDomainsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, resourceName: string, name: string, options?: WebPubSubCustomDomainsDeleteOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, name: string, options?: WebPubSubCustomDomainsGetOptionalParams): Promise; + list(resourceGroupName: string, resourceName: string, options?: WebPubSubCustomDomainsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface WebPubSubCustomDomainsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type WebPubSubCustomDomainsCreateOrUpdateResponse = CustomDomain; + +// @public +export interface WebPubSubCustomDomainsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface WebPubSubCustomDomainsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WebPubSubCustomDomainsGetResponse = CustomDomain; + +// @public +export interface WebPubSubCustomDomainsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WebPubSubCustomDomainsListNextResponse = CustomDomainList; + +// @public +export interface WebPubSubCustomDomainsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WebPubSubCustomDomainsListResponse = CustomDomainList; + // @public export interface WebPubSubDeleteOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; @@ -573,10 +707,10 @@ export interface WebPubSubGetOptionalParams extends coreClient.OperationOptions export type WebPubSubGetResponse = WebPubSubResource; // @public -export type WebPubSubHub = ProxyResource & { - readonly systemData?: SystemData; +export interface WebPubSubHub extends ProxyResource { properties: WebPubSubHubProperties; -}; + readonly systemData?: SystemData; +} // @public export interface WebPubSubHubList { @@ -588,6 +722,7 @@ export interface WebPubSubHubList { export interface WebPubSubHubProperties { anonymousConnectPolicy?: string; eventHandlers?: EventHandler[]; + eventListeners?: EventListener_2[]; } // @public @@ -702,6 +837,10 @@ export class WebPubSubManagementClient extends coreClient.ServiceClient { // (undocumented) webPubSub: WebPubSub; // (undocumented) + webPubSubCustomCertificates: WebPubSubCustomCertificates; + // (undocumented) + webPubSubCustomDomains: WebPubSubCustomDomains; + // (undocumented) webPubSubHubs: WebPubSubHubs; // (undocumented) webPubSubPrivateEndpointConnections: WebPubSubPrivateEndpointConnections; @@ -800,27 +939,27 @@ export type WebPubSubRegenerateKeyResponse = WebPubSubKeys; export type WebPubSubRequestType = string; // @public -export type WebPubSubResource = TrackedResource & { - sku?: ResourceSku; - identity?: ManagedIdentity; - readonly systemData?: SystemData; - readonly provisioningState?: ProvisioningState; +export interface WebPubSubResource extends TrackedResource { + disableAadAuth?: boolean; + disableLocalAuth?: boolean; readonly externalIP?: string; readonly hostName?: string; - readonly publicPort?: number; - readonly serverPort?: number; - readonly version?: string; - readonly privateEndpointConnections?: PrivateEndpointConnection[]; - readonly sharedPrivateLinkResources?: SharedPrivateLinkResource[]; - tls?: WebPubSubTlsSettings; readonly hostNamePrefix?: string; + identity?: ManagedIdentity; liveTraceConfiguration?: LiveTraceConfiguration; - resourceLogConfiguration?: ResourceLogConfiguration; networkACLs?: WebPubSubNetworkACLs; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly provisioningState?: ProvisioningState; publicNetworkAccess?: string; - disableLocalAuth?: boolean; - disableAadAuth?: boolean; -}; + readonly publicPort?: number; + resourceLogConfiguration?: ResourceLogConfiguration; + readonly serverPort?: number; + readonly sharedPrivateLinkResources?: SharedPrivateLinkResource[]; + sku?: ResourceSku; + readonly systemData?: SystemData; + tls?: WebPubSubTlsSettings; + readonly version?: string; +} // @public export interface WebPubSubResourceList { diff --git a/sdk/web-pubsub/arm-webpubsub/rollup.config.js b/sdk/web-pubsub/arm-webpubsub/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/web-pubsub/arm-webpubsub/rollup.config.js +++ b/sdk/web-pubsub/arm-webpubsub/rollup.config.js @@ -14,62 +14,14 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; -/** - * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. - * - * NOTE: this manual configuration is only needed because OpenTelemetry uses an - * __exportStar downleveled helper function to declare its exports which confuses - * rollup's automatic discovery mechanism. - * - * @returns an object reference that can be `...`'d into your cjs() configuration. - */ -export function openTelemetryCommonJs() { - const namedExports = {}; - - for (const key of [ - "@opentelemetry/api", - "@azure/core-tracing/node_modules/@opentelemetry/api" - ]) { - namedExports[key] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "SpanStatusCode", - "getSpanContext", - "setSpanContext" - ]; - } - - const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; - - for (const version of releasedOpenTelemetryVersions) { - namedExports[ - // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. - `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` - ] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "StatusCode", - "CanonicalCode", - "getSpanContext", - "setSpanContext" - ]; - } - - return namedExports; -} - // #region Warning Handler /** - * A function that can determine whether a rollupwarning should be ignored. If + * A function that can determine whether a rollup warning should be ignored. If * the function returns `true`, then the warning will not be displayed. */ -function ignoreNiseSinonEvalWarnings(warning) { +function ignoreNiseSinonEval(warning) { return ( warning.code === "EVAL" && warning.id && @@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) { ); } -function ignoreChaiCircularDependencyWarnings(warning) { +function ignoreChaiCircularDependency(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ - ignoreChaiCircularDependencyWarnings, - ignoreNiseSinonEvalWarnings -]; +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; /** * Construct a warning handler for the shared rollup configuration @@ -122,22 +71,7 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs({ - namedExports: { - // Chai's strange internal architecture makes it impossible to statically - // analyze its exports. - chai: [ - "version", - "use", - "util", - "config", - "expect", - "should", - "assert" - ], - ...openTelemetryCommonJs() - } - }), + cjs(), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -173,7 +107,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve(), cjs()] + plugins: [sourcemaps(), nodeResolve()] }; const config = [baseConfig]; diff --git a/sdk/web-pubsub/arm-webpubsub/sample.env b/sdk/web-pubsub/arm-webpubsub/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/web-pubsub/arm-webpubsub/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/web-pubsub/arm-webpubsub/src/models/index.ts b/sdk/web-pubsub/arm-webpubsub/src/models/index.ts index 94d7b3a834f3..b881cb555499 100644 --- a/sdk/web-pubsub/arm-webpubsub/src/models/index.ts +++ b/sdk/web-pubsub/arm-webpubsub/src/models/index.ts @@ -8,6 +8,11 @@ import * as coreClient from "@azure/core-client"; +export type EventListenerFilterUnion = EventListenerFilter | EventNameFilter; +export type EventListenerEndpointUnion = + | EventListenerEndpoint + | EventHubEndpoint; + /** Result of the request to list REST API operations. It contains a list of operations. */ export interface OperationList { /** List of operations supported by the resource provider. */ @@ -219,7 +224,7 @@ export interface ResourceSku { /** * The name of the SKU. Required. * - * Allowed values: Standard_S1, Free_F1 + * Allowed values: Standard_S1, Free_F1, Premium_P1 */ name: string; /** @@ -242,8 +247,9 @@ export interface ResourceSku { * Optional, integer. The unit count of the resource. 1 by default. * * If present, following values are allowed: - * Free: 1 - * Standard: 1,2,5,10,20,50,100 + * Free: 1; + * Standard: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + * Premium: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; */ capacity?: number; } @@ -411,6 +417,34 @@ export interface UserAssignedIdentityProperty { readonly clientId?: string; } +/** Custom certificates list. */ +export interface CustomCertificateList { + /** List of custom certificates of this resource. */ + value?: CustomCertificate[]; + /** + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + nextLink?: string; +} + +/** Custom domains list */ +export interface CustomDomainList { + /** List of custom domains that bind to this resource. */ + value?: CustomDomain[]; + /** + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + nextLink?: string; +} + +/** Reference to a resource. */ +export interface ResourceReference { + /** Resource ID. */ + id?: string; +} + /** Hub setting list */ export interface WebPubSubHubList { /** List of hub settings to this resource. */ @@ -427,6 +461,13 @@ export interface WebPubSubHubList { export interface WebPubSubHubProperties { /** Event handler of a hub. */ eventHandlers?: EventHandler[]; + /** + * Event listener settings for forwarding your client events to listeners. + * Event listener is transparent to Web PubSub clients, and it doesn't return any result to clients nor interrupt the lifetime of clients. + * One event can be sent to multiple listeners, as long as it matches the filters in those listeners. The order of the array elements doesn't matter. + * Maximum count of event listeners among all hubs is 10. + */ + eventListeners?: EventListener[]; /** The settings for configuring if anonymous connections are allowed for this hub: "allow" or "deny". Default to "deny". */ anonymousConnectPolicy?: string; } @@ -440,13 +481,13 @@ export interface EventHandler { urlTemplate: string; /** * Gets or sets the matching pattern for event names. - * There are 3 kind of patterns supported: - * 1. "*", it to matches any event name + * There are 3 kinds of patterns supported: + * 1. "*", it matches any event name * 2. Combine multiple events with ",", for example "event1,event2", it matches event "event1" and "event2" - * 3. The single event name, for example, "event1", it matches "event1" + * 3. A single event name, for example, "event1", it matches "event1" */ userEventPattern?: string; - /** Gets ot sets the list of system events. */ + /** Gets or sets the list of system events. */ systemEvents?: string[]; /** Upstream auth settings. If not set, no auth is used for upstream messages. */ auth?: UpstreamAuthSettings; @@ -469,6 +510,26 @@ export interface ManagedIdentitySettings { resource?: string; } +/** A setting defines which kinds of events should be sent to which endpoint. */ +export interface EventListener { + /** A base class for event filter which determines whether an event should be sent to an event listener. */ + filter: EventListenerFilterUnion; + /** An endpoint specifying where Web PubSub should send events to. */ + endpoint: EventListenerEndpointUnion; +} + +/** A base class for event filter which determines whether an event should be sent to an event listener. */ +export interface EventListenerFilter { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "EventName"; +} + +/** An endpoint specifying where Web PubSub should send events to. */ +export interface EventListenerEndpoint { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "EventHub"; +} + /** A class represents the access keys of the resource. */ export interface WebPubSubKeys { /** The primary access key. */ @@ -596,24 +657,53 @@ export interface SkuCapacity { } /** The resource model definition for a ARM proxy resource. It will have everything other than required location and tags */ -export type ProxyResource = Resource & {}; +export interface ProxyResource extends Resource {} /** The resource model definition for a ARM tracked top level resource. */ -export type TrackedResource = Resource & { +export interface TrackedResource extends Resource { /** The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. */ location?: string; /** Tags of the service which is a list of key value pairs that describe the resource. */ tags?: { [propertyName: string]: string }; -}; +} /** ACL for a private endpoint */ -export type PrivateEndpointACL = NetworkACL & { +export interface PrivateEndpointACL extends NetworkACL { /** Name of the private endpoint connection */ name: string; -}; +} + +/** Filter events by their name. */ +export interface EventNameFilter extends EventListenerFilter { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "EventName"; + /** Gets or sets a list of system events. Supported events: "connected" and "disconnected". Blocking event "connect" is not supported because it requires a response. */ + systemEvents?: string[]; + /** + * Gets or sets a matching pattern for event names. + * There are 3 kinds of patterns supported: + * 1. "*", it matches any event name + * 2. Combine multiple events with ",", for example "event1,event2", it matches events "event1" and "event2" + * 3. A single event name, for example, "event1", it matches "event1" + */ + userEventPattern?: string; +} + +/** + * An Event Hub endpoint. + * The managed identity of Web PubSub service must be enabled, and the identity should have the "Azure Event Hubs Data sender" role to access Event Hub. + */ +export interface EventHubEndpoint extends EventListenerEndpoint { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "EventHub"; + /** The fully qualified namespace name of the Event Hub resource. For example, "example.servicebus.windows.net". */ + fullyQualifiedNamespace: string; + /** The name of the Event Hub. */ + eventHubName: string; +} /** A private endpoint connection to an azure resource */ -export type PrivateEndpointConnection = ProxyResource & { +export interface PrivateEndpointConnection extends ProxyResource { /** * Metadata pertaining to creation and last modification of the resource. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -633,10 +723,10 @@ export type PrivateEndpointConnection = ProxyResource & { readonly groupIds?: string[]; /** Connection state of the private endpoint connection */ privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; -}; +} /** Describes a Shared Private Link Resource */ -export type SharedPrivateLinkResource = ProxyResource & { +export interface SharedPrivateLinkResource extends ProxyResource { /** * Metadata pertaining to creation and last modification of the resource. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -658,10 +748,48 @@ export type SharedPrivateLinkResource = ProxyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly status?: SharedPrivateLinkResourceStatus; -}; +} + +/** A custom certificate. */ +export interface CustomCertificate extends ProxyResource { + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** + * Provisioning state of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** Base uri of the KeyVault that stores certificate. */ + keyVaultBaseUri: string; + /** Certificate secret name. */ + keyVaultSecretName: string; + /** Certificate secret version. */ + keyVaultSecretVersion?: string; +} + +/** A custom domain */ +export interface CustomDomain extends ProxyResource { + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** + * Provisioning state of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** The custom domain name. */ + domainName: string; + /** Reference to a resource. */ + customCertificate: ResourceReference; +} /** A hub setting */ -export type WebPubSubHub = ProxyResource & { +export interface WebPubSubHub extends ProxyResource { /** * Metadata pertaining to creation and last modification of the resource. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -669,10 +797,10 @@ export type WebPubSubHub = ProxyResource & { readonly systemData?: SystemData; /** Properties of a hub. */ properties: WebPubSubHubProperties; -}; +} /** Private link resource */ -export type PrivateLinkResource = ProxyResource & { +export interface PrivateLinkResource extends ProxyResource { /** Group Id of the private link resource */ groupId?: string; /** Required members of the private link resource */ @@ -681,10 +809,10 @@ export type PrivateLinkResource = ProxyResource & { requiredZoneNames?: string[]; /** The list of resources that are onboarded to private link service */ shareablePrivateLinkResourceTypes?: ShareablePrivateLinkResourceType[]; -}; +} /** A class represent a resource. */ -export type WebPubSubResource = TrackedResource & { +export interface WebPubSubResource extends TrackedResource { /** The billing information of the resource. */ sku?: ResourceSku; /** A class represent managed identities used for request and response */ @@ -765,13 +893,17 @@ export type WebPubSubResource = TrackedResource & { * When set as true, connection with AuthType=aad won't work. */ disableAadAuth?: boolean; -}; +} /** Known values of {@link WebPubSubSkuTier} that the service accepts. */ export enum KnownWebPubSubSkuTier { + /** Free */ Free = "Free", + /** Basic */ Basic = "Basic", + /** Standard */ Standard = "Standard", + /** Premium */ Premium = "Premium" } @@ -789,14 +921,23 @@ export type WebPubSubSkuTier = string; /** Known values of {@link ProvisioningState} that the service accepts. */ export enum KnownProvisioningState { + /** Unknown */ Unknown = "Unknown", + /** Succeeded */ Succeeded = "Succeeded", + /** Failed */ Failed = "Failed", + /** Canceled */ Canceled = "Canceled", + /** Running */ Running = "Running", + /** Creating */ Creating = "Creating", + /** Updating */ Updating = "Updating", + /** Deleting */ Deleting = "Deleting", + /** Moving */ Moving = "Moving" } @@ -819,9 +960,13 @@ export type ProvisioningState = string; /** Known values of {@link CreatedByType} that the service accepts. */ export enum KnownCreatedByType { + /** User */ User = "User", + /** Application */ Application = "Application", + /** ManagedIdentity */ ManagedIdentity = "ManagedIdentity", + /** Key */ Key = "Key" } @@ -839,9 +984,13 @@ export type CreatedByType = string; /** Known values of {@link PrivateLinkServiceConnectionStatus} that the service accepts. */ export enum KnownPrivateLinkServiceConnectionStatus { + /** Pending */ Pending = "Pending", + /** Approved */ Approved = "Approved", + /** Rejected */ Rejected = "Rejected", + /** Disconnected */ Disconnected = "Disconnected" } @@ -859,10 +1008,15 @@ export type PrivateLinkServiceConnectionStatus = string; /** Known values of {@link SharedPrivateLinkResourceStatus} that the service accepts. */ export enum KnownSharedPrivateLinkResourceStatus { + /** Pending */ Pending = "Pending", + /** Approved */ Approved = "Approved", + /** Rejected */ Rejected = "Rejected", + /** Disconnected */ Disconnected = "Disconnected", + /** Timeout */ Timeout = "Timeout" } @@ -881,7 +1035,9 @@ export type SharedPrivateLinkResourceStatus = string; /** Known values of {@link ACLAction} that the service accepts. */ export enum KnownACLAction { + /** Allow */ Allow = "Allow", + /** Deny */ Deny = "Deny" } @@ -897,9 +1053,13 @@ export type ACLAction = string; /** Known values of {@link WebPubSubRequestType} that the service accepts. */ export enum KnownWebPubSubRequestType { + /** ClientConnection */ ClientConnection = "ClientConnection", + /** ServerConnection */ ServerConnection = "ServerConnection", + /** Restapi */ Restapi = "RESTAPI", + /** Trace */ Trace = "Trace" } @@ -917,8 +1077,11 @@ export type WebPubSubRequestType = string; /** Known values of {@link ManagedIdentityType} that the service accepts. */ export enum KnownManagedIdentityType { + /** None */ None = "None", + /** SystemAssigned */ SystemAssigned = "SystemAssigned", + /** UserAssigned */ UserAssigned = "UserAssigned" } @@ -935,7 +1098,9 @@ export type ManagedIdentityType = string; /** Known values of {@link UpstreamAuthType} that the service accepts. */ export enum KnownUpstreamAuthType { + /** None */ None = "None", + /** ManagedIdentity */ ManagedIdentity = "ManagedIdentity" } @@ -949,10 +1114,43 @@ export enum KnownUpstreamAuthType { */ export type UpstreamAuthType = string; +/** Known values of {@link EventListenerFilterDiscriminator} that the service accepts. */ +export enum KnownEventListenerFilterDiscriminator { + /** EventName */ + EventName = "EventName" +} + +/** + * Defines values for EventListenerFilterDiscriminator. \ + * {@link KnownEventListenerFilterDiscriminator} can be used interchangeably with EventListenerFilterDiscriminator, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **EventName** + */ +export type EventListenerFilterDiscriminator = string; + +/** Known values of {@link EventListenerEndpointDiscriminator} that the service accepts. */ +export enum KnownEventListenerEndpointDiscriminator { + /** EventHub */ + EventHub = "EventHub" +} + +/** + * Defines values for EventListenerEndpointDiscriminator. \ + * {@link KnownEventListenerEndpointDiscriminator} can be used interchangeably with EventListenerEndpointDiscriminator, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **EventHub** + */ +export type EventListenerEndpointDiscriminator = string; + /** Known values of {@link KeyType} that the service accepts. */ export enum KnownKeyType { + /** Primary */ Primary = "Primary", + /** Secondary */ Secondary = "Secondary", + /** Salt */ Salt = "Salt" } @@ -969,8 +1167,11 @@ export type KeyType = string; /** Known values of {@link ScaleType} that the service accepts. */ export enum KnownScaleType { + /** None */ None = "None", + /** Manual */ Manual = "Manual", + /** Automatic */ Automatic = "Automatic" } @@ -1122,6 +1323,85 @@ export interface UsagesListNextOptionalParams /** Contains response data for the listNext operation. */ export type UsagesListNextResponse = SignalRServiceUsageList; +/** Optional parameters. */ +export interface WebPubSubCustomCertificatesListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type WebPubSubCustomCertificatesListResponse = CustomCertificateList; + +/** Optional parameters. */ +export interface WebPubSubCustomCertificatesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type WebPubSubCustomCertificatesGetResponse = CustomCertificate; + +/** Optional parameters. */ +export interface WebPubSubCustomCertificatesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type WebPubSubCustomCertificatesCreateOrUpdateResponse = CustomCertificate; + +/** Optional parameters. */ +export interface WebPubSubCustomCertificatesDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface WebPubSubCustomCertificatesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type WebPubSubCustomCertificatesListNextResponse = CustomCertificateList; + +/** Optional parameters. */ +export interface WebPubSubCustomDomainsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type WebPubSubCustomDomainsListResponse = CustomDomainList; + +/** Optional parameters. */ +export interface WebPubSubCustomDomainsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type WebPubSubCustomDomainsGetResponse = CustomDomain; + +/** Optional parameters. */ +export interface WebPubSubCustomDomainsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type WebPubSubCustomDomainsCreateOrUpdateResponse = CustomDomain; + +/** Optional parameters. */ +export interface WebPubSubCustomDomainsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface WebPubSubCustomDomainsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type WebPubSubCustomDomainsListNextResponse = CustomDomainList; + /** Optional parameters. */ export interface WebPubSubHubsListOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/web-pubsub/arm-webpubsub/src/models/mappers.ts b/sdk/web-pubsub/arm-webpubsub/src/models/mappers.ts index 8b973a726909..766a83dbb79f 100644 --- a/sdk/web-pubsub/arm-webpubsub/src/models/mappers.ts +++ b/sdk/web-pubsub/arm-webpubsub/src/models/mappers.ts @@ -931,6 +931,75 @@ export const UserAssignedIdentityProperty: coreClient.CompositeMapper = { } }; +export const CustomCertificateList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CustomCertificateList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CustomCertificate" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const CustomDomainList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CustomDomainList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CustomDomain" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceReference: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceReference", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + } + } + } +}; + export const WebPubSubHubList: coreClient.CompositeMapper = { type: { name: "Composite", @@ -976,6 +1045,18 @@ export const WebPubSubHubProperties: coreClient.CompositeMapper = { } } }, + eventListeners: { + serializedName: "eventListeners", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EventListener" + } + } + } + }, anonymousConnectPolicy: { defaultValue: "deny", serializedName: "anonymousConnectPolicy", @@ -1064,6 +1145,71 @@ export const ManagedIdentitySettings: coreClient.CompositeMapper = { } }; +export const EventListener: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EventListener", + modelProperties: { + filter: { + serializedName: "filter", + type: { + name: "Composite", + className: "EventListenerFilter" + } + }, + endpoint: { + serializedName: "endpoint", + type: { + name: "Composite", + className: "EventListenerEndpoint" + } + } + } + } +}; + +export const EventListenerFilter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EventListenerFilter", + uberParent: "EventListenerFilter", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + modelProperties: { + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const EventListenerEndpoint: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EventListenerEndpoint", + uberParent: "EventListenerEndpoint", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + modelProperties: { + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + } + } + } +}; + export const WebPubSubKeys: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1400,6 +1546,64 @@ export const PrivateEndpointACL: coreClient.CompositeMapper = { } }; +export const EventNameFilter: coreClient.CompositeMapper = { + serializedName: "EventName", + type: { + name: "Composite", + className: "EventNameFilter", + uberParent: "EventListenerFilter", + polymorphicDiscriminator: EventListenerFilter.type.polymorphicDiscriminator, + modelProperties: { + ...EventListenerFilter.type.modelProperties, + systemEvents: { + serializedName: "systemEvents", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + userEventPattern: { + serializedName: "userEventPattern", + type: { + name: "String" + } + } + } + } +}; + +export const EventHubEndpoint: coreClient.CompositeMapper = { + serializedName: "EventHub", + type: { + name: "Composite", + className: "EventHubEndpoint", + uberParent: "EventListenerEndpoint", + polymorphicDiscriminator: + EventListenerEndpoint.type.polymorphicDiscriminator, + modelProperties: { + ...EventListenerEndpoint.type.modelProperties, + fullyQualifiedNamespace: { + serializedName: "fullyQualifiedNamespace", + required: true, + type: { + name: "String" + } + }, + eventHubName: { + serializedName: "eventHubName", + required: true, + type: { + name: "String" + } + } + } + } +}; + export const PrivateEndpointConnection: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1499,6 +1703,88 @@ export const SharedPrivateLinkResource: coreClient.CompositeMapper = { } }; +export const CustomCertificate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CustomCertificate", + modelProperties: { + ...ProxyResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + keyVaultBaseUri: { + serializedName: "properties.keyVaultBaseUri", + required: true, + type: { + name: "String" + } + }, + keyVaultSecretName: { + serializedName: "properties.keyVaultSecretName", + required: true, + type: { + name: "String" + } + }, + keyVaultSecretVersion: { + serializedName: "properties.keyVaultSecretVersion", + type: { + name: "String" + } + } + } + } +}; + +export const CustomDomain: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CustomDomain", + modelProperties: { + ...ProxyResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + domainName: { + serializedName: "properties.domainName", + required: true, + type: { + name: "String" + } + }, + customCertificate: { + serializedName: "properties.customCertificate", + type: { + name: "Composite", + className: "ResourceReference" + } + } + } + } +}; + export const WebPubSubHub: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1727,3 +2013,10 @@ export const WebPubSubResource: coreClient.CompositeMapper = { } } }; + +export let discriminators = { + EventListenerFilter: EventListenerFilter, + EventListenerEndpoint: EventListenerEndpoint, + "EventListenerFilter.EventName": EventNameFilter, + "EventListenerEndpoint.EventHub": EventHubEndpoint +}; diff --git a/sdk/web-pubsub/arm-webpubsub/src/models/parameters.ts b/sdk/web-pubsub/arm-webpubsub/src/models/parameters.ts index 086f27bd8546..2a8b4799dd83 100644 --- a/sdk/web-pubsub/arm-webpubsub/src/models/parameters.ts +++ b/sdk/web-pubsub/arm-webpubsub/src/models/parameters.ts @@ -15,6 +15,8 @@ import { NameAvailabilityParameters as NameAvailabilityParametersMapper, WebPubSubResource as WebPubSubResourceMapper, RegenerateKeyParameters as RegenerateKeyParametersMapper, + CustomCertificate as CustomCertificateMapper, + CustomDomain as CustomDomainMapper, WebPubSubHub as WebPubSubHubMapper, PrivateEndpointConnection as PrivateEndpointConnectionMapper, SharedPrivateLinkResource as SharedPrivateLinkResourceMapper @@ -47,7 +49,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-10-01", + defaultValue: "2022-08-01-preview", isConstant: true, serializedName: "api-version", type: { @@ -139,6 +141,38 @@ export const parameters2: OperationParameter = { mapper: RegenerateKeyParametersMapper }; +export const certificateName: OperationURLParameter = { + parameterPath: "certificateName", + mapper: { + serializedName: "certificateName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters3: OperationParameter = { + parameterPath: "parameters", + mapper: CustomCertificateMapper +}; + +export const name: OperationURLParameter = { + parameterPath: "name", + mapper: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters4: OperationParameter = { + parameterPath: "parameters", + mapper: CustomDomainMapper +}; + export const hubName: OperationURLParameter = { parameterPath: "hubName", mapper: { @@ -150,7 +184,7 @@ export const hubName: OperationURLParameter = { } }; -export const parameters3: OperationParameter = { +export const parameters5: OperationParameter = { parameterPath: "parameters", mapper: WebPubSubHubMapper }; @@ -166,7 +200,7 @@ export const privateEndpointConnectionName: OperationURLParameter = { } }; -export const parameters4: OperationParameter = { +export const parameters6: OperationParameter = { parameterPath: "parameters", mapper: PrivateEndpointConnectionMapper }; @@ -182,7 +216,7 @@ export const sharedPrivateLinkResourceName: OperationURLParameter = { } }; -export const parameters5: OperationParameter = { +export const parameters7: OperationParameter = { parameterPath: "parameters", mapper: SharedPrivateLinkResourceMapper }; diff --git a/sdk/web-pubsub/arm-webpubsub/src/operations/index.ts b/sdk/web-pubsub/arm-webpubsub/src/operations/index.ts index 90539aef2838..d8a87620926b 100644 --- a/sdk/web-pubsub/arm-webpubsub/src/operations/index.ts +++ b/sdk/web-pubsub/arm-webpubsub/src/operations/index.ts @@ -9,6 +9,8 @@ export * from "./operations"; export * from "./webPubSub"; export * from "./usages"; +export * from "./webPubSubCustomCertificates"; +export * from "./webPubSubCustomDomains"; export * from "./webPubSubHubs"; export * from "./webPubSubPrivateEndpointConnections"; export * from "./webPubSubPrivateLinkResources"; diff --git a/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSub.ts b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSub.ts index 8c0313e37243..7f1fbcd7f9c2 100644 --- a/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSub.ts +++ b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSub.ts @@ -280,10 +280,12 @@ export class WebPubSubImpl implements WebPubSub { { resourceGroupName, resourceName, parameters, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -365,10 +367,13 @@ export class WebPubSubImpl implements WebPubSub { { resourceGroupName, resourceName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" }); + await poller.poll(); + return poller; } /** @@ -454,10 +459,12 @@ export class WebPubSubImpl implements WebPubSub { { resourceGroupName, resourceName, parameters, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -565,11 +572,13 @@ export class WebPubSubImpl implements WebPubSub { { resourceGroupName, resourceName, parameters, options }, regenerateKeyOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); + await poller.poll(); + return poller; } /** @@ -652,11 +661,13 @@ export class WebPubSubImpl implements WebPubSub { { resourceGroupName, resourceName, options }, restartOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); + await poller.poll(); + return poller; } /** diff --git a/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubCustomCertificates.ts b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubCustomCertificates.ts new file mode 100644 index 000000000000..ce8b94a13fa6 --- /dev/null +++ b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubCustomCertificates.ts @@ -0,0 +1,406 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { WebPubSubCustomCertificates } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { WebPubSubManagementClient } from "../webPubSubManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + CustomCertificate, + WebPubSubCustomCertificatesListNextOptionalParams, + WebPubSubCustomCertificatesListOptionalParams, + WebPubSubCustomCertificatesListResponse, + WebPubSubCustomCertificatesGetOptionalParams, + WebPubSubCustomCertificatesGetResponse, + WebPubSubCustomCertificatesCreateOrUpdateOptionalParams, + WebPubSubCustomCertificatesCreateOrUpdateResponse, + WebPubSubCustomCertificatesDeleteOptionalParams, + WebPubSubCustomCertificatesListNextResponse +} from "../models"; + +/// +/** Class containing WebPubSubCustomCertificates operations. */ +export class WebPubSubCustomCertificatesImpl + implements WebPubSubCustomCertificates { + private readonly client: WebPubSubManagementClient; + + /** + * Initialize a new instance of the class WebPubSubCustomCertificates class. + * @param client Reference to the service client + */ + constructor(client: WebPubSubManagementClient) { + this.client = client; + } + + /** + * List all custom certificates. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + resourceName: string, + options?: WebPubSubCustomCertificatesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, resourceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(resourceGroupName, resourceName, options); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + resourceName: string, + options?: WebPubSubCustomCertificatesListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, resourceName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + resourceName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + resourceName: string, + options?: WebPubSubCustomCertificatesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + resourceName, + options + )) { + yield* page; + } + } + + /** + * List all custom certificates. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + resourceName: string, + options?: WebPubSubCustomCertificatesListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + listOperationSpec + ); + } + + /** + * Get a custom certificate. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param certificateName Custom certificate name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + certificateName: string, + options?: WebPubSubCustomCertificatesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, certificateName, options }, + getOperationSpec + ); + } + + /** + * Create or update a custom certificate. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param certificateName Custom certificate name + * @param parameters A custom certificate. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + certificateName: string, + parameters: CustomCertificate, + options?: WebPubSubCustomCertificatesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + WebPubSubCustomCertificatesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, certificateName, parameters, options }, + createOrUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Create or update a custom certificate. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param certificateName Custom certificate name + * @param parameters A custom certificate. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + certificateName: string, + parameters: CustomCertificate, + options?: WebPubSubCustomCertificatesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + resourceName, + certificateName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a custom certificate. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param certificateName Custom certificate name + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + resourceName: string, + certificateName: string, + options?: WebPubSubCustomCertificatesDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, certificateName, options }, + deleteOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + resourceName: string, + nextLink: string, + options?: WebPubSubCustomCertificatesListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customCertificates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CustomCertificateList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customCertificates/{certificateName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CustomCertificate + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.certificateName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customCertificates/{certificateName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.CustomCertificate + }, + 201: { + bodyMapper: Mappers.CustomCertificate + }, + 202: { + bodyMapper: Mappers.CustomCertificate + }, + 204: { + bodyMapper: Mappers.CustomCertificate + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.certificateName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customCertificates/{certificateName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.certificateName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CustomCertificateList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubCustomDomains.ts b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubCustomDomains.ts new file mode 100644 index 000000000000..b0e9cbce70ab --- /dev/null +++ b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubCustomDomains.ts @@ -0,0 +1,477 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { WebPubSubCustomDomains } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { WebPubSubManagementClient } from "../webPubSubManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + CustomDomain, + WebPubSubCustomDomainsListNextOptionalParams, + WebPubSubCustomDomainsListOptionalParams, + WebPubSubCustomDomainsListResponse, + WebPubSubCustomDomainsGetOptionalParams, + WebPubSubCustomDomainsGetResponse, + WebPubSubCustomDomainsCreateOrUpdateOptionalParams, + WebPubSubCustomDomainsCreateOrUpdateResponse, + WebPubSubCustomDomainsDeleteOptionalParams, + WebPubSubCustomDomainsListNextResponse +} from "../models"; + +/// +/** Class containing WebPubSubCustomDomains operations. */ +export class WebPubSubCustomDomainsImpl implements WebPubSubCustomDomains { + private readonly client: WebPubSubManagementClient; + + /** + * Initialize a new instance of the class WebPubSubCustomDomains class. + * @param client Reference to the service client + */ + constructor(client: WebPubSubManagementClient) { + this.client = client; + } + + /** + * List all custom domains. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + resourceName: string, + options?: WebPubSubCustomDomainsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, resourceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(resourceGroupName, resourceName, options); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + resourceName: string, + options?: WebPubSubCustomDomainsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, resourceName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + resourceName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + resourceName: string, + options?: WebPubSubCustomDomainsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + resourceName, + options + )) { + yield* page; + } + } + + /** + * List all custom domains. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + resourceName: string, + options?: WebPubSubCustomDomainsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + listOperationSpec + ); + } + + /** + * Get a custom domain. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param name Custom domain name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + name: string, + options?: WebPubSubCustomDomainsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, name, options }, + getOperationSpec + ); + } + + /** + * Create or update a custom domain. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param name Custom domain name. + * @param parameters A custom domain + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + name: string, + parameters: CustomDomain, + options?: WebPubSubCustomDomainsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + WebPubSubCustomDomainsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, name, parameters, options }, + createOrUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Create or update a custom domain. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param name Custom domain name. + * @param parameters A custom domain + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + name: string, + parameters: CustomDomain, + options?: WebPubSubCustomDomainsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + resourceName, + name, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a custom domain. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param name Custom domain name. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + resourceName: string, + name: string, + options?: WebPubSubCustomDomainsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, name, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a custom domain. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param name Custom domain name. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + name: string, + options?: WebPubSubCustomDomainsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + resourceName, + name, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + resourceName: string, + nextLink: string, + options?: WebPubSubCustomDomainsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customDomains", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CustomDomainList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customDomains/{name}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CustomDomain + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customDomains/{name}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.CustomDomain + }, + 201: { + bodyMapper: Mappers.CustomDomain + }, + 202: { + bodyMapper: Mappers.CustomDomain + }, + 204: { + bodyMapper: Mappers.CustomDomain + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.name + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customDomains/{name}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CustomDomainList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubHubs.ts b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubHubs.ts index 6e2ef6cc66b5..9aa0925f0f35 100644 --- a/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubHubs.ts +++ b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubHubs.ts @@ -203,10 +203,12 @@ export class WebPubSubHubsImpl implements WebPubSubHubs { { hubName, resourceGroupName, resourceName, parameters, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -293,10 +295,13 @@ export class WebPubSubHubsImpl implements WebPubSubHubs { { hubName, resourceGroupName, resourceName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" }); + await poller.poll(); + return poller; } /** @@ -411,7 +416,7 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - requestBody: Parameters.parameters3, + requestBody: Parameters.parameters5, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubPrivateEndpointConnections.ts b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubPrivateEndpointConnections.ts index 5e4acef4fb34..1a54950513ee 100644 --- a/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubPrivateEndpointConnections.ts +++ b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubPrivateEndpointConnections.ts @@ -235,10 +235,13 @@ export class WebPubSubPrivateEndpointConnectionsImpl }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" }); + await poller.poll(); + return poller; } /** @@ -344,7 +347,7 @@ const updateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - requestBody: Parameters.parameters4, + requestBody: Parameters.parameters6, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubSharedPrivateLinkResources.ts b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubSharedPrivateLinkResources.ts index fc1f643e2460..af69cdbf3858 100644 --- a/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubSharedPrivateLinkResources.ts +++ b/sdk/web-pubsub/arm-webpubsub/src/operations/webPubSubSharedPrivateLinkResources.ts @@ -217,10 +217,12 @@ export class WebPubSubSharedPrivateLinkResourcesImpl }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -312,10 +314,13 @@ export class WebPubSubSharedPrivateLinkResourcesImpl }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" }); + await poller.poll(); + return poller; } /** @@ -430,7 +435,7 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - requestBody: Parameters.parameters5, + requestBody: Parameters.parameters7, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/web-pubsub/arm-webpubsub/src/operationsInterfaces/index.ts b/sdk/web-pubsub/arm-webpubsub/src/operationsInterfaces/index.ts index 90539aef2838..d8a87620926b 100644 --- a/sdk/web-pubsub/arm-webpubsub/src/operationsInterfaces/index.ts +++ b/sdk/web-pubsub/arm-webpubsub/src/operationsInterfaces/index.ts @@ -9,6 +9,8 @@ export * from "./operations"; export * from "./webPubSub"; export * from "./usages"; +export * from "./webPubSubCustomCertificates"; +export * from "./webPubSubCustomDomains"; export * from "./webPubSubHubs"; export * from "./webPubSubPrivateEndpointConnections"; export * from "./webPubSubPrivateLinkResources"; diff --git a/sdk/web-pubsub/arm-webpubsub/src/operationsInterfaces/webPubSubCustomCertificates.ts b/sdk/web-pubsub/arm-webpubsub/src/operationsInterfaces/webPubSubCustomCertificates.ts new file mode 100644 index 000000000000..c0966e13f630 --- /dev/null +++ b/sdk/web-pubsub/arm-webpubsub/src/operationsInterfaces/webPubSubCustomCertificates.ts @@ -0,0 +1,101 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + CustomCertificate, + WebPubSubCustomCertificatesListOptionalParams, + WebPubSubCustomCertificatesGetOptionalParams, + WebPubSubCustomCertificatesGetResponse, + WebPubSubCustomCertificatesCreateOrUpdateOptionalParams, + WebPubSubCustomCertificatesCreateOrUpdateResponse, + WebPubSubCustomCertificatesDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a WebPubSubCustomCertificates. */ +export interface WebPubSubCustomCertificates { + /** + * List all custom certificates. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceName: string, + options?: WebPubSubCustomCertificatesListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a custom certificate. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param certificateName Custom certificate name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + certificateName: string, + options?: WebPubSubCustomCertificatesGetOptionalParams + ): Promise; + /** + * Create or update a custom certificate. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param certificateName Custom certificate name + * @param parameters A custom certificate. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + certificateName: string, + parameters: CustomCertificate, + options?: WebPubSubCustomCertificatesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + WebPubSubCustomCertificatesCreateOrUpdateResponse + > + >; + /** + * Create or update a custom certificate. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param certificateName Custom certificate name + * @param parameters A custom certificate. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + certificateName: string, + parameters: CustomCertificate, + options?: WebPubSubCustomCertificatesCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete a custom certificate. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param certificateName Custom certificate name + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + resourceName: string, + certificateName: string, + options?: WebPubSubCustomCertificatesDeleteOptionalParams + ): Promise; +} diff --git a/sdk/web-pubsub/arm-webpubsub/src/operationsInterfaces/webPubSubCustomDomains.ts b/sdk/web-pubsub/arm-webpubsub/src/operationsInterfaces/webPubSubCustomDomains.ts new file mode 100644 index 000000000000..0eb96ef461b2 --- /dev/null +++ b/sdk/web-pubsub/arm-webpubsub/src/operationsInterfaces/webPubSubCustomDomains.ts @@ -0,0 +1,115 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + CustomDomain, + WebPubSubCustomDomainsListOptionalParams, + WebPubSubCustomDomainsGetOptionalParams, + WebPubSubCustomDomainsGetResponse, + WebPubSubCustomDomainsCreateOrUpdateOptionalParams, + WebPubSubCustomDomainsCreateOrUpdateResponse, + WebPubSubCustomDomainsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a WebPubSubCustomDomains. */ +export interface WebPubSubCustomDomains { + /** + * List all custom domains. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceName: string, + options?: WebPubSubCustomDomainsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a custom domain. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param name Custom domain name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + name: string, + options?: WebPubSubCustomDomainsGetOptionalParams + ): Promise; + /** + * Create or update a custom domain. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param name Custom domain name. + * @param parameters A custom domain + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + name: string, + parameters: CustomDomain, + options?: WebPubSubCustomDomainsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + WebPubSubCustomDomainsCreateOrUpdateResponse + > + >; + /** + * Create or update a custom domain. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param name Custom domain name. + * @param parameters A custom domain + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + name: string, + parameters: CustomDomain, + options?: WebPubSubCustomDomainsCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete a custom domain. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param name Custom domain name. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + resourceName: string, + name: string, + options?: WebPubSubCustomDomainsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a custom domain. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param name Custom domain name. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + name: string, + options?: WebPubSubCustomDomainsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/web-pubsub/arm-webpubsub/src/webPubSubManagementClient.ts b/sdk/web-pubsub/arm-webpubsub/src/webPubSubManagementClient.ts index af2243c598f4..026416c3db95 100644 --- a/sdk/web-pubsub/arm-webpubsub/src/webPubSubManagementClient.ts +++ b/sdk/web-pubsub/arm-webpubsub/src/webPubSubManagementClient.ts @@ -7,11 +7,19 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { OperationsImpl, WebPubSubImpl, UsagesImpl, + WebPubSubCustomCertificatesImpl, + WebPubSubCustomDomainsImpl, WebPubSubHubsImpl, WebPubSubPrivateEndpointConnectionsImpl, WebPubSubPrivateLinkResourcesImpl, @@ -21,6 +29,8 @@ import { Operations, WebPubSub, Usages, + WebPubSubCustomCertificates, + WebPubSubCustomDomains, WebPubSubHubs, WebPubSubPrivateEndpointConnections, WebPubSubPrivateLinkResources, @@ -61,7 +71,7 @@ export class WebPubSubManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-webpubsub/1.0.0`; + const packageDetails = `azsdk-js-arm-webpubsub/1.1.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -76,18 +86,53 @@ export class WebPubSubManagementClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: `${optionsWithDefaults.credentialScopes}`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } // Parameter assignments this.subscriptionId = subscriptionId; // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-10-01"; + this.apiVersion = options.apiVersion || "2022-08-01-preview"; this.operations = new OperationsImpl(this); this.webPubSub = new WebPubSubImpl(this); this.usages = new UsagesImpl(this); + this.webPubSubCustomCertificates = new WebPubSubCustomCertificatesImpl( + this + ); + this.webPubSubCustomDomains = new WebPubSubCustomDomainsImpl(this); this.webPubSubHubs = new WebPubSubHubsImpl(this); this.webPubSubPrivateEndpointConnections = new WebPubSubPrivateEndpointConnectionsImpl( this @@ -98,11 +143,42 @@ export class WebPubSubManagementClient extends coreClient.ServiceClient { this.webPubSubSharedPrivateLinkResources = new WebPubSubSharedPrivateLinkResourcesImpl( this ); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); } operations: Operations; webPubSub: WebPubSub; usages: Usages; + webPubSubCustomCertificates: WebPubSubCustomCertificates; + webPubSubCustomDomains: WebPubSubCustomDomains; webPubSubHubs: WebPubSubHubs; webPubSubPrivateEndpointConnections: WebPubSubPrivateEndpointConnections; webPubSubPrivateLinkResources: WebPubSubPrivateLinkResources; diff --git a/sdk/web-pubsub/arm-webpubsub/test/sampleTest.ts b/sdk/web-pubsub/arm-webpubsub/test/sampleTest.ts index 7ed89b043e1b..25aeb3ebcc36 100644 --- a/sdk/web-pubsub/arm-webpubsub/test/sampleTest.ts +++ b/sdk/web-pubsub/arm-webpubsub/test/sampleTest.ts @@ -7,35 +7,30 @@ */ import { - env, - record, - RecorderEnvironmentSetup, - Recorder + Recorder, + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; -import * as assert from "assert"; +import { assert } from "chai"; +import { Context } from "mocha"; -const recorderEnvSetup: RecorderEnvironmentSetup = { - replaceableVariables: { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id" - }, - customizationsOnRecordings: [ - (recording: any): any => - recording.replace( - /"access_token":"[^"]*"/g, - `"access_token":"access_token"` - ) - ], - queryParametersToSkip: [] +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables }; describe("My test", () => { let recorder: Recorder; - beforeEach(async function() { - recorder = record(this, recorderEnvSetup); + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); }); afterEach(async function() { diff --git a/sdk/web-pubsub/arm-webpubsub/tsconfig.json b/sdk/web-pubsub/arm-webpubsub/tsconfig.json index 6e3251194117..3e6ae96443f3 100644 --- a/sdk/web-pubsub/arm-webpubsub/tsconfig.json +++ b/sdk/web-pubsub/arm-webpubsub/tsconfig.json @@ -9,11 +9,19 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", "importHelpers": true }, - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/web-pubsub/ci.mgmt.yml b/sdk/web-pubsub/ci.mgmt.yml index 020f5774c4a1..d2e009c4022f 100644 --- a/sdk/web-pubsub/ci.mgmt.yml +++ b/sdk/web-pubsub/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -10,6 +10,7 @@ trigger: include: - sdk/web-pubsub/ci.mgmt.yml - sdk/web-pubsub/arm-webpubsub/ + - sdk/web-pubsub/arm-webpubsub pr: branches: include: @@ -23,6 +24,7 @@ pr: include: - sdk/web-pubsub/ci.mgmt.yml - sdk/web-pubsub/arm-webpubsub/ + - sdk/web-pubsub/arm-webpubsub extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/web-pubsub/ci.yml b/sdk/web-pubsub/ci.yml index 925c14f176c1..d06dc36e019e 100644 --- a/sdk/web-pubsub/ci.yml +++ b/sdk/web-pubsub/ci.yml @@ -1,3 +1,5 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + trigger: branches: include: @@ -10,6 +12,7 @@ trigger: exclude: - sdk/web-pubsub/ci.mgmt.yml - sdk/web-pubsub/arm-webpubsub/ + - sdk/web-pubsub/arm-webpubsub pr: branches: include: @@ -25,6 +28,7 @@ pr: exclude: - sdk/web-pubsub/ci.mgmt.yml - sdk/web-pubsub/arm-webpubsub/ + - sdk/web-pubsub/arm-webpubsub extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: