From 79d0cc2e2a0005a943bbbf8df1ca425629210b85 Mon Sep 17 00:00:00 2001 From: colawwj <70128817+colawwj@users.noreply.github.com> Date: Wed, 21 Oct 2020 10:05:03 +0800 Subject: [PATCH] Generated from 94c5cf6ac0eb36a4a844f6c1fdcd3a01cec5a8f7 (#11880) Co-authored-by: SDK Automation --- .../arm-communication/LICENSE.txt | 21 + sdk/communication/arm-communication/README.md | 99 +++ .../arm-communication/package.json | 58 ++ .../arm-communication/rollup.config.js | 37 + .../communicationServiceManagementClient.ts | 47 ++ ...unicationServiceManagementClientContext.ts | 63 ++ .../src/models/communicationServiceMappers.ts | 21 + .../arm-communication/src/models/index.ts | 779 ++++++++++++++++++ .../arm-communication/src/models/mappers.ts | 655 +++++++++++++++ .../src/models/operationStatusesMappers.ts | 13 + .../src/models/operationsMappers.ts | 19 + .../src/models/parameters.ts | 95 +++ .../src/operations/communicationService.ts | 703 ++++++++++++++++ .../arm-communication/src/operations/index.ts | 13 + .../src/operations/operationStatuses.ts | 87 ++ .../src/operations/operations.ts | 125 +++ .../arm-communication/tsconfig.json | 19 + 17 files changed, 2854 insertions(+) create mode 100644 sdk/communication/arm-communication/LICENSE.txt create mode 100644 sdk/communication/arm-communication/README.md create mode 100644 sdk/communication/arm-communication/package.json create mode 100644 sdk/communication/arm-communication/rollup.config.js create mode 100644 sdk/communication/arm-communication/src/communicationServiceManagementClient.ts create mode 100644 sdk/communication/arm-communication/src/communicationServiceManagementClientContext.ts create mode 100644 sdk/communication/arm-communication/src/models/communicationServiceMappers.ts create mode 100644 sdk/communication/arm-communication/src/models/index.ts create mode 100644 sdk/communication/arm-communication/src/models/mappers.ts create mode 100644 sdk/communication/arm-communication/src/models/operationStatusesMappers.ts create mode 100644 sdk/communication/arm-communication/src/models/operationsMappers.ts create mode 100644 sdk/communication/arm-communication/src/models/parameters.ts create mode 100644 sdk/communication/arm-communication/src/operations/communicationService.ts create mode 100644 sdk/communication/arm-communication/src/operations/index.ts create mode 100644 sdk/communication/arm-communication/src/operations/operationStatuses.ts create mode 100644 sdk/communication/arm-communication/src/operations/operations.ts create mode 100644 sdk/communication/arm-communication/tsconfig.json diff --git a/sdk/communication/arm-communication/LICENSE.txt b/sdk/communication/arm-communication/LICENSE.txt new file mode 100644 index 000000000000..ea8fb1516028 --- /dev/null +++ b/sdk/communication/arm-communication/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/communication/arm-communication/README.md b/sdk/communication/arm-communication/README.md new file mode 100644 index 000000000000..66d1e07c2145 --- /dev/null +++ b/sdk/communication/arm-communication/README.md @@ -0,0 +1,99 @@ +## Azure CommunicationServiceManagementClient SDK for JavaScript + +This package contains an isomorphic SDK for CommunicationServiceManagementClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/arm-communication +``` + +### How to use + +#### nodejs - Authentication, client creation and list operations as an example written in TypeScript. + +##### Install @azure/ms-rest-nodeauth + +- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. +```bash +npm install @azure/ms-rest-nodeauth@"^3.0.0" +``` + +##### Sample code + +```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 subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new CommunicationServiceManagementClient(creds, subscriptionId); + client.operations.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and list operations as an example written in JavaScript. + +##### Install @azure/ms-rest-browserauth + +```bash +npm install @azure/ms-rest-browserauth +``` + +##### Sample code + +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/arm-communication sample + + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/communication/arm-communication/README.png) diff --git a/sdk/communication/arm-communication/package.json b/sdk/communication/arm-communication/package.json new file mode 100644 index 000000000000..926af70fcee0 --- /dev/null +++ b/sdk/communication/arm-communication/package.json @@ -0,0 +1,58 @@ +{ + "name": "@azure/arm-communication", + "author": "Microsoft Corporation", + "description": "CommunicationServiceManagementClient Library with typescript type definitions for node.js and browser.", + "version": "1.0.0", + "dependencies": { + "@azure/ms-rest-azure-js": "^2.0.1", + "@azure/ms-rest-js": "^2.0.4", + "tslib": "^1.10.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/arm-communication.js", + "module": "./esm/communicationServiceManagementClient.js", + "types": "./esm/communicationServiceManagementClient.d.ts", + "devDependencies": { + "typescript": "^3.5.3", + "rollup": "^1.18.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.6.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/communication/arm-communication", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-communication.js.map'\" -o ./dist/arm-communication.min.js ./dist/arm-communication.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/communication/arm-communication/rollup.config.js b/sdk/communication/arm-communication/rollup.config.js new file mode 100644 index 000000000000..0268bc1dad9a --- /dev/null +++ b/sdk/communication/arm-communication/rollup.config.js @@ -0,0 +1,37 @@ +import rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/communicationServiceManagementClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/arm-communication.js", + format: "umd", + name: "Azure.ArmCommunication", + sourcemap: true, + globals: { + "@azure/ms-rest-js": "msRest", + "@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. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */` + }, + plugins: [ + nodeResolve({ mainFields: ['module', 'main'] }), + sourcemaps() + ] +}; + +export default config; diff --git a/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts b/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts new file mode 100644 index 000000000000..f6bf852fb800 --- /dev/null +++ b/sdk/communication/arm-communication/src/communicationServiceManagementClient.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import * as operations from "./operations"; +import { CommunicationServiceManagementClientContext } from "./communicationServiceManagementClientContext"; + + +class CommunicationServiceManagementClient extends CommunicationServiceManagementClientContext { + // Operation groups + operations: operations.Operations; + communicationService: operations.CommunicationService; + operationStatuses: operations.OperationStatuses; + + /** + * Initializes a new instance of the CommunicationServiceManagementClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId Gets subscription ID which uniquely identifies the Microsoft Azure + * subscription. The subscription ID forms part of the URI for every service call. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.CommunicationServiceManagementClientOptions) { + super(credentials, subscriptionId, options); + this.operations = new operations.Operations(this); + this.communicationService = new operations.CommunicationService(this); + this.operationStatuses = new operations.OperationStatuses(this); + } +} + +// Operation Specifications + +export { + CommunicationServiceManagementClient, + CommunicationServiceManagementClientContext, + Models as CommunicationServiceManagementModels, + Mappers as CommunicationServiceManagementMappers +}; +export * from "./operations"; diff --git a/sdk/communication/arm-communication/src/communicationServiceManagementClientContext.ts b/sdk/communication/arm-communication/src/communicationServiceManagementClientContext.ts new file mode 100644 index 000000000000..5fc002a5a912 --- /dev/null +++ b/sdk/communication/arm-communication/src/communicationServiceManagementClientContext.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as Models from "./models"; +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; + +const packageName = "@azure/arm-communication"; +const packageVersion = "1.0.0"; + +export class CommunicationServiceManagementClientContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials; + apiVersion?: string; + subscriptionId: string; + + /** + * Initializes a new instance of the CommunicationServiceManagementClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId Gets subscription ID which uniquely identifies the Microsoft Azure + * subscription. The subscription ID forms part of the URI for every service call. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.CommunicationServiceManagementClientOptions) { + if (credentials == undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId == undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if(!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.apiVersion = '2020-08-20-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; + this.requestContentType = "application/json; charset=utf-8"; + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + } +} diff --git a/sdk/communication/arm-communication/src/models/communicationServiceMappers.ts b/sdk/communication/arm-communication/src/models/communicationServiceMappers.ts new file mode 100644 index 000000000000..9e29f790f0a9 --- /dev/null +++ b/sdk/communication/arm-communication/src/models/communicationServiceMappers.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + CommunicationServiceCreateOrUpdateHeaders, + CommunicationServiceDeleteHeaders, + CommunicationServiceKeys, + CommunicationServiceResource, + CommunicationServiceResourceList, + ErrorResponse, + ErrorResponseError, + LinkedNotificationHub, + LinkNotificationHubParameters, + 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 new file mode 100644 index 000000000000..f53330ffb9e0 --- /dev/null +++ b/sdk/communication/arm-communication/src/models/index.ts @@ -0,0 +1,779 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export { BaseResource, CloudError }; + +/** + * The error + */ +export interface ErrorResponseError { + /** + * Error code. + */ + code?: string; + /** + * Error message indicating why the operation failed. + */ + message?: string; +} + +/** + * Error response indicating why the requested operation could not be performed. + */ +export interface ErrorResponse { + /** + * The error + */ + error?: ErrorResponseError; +} + +/** + * The object that describes a operation. + */ +export interface OperationDisplay { + /** + * Friendly name of the resource provider + */ + provider?: string; + /** + * Resource type on which the operation is performed. + */ + resource?: string; + /** + * The localized friendly name for the operation. + */ + operation?: string; + /** + * The localized friendly description for the operation + */ + description?: string; +} + +/** + * Specifications of the Dimension of metrics. + */ +export interface Dimension { + /** + * The public facing name of the dimension. + */ + name?: string; + /** + * Localized friendly display name of the dimension. + */ + displayName?: string; + /** + * Name of the dimension as it appears in MDM. + */ + internalName?: string; + /** + * A Boolean flag indicating whether this dimension should be included for the shoebox export + * scenario. + */ + toBeExportedForShoebox?: boolean; +} + +/** + * Specifications of the Metrics for Azure Monitoring. + */ +export interface MetricSpecification { + /** + * Name of the metric. + */ + name?: string; + /** + * Localized friendly display name of the metric. + */ + displayName?: string; + /** + * Localized friendly description of the metric. + */ + displayDescription?: string; + /** + * The unit that makes sense for the metric. + */ + unit?: string; + /** + * The method for aggregating the metric. Possible values include: 'Average', 'Minimum', + * 'Maximum', 'Total', 'Count' + */ + aggregationType?: AggregationType; + /** + * Optional. If set to true, then zero will be returned for time duration where no metric is + * emitted/published. + * Ex. a metric that returns the number of times a particular error code was emitted. The error + * code may not appear + * often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where + * nothing was emitted. + */ + fillGapWithZero?: string; + /** + * The name of the metric category that the metric belongs to. A metric can only belong to a + * single category. + */ + category?: string; + /** + * The dimensions of the metrics. + */ + dimensions?: Dimension[]; +} + +/** + * An object that describes a specification. + */ +export interface ServiceSpecification { + /** + * Specifications of the Metrics for Azure Monitoring. + */ + metricSpecifications?: MetricSpecification[]; +} + +/** + * Extra Operation properties. + */ +export interface OperationProperties { + /** + * The service specifications. + */ + serviceSpecification?: ServiceSpecification; +} + +/** + * REST API operation supported by CommunicationService resource provider. + */ +export interface Operation { + /** + * Name of the operation with format: {provider}/{resource}/{operation} + */ + name?: string; + /** + * The object that describes the operation. + */ + display?: OperationDisplay; + /** + * Optional. The intended executor of the operation; governs the display of the operation in the + * RBAC UX and the audit logs UX. + */ + origin?: string; + /** + * Extra properties for the operation. + */ + properties?: OperationProperties; +} + +/** + * Description of an Azure Notification Hub to link to the communication service + */ +export interface LinkNotificationHubParameters { + /** + * The resource ID of the notification hub + */ + resourceId: string; + /** + * Connection string for the notification hub + */ + connectionString: string; +} + +/** + * A notification hub that has been linked to the communication service + */ +export interface LinkedNotificationHub { + /** + * The resource ID of the notification hub + */ + resourceId?: string; +} + +/** + * The current status of an async operation + */ +export interface OperationStatus { + /** + * The operation Id. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * Provisioning state of the resource. Possible values include: 'Succeeded', 'Failed', + * 'Canceled', 'Creating', 'Deleting', 'Moving' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly status?: Status; + /** + * The start time of the operation + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly startTime?: Date; + /** + * The end time of the operation + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly endTime?: Date; + /** + * Percent of the operation that is complete + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly percentComplete?: number; + /** + * The error + */ + error?: ErrorResponseError; +} + +/** + * A class representing a CommunicationService resource. + */ +export interface CommunicationServiceResource { + /** + * Fully qualified resource ID for the resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * The name of the resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * The type of the service - e.g. "Microsoft.Communication/CommunicationServices" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; + /** + * The Azure location where the CommunicationService is running. + */ + location?: string; + /** + * Tags of the service which is a list of key value pairs that describe the resource. + */ + tags?: { [propertyName: string]: string }; + /** + * Provisioning state of the resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', + * 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly provisioningState?: ProvisioningState; + /** + * FQDN of the CommunicationService instance. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly hostName?: string; + /** + * The location where the communication service stores its data at rest. + */ + dataLocation: string; + /** + * Resource ID of an Azure Notification Hub linked to this resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly notificationHubId?: string; + /** + * Version of the CommunicationService resource. Probably you need the same or higher version of + * client SDKs. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly version?: string; + /** + * The immutable resource Id of the communication service. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly immutableResourceId?: string; +} + +/** + * The core properties of ARM resources. + */ +export interface Resource extends BaseResource { + /** + * Fully qualified resource ID for the resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * The name of the resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * The type of the service - e.g. "Microsoft.Communication/CommunicationServices" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; +} + +/** + * An ARM resource with its own location (not a global or an inherited location). + */ +export interface LocationResource { + /** + * The Azure location where the CommunicationService is running. + */ + location?: string; +} + +/** + * An ARM resource with that can accept tags + */ +export interface TaggedResource { + /** + * Tags of the service which is a list of key value pairs that describe the resource. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * A class representing the access keys of a CommunicationService. + */ +export interface CommunicationServiceKeys { + /** + * The primary access key. + */ + primaryKey?: string; + /** + * The secondary access key. + */ + secondaryKey?: string; + /** + * CommunicationService connection string constructed via the primaryKey + */ + primaryConnectionString?: string; + /** + * CommunicationService connection string constructed via the secondaryKey + */ + secondaryConnectionString?: string; +} + +/** + * Parameters describes the request to regenerate access keys + */ +export interface RegenerateKeyParameters { + /** + * The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible + * values include: 'Primary', 'Secondary' + */ + keyType?: KeyType; +} + +/** + * Optional Parameters. + */ +export interface CommunicationServiceLinkNotificationHubOptionalParams extends msRest.RequestOptionsBase { + /** + * Parameters supplied to the operation. + */ + linkNotificationHubParameters?: LinkNotificationHubParameters; +} + +/** + * Optional Parameters. + */ +export interface CommunicationServiceUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * Parameters for the update operation + */ + parameters?: TaggedResource; +} + +/** + * Optional Parameters. + */ +export interface CommunicationServiceCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * Parameters for the create or update operation + */ + parameters?: CommunicationServiceResource; +} + +/** + * Optional Parameters. + */ +export interface CommunicationServiceRegenerateKeyOptionalParams extends msRest.RequestOptionsBase { + /** + * Parameter that describes the Regenerate Key Operation. + */ + parameters?: RegenerateKeyParameters; +} + +/** + * Optional Parameters. + */ +export interface CommunicationServiceBeginCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * Parameters for the create or update operation + */ + parameters?: CommunicationServiceResource; +} + +/** + * An interface representing CommunicationServiceManagementClientOptions. + */ +export interface CommunicationServiceManagementClientOptions extends AzureServiceClientOptions { + baseUri?: string; +} + +/** + * Defines headers for CreateOrUpdate operation. + */ +export interface CommunicationServiceCreateOrUpdateHeaders { + /** + * URL to query for status of the operation. + */ + azureAsyncOperation: string; +} + +/** + * Defines headers for Delete operation. + */ +export interface CommunicationServiceDeleteHeaders { + /** + * URL to query for status of the operation. + */ + location: string; +} + +/** + * @interface + * Result of the request to list REST API operations. It contains a list of operations. + * @extends Array + */ +export interface OperationList extends Array { + /** + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + nextLink?: string; +} + +/** + * @interface + * Object that includes an array of CommunicationServices and a possible link for next set. + * @extends Array + */ +export interface CommunicationServiceResourceList extends Array { + /** + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + nextLink?: string; +} + +/** + * Defines values for AggregationType. + * Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count' + * @readonly + * @enum {string} + */ +export type AggregationType = 'Average' | 'Minimum' | 'Maximum' | 'Total' | 'Count'; + +/** + * Defines values for Status. + * Possible values include: 'Succeeded', 'Failed', 'Canceled', 'Creating', 'Deleting', 'Moving' + * @readonly + * @enum {string} + */ +export type Status = 'Succeeded' | 'Failed' | 'Canceled' | 'Creating' | 'Deleting' | 'Moving'; + +/** + * Defines values for ProvisioningState. + * Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', + * 'Updating', 'Deleting', 'Moving' + * @readonly + * @enum {string} + */ +export type ProvisioningState = 'Unknown' | 'Succeeded' | 'Failed' | 'Canceled' | 'Running' | 'Creating' | 'Updating' | 'Deleting' | 'Moving'; + +/** + * Defines values for KeyType. + * Possible values include: 'Primary', 'Secondary' + * @readonly + * @enum {string} + */ +export type KeyType = 'Primary' | 'Secondary'; + +/** + * Contains response data for the list operation. + */ +export type OperationsListResponse = OperationList & { + /** + * 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: OperationList; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type OperationsListNextResponse = OperationList & { + /** + * 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: OperationList; + }; +}; + +/** + * Contains response data for the linkNotificationHub operation. + */ +export type CommunicationServiceLinkNotificationHubResponse = LinkedNotificationHub & { + /** + * 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: LinkedNotificationHub; + }; +}; + +/** + * Contains response data for the listBySubscription operation. + */ +export type CommunicationServiceListBySubscriptionResponse = CommunicationServiceResourceList & { + /** + * 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: CommunicationServiceResourceList; + }; +}; + +/** + * Contains response data for the listByResourceGroup operation. + */ +export type CommunicationServiceListByResourceGroupResponse = CommunicationServiceResourceList & { + /** + * 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: CommunicationServiceResourceList; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type CommunicationServiceUpdateResponse = CommunicationServiceResource & { + /** + * 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: CommunicationServiceResource; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type CommunicationServiceGetResponse = CommunicationServiceResource & { + /** + * 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: CommunicationServiceResource; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type CommunicationServiceCreateOrUpdateResponse = CommunicationServiceResource & CommunicationServiceCreateOrUpdateHeaders & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: CommunicationServiceCreateOrUpdateHeaders; + + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CommunicationServiceResource; + }; +}; + +/** + * Contains response data for the deleteMethod operation. + */ +export type CommunicationServiceDeleteResponse = CommunicationServiceDeleteHeaders & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: CommunicationServiceDeleteHeaders; + }; +}; + +/** + * Contains response data for the listKeys operation. + */ +export type CommunicationServiceListKeysResponse = CommunicationServiceKeys & { + /** + * 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: CommunicationServiceKeys; + }; +}; + +/** + * Contains response data for the regenerateKey operation. + */ +export type CommunicationServiceRegenerateKeyResponse = CommunicationServiceKeys & { + /** + * 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: CommunicationServiceKeys; + }; +}; + +/** + * Contains response data for the listBySubscriptionNext operation. + */ +export type CommunicationServiceListBySubscriptionNextResponse = CommunicationServiceResourceList & { + /** + * 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: CommunicationServiceResourceList; + }; +}; + +/** + * Contains response data for the listByResourceGroupNext operation. + */ +export type CommunicationServiceListByResourceGroupNextResponse = CommunicationServiceResourceList & { + /** + * 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: CommunicationServiceResourceList; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type OperationStatusesGetResponse = OperationStatus & { + /** + * 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: OperationStatus; + }; +}; diff --git a/sdk/communication/arm-communication/src/models/mappers.ts b/sdk/communication/arm-communication/src/models/mappers.ts new file mode 100644 index 000000000000..67367870daf9 --- /dev/null +++ b/sdk/communication/arm-communication/src/models/mappers.ts @@ -0,0 +1,655 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export const CloudError = CloudErrorMapper; +export const BaseResource = BaseResourceMapper; + +export const ErrorResponseError: msRest.CompositeMapper = { + serializedName: "ErrorResponse_error", + type: { + name: "Composite", + className: "ErrorResponseError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "ErrorResponse", + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorResponseError" + } + } + } + } +}; + +export const OperationDisplay: msRest.CompositeMapper = { + serializedName: "OperationDisplay", + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const Dimension: msRest.CompositeMapper = { + serializedName: "Dimension", + type: { + name: "Composite", + className: "Dimension", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + internalName: { + serializedName: "internalName", + type: { + name: "String" + } + }, + toBeExportedForShoebox: { + serializedName: "toBeExportedForShoebox", + type: { + name: "Boolean" + } + } + } + } +}; + +export const MetricSpecification: msRest.CompositeMapper = { + serializedName: "MetricSpecification", + type: { + name: "Composite", + className: "MetricSpecification", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + displayDescription: { + serializedName: "displayDescription", + type: { + name: "String" + } + }, + unit: { + serializedName: "unit", + type: { + name: "String" + } + }, + aggregationType: { + serializedName: "aggregationType", + type: { + name: "String" + } + }, + fillGapWithZero: { + serializedName: "fillGapWithZero", + type: { + name: "String" + } + }, + category: { + serializedName: "category", + type: { + name: "String" + } + }, + dimensions: { + serializedName: "dimensions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Dimension" + } + } + } + } + } + } +}; + +export const ServiceSpecification: msRest.CompositeMapper = { + serializedName: "ServiceSpecification", + type: { + name: "Composite", + className: "ServiceSpecification", + modelProperties: { + metricSpecifications: { + serializedName: "metricSpecifications", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetricSpecification" + } + } + } + } + } + } +}; + +export const OperationProperties: msRest.CompositeMapper = { + serializedName: "OperationProperties", + type: { + name: "Composite", + className: "OperationProperties", + modelProperties: { + serviceSpecification: { + serializedName: "serviceSpecification", + type: { + name: "Composite", + className: "ServiceSpecification" + } + } + } + } +}; + +export const Operation: msRest.CompositeMapper = { + serializedName: "Operation", + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "OperationProperties" + } + } + } + } +}; + +export const LinkNotificationHubParameters: msRest.CompositeMapper = { + serializedName: "LinkNotificationHubParameters", + type: { + name: "Composite", + className: "LinkNotificationHubParameters", + modelProperties: { + resourceId: { + required: true, + serializedName: "resourceId", + type: { + name: "String" + } + }, + connectionString: { + required: true, + serializedName: "connectionString", + type: { + name: "String" + } + } + } + } +}; + +export const LinkedNotificationHub: msRest.CompositeMapper = { + serializedName: "LinkedNotificationHub", + type: { + name: "Composite", + className: "LinkedNotificationHub", + modelProperties: { + resourceId: { + serializedName: "resourceId", + type: { + name: "String" + } + } + } + } +}; + +export const OperationStatus: msRest.CompositeMapper = { + serializedName: "OperationStatus", + type: { + name: "Composite", + className: "OperationStatus", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + status: { + readOnly: true, + serializedName: "status", + type: { + name: "String" + } + }, + startTime: { + readOnly: true, + serializedName: "startTime", + type: { + name: "DateTime" + } + }, + endTime: { + readOnly: true, + serializedName: "endTime", + type: { + name: "DateTime" + } + }, + percentComplete: { + readOnly: true, + serializedName: "percentComplete", + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + type: { + name: "Number" + } + }, + error: { + serializedName: "error.error", + type: { + name: "Composite", + className: "ErrorResponseError" + } + } + } + } +}; + +export const CommunicationServiceResource: msRest.CompositeMapper = { + serializedName: "CommunicationServiceResource", + type: { + name: "Composite", + className: "CommunicationServiceResource", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + provisioningState: { + readOnly: true, + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + hostName: { + readOnly: true, + serializedName: "properties.hostName", + type: { + name: "String" + } + }, + dataLocation: { + required: true, + serializedName: "properties.dataLocation", + type: { + name: "String" + } + }, + notificationHubId: { + readOnly: true, + serializedName: "properties.notificationHubId", + type: { + name: "String" + } + }, + version: { + readOnly: true, + serializedName: "properties.version", + type: { + name: "String" + } + }, + immutableResourceId: { + readOnly: true, + serializedName: "properties.immutableResourceId", + type: { + name: "String" + } + } + } + } +}; + +export const Resource: msRest.CompositeMapper = { + serializedName: "Resource", + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const LocationResource: msRest.CompositeMapper = { + serializedName: "LocationResource", + type: { + name: "Composite", + className: "LocationResource", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const TaggedResource: msRest.CompositeMapper = { + serializedName: "TaggedResource", + type: { + name: "Composite", + className: "TaggedResource", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const CommunicationServiceKeys: msRest.CompositeMapper = { + serializedName: "CommunicationServiceKeys", + type: { + name: "Composite", + className: "CommunicationServiceKeys", + modelProperties: { + primaryKey: { + serializedName: "primaryKey", + type: { + name: "String" + } + }, + secondaryKey: { + serializedName: "secondaryKey", + type: { + name: "String" + } + }, + primaryConnectionString: { + serializedName: "primaryConnectionString", + type: { + name: "String" + } + }, + secondaryConnectionString: { + serializedName: "secondaryConnectionString", + type: { + name: "String" + } + } + } + } +}; + +export const RegenerateKeyParameters: msRest.CompositeMapper = { + serializedName: "RegenerateKeyParameters", + type: { + name: "Composite", + className: "RegenerateKeyParameters", + modelProperties: { + keyType: { + serializedName: "keyType", + type: { + name: "Enum", + allowedValues: [ + "Primary", + "Secondary" + ] + } + } + } + } +}; + +export const CommunicationServiceCreateOrUpdateHeaders: msRest.CompositeMapper = { + serializedName: "communicationservice-createorupdate-headers", + type: { + name: "Composite", + className: "CommunicationServiceCreateOrUpdateHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + +export const CommunicationServiceDeleteHeaders: msRest.CompositeMapper = { + serializedName: "communicationservice-delete-headers", + type: { + name: "Composite", + className: "CommunicationServiceDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const OperationList: msRest.CompositeMapper = { + serializedName: "OperationList", + type: { + name: "Composite", + className: "OperationList", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const CommunicationServiceResourceList: msRest.CompositeMapper = { + serializedName: "CommunicationServiceResourceList", + type: { + name: "Composite", + className: "CommunicationServiceResourceList", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CommunicationServiceResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/communication/arm-communication/src/models/operationStatusesMappers.ts b/sdk/communication/arm-communication/src/models/operationStatusesMappers.ts new file mode 100644 index 000000000000..446146928230 --- /dev/null +++ b/sdk/communication/arm-communication/src/models/operationStatusesMappers.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + ErrorResponse, + ErrorResponseError, + OperationStatus +} from "../models/mappers"; diff --git a/sdk/communication/arm-communication/src/models/operationsMappers.ts b/sdk/communication/arm-communication/src/models/operationsMappers.ts new file mode 100644 index 000000000000..f137abdc152c --- /dev/null +++ b/sdk/communication/arm-communication/src/models/operationsMappers.ts @@ -0,0 +1,19 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + Dimension, + ErrorResponse, + ErrorResponseError, + MetricSpecification, + Operation, + OperationDisplay, + OperationList, + OperationProperties, + ServiceSpecification +} from "../models/mappers"; diff --git a/sdk/communication/arm-communication/src/models/parameters.ts b/sdk/communication/arm-communication/src/models/parameters.ts new file mode 100644 index 000000000000..9a61a9a00702 --- /dev/null +++ b/sdk/communication/arm-communication/src/models/parameters.ts @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; + +export const acceptLanguage: msRest.OperationParameter = { + parameterPath: "acceptLanguage", + mapper: { + serializedName: "accept-language", + defaultValue: 'en-US', + type: { + name: "String" + } + } +}; +export const apiVersion: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + isConstant: true, + serializedName: "api-version", + defaultValue: '2020-08-20-preview', + type: { + name: "String" + } + } +}; +export const communicationServiceName: msRest.OperationURLParameter = { + parameterPath: "communicationServiceName", + mapper: { + required: true, + serializedName: "communicationServiceName", + type: { + name: "String" + } + } +}; +export const location: msRest.OperationURLParameter = { + parameterPath: "location", + mapper: { + required: true, + serializedName: "location", + type: { + name: "String" + } + } +}; +export const nextPageLink: msRest.OperationURLParameter = { + parameterPath: "nextPageLink", + mapper: { + required: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const operationId: msRest.OperationURLParameter = { + parameterPath: "operationId", + mapper: { + required: true, + serializedName: "operationId", + type: { + name: "String" + } + } +}; +export const resourceGroupName: msRest.OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + required: true, + serializedName: "resourceGroupName", + type: { + name: "String" + } + } +}; +export const subscriptionId: msRest.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + required: true, + serializedName: "subscriptionId", + type: { + name: "String" + } + } +}; diff --git a/sdk/communication/arm-communication/src/operations/communicationService.ts b/sdk/communication/arm-communication/src/operations/communicationService.ts new file mode 100644 index 000000000000..56d302c3155b --- /dev/null +++ b/sdk/communication/arm-communication/src/operations/communicationService.ts @@ -0,0 +1,703 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as Models from "../models"; +import * as Mappers from "../models/communicationServiceMappers"; +import * as Parameters from "../models/parameters"; +import { CommunicationServiceManagementClientContext } from "../communicationServiceManagementClientContext"; + +/** Class representing a CommunicationService. */ +export class CommunicationService { + private readonly client: CommunicationServiceManagementClientContext; + + /** + * Create a CommunicationService. + * @param {CommunicationServiceManagementClientContext} client Reference to the service client. + */ + constructor(client: CommunicationServiceManagementClientContext) { + this.client = client; + } + + /** + * Links an Azure Notification Hub to this communication service. + * @summary Link Notification Hub + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param [options] The optional parameters + * @returns Promise + */ + linkNotificationHub(resourceGroupName: string, communicationServiceName: string, options?: Models.CommunicationServiceLinkNotificationHubOptionalParams): Promise; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param callback The callback + */ + linkNotificationHub(resourceGroupName: string, communicationServiceName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param options The optional parameters + * @param callback The callback + */ + linkNotificationHub(resourceGroupName: string, communicationServiceName: string, options: Models.CommunicationServiceLinkNotificationHubOptionalParams, callback: msRest.ServiceCallback): void; + linkNotificationHub(resourceGroupName: string, communicationServiceName: string, options?: Models.CommunicationServiceLinkNotificationHubOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + communicationServiceName, + options + }, + linkNotificationHubOperationSpec, + callback) as Promise; + } + + /** + * Handles requests to list all resources in a subscription. + * @summary List By Subscription + * @param [options] The optional parameters + * @returns Promise + */ + listBySubscription(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + listBySubscription(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + listBySubscription(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listBySubscription(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listBySubscriptionOperationSpec, + callback) as Promise; + } + + /** + * Handles requests to list all resources in a resource group. + * @summary List By Resource Group + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param [options] The optional parameters + * @returns Promise + */ + listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param callback The callback + */ + listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param options The optional parameters + * @param callback The callback + */ + listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + options + }, + listByResourceGroupOperationSpec, + callback) as Promise; + } + + /** + * Operation to update an existing CommunicationService. + * @summary Update + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param [options] The optional parameters + * @returns Promise + */ + update(resourceGroupName: string, communicationServiceName: string, options?: Models.CommunicationServiceUpdateOptionalParams): Promise; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param callback The callback + */ + update(resourceGroupName: string, communicationServiceName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param options The optional parameters + * @param callback The callback + */ + update(resourceGroupName: string, communicationServiceName: string, options: Models.CommunicationServiceUpdateOptionalParams, callback: msRest.ServiceCallback): void; + update(resourceGroupName: string, communicationServiceName: string, options?: Models.CommunicationServiceUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + communicationServiceName, + options + }, + updateOperationSpec, + callback) as Promise; + } + + /** + * Get the CommunicationService and its properties. + * @summary Get + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param [options] The optional parameters + * @returns Promise + */ + get(resourceGroupName: string, communicationServiceName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param callback The callback + */ + get(resourceGroupName: string, communicationServiceName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param options The optional parameters + * @param callback The callback + */ + get(resourceGroupName: string, communicationServiceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(resourceGroupName: string, communicationServiceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + communicationServiceName, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * @summary Create Or Update + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param [options] The optional parameters + * @returns Promise + */ + createOrUpdate(resourceGroupName: string, communicationServiceName: string, options?: Models.CommunicationServiceCreateOrUpdateOptionalParams): Promise { + return this.beginCreateOrUpdate(resourceGroupName,communicationServiceName,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Operation to delete a CommunicationService. + * @summary Delete + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(resourceGroupName: string, communicationServiceName: string, options?: msRest.RequestOptionsBase): Promise { + return this.beginDeleteMethod(resourceGroupName,communicationServiceName,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Get the access keys of the CommunicationService resource. + * @summary List Keys + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param [options] The optional parameters + * @returns Promise + */ + listKeys(resourceGroupName: string, communicationServiceName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param callback The callback + */ + listKeys(resourceGroupName: string, communicationServiceName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param options The optional parameters + * @param callback The callback + */ + listKeys(resourceGroupName: string, communicationServiceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listKeys(resourceGroupName: string, communicationServiceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + communicationServiceName, + options + }, + listKeysOperationSpec, + callback) as Promise; + } + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at + * the same time. + * @summary Regenerate Key + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param [options] The optional parameters + * @returns Promise + */ + regenerateKey(resourceGroupName: string, communicationServiceName: string, options?: Models.CommunicationServiceRegenerateKeyOptionalParams): Promise; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param callback The callback + */ + regenerateKey(resourceGroupName: string, communicationServiceName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param options The optional parameters + * @param callback The callback + */ + regenerateKey(resourceGroupName: string, communicationServiceName: string, options: Models.CommunicationServiceRegenerateKeyOptionalParams, callback: msRest.ServiceCallback): void; + regenerateKey(resourceGroupName: string, communicationServiceName: string, options?: Models.CommunicationServiceRegenerateKeyOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + communicationServiceName, + options + }, + regenerateKeyOperationSpec, + callback) as Promise; + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * @summary Create Or Update + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param [options] The optional parameters + * @returns Promise + */ + beginCreateOrUpdate(resourceGroupName: string, communicationServiceName: string, options?: Models.CommunicationServiceBeginCreateOrUpdateOptionalParams): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + communicationServiceName, + options + }, + beginCreateOrUpdateOperationSpec, + options); + } + + /** + * Operation to delete a CommunicationService. + * @summary Delete + * @param resourceGroupName The name of the resource group that contains the resource. You can + * obtain this value from the Azure Resource Manager API or the portal. + * @param communicationServiceName The name of the CommunicationService resource. + * @param [options] The optional parameters + * @returns Promise + */ + beginDeleteMethod(resourceGroupName: string, communicationServiceName: string, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + communicationServiceName, + options + }, + beginDeleteMethodOperationSpec, + options); + } + + /** + * Handles requests to list all resources in a subscription. + * @summary List By Subscription + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listBySubscriptionNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listBySubscriptionNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listBySubscriptionNextOperationSpec, + callback) as Promise; + } + + /** + * Handles requests to list all resources in a resource group. + * @summary List By Resource Group + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listByResourceGroupNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const linkNotificationHubOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/linkNotificationHub", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communicationServiceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: [ + "options", + "linkNotificationHubParameters" + ], + mapper: Mappers.LinkNotificationHubParameters + }, + responses: { + 200: { + bodyMapper: Mappers.LinkedNotificationHub + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listBySubscriptionOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CommunicationServiceResourceList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listByResourceGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CommunicationServiceResourceList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communicationServiceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: [ + "options", + "parameters" + ], + mapper: Mappers.TaggedResource + }, + responses: { + 200: { + bodyMapper: Mappers.CommunicationServiceResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communicationServiceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CommunicationServiceResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listKeysOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communicationServiceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CommunicationServiceKeys + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const regenerateKeyOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communicationServiceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: [ + "options", + "parameters" + ], + mapper: Mappers.RegenerateKeyParameters + }, + responses: { + 200: { + bodyMapper: Mappers.CommunicationServiceKeys + }, + 201: { + bodyMapper: Mappers.CommunicationServiceKeys + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communicationServiceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: [ + "options", + "parameters" + ], + mapper: Mappers.CommunicationServiceResource + }, + responses: { + 200: { + bodyMapper: Mappers.CommunicationServiceResource, + headersMapper: Mappers.CommunicationServiceCreateOrUpdateHeaders + }, + 201: { + bodyMapper: Mappers.CommunicationServiceResource, + headersMapper: Mappers.CommunicationServiceCreateOrUpdateHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse, + headersMapper: Mappers.CommunicationServiceCreateOrUpdateHeaders + } + }, + serializer +}; + +const beginDeleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communicationServiceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + headersMapper: Mappers.CommunicationServiceDeleteHeaders + }, + 202: { + headersMapper: Mappers.CommunicationServiceDeleteHeaders + }, + 204: { + headersMapper: Mappers.CommunicationServiceDeleteHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse, + headersMapper: Mappers.CommunicationServiceDeleteHeaders + } + }, + serializer +}; + +const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CommunicationServiceResourceList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CommunicationServiceResourceList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/communication/arm-communication/src/operations/index.ts b/sdk/communication/arm-communication/src/operations/index.ts new file mode 100644 index 000000000000..8bfc7298c3a3 --- /dev/null +++ b/sdk/communication/arm-communication/src/operations/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export * from "./operations"; +export * from "./communicationService"; +export * from "./operationStatuses"; diff --git a/sdk/communication/arm-communication/src/operations/operationStatuses.ts b/sdk/communication/arm-communication/src/operations/operationStatuses.ts new file mode 100644 index 000000000000..e7b491c708e0 --- /dev/null +++ b/sdk/communication/arm-communication/src/operations/operationStatuses.ts @@ -0,0 +1,87 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/operationStatusesMappers"; +import * as Parameters from "../models/parameters"; +import { CommunicationServiceManagementClientContext } from "../communicationServiceManagementClientContext"; + +/** Class representing a OperationStatuses. */ +export class OperationStatuses { + private readonly client: CommunicationServiceManagementClientContext; + + /** + * Create a OperationStatuses. + * @param {CommunicationServiceManagementClientContext} client Reference to the service client. + */ + constructor(client: CommunicationServiceManagementClientContext) { + this.client = client; + } + + /** + * Gets the current status of an async operation. + * @summary Get Operation Status + * @param location The Azure region + * @param operationId The ID of an ongoing async operation + * @param [options] The optional parameters + * @returns Promise + */ + get(location: string, operationId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param location The Azure region + * @param operationId The ID of an ongoing async operation + * @param callback The callback + */ + get(location: string, operationId: string, callback: msRest.ServiceCallback): void; + /** + * @param location The Azure region + * @param operationId The ID of an ongoing async operation + * @param options The optional parameters + * @param callback The callback + */ + get(location: string, operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(location: string, operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + location, + operationId, + options + }, + getOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Communication/locations/{location}/operationStatuses/{operationId}", + urlParameters: [ + Parameters.location, + Parameters.operationId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationStatus + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/communication/arm-communication/src/operations/operations.ts b/sdk/communication/arm-communication/src/operations/operations.ts new file mode 100644 index 000000000000..e44adebf41db --- /dev/null +++ b/sdk/communication/arm-communication/src/operations/operations.ts @@ -0,0 +1,125 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/operationsMappers"; +import * as Parameters from "../models/parameters"; +import { CommunicationServiceManagementClientContext } from "../communicationServiceManagementClientContext"; + +/** Class representing a Operations. */ +export class Operations { + private readonly client: CommunicationServiceManagementClientContext; + + /** + * Create a Operations. + * @param {CommunicationServiceManagementClientContext} client Reference to the service client. + */ + constructor(client: CommunicationServiceManagementClientContext) { + this.client = client; + } + + /** + * Lists all of the available REST API operations of the Microsoft.Communication provider. + * @summary List Operations + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Lists all of the available REST API operations of the Microsoft.Communication provider. + * @summary List Operations + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Communication/operations", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/communication/arm-communication/tsconfig.json b/sdk/communication/arm-communication/tsconfig.json new file mode 100644 index 000000000000..422b584abd5e --- /dev/null +++ b/sdk/communication/arm-communication/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6", "dom"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules"] +}