From 491bb8a5dc8359eba8a2a0d6703ee57aaabba6ba Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 21 Mar 2023 21:47:33 +0000 Subject: [PATCH] CodeGen from PR 23202 in Azure/azure-rest-api-specs Merge bbee55edb05169aba6d8d1944c0e2bc2b9408943 into 543f1920ac96303cc244d60e1c12f0b56fc646db --- common/config/rush/pnpm-lock.yaml | 22 +- .../arm-communication/CHANGELOG.md | 29 +- sdk/communication/arm-communication/README.md | 2 +- .../arm-communication/_meta.json | 10 +- .../arm-communication/package.json | 22 +- .../review/arm-communication.api.md | 121 ++++-- .../communicationServiceManagementClient.ts | 14 +- .../arm-communication/src/lroImpl.ts | 54 +-- .../arm-communication/src/models/index.ts | 122 +++++- .../arm-communication/src/models/mappers.ts | 80 +++- .../src/models/parameters.ts | 32 +- .../src/operations/communicationServices.ts | 237 ++--------- .../src/operations/domains.ts | 153 ++++--- .../src/operations/emailServices.ts | 78 ++-- .../arm-communication/src/operations/index.ts | 1 + .../src/operations/senderUsernames.ts | 383 ++++++++++++++++++ .../communicationServices.ts | 49 +-- .../src/operationsInterfaces/domains.ts | 21 +- .../src/operationsInterfaces/emailServices.ts | 12 +- .../src/operationsInterfaces/index.ts | 1 + .../operationsInterfaces/senderUsernames.ts | 84 ++++ .../arm-communication/test/sampleTest.ts | 43 ++ .../arm-communication/tsconfig.json | 10 +- 23 files changed, 1078 insertions(+), 502 deletions(-) create mode 100644 sdk/communication/arm-communication/src/operations/senderUsernames.ts create mode 100644 sdk/communication/arm-communication/src/operationsInterfaces/senderUsernames.ts create mode 100644 sdk/communication/arm-communication/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 819babdbf5a2..91678dd2d656 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -731,6 +731,7 @@ packages: /@azure/ai-form-recognizer/3.1.0-beta.3: resolution: {integrity: sha512-+4QtFKNyxAmdqpcYjuAtmWKm/MuOe9kZsbpS9jA9h0YHzngNj5gc67AA4egV9BXOq9x+1phjYTNC/rxiOUr1uQ==} engines: {node: '>=8.0.0'} + deprecated: Please migrate to a supported (non-beta) version of this package dependencies: '@azure/core-auth': 1.4.0 '@azure/core-http': 1.2.6 @@ -3893,7 +3894,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 5.1.0-dev.20230320 + typescript: 5.1.0-dev.20230321 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8749,8 +8750,8 @@ packages: hasBin: true dev: false - /typescript/5.1.0-dev.20230320: - resolution: {integrity: sha512-UWob7IhN/k84vqndbUwXaUNuLfzpgaD3wYm2FAKCUjXE0sMn5rf0Z+A8N2glIfqQBnBObLzIitWepn3TRF9Sjg==} + /typescript/5.1.0-dev.20230321: + resolution: {integrity: sha512-GFq3xvjbJImoKgCDJEiB7Bsa1wQdu/9tlb8Qj475ydSraETbCLzy+Ao3cqQ+KWBM6Mqo+0b1rrpe2Gj0DZz2+w==} engines: {node: '>=12.20'} hasBin: true dev: false @@ -10787,7 +10788,7 @@ packages: dev: false file:projects/arm-communication.tgz: - resolution: {integrity: sha512-ZngMAKiaE2ZDOw6Yyyt5MYMKFaKUJE7g5sOqz/9wnD4aRQhCJ0CtgCBss6mIywzFHtZ79BL0zPOt1JBC38UW8w==, tarball: file:projects/arm-communication.tgz} + resolution: {integrity: sha512-9aggd5C8Ewf5AHKZ5PU/F7soofXTY0qUYZ1fJjNU07i/gGAX+4KKQhOKB7R3gzWfzL8eoHvD/Ho+E30/ZZ0pZA==, tarball: file:projects/arm-communication.tgz} name: '@rush-temp/arm-communication' version: 0.0.0 dependencies: @@ -10801,8 +10802,8 @@ packages: '@types/node': 14.18.38 chai: 4.3.7 cross-env: 7.0.3 - dotenv: 8.6.0 - mkdirp: 1.0.4 + dotenv: 16.0.3 + mkdirp: 2.1.5 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 @@ -12170,19 +12171,19 @@ packages: dev: false file:projects/arm-graphservices.tgz: - resolution: {integrity: sha512-FGMQq6BOIpb01GiMS1PDpo/y17Bb9bxNSMVtLJRoORxpGlTgbpDWB+1o65n5kZ4P2Sda2DScSr+Oml3uXoC3kg==, tarball: file:projects/arm-graphservices.tgz} + resolution: {integrity: sha512-W4Mpd/2C0oFq2ylu1h0QbdANHiy70H5DmfFjBxsY/9xE4X9IV9DlihvCO6i+VJNC0X7BTlvGmfa9JLVgFLjqxg==, tarball: file:projects/arm-graphservices.tgz} name: '@rush-temp/arm-graphservices' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 2.0.0 '@azure/identity': 2.1.0 - '@microsoft/api-extractor': 7.34.4_@types+node@14.18.37 + '@microsoft/api-extractor': 7.34.4_@types+node@14.18.38 '@rollup/plugin-commonjs': 24.0.1_rollup@2.79.1 '@rollup/plugin-json': 6.0.0_rollup@2.79.1 '@rollup/plugin-multi-entry': 6.0.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 '@types/chai': 4.3.4 - '@types/node': 14.18.37 + '@types/node': 14.18.38 chai: 4.3.7 cross-env: 7.0.3 dotenv: 16.0.3 @@ -12190,12 +12191,11 @@ packages: mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3_uvqxrz6xmh6o32kxhfeqlqrt5q + rollup-plugin-sourcemaps: 0.6.3_rrfo4ccoq6ga3fxzubpgdsawvq tslib: 2.5.0 typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - - encoding - supports-color dev: false diff --git a/sdk/communication/arm-communication/CHANGELOG.md b/sdk/communication/arm-communication/CHANGELOG.md index a4848b3f13a6..57abcf4a3395 100644 --- a/sdk/communication/arm-communication/CHANGELOG.md +++ b/sdk/communication/arm-communication/CHANGELOG.md @@ -1,22 +1,13 @@ # Release History - -## 4.0.0-beta.4 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 4.0.0-beta.3 (2023-01-12) + +## 4.0.0 (2023-03-21) **Features** - Added operation group CommunicationServices - Added operation group Domains - Added operation group EmailServices + - Added operation group SenderUsernames - Added Interface CheckNameAvailabilityRequest - Added Interface CheckNameAvailabilityResponse - Added Interface CommunicationServiceResource @@ -34,7 +25,6 @@ - Added Interface CommunicationServicesListBySubscriptionOptionalParams - Added Interface CommunicationServicesListKeysOptionalParams - Added Interface CommunicationServicesRegenerateKeyOptionalParams - - Added Interface CommunicationServicesUpdateHeaders - Added Interface CommunicationServicesUpdateOptionalParams - Added Interface DnsRecord - Added Interface DomainPropertiesVerificationRecords @@ -69,6 +59,14 @@ - Added Interface EmailServicesListVerifiedExchangeOnlineDomainsOptionalParams - Added Interface EmailServicesUpdateHeaders - Added Interface EmailServicesUpdateOptionalParams + - Added Interface ProxyResource + - Added Interface SenderUsernameResource + - Added Interface SenderUsernameResourceCollection + - Added Interface SenderUsernamesCreateOrUpdateOptionalParams + - Added Interface SenderUsernamesDeleteOptionalParams + - Added Interface SenderUsernamesGetOptionalParams + - Added Interface SenderUsernamesListByDomainsNextOptionalParams + - Added Interface SenderUsernamesListByDomainsOptionalParams - Added Interface TrackedResource - Added Interface UpdateDomainRequestParameters - Added Interface VerificationParameter @@ -104,6 +102,10 @@ - Added Type Alias EmailServicesListVerifiedExchangeOnlineDomainsResponse - Added Type Alias EmailServicesProvisioningState - Added Type Alias EmailServicesUpdateResponse + - Added Type Alias SenderUsernamesCreateOrUpdateResponse + - Added Type Alias SenderUsernamesGetResponse + - Added Type Alias SenderUsernamesListByDomainsNextResponse + - Added Type Alias SenderUsernamesListByDomainsResponse - Added Type Alias UserEngagementTracking - Added Type Alias VerificationStatus - Added Type Alias VerificationType @@ -122,7 +124,6 @@ - Removed operation group CommunicationService - Class CommunicationServiceManagementClient no longer has parameter communicationService - - Removed Enum KnownProvisioningState ## 3.0.1 (2022-04-11) diff --git a/sdk/communication/arm-communication/README.md b/sdk/communication/arm-communication/README.md index 8946cde3df04..e8f835d3286a 100644 --- a/sdk/communication/arm-communication/README.md +++ b/sdk/communication/arm-communication/README.md @@ -6,7 +6,7 @@ REST API for Azure Communication Services [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/arm-communication) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-communication) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-communication?view=azure-node-preview) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-communication) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started diff --git a/sdk/communication/arm-communication/_meta.json b/sdk/communication/arm-communication/_meta.json index 88d7b2ac42a2..6ff790e32ae4 100644 --- a/sdk/communication/arm-communication/_meta.json +++ b/sdk/communication/arm-communication/_meta.json @@ -1,8 +1,8 @@ { - "commit": "c3753108541c27b2e5197651702837ec283d37ca", - "readme": "specification\\communication\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\communication\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.5.20221215.1 --generate-sample=true", + "commit": "e966a1db9ba0b20a4585da6fa3bb5d0434f92a5a", + "readme": "specification/communication/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.3 --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/communication/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.10", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.5.4", - "use": "@autorest/typescript@6.0.0-rc.5.20221215.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.2", + "use": "@autorest/typescript@6.0.0-rc.10" } \ No newline at end of file diff --git a/sdk/communication/arm-communication/package.json b/sdk/communication/arm-communication/package.json index 34170f508642..6b98482439b1 100644 --- a/sdk/communication/arm-communication/package.json +++ b/sdk/communication/arm-communication/package.json @@ -3,15 +3,15 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for CommunicationServiceManagementClient.", - "version": "4.0.0-beta.4", + "version": "4.0.0", "engines": { "node": ">=14.0.0" }, "dependencies": { - "@azure/core-lro": "^2.2.0", + "@azure/core-lro": "^2.5.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.6.1", + "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -33,13 +33,13 @@ "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-node-resolve": "^13.1.3", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.2", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", - "dotenv": "^8.2.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -111,13 +111,5 @@ ] }, "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/arm-communication", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-communication?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/arm-communication" +} \ No newline at end of file diff --git a/sdk/communication/arm-communication/review/arm-communication.api.md b/sdk/communication/arm-communication/review/arm-communication.api.md index 85cbe424a8bc..1801c2a18aee 100644 --- a/sdk/communication/arm-communication/review/arm-communication.api.md +++ b/sdk/communication/arm-communication/review/arm-communication.api.md @@ -6,9 +6,9 @@ import * as coreAuth from '@azure/core-auth'; import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { PollerLike } from '@azure/core-lro'; -import { PollOperationState } from '@azure/core-lro'; +import { SimplePollerLike } from '@azure/core-lro'; // @public export type ActionType = string; @@ -53,6 +53,8 @@ export class CommunicationServiceManagementClient extends coreClient.ServiceClie // (undocumented) operations: Operations; // (undocumented) + senderUsernames: SenderUsernames; + // (undocumented) subscriptionId: string; } @@ -87,20 +89,18 @@ export interface CommunicationServiceResourceUpdate extends TaggedResource { // @public export interface CommunicationServices { - beginCreateOrUpdate(resourceGroupName: string, communicationServiceName: string, parameters: CommunicationServiceResource, options?: CommunicationServicesCreateOrUpdateOptionalParams): Promise, CommunicationServicesCreateOrUpdateResponse>>; + beginCreateOrUpdate(resourceGroupName: string, communicationServiceName: string, parameters: CommunicationServiceResource, options?: CommunicationServicesCreateOrUpdateOptionalParams): Promise, CommunicationServicesCreateOrUpdateResponse>>; beginCreateOrUpdateAndWait(resourceGroupName: string, communicationServiceName: string, parameters: CommunicationServiceResource, options?: CommunicationServicesCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, communicationServiceName: string, options?: CommunicationServicesDeleteOptionalParams): Promise, void>>; + beginDelete(resourceGroupName: string, communicationServiceName: string, options?: CommunicationServicesDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, communicationServiceName: string, options?: CommunicationServicesDeleteOptionalParams): Promise; - beginRegenerateKey(resourceGroupName: string, communicationServiceName: string, parameters: RegenerateKeyParameters, options?: CommunicationServicesRegenerateKeyOptionalParams): Promise, CommunicationServicesRegenerateKeyResponse>>; - beginRegenerateKeyAndWait(resourceGroupName: string, communicationServiceName: string, parameters: RegenerateKeyParameters, options?: CommunicationServicesRegenerateKeyOptionalParams): Promise; - beginUpdate(resourceGroupName: string, communicationServiceName: string, parameters: CommunicationServiceResourceUpdate, options?: CommunicationServicesUpdateOptionalParams): Promise, CommunicationServicesUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, communicationServiceName: string, parameters: CommunicationServiceResourceUpdate, options?: CommunicationServicesUpdateOptionalParams): Promise; checkNameAvailability(nameAvailabilityParameters: NameAvailabilityParameters, options?: CommunicationServicesCheckNameAvailabilityOptionalParams): Promise; get(resourceGroupName: string, communicationServiceName: string, options?: CommunicationServicesGetOptionalParams): Promise; linkNotificationHub(resourceGroupName: string, communicationServiceName: string, options?: CommunicationServicesLinkNotificationHubOptionalParams): Promise; listByResourceGroup(resourceGroupName: string, options?: CommunicationServicesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; listBySubscription(options?: CommunicationServicesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; listKeys(resourceGroupName: string, communicationServiceName: string, options?: CommunicationServicesListKeysOptionalParams): Promise; + regenerateKey(resourceGroupName: string, communicationServiceName: string, parameters: RegenerateKeyParameters, options?: CommunicationServicesRegenerateKeyOptionalParams): Promise; + update(resourceGroupName: string, communicationServiceName: string, parameters: CommunicationServiceResourceUpdate, options?: CommunicationServicesUpdateOptionalParams): Promise; } // @public @@ -190,22 +190,13 @@ export type CommunicationServicesProvisioningState = string; // @public export interface CommunicationServicesRegenerateKeyOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; } // @public export type CommunicationServicesRegenerateKeyResponse = CommunicationServiceKeys; -// @public -export interface CommunicationServicesUpdateHeaders { - azureAsyncOperation?: string; -} - // @public export interface CommunicationServicesUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; } // @public @@ -251,9 +242,6 @@ export interface DomainResource extends TrackedResource { readonly mailFromSenderDomain?: string; readonly provisioningState?: DomainsProvisioningState; userEngagementTracking?: UserEngagementTracking; - validSenderUsernames?: { - [propertyName: string]: string; - }; readonly verificationRecords?: DomainPropertiesVerificationRecords; readonly verificationStates?: DomainPropertiesVerificationStates; } @@ -266,15 +254,15 @@ export interface DomainResourceList { // @public export interface Domains { - beginCancelVerification(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: VerificationParameter, options?: DomainsCancelVerificationOptionalParams): Promise, DomainsCancelVerificationResponse>>; + beginCancelVerification(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: VerificationParameter, options?: DomainsCancelVerificationOptionalParams): Promise, DomainsCancelVerificationResponse>>; beginCancelVerificationAndWait(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: VerificationParameter, options?: DomainsCancelVerificationOptionalParams): Promise; - beginCreateOrUpdate(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: DomainResource, options?: DomainsCreateOrUpdateOptionalParams): Promise, DomainsCreateOrUpdateResponse>>; + beginCreateOrUpdate(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: DomainResource, options?: DomainsCreateOrUpdateOptionalParams): Promise, DomainsCreateOrUpdateResponse>>; beginCreateOrUpdateAndWait(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: DomainResource, options?: DomainsCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, emailServiceName: string, domainName: string, options?: DomainsDeleteOptionalParams): Promise, void>>; + beginDelete(resourceGroupName: string, emailServiceName: string, domainName: string, options?: DomainsDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, emailServiceName: string, domainName: string, options?: DomainsDeleteOptionalParams): Promise; - beginInitiateVerification(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: VerificationParameter, options?: DomainsInitiateVerificationOptionalParams): Promise, DomainsInitiateVerificationResponse>>; + beginInitiateVerification(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: VerificationParameter, options?: DomainsInitiateVerificationOptionalParams): Promise, DomainsInitiateVerificationResponse>>; beginInitiateVerificationAndWait(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: VerificationParameter, options?: DomainsInitiateVerificationOptionalParams): Promise; - beginUpdate(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: UpdateDomainRequestParameters, options?: DomainsUpdateOptionalParams): Promise, DomainsUpdateResponse>>; + beginUpdate(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: UpdateDomainRequestParameters, options?: DomainsUpdateOptionalParams): Promise, DomainsUpdateResponse>>; beginUpdateAndWait(resourceGroupName: string, emailServiceName: string, domainName: string, parameters: UpdateDomainRequestParameters, options?: DomainsUpdateOptionalParams): Promise; get(resourceGroupName: string, emailServiceName: string, domainName: string, options?: DomainsGetOptionalParams): Promise; listByEmailServiceResource(resourceGroupName: string, emailServiceName: string, options?: DomainsListByEmailServiceResourceOptionalParams): PagedAsyncIterableIterator; @@ -389,11 +377,11 @@ export interface EmailServiceResourceUpdate extends TaggedResource { // @public export interface EmailServices { - beginCreateOrUpdate(resourceGroupName: string, emailServiceName: string, parameters: EmailServiceResource, options?: EmailServicesCreateOrUpdateOptionalParams): Promise, EmailServicesCreateOrUpdateResponse>>; + beginCreateOrUpdate(resourceGroupName: string, emailServiceName: string, parameters: EmailServiceResource, options?: EmailServicesCreateOrUpdateOptionalParams): Promise, EmailServicesCreateOrUpdateResponse>>; beginCreateOrUpdateAndWait(resourceGroupName: string, emailServiceName: string, parameters: EmailServiceResource, options?: EmailServicesCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, emailServiceName: string, options?: EmailServicesDeleteOptionalParams): Promise, void>>; + beginDelete(resourceGroupName: string, emailServiceName: string, options?: EmailServicesDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, emailServiceName: string, options?: EmailServicesDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, emailServiceName: string, parameters: EmailServiceResourceUpdate, options?: EmailServicesUpdateOptionalParams): Promise, EmailServicesUpdateResponse>>; + beginUpdate(resourceGroupName: string, emailServiceName: string, parameters: EmailServiceResourceUpdate, options?: EmailServicesUpdateOptionalParams): Promise, EmailServicesUpdateResponse>>; beginUpdateAndWait(resourceGroupName: string, emailServiceName: string, parameters: EmailServiceResourceUpdate, options?: EmailServicesUpdateOptionalParams): Promise; get(resourceGroupName: string, emailServiceName: string, options?: EmailServicesGetOptionalParams): Promise; listByResourceGroup(resourceGroupName: string, options?: EmailServicesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; @@ -586,6 +574,19 @@ export enum KnownOrigin { UserSystem = "user,system" } +// @public +export enum KnownProvisioningState { + Canceled = "Canceled", + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Moving = "Moving", + Running = "Running", + Succeeded = "Succeeded", + Unknown = "Unknown", + Updating = "Updating" +} + // @public export enum KnownUserEngagementTracking { Disabled = "Disabled", @@ -671,6 +672,13 @@ export type OperationsListResponse = OperationListResult; // @public export type Origin = string; +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + // @public export interface RegenerateKeyParameters { keyType?: KeyType_2; @@ -684,6 +692,60 @@ export interface Resource { readonly type?: string; } +// @public +export interface SenderUsernameResource extends ProxyResource { + readonly dataLocation?: string; + displayName?: string; + readonly provisioningState?: ProvisioningState; + username?: string; +} + +// @public +export interface SenderUsernameResourceCollection { + nextLink?: string; + value?: SenderUsernameResource[]; +} + +// @public +export interface SenderUsernames { + createOrUpdate(resourceGroupName: string, emailServiceName: string, domainName: string, senderUsername: string, parameters: SenderUsernameResource, options?: SenderUsernamesCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, emailServiceName: string, domainName: string, senderUsername: string, options?: SenderUsernamesDeleteOptionalParams): Promise; + get(resourceGroupName: string, emailServiceName: string, domainName: string, senderUsername: string, options?: SenderUsernamesGetOptionalParams): Promise; + listByDomains(resourceGroupName: string, emailServiceName: string, domainName: string, options?: SenderUsernamesListByDomainsOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SenderUsernamesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SenderUsernamesCreateOrUpdateResponse = SenderUsernameResource; + +// @public +export interface SenderUsernamesDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface SenderUsernamesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SenderUsernamesGetResponse = SenderUsernameResource; + +// @public +export interface SenderUsernamesListByDomainsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SenderUsernamesListByDomainsNextResponse = SenderUsernameResourceCollection; + +// @public +export interface SenderUsernamesListByDomainsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SenderUsernamesListByDomainsResponse = SenderUsernameResourceCollection; + // @public export interface SystemData { createdAt?: Date; @@ -712,9 +774,6 @@ export interface TrackedResource extends Resource { // @public export interface UpdateDomainRequestParameters extends TaggedResource { userEngagementTracking?: UserEngagementTracking; - validSenderUsernames?: { - [propertyName: string]: string; - }; } // @public diff --git a/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts b/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts index e0826e9d4416..8fbf5d84649f 100644 --- a/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts +++ b/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts @@ -18,13 +18,15 @@ import { OperationsImpl, CommunicationServicesImpl, DomainsImpl, - EmailServicesImpl + EmailServicesImpl, + SenderUsernamesImpl } from "./operations"; import { Operations, CommunicationServices, Domains, - EmailServices + EmailServices, + SenderUsernames } from "./operationsInterfaces"; import { CommunicationServiceManagementClientOptionalParams } from "./models"; @@ -36,7 +38,7 @@ export class CommunicationServiceManagementClient extends coreClient.ServiceClie /** * Initializes a new instance of the CommunicationServiceManagementClient class. * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. * @param options The parameter options */ constructor( @@ -60,7 +62,7 @@ export class CommunicationServiceManagementClient extends coreClient.ServiceClie credential: credentials }; - const packageDetails = `azsdk-js-arm-communication/4.0.0-beta.4`; + const packageDetails = `azsdk-js-arm-communication/4.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -113,11 +115,12 @@ export class CommunicationServiceManagementClient extends coreClient.ServiceClie // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2022-07-01-preview"; + this.apiVersion = options.apiVersion || "2023-03-31"; this.operations = new OperationsImpl(this); this.communicationServices = new CommunicationServicesImpl(this); this.domains = new DomainsImpl(this); this.emailServices = new EmailServicesImpl(this); + this.senderUsernames = new SenderUsernamesImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); } @@ -153,4 +156,5 @@ export class CommunicationServiceManagementClient extends coreClient.ServiceClie communicationServices: CommunicationServices; domains: Domains; emailServices: EmailServices; + senderUsernames: SenderUsernames; } diff --git a/sdk/communication/arm-communication/src/lroImpl.ts b/sdk/communication/arm-communication/src/lroImpl.ts index 518d5f053b4e..dd803cd5e28c 100644 --- a/sdk/communication/arm-communication/src/lroImpl.ts +++ b/sdk/communication/arm-communication/src/lroImpl.ts @@ -6,29 +6,37 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; import { LongRunningOperation, LroResponse } from "@azure/core-lro"; -export class LroImpl implements LongRunningOperation { - constructor( - private sendOperationFn: (args: any, spec: any) => Promise>, - private args: Record, - private spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record, - public requestPath: string = spec.path!, - public requestMethod: string = spec.httpMethod - ) {} - public async sendInitialRequest(): Promise> { - return this.sendOperationFn(this.args, this.spec); - } - public async sendPollRequest(path: string): Promise> { - const { requestBody, ...restSpec } = this.spec; - return this.sendOperationFn(this.args, { - ...restSpec, - path, - httpMethod: "GET" - }); - } +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; } diff --git a/sdk/communication/arm-communication/src/models/index.ts b/sdk/communication/arm-communication/src/models/index.ts index cc41b6cbd490..53bc8a60e325 100644 --- a/sdk/communication/arm-communication/src/models/index.ts +++ b/sdk/communication/arm-communication/src/models/index.ts @@ -167,7 +167,7 @@ export interface CommunicationServiceResourceList { /** Common fields that are returned in the response for all Azure Resource Manager resources */ export interface Resource { /** - * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; @@ -322,6 +322,14 @@ export interface EmailServiceResourceList { nextLink?: string; } +/** A class representing a Domains SenderUsernames collection. */ +export interface SenderUsernameResourceCollection { + /** List of SenderUsernames */ + value?: SenderUsernameResource[]; + /** The URL the client should use to fetch the next page (per server side paging). */ + nextLink?: string; +} + /** Data POST-ed to the nameAvailability action */ export interface NameAvailabilityParameters extends CheckNameAvailabilityRequest {} @@ -334,6 +342,9 @@ export interface TrackedResource extends Resource { location: string; } +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + /** A class representing update parameters for CommunicationService resource. */ export interface CommunicationServiceResourceUpdate extends TaggedResource { /** List of email Domain resource Ids. */ @@ -342,8 +353,6 @@ export interface CommunicationServiceResourceUpdate extends TaggedResource { /** A class that describes the PATCH request parameters of a Domains resource. */ export interface UpdateDomainRequestParameters extends TaggedResource { - /** Collection of valid sender usernames. This is a key-value pair where key=username and value=display name. */ - validSenderUsernames?: { [propertyName: string]: string }; /** Describes whether user engagement tracking is enabled or disabled. */ userEngagementTracking?: UserEngagementTracking; } @@ -418,8 +427,6 @@ export interface DomainResource extends TrackedResource { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly verificationRecords?: DomainPropertiesVerificationRecords; - /** Collection of valid sender usernames. This is a key-value pair where key=username and value=display name. */ - validSenderUsernames?: { [propertyName: string]: string }; /** Describes whether user engagement tracking is enabled or disabled. */ userEngagementTracking?: UserEngagementTracking; } @@ -435,10 +442,22 @@ export interface EmailServiceResource extends TrackedResource { dataLocation?: string; } -/** Defines headers for CommunicationServices_update operation. */ -export interface CommunicationServicesUpdateHeaders { - /** URL to query for status of the operation. */ - azureAsyncOperation?: string; +/** A class representing a SenderUsername resource. */ +export interface SenderUsernameResource extends ProxyResource { + /** + * The location where the SenderUsername resource data is stored at rest. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly dataLocation?: string; + /** A sender senderUsername to be used when sending emails. */ + username?: string; + /** The display name for the senderUsername. */ + displayName?: string; + /** + * Provisioning state of the resource. Unknown is the default state for Communication Services. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; } /** Defines headers for CommunicationServices_createOrUpdate operation. */ @@ -791,6 +810,45 @@ export enum KnownEmailServicesProvisioningState { * **Moving** */ export type EmailServicesProvisioningState = 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" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Running** \ + * **Creating** \ + * **Updating** \ + * **Deleting** \ + * **Moving** + */ +export type ProvisioningState = string; /** Defines values for KeyType. */ export type KeyType = "Primary" | "Secondary"; @@ -841,12 +899,7 @@ export type CommunicationServicesListByResourceGroupResponse = CommunicationServ /** Optional parameters. */ export interface CommunicationServicesUpdateOptionalParams - 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; -} + extends coreClient.OperationOptions {} /** Contains response data for the update operation. */ export type CommunicationServicesUpdateResponse = CommunicationServiceResource; @@ -888,12 +941,7 @@ export type CommunicationServicesListKeysResponse = CommunicationServiceKeys; /** Optional parameters. */ export interface CommunicationServicesRegenerateKeyOptionalParams - 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; -} + extends coreClient.OperationOptions {} /** Contains response data for the regenerateKey operation. */ export type CommunicationServicesRegenerateKeyResponse = CommunicationServiceKeys; @@ -1067,6 +1115,38 @@ export interface EmailServicesListByResourceGroupNextOptionalParams /** Contains response data for the listByResourceGroupNext operation. */ export type EmailServicesListByResourceGroupNextResponse = EmailServiceResourceList; +/** Optional parameters. */ +export interface SenderUsernamesListByDomainsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByDomains operation. */ +export type SenderUsernamesListByDomainsResponse = SenderUsernameResourceCollection; + +/** Optional parameters. */ +export interface SenderUsernamesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SenderUsernamesGetResponse = SenderUsernameResource; + +/** Optional parameters. */ +export interface SenderUsernamesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type SenderUsernamesCreateOrUpdateResponse = SenderUsernameResource; + +/** Optional parameters. */ +export interface SenderUsernamesDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface SenderUsernamesListByDomainsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByDomainsNext operation. */ +export type SenderUsernamesListByDomainsNextResponse = SenderUsernameResourceCollection; + /** Optional parameters. */ export interface CommunicationServiceManagementClientOptionalParams extends coreClient.ServiceClientOptions { diff --git a/sdk/communication/arm-communication/src/models/mappers.ts b/sdk/communication/arm-communication/src/models/mappers.ts index f582674deb25..d966b1e1b4aa 100644 --- a/sdk/communication/arm-communication/src/models/mappers.ts +++ b/sdk/communication/arm-communication/src/models/mappers.ts @@ -692,6 +692,33 @@ export const EmailServiceResourceList: coreClient.CompositeMapper = { } }; +export const SenderUsernameResourceCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SenderUsernameResourceCollection", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SenderUsernameResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + export const NameAvailabilityParameters: coreClient.CompositeMapper = { type: { name: "Composite", @@ -726,6 +753,16 @@ export const TrackedResource: coreClient.CompositeMapper = { } }; +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + export const CommunicationServiceResourceUpdate: coreClient.CompositeMapper = { type: { name: "Composite", @@ -753,13 +790,6 @@ export const UpdateDomainRequestParameters: coreClient.CompositeMapper = { className: "UpdateDomainRequestParameters", modelProperties: { ...TaggedResource.type.modelProperties, - validSenderUsernames: { - serializedName: "properties.validSenderUsernames", - type: { - name: "Dictionary", - value: { type: { name: "String" } } - } - }, userEngagementTracking: { serializedName: "properties.userEngagementTracking", type: { @@ -896,13 +926,6 @@ export const DomainResource: coreClient.CompositeMapper = { className: "DomainPropertiesVerificationRecords" } }, - validSenderUsernames: { - serializedName: "properties.validSenderUsernames", - type: { - name: "Dictionary", - value: { type: { name: "String" } } - } - }, userEngagementTracking: { serializedName: "properties.userEngagementTracking", type: { @@ -936,13 +959,34 @@ export const EmailServiceResource: coreClient.CompositeMapper = { } }; -export const CommunicationServicesUpdateHeaders: coreClient.CompositeMapper = { +export const SenderUsernameResource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CommunicationServicesUpdateHeaders", + className: "SenderUsernameResource", modelProperties: { - azureAsyncOperation: { - serializedName: "azure-asyncoperation", + ...ProxyResource.type.modelProperties, + dataLocation: { + serializedName: "properties.dataLocation", + readOnly: true, + type: { + name: "String" + } + }, + username: { + serializedName: "properties.username", + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, type: { name: "String" } diff --git a/sdk/communication/arm-communication/src/models/parameters.ts b/sdk/communication/arm-communication/src/models/parameters.ts index e5d87e61eb23..0b45055b4de5 100644 --- a/sdk/communication/arm-communication/src/models/parameters.ts +++ b/sdk/communication/arm-communication/src/models/parameters.ts @@ -21,7 +21,8 @@ import { UpdateDomainRequestParameters as UpdateDomainRequestParametersMapper, VerificationParameter as VerificationParameterMapper, EmailServiceResource as EmailServiceResourceMapper, - EmailServiceResourceUpdate as EmailServiceResourceUpdateMapper + EmailServiceResourceUpdate as EmailServiceResourceUpdateMapper, + SenderUsernameResource as SenderUsernameResourceMapper } from "../models/mappers"; export const accept: OperationParameter = { @@ -51,7 +52,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-07-01-preview", + defaultValue: "2023-03-31", isConstant: true, serializedName: "api-version", type: { @@ -92,13 +93,10 @@ export const nameAvailabilityParameters: OperationParameter = { export const subscriptionId: OperationURLParameter = { parameterPath: "subscriptionId", mapper: { - constraints: { - MinLength: 1 - }, serializedName: "subscriptionId", required: true, type: { - name: "String" + name: "Uuid" } } }; @@ -127,7 +125,7 @@ export const communicationServiceName: OperationURLParameter = { parameterPath: "communicationServiceName", mapper: { constraints: { - Pattern: new RegExp("^[-\\w]+$"), + Pattern: new RegExp("^[a-zA-Z0-9-]+$"), MaxLength: 63, MinLength: 1 }, @@ -209,3 +207,23 @@ export const parameters7: OperationParameter = { parameterPath: "parameters", mapper: EmailServiceResourceUpdateMapper }; + +export const senderUsername: OperationURLParameter = { + parameterPath: "senderUsername", + mapper: { + constraints: { + MaxLength: 253, + MinLength: 1 + }, + serializedName: "senderUsername", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters8: OperationParameter = { + parameterPath: "parameters", + mapper: SenderUsernameResourceMapper +}; diff --git a/sdk/communication/arm-communication/src/operations/communicationServices.ts b/sdk/communication/arm-communication/src/operations/communicationServices.ts index 71877ae368d5..66c4413c4631 100644 --- a/sdk/communication/arm-communication/src/operations/communicationServices.ts +++ b/sdk/communication/arm-communication/src/operations/communicationServices.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { CommunicationServiceManagementClient } from "../communicationServiceManagementClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { CommunicationServiceResource, CommunicationServicesListBySubscriptionNextOptionalParams, @@ -248,90 +252,16 @@ export class CommunicationServicesImpl implements CommunicationServices { * @param parameters Parameters for the update operation * @param options The options parameters. */ - async beginUpdate( + update( resourceGroupName: string, communicationServiceName: string, parameters: CommunicationServiceResourceUpdate, options?: CommunicationServicesUpdateOptionalParams - ): Promise< - PollerLike< - PollOperationState, - CommunicationServicesUpdateResponse - > - > { - 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, + ): Promise { + return this.client.sendOperationRequest( { resourceGroupName, communicationServiceName, parameters, options }, updateOperationSpec ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "azure-async-operation" - }); - await poller.poll(); - return poller; - } - - /** - * Operation to update an existing CommunicationService. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameters for the update operation - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - communicationServiceName: string, - parameters: CommunicationServiceResourceUpdate, - options?: CommunicationServicesUpdateOptionalParams - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - communicationServiceName, - parameters, - options - ); - return poller.pollUntilDone(); } /** @@ -364,8 +294,8 @@ export class CommunicationServicesImpl implements CommunicationServices { parameters: CommunicationServiceResource, options?: CommunicationServicesCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, CommunicationServicesCreateOrUpdateResponse > > { @@ -375,7 +305,7 @@ export class CommunicationServicesImpl implements CommunicationServices { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -408,15 +338,23 @@ export class CommunicationServicesImpl implements CommunicationServices { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, communicationServiceName, parameters, options }, - createOrUpdateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + communicationServiceName, + parameters, + options + }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + CommunicationServicesCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "azure-async-operation" + resourceLocationConfig: "azure-async-operation" }); await poller.poll(); return poller; @@ -454,14 +392,14 @@ export class CommunicationServicesImpl implements CommunicationServices { resourceGroupName: string, communicationServiceName: string, options?: CommunicationServicesDeleteOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -494,15 +432,15 @@ export class CommunicationServicesImpl implements CommunicationServices { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, communicationServiceName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, communicationServiceName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -552,91 +490,16 @@ export class CommunicationServicesImpl implements CommunicationServices { * @param parameters Parameter that describes the Regenerate Key Operation. * @param options The options parameters. */ - async beginRegenerateKey( + regenerateKey( resourceGroupName: string, communicationServiceName: string, parameters: RegenerateKeyParameters, options?: CommunicationServicesRegenerateKeyOptionalParams - ): Promise< - PollerLike< - PollOperationState, - CommunicationServicesRegenerateKeyResponse - > - > { - 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, + ): Promise { + return this.client.sendOperationRequest( { resourceGroupName, communicationServiceName, parameters, options }, regenerateKeyOperationSpec ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "azure-async-operation" - }); - await poller.poll(); - return poller; - } - - /** - * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the - * same time. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameter that describes the Regenerate Key Operation. - * @param options The options parameters. - */ - async beginRegenerateKeyAndWait( - resourceGroupName: string, - communicationServiceName: string, - parameters: RegenerateKeyParameters, - options?: CommunicationServicesRegenerateKeyOptionalParams - ): Promise { - const poller = await this.beginRegenerateKey( - resourceGroupName, - communicationServiceName, - parameters, - options - ); - return poller.pollUntilDone(); } /** @@ -763,15 +626,6 @@ const updateOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.CommunicationServiceResource }, - 201: { - bodyMapper: Mappers.CommunicationServiceResource - }, - 202: { - bodyMapper: Mappers.CommunicationServiceResource - }, - 204: { - bodyMapper: Mappers.CommunicationServiceResource - }, default: { bodyMapper: Mappers.ErrorResponse } @@ -896,15 +750,6 @@ const regenerateKeyOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.CommunicationServiceKeys }, - 201: { - bodyMapper: Mappers.CommunicationServiceKeys - }, - 202: { - bodyMapper: Mappers.CommunicationServiceKeys - }, - 204: { - bodyMapper: Mappers.CommunicationServiceKeys - }, default: { bodyMapper: Mappers.ErrorResponse } diff --git a/sdk/communication/arm-communication/src/operations/domains.ts b/sdk/communication/arm-communication/src/operations/domains.ts index 3b6e0278323f..e0eccee73189 100644 --- a/sdk/communication/arm-communication/src/operations/domains.ts +++ b/sdk/communication/arm-communication/src/operations/domains.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { CommunicationServiceManagementClient } from "../communicationServiceManagementClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { DomainResource, DomainsListByEmailServiceResourceNextOptionalParams, @@ -168,8 +172,8 @@ export class DomainsImpl implements Domains { parameters: DomainResource, options?: DomainsCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, DomainsCreateOrUpdateResponse > > { @@ -179,7 +183,7 @@ export class DomainsImpl implements Domains { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -212,15 +216,24 @@ export class DomainsImpl implements Domains { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, emailServiceName, domainName, parameters, options }, - createOrUpdateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + emailServiceName, + domainName, + parameters, + options + }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + DomainsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "azure-async-operation" + resourceLocationConfig: "azure-async-operation" }); await poller.poll(); return poller; @@ -264,14 +277,14 @@ export class DomainsImpl implements Domains { emailServiceName: string, domainName: string, options?: DomainsDeleteOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -304,15 +317,15 @@ export class DomainsImpl implements Domains { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, emailServiceName, domainName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, emailServiceName, domainName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -355,7 +368,10 @@ export class DomainsImpl implements Domains { parameters: UpdateDomainRequestParameters, options?: DomainsUpdateOptionalParams ): Promise< - PollerLike, DomainsUpdateResponse> + SimplePollerLike< + OperationState, + DomainsUpdateResponse + > > { const directSendOperation = async ( args: coreClient.OperationArguments, @@ -363,7 +379,7 @@ export class DomainsImpl implements Domains { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -396,15 +412,24 @@ export class DomainsImpl implements Domains { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, emailServiceName, domainName, parameters, options }, - updateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + emailServiceName, + domainName, + parameters, + options + }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + DomainsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "azure-async-operation" + resourceLocationConfig: "azure-async-operation" }); await poller.poll(); return poller; @@ -467,8 +492,8 @@ export class DomainsImpl implements Domains { parameters: VerificationParameter, options?: DomainsInitiateVerificationOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, DomainsInitiateVerificationResponse > > { @@ -478,7 +503,7 @@ export class DomainsImpl implements Domains { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -511,15 +536,24 @@ export class DomainsImpl implements Domains { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, emailServiceName, domainName, parameters, options }, - initiateVerificationOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + emailServiceName, + domainName, + parameters, + options + }, + spec: initiateVerificationOperationSpec + }); + const poller = await createHttpPoller< + DomainsInitiateVerificationResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -565,8 +599,8 @@ export class DomainsImpl implements Domains { parameters: VerificationParameter, options?: DomainsCancelVerificationOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, DomainsCancelVerificationResponse > > { @@ -576,7 +610,7 @@ export class DomainsImpl implements Domains { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -609,15 +643,24 @@ export class DomainsImpl implements Domains { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, emailServiceName, domainName, parameters, options }, - cancelVerificationOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + emailServiceName, + domainName, + parameters, + options + }, + spec: cancelVerificationOperationSpec + }); + const poller = await createHttpPoller< + DomainsCancelVerificationResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "location" }); await poller.poll(); return poller; diff --git a/sdk/communication/arm-communication/src/operations/emailServices.ts b/sdk/communication/arm-communication/src/operations/emailServices.ts index a8aa6d42a013..1be603f9fb7a 100644 --- a/sdk/communication/arm-communication/src/operations/emailServices.ts +++ b/sdk/communication/arm-communication/src/operations/emailServices.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { CommunicationServiceManagementClient } from "../communicationServiceManagementClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { EmailServiceResource, EmailServicesListBySubscriptionNextOptionalParams, @@ -203,8 +207,8 @@ export class EmailServicesImpl implements EmailServices { parameters: EmailServiceResource, options?: EmailServicesCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, EmailServicesCreateOrUpdateResponse > > { @@ -214,7 +218,7 @@ export class EmailServicesImpl implements EmailServices { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -247,15 +251,18 @@ export class EmailServicesImpl implements EmailServices { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, emailServiceName, parameters, options }, - createOrUpdateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, emailServiceName, parameters, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + EmailServicesCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "azure-async-operation" + resourceLocationConfig: "azure-async-operation" }); await poller.poll(); return poller; @@ -293,14 +300,14 @@ export class EmailServicesImpl implements EmailServices { resourceGroupName: string, emailServiceName: string, options?: EmailServicesDeleteOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -333,15 +340,15 @@ export class EmailServicesImpl implements EmailServices { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, emailServiceName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, emailServiceName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -379,8 +386,8 @@ export class EmailServicesImpl implements EmailServices { parameters: EmailServiceResourceUpdate, options?: EmailServicesUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, EmailServicesUpdateResponse > > { @@ -390,7 +397,7 @@ export class EmailServicesImpl implements EmailServices { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -423,15 +430,18 @@ export class EmailServicesImpl implements EmailServices { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, emailServiceName, parameters, options }, - updateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, emailServiceName, parameters, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + EmailServicesUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "azure-async-operation" + resourceLocationConfig: "azure-async-operation" }); await poller.poll(); return poller; diff --git a/sdk/communication/arm-communication/src/operations/index.ts b/sdk/communication/arm-communication/src/operations/index.ts index 7ac67a892445..1d47ce38a16e 100644 --- a/sdk/communication/arm-communication/src/operations/index.ts +++ b/sdk/communication/arm-communication/src/operations/index.ts @@ -10,3 +10,4 @@ export * from "./operations"; export * from "./communicationServices"; export * from "./domains"; export * from "./emailServices"; +export * from "./senderUsernames"; diff --git a/sdk/communication/arm-communication/src/operations/senderUsernames.ts b/sdk/communication/arm-communication/src/operations/senderUsernames.ts new file mode 100644 index 000000000000..12836520c7e3 --- /dev/null +++ b/sdk/communication/arm-communication/src/operations/senderUsernames.ts @@ -0,0 +1,383 @@ +/* + * 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, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { SenderUsernames } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CommunicationServiceManagementClient } from "../communicationServiceManagementClient"; +import { + SenderUsernameResource, + SenderUsernamesListByDomainsNextOptionalParams, + SenderUsernamesListByDomainsOptionalParams, + SenderUsernamesListByDomainsResponse, + SenderUsernamesGetOptionalParams, + SenderUsernamesGetResponse, + SenderUsernamesCreateOrUpdateOptionalParams, + SenderUsernamesCreateOrUpdateResponse, + SenderUsernamesDeleteOptionalParams, + SenderUsernamesListByDomainsNextResponse +} from "../models"; + +/// +/** Class containing SenderUsernames operations. */ +export class SenderUsernamesImpl implements SenderUsernames { + private readonly client: CommunicationServiceManagementClient; + + /** + * Initialize a new instance of the class SenderUsernames class. + * @param client Reference to the service client + */ + constructor(client: CommunicationServiceManagementClient) { + this.client = client; + } + + /** + * List all valid sender usernames for a domains resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param options The options parameters. + */ + public listByDomains( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + options?: SenderUsernamesListByDomainsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByDomainsPagingAll( + resourceGroupName, + emailServiceName, + domainName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByDomainsPagingPage( + resourceGroupName, + emailServiceName, + domainName, + options, + settings + ); + } + }; + } + + private async *listByDomainsPagingPage( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + options?: SenderUsernamesListByDomainsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: SenderUsernamesListByDomainsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByDomains( + resourceGroupName, + emailServiceName, + domainName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByDomainsNext( + resourceGroupName, + emailServiceName, + domainName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByDomainsPagingAll( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + options?: SenderUsernamesListByDomainsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByDomainsPagingPage( + resourceGroupName, + emailServiceName, + domainName, + options + )) { + yield* page; + } + } + + /** + * List all valid sender usernames for a domains resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param options The options parameters. + */ + private _listByDomains( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + options?: SenderUsernamesListByDomainsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, emailServiceName, domainName, options }, + listByDomainsOperationSpec + ); + } + + /** + * Get a valid sender username for a domains resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param senderUsername The valid sender Username. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + senderUsername: string, + options?: SenderUsernamesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + emailServiceName, + domainName, + senderUsername, + options + }, + getOperationSpec + ); + } + + /** + * Add a new SenderUsername resource under the parent Domains resource or update an existing + * SenderUsername resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param senderUsername The valid sender Username. + * @param parameters Parameters for the create or update operation + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + senderUsername: string, + parameters: SenderUsernameResource, + options?: SenderUsernamesCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + emailServiceName, + domainName, + senderUsername, + parameters, + options + }, + createOrUpdateOperationSpec + ); + } + + /** + * Operation to delete a SenderUsernames resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param senderUsername The valid sender Username. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + senderUsername: string, + options?: SenderUsernamesDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + emailServiceName, + domainName, + senderUsername, + options + }, + deleteOperationSpec + ); + } + + /** + * ListByDomainsNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param nextLink The nextLink from the previous successful call to the ListByDomains method. + * @param options The options parameters. + */ + private _listByDomainsNext( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + nextLink: string, + options?: SenderUsernamesListByDomainsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, emailServiceName, domainName, nextLink, options }, + listByDomainsNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByDomainsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SenderUsernameResourceCollection + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.emailServiceName, + Parameters.domainName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SenderUsernameResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.emailServiceName, + Parameters.domainName, + Parameters.senderUsername + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SenderUsernameResource + }, + 201: { + bodyMapper: Mappers.SenderUsernameResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters8, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.emailServiceName, + Parameters.domainName, + Parameters.senderUsername + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.emailServiceName, + Parameters.domainName, + Parameters.senderUsername + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByDomainsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SenderUsernameResourceCollection + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.emailServiceName, + Parameters.domainName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/communication/arm-communication/src/operationsInterfaces/communicationServices.ts b/sdk/communication/arm-communication/src/operationsInterfaces/communicationServices.ts index 9ba77fa04306..6425c7deb57c 100644 --- a/sdk/communication/arm-communication/src/operationsInterfaces/communicationServices.ts +++ b/sdk/communication/arm-communication/src/operationsInterfaces/communicationServices.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { CommunicationServiceResource, CommunicationServicesListBySubscriptionOptionalParams, @@ -78,25 +78,7 @@ export interface CommunicationServices { * @param parameters Parameters for the update operation * @param options The options parameters. */ - beginUpdate( - resourceGroupName: string, - communicationServiceName: string, - parameters: CommunicationServiceResourceUpdate, - options?: CommunicationServicesUpdateOptionalParams - ): Promise< - PollerLike< - PollOperationState, - CommunicationServicesUpdateResponse - > - >; - /** - * Operation to update an existing CommunicationService. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameters for the update operation - * @param options The options parameters. - */ - beginUpdateAndWait( + update( resourceGroupName: string, communicationServiceName: string, parameters: CommunicationServiceResourceUpdate, @@ -126,8 +108,8 @@ export interface CommunicationServices { parameters: CommunicationServiceResource, options?: CommunicationServicesCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, CommunicationServicesCreateOrUpdateResponse > >; @@ -154,7 +136,7 @@ export interface CommunicationServices { resourceGroupName: string, communicationServiceName: string, options?: CommunicationServicesDeleteOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Operation to delete a CommunicationService. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -185,26 +167,7 @@ export interface CommunicationServices { * @param parameters Parameter that describes the Regenerate Key Operation. * @param options The options parameters. */ - beginRegenerateKey( - resourceGroupName: string, - communicationServiceName: string, - parameters: RegenerateKeyParameters, - options?: CommunicationServicesRegenerateKeyOptionalParams - ): Promise< - PollerLike< - PollOperationState, - CommunicationServicesRegenerateKeyResponse - > - >; - /** - * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the - * same time. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameter that describes the Regenerate Key Operation. - * @param options The options parameters. - */ - beginRegenerateKeyAndWait( + regenerateKey( resourceGroupName: string, communicationServiceName: string, parameters: RegenerateKeyParameters, diff --git a/sdk/communication/arm-communication/src/operationsInterfaces/domains.ts b/sdk/communication/arm-communication/src/operationsInterfaces/domains.ts index 9949f6a016f6..97221522e5f5 100644 --- a/sdk/communication/arm-communication/src/operationsInterfaces/domains.ts +++ b/sdk/communication/arm-communication/src/operationsInterfaces/domains.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { DomainResource, DomainsListByEmailServiceResourceOptionalParams, @@ -69,8 +69,8 @@ export interface Domains { parameters: DomainResource, options?: DomainsCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, DomainsCreateOrUpdateResponse > >; @@ -102,7 +102,7 @@ export interface Domains { emailServiceName: string, domainName: string, options?: DomainsDeleteOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Operation to delete a Domains resource. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -131,7 +131,10 @@ export interface Domains { parameters: UpdateDomainRequestParameters, options?: DomainsUpdateOptionalParams ): Promise< - PollerLike, DomainsUpdateResponse> + SimplePollerLike< + OperationState, + DomainsUpdateResponse + > >; /** * Operation to update an existing Domains resource. @@ -163,8 +166,8 @@ export interface Domains { parameters: VerificationParameter, options?: DomainsInitiateVerificationOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, DomainsInitiateVerificationResponse > >; @@ -198,8 +201,8 @@ export interface Domains { parameters: VerificationParameter, options?: DomainsCancelVerificationOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, DomainsCancelVerificationResponse > >; diff --git a/sdk/communication/arm-communication/src/operationsInterfaces/emailServices.ts b/sdk/communication/arm-communication/src/operationsInterfaces/emailServices.ts index fbc2718031cd..a6c3c154dcf4 100644 --- a/sdk/communication/arm-communication/src/operationsInterfaces/emailServices.ts +++ b/sdk/communication/arm-communication/src/operationsInterfaces/emailServices.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { EmailServiceResource, EmailServicesListBySubscriptionOptionalParams, @@ -67,8 +67,8 @@ export interface EmailServices { parameters: EmailServiceResource, options?: EmailServicesCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, EmailServicesCreateOrUpdateResponse > >; @@ -95,7 +95,7 @@ export interface EmailServices { resourceGroupName: string, emailServiceName: string, options?: EmailServicesDeleteOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Operation to delete a EmailService. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -120,8 +120,8 @@ export interface EmailServices { parameters: EmailServiceResourceUpdate, options?: EmailServicesUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, EmailServicesUpdateResponse > >; diff --git a/sdk/communication/arm-communication/src/operationsInterfaces/index.ts b/sdk/communication/arm-communication/src/operationsInterfaces/index.ts index 7ac67a892445..1d47ce38a16e 100644 --- a/sdk/communication/arm-communication/src/operationsInterfaces/index.ts +++ b/sdk/communication/arm-communication/src/operationsInterfaces/index.ts @@ -10,3 +10,4 @@ export * from "./operations"; export * from "./communicationServices"; export * from "./domains"; export * from "./emailServices"; +export * from "./senderUsernames"; diff --git a/sdk/communication/arm-communication/src/operationsInterfaces/senderUsernames.ts b/sdk/communication/arm-communication/src/operationsInterfaces/senderUsernames.ts new file mode 100644 index 000000000000..47fba537018d --- /dev/null +++ b/sdk/communication/arm-communication/src/operationsInterfaces/senderUsernames.ts @@ -0,0 +1,84 @@ +/* + * 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 { + SenderUsernameResource, + SenderUsernamesListByDomainsOptionalParams, + SenderUsernamesGetOptionalParams, + SenderUsernamesGetResponse, + SenderUsernamesCreateOrUpdateOptionalParams, + SenderUsernamesCreateOrUpdateResponse, + SenderUsernamesDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a SenderUsernames. */ +export interface SenderUsernames { + /** + * List all valid sender usernames for a domains resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param options The options parameters. + */ + listByDomains( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + options?: SenderUsernamesListByDomainsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a valid sender username for a domains resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param senderUsername The valid sender Username. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + senderUsername: string, + options?: SenderUsernamesGetOptionalParams + ): Promise; + /** + * Add a new SenderUsername resource under the parent Domains resource or update an existing + * SenderUsername resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param senderUsername The valid sender Username. + * @param parameters Parameters for the create or update operation + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + senderUsername: string, + parameters: SenderUsernameResource, + options?: SenderUsernamesCreateOrUpdateOptionalParams + ): Promise; + /** + * Operation to delete a SenderUsernames resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param senderUsername The valid sender Username. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + emailServiceName: string, + domainName: string, + senderUsername: string, + options?: SenderUsernamesDeleteOptionalParams + ): Promise; +} diff --git a/sdk/communication/arm-communication/test/sampleTest.ts b/sdk/communication/arm-communication/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/communication/arm-communication/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * 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 { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +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(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/communication/arm-communication/tsconfig.json b/sdk/communication/arm-communication/tsconfig.json index 2549bb6e5ad4..3e6ae96443f3 100644 --- a/sdk/communication/arm-communication/tsconfig.json +++ b/sdk/communication/arm-communication/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-communication": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"