From c1506f42f64bde0d899bf0d27f3a4c755d8b0b3f Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 5 Nov 2020 10:32:11 +0000 Subject: [PATCH] Generated from af3fae7cd65f1b4588fdbb5ff9dc8f662e0e0776 --- sdk/communication/arm-communication/README.md | 9 ++- .../arm-communication/rollup.config.js | 4 +- .../communicationServiceManagementClient.ts | 5 +- ...unicationServiceManagementClientContext.ts | 5 +- .../src/models/communicationServiceMappers.ts | 6 +- .../arm-communication/src/models/index.ts | 69 ++++++++++++++++++- .../arm-communication/src/models/mappers.ts | 56 ++++++++++++++- .../src/models/operationStatusesMappers.ts | 4 +- .../src/models/operationsMappers.ts | 4 +- .../src/models/parameters.ts | 5 +- .../src/operations/communicationService.ts | 66 +++++++++++++++++- .../arm-communication/src/operations/index.ts | 5 +- .../src/operations/operationStatuses.ts | 5 +- .../src/operations/operations.ts | 8 ++- 14 files changed, 212 insertions(+), 39 deletions(-) diff --git a/sdk/communication/arm-communication/README.md b/sdk/communication/arm-communication/README.md index 66d1e07c2145..6de5fb8a12ba 100644 --- a/sdk/communication/arm-communication/README.md +++ b/sdk/communication/arm-communication/README.md @@ -15,7 +15,7 @@ npm install @azure/arm-communication ### How to use -#### nodejs - Authentication, client creation and list operations as an example written in TypeScript. +#### nodejs - client creation and list operations as an example written in TypeScript. ##### Install @azure/ms-rest-nodeauth @@ -26,11 +26,10 @@ npm install @azure/ms-rest-nodeauth@"^3.0.0" ##### Sample code +While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package ```typescript -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { CommunicationServiceManagementClient, CommunicationServiceManagementModels, CommunicationServiceManagementMappers } from "@azure/arm-communication"; +const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +const { CommunicationServiceManagementClient } = require("@azure/arm-communication"); const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; msRestNodeAuth.interactiveLogin().then((creds) => { diff --git a/sdk/communication/arm-communication/rollup.config.js b/sdk/communication/arm-communication/rollup.config.js index 0268bc1dad9a..118440bec6df 100644 --- a/sdk/communication/arm-communication/rollup.config.js +++ b/sdk/communication/arm-communication/rollup.config.js @@ -21,8 +21,8 @@ const config = { "@azure/ms-rest-azure-js": "msRestAzure" }, banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. diff --git a/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts b/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts index f6bf852fb800..11693493ffd7 100644 --- a/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts +++ b/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/communication/arm-communication/src/communicationServiceManagementClientContext.ts b/sdk/communication/arm-communication/src/communicationServiceManagementClientContext.ts index 5fc002a5a912..dcd4073f443b 100644 --- a/sdk/communication/arm-communication/src/communicationServiceManagementClientContext.ts +++ b/sdk/communication/arm-communication/src/communicationServiceManagementClientContext.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/communication/arm-communication/src/models/communicationServiceMappers.ts b/sdk/communication/arm-communication/src/models/communicationServiceMappers.ts index 9e29f790f0a9..baf474d1c409 100644 --- a/sdk/communication/arm-communication/src/models/communicationServiceMappers.ts +++ b/sdk/communication/arm-communication/src/models/communicationServiceMappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. @@ -16,6 +16,8 @@ export { ErrorResponseError, LinkedNotificationHub, LinkNotificationHubParameters, + NameAvailability, + NameAvailabilityParameters, RegenerateKeyParameters, TaggedResource } from "../models/mappers"; diff --git a/sdk/communication/arm-communication/src/models/index.ts b/sdk/communication/arm-communication/src/models/index.ts index f53330ffb9e0..21821a8632ba 100644 --- a/sdk/communication/arm-communication/src/models/index.ts +++ b/sdk/communication/arm-communication/src/models/index.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. @@ -168,6 +168,39 @@ export interface Operation { properties?: OperationProperties; } +/** + * Data POST-ed to the nameAvailability action + */ +export interface NameAvailabilityParameters { + /** + * The resource type. Should be always "Microsoft.Communication/CommunicationServices". + */ + type: string; + /** + * The CommunicationService name to validate. e.g."my-CommunicationService-name-here" + */ + name: string; +} + +/** + * Result of the request to check name availability. It contains a flag and possible reason of + * failure. + */ +export interface NameAvailability { + /** + * Indicates whether the name is available or not. + */ + nameAvailable?: boolean; + /** + * The reason of the availability. Required if name is not available. + */ + reason?: string; + /** + * The message of the operation. + */ + message?: string; +} + /** * Description of an Azure Notification Hub to link to the communication service */ @@ -197,7 +230,7 @@ export interface LinkedNotificationHub { */ export interface OperationStatus { /** - * The operation Id. + * Fully qualified ID for the operation status. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly id?: string; @@ -362,6 +395,16 @@ export interface RegenerateKeyParameters { keyType?: KeyType; } +/** + * Optional Parameters. + */ +export interface CommunicationServiceCheckNameAvailabilityOptionalParams extends msRest.RequestOptionsBase { + /** + * Parameters supplied to the operation. + */ + nameAvailabilityParameters?: NameAvailabilityParameters; +} + /** * Optional Parameters. */ @@ -538,6 +581,26 @@ export type OperationsListNextResponse = OperationList & { }; }; +/** + * Contains response data for the checkNameAvailability operation. + */ +export type CommunicationServiceCheckNameAvailabilityResponse = NameAvailability & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: NameAvailability; + }; +}; + /** * Contains response data for the linkNotificationHub operation. */ diff --git a/sdk/communication/arm-communication/src/models/mappers.ts b/sdk/communication/arm-communication/src/models/mappers.ts index 67367870daf9..dd604b9e5491 100644 --- a/sdk/communication/arm-communication/src/models/mappers.ts +++ b/sdk/communication/arm-communication/src/models/mappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. @@ -258,6 +258,58 @@ export const Operation: msRest.CompositeMapper = { } }; +export const NameAvailabilityParameters: msRest.CompositeMapper = { + serializedName: "NameAvailabilityParameters", + type: { + name: "Composite", + className: "NameAvailabilityParameters", + modelProperties: { + type: { + required: true, + serializedName: "type", + type: { + name: "String" + } + }, + name: { + required: true, + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const NameAvailability: msRest.CompositeMapper = { + serializedName: "NameAvailability", + type: { + name: "Composite", + className: "NameAvailability", + modelProperties: { + nameAvailable: { + serializedName: "nameAvailable", + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + export const LinkNotificationHubParameters: msRest.CompositeMapper = { serializedName: "LinkNotificationHubParameters", type: { diff --git a/sdk/communication/arm-communication/src/models/operationStatusesMappers.ts b/sdk/communication/arm-communication/src/models/operationStatusesMappers.ts index 446146928230..bfb50c7775b1 100644 --- a/sdk/communication/arm-communication/src/models/operationStatusesMappers.ts +++ b/sdk/communication/arm-communication/src/models/operationStatusesMappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. diff --git a/sdk/communication/arm-communication/src/models/operationsMappers.ts b/sdk/communication/arm-communication/src/models/operationsMappers.ts index f137abdc152c..116b50563dec 100644 --- a/sdk/communication/arm-communication/src/models/operationsMappers.ts +++ b/sdk/communication/arm-communication/src/models/operationsMappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. diff --git a/sdk/communication/arm-communication/src/models/parameters.ts b/sdk/communication/arm-communication/src/models/parameters.ts index 9a61a9a00702..8271fe4d0e8a 100644 --- a/sdk/communication/arm-communication/src/models/parameters.ts +++ b/sdk/communication/arm-communication/src/models/parameters.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/communication/arm-communication/src/operations/communicationService.ts b/sdk/communication/arm-communication/src/operations/communicationService.ts index 56d302c3155b..c8f2cd68e5ec 100644 --- a/sdk/communication/arm-communication/src/operations/communicationService.ts +++ b/sdk/communication/arm-communication/src/operations/communicationService.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 @@ -27,6 +26,31 @@ export class CommunicationService { this.client = client; } + /** + * Checks that the CommunicationService name is valid and is not already in use. + * @summary Check Name Availability + * @param [options] The optional parameters + * @returns Promise + */ + checkNameAvailability(options?: Models.CommunicationServiceCheckNameAvailabilityOptionalParams): Promise; + /** + * @param callback The callback + */ + checkNameAvailability(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + checkNameAvailability(options: Models.CommunicationServiceCheckNameAvailabilityOptionalParams, callback: msRest.ServiceCallback): void; + checkNameAvailability(options?: Models.CommunicationServiceCheckNameAvailabilityOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + checkNameAvailabilityOperationSpec, + callback) as Promise; + } + /** * Links an Azure Notification Hub to this communication service. * @summary Link Notification Hub @@ -394,6 +418,36 @@ export class CommunicationService { // Operation Specifications const serializer = new msRest.Serializer(Mappers); +const checkNameAvailabilityOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: [ + "options", + "nameAvailabilityParameters" + ], + mapper: Mappers.NameAvailabilityParameters + }, + responses: { + 200: { + bodyMapper: Mappers.NameAvailability + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + const linkNotificationHubOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/linkNotificationHub", @@ -667,6 +721,9 @@ const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], @@ -688,6 +745,9 @@ const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], diff --git a/sdk/communication/arm-communication/src/operations/index.ts b/sdk/communication/arm-communication/src/operations/index.ts index 8bfc7298c3a3..652d14e1890c 100644 --- a/sdk/communication/arm-communication/src/operations/index.ts +++ b/sdk/communication/arm-communication/src/operations/index.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/communication/arm-communication/src/operations/operationStatuses.ts b/sdk/communication/arm-communication/src/operations/operationStatuses.ts index e7b491c708e0..07144b6d785e 100644 --- a/sdk/communication/arm-communication/src/operations/operationStatuses.ts +++ b/sdk/communication/arm-communication/src/operations/operationStatuses.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/communication/arm-communication/src/operations/operations.ts b/sdk/communication/arm-communication/src/operations/operations.ts index e44adebf41db..c9c2a1d0c83e 100644 --- a/sdk/communication/arm-communication/src/operations/operations.ts +++ b/sdk/communication/arm-communication/src/operations/operations.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 @@ -110,6 +109,9 @@ const listNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ],