From 6fe00c782e3d7925d5aa35d68ee96d4613d1dbd1 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 17 Apr 2019 10:16:09 -0700 Subject: [PATCH] Generated from 4fc48948542c87996ffc1db30e5b58f9697e97be (#2319) Add IOT central app templates api in swagger --- sdk/iotcentral/arm-iotcentral/LICENSE.txt | 21 + sdk/iotcentral/arm-iotcentral/README.md | 100 +++ .../arm-iotcentral/lib/iotCentralClient.ts | 44 ++ .../lib/iotCentralClientContext.ts | 62 ++ .../arm-iotcentral/lib/models/appsMappers.ts | 25 + .../arm-iotcentral/lib/models/index.ts | 697 +++++++++++++++++ .../arm-iotcentral/lib/models/mappers.ts | 530 +++++++++++++ .../lib/models/operationsMappers.ts | 18 + .../arm-iotcentral/lib/models/parameters.ts | 73 ++ .../arm-iotcentral/lib/operations/apps.ts | 709 ++++++++++++++++++ .../arm-iotcentral/lib/operations/index.ts | 12 + .../lib/operations/operations.ts | 123 +++ sdk/iotcentral/arm-iotcentral/package.json | 56 ++ .../arm-iotcentral/rollup.config.js | 37 + sdk/iotcentral/arm-iotcentral/tsconfig.json | 19 + 15 files changed, 2526 insertions(+) create mode 100644 sdk/iotcentral/arm-iotcentral/LICENSE.txt create mode 100644 sdk/iotcentral/arm-iotcentral/README.md create mode 100644 sdk/iotcentral/arm-iotcentral/lib/iotCentralClient.ts create mode 100644 sdk/iotcentral/arm-iotcentral/lib/iotCentralClientContext.ts create mode 100644 sdk/iotcentral/arm-iotcentral/lib/models/appsMappers.ts create mode 100644 sdk/iotcentral/arm-iotcentral/lib/models/index.ts create mode 100644 sdk/iotcentral/arm-iotcentral/lib/models/mappers.ts create mode 100644 sdk/iotcentral/arm-iotcentral/lib/models/operationsMappers.ts create mode 100644 sdk/iotcentral/arm-iotcentral/lib/models/parameters.ts create mode 100644 sdk/iotcentral/arm-iotcentral/lib/operations/apps.ts create mode 100644 sdk/iotcentral/arm-iotcentral/lib/operations/index.ts create mode 100644 sdk/iotcentral/arm-iotcentral/lib/operations/operations.ts create mode 100644 sdk/iotcentral/arm-iotcentral/package.json create mode 100644 sdk/iotcentral/arm-iotcentral/rollup.config.js create mode 100644 sdk/iotcentral/arm-iotcentral/tsconfig.json diff --git a/sdk/iotcentral/arm-iotcentral/LICENSE.txt b/sdk/iotcentral/arm-iotcentral/LICENSE.txt new file mode 100644 index 000000000000..8f3d856145c5 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 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/iotcentral/arm-iotcentral/README.md b/sdk/iotcentral/arm-iotcentral/README.md new file mode 100644 index 000000000000..853497781966 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/README.md @@ -0,0 +1,100 @@ +## Azure IotCentralClient SDK for JavaScript + +This package contains an isomorphic SDK for IotCentralClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/arm-iotcentral +``` + +### How to use + +#### nodejs - Authentication, client creation and get apps as an example written in TypeScript. + +##### Install @azure/ms-rest-nodeauth + +```bash +npm install @azure/ms-rest-nodeauth +``` + +##### 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 { IotCentralClient, IotCentralModels, IotCentralMappers } from "@azure/arm-iotcentral"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new IotCentralClient(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + const resourceName = "testresourceName"; + client.apps.get(resourceGroupName, resourceName).then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and get apps 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-iotcentral sample + + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/sdk/iotcentral/arm-iotcentral/lib/iotCentralClient.ts b/sdk/iotcentral/arm-iotcentral/lib/iotCentralClient.ts new file mode 100644 index 000000000000..6a0d6dda5658 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/lib/iotCentralClient.ts @@ -0,0 +1,44 @@ +/* + * 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 { IotCentralClientContext } from "./iotCentralClientContext"; + + +class IotCentralClient extends IotCentralClientContext { + // Operation groups + apps: operations.Apps; + operations: operations.Operations; + + /** + * Initializes a new instance of the IotCentralClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId The subscription identifier. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.IotCentralClientOptions) { + super(credentials, subscriptionId, options); + this.apps = new operations.Apps(this); + this.operations = new operations.Operations(this); + } +} + +// Operation Specifications + +export { + IotCentralClient, + IotCentralClientContext, + Models as IotCentralModels, + Mappers as IotCentralMappers +}; +export * from "./operations"; diff --git a/sdk/iotcentral/arm-iotcentral/lib/iotCentralClientContext.ts b/sdk/iotcentral/arm-iotcentral/lib/iotCentralClientContext.ts new file mode 100644 index 000000000000..2fd9d4e530e7 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/lib/iotCentralClientContext.ts @@ -0,0 +1,62 @@ +/* + * 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-iotcentral"; +const packageVersion = "2.1.0"; + +export class IotCentralClientContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials; + subscriptionId: string; + apiVersion?: string; + + /** + * Initializes a new instance of the IotCentralClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId The subscription identifier. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.IotCentralClientOptions) { + 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 = '2018-09-01'; + 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/iotcentral/arm-iotcentral/lib/models/appsMappers.ts b/sdk/iotcentral/arm-iotcentral/lib/models/appsMappers.ts new file mode 100644 index 000000000000..fa60e8406dd1 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/lib/models/appsMappers.ts @@ -0,0 +1,25 @@ +/* + * 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 { + App, + Resource, + BaseResource, + AppSkuInfo, + ErrorDetails, + ErrorResponseBody, + AppPatch, + AppListResult, + OperationInputs, + AppAvailabilityInfo, + AppTemplatesResult, + AppTemplate +} from "../models/mappers"; + diff --git a/sdk/iotcentral/arm-iotcentral/lib/models/index.ts b/sdk/iotcentral/arm-iotcentral/lib/models/index.ts new file mode 100644 index 000000000000..6d35b086c473 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/lib/models/index.ts @@ -0,0 +1,697 @@ +/* + * 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 }; + + +/** + * @interface + * An interface representing AppSkuInfo. + * Information about the SKU of the IoT Central application. + * + */ +export interface AppSkuInfo { + /** + * @member {AppSku} name The name of the SKU. Possible values include: 'F1', + * 'S1' + */ + name: AppSku; +} + +/** + * @interface + * An interface representing Resource. + * The common properties of an ARM resource. + * + * @extends BaseResource + */ +export interface Resource extends BaseResource { + /** + * @member {string} [id] The ARM resource identifier. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [name] The ARM resource name. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {string} [type] The resource type. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; + /** + * @member {string} location The resource location. + */ + location: string; + /** + * @member {{ [propertyName: string]: string }} [tags] The resource tags. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * @interface + * An interface representing App. + * The IoT Central application. + * + * @extends Resource + */ +export interface App extends Resource { + /** + * @member {string} [applicationId] The ID of the application. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly applicationId?: string; + /** + * @member {string} [displayName] The display name of the application. + */ + displayName?: string; + /** + * @member {string} [subdomain] The subdomain of the application. + */ + subdomain?: string; + /** + * @member {string} [template] The ID of the application template, which is a + * blueprint that defines the characteristics and behaviors of an + * application. Optional; if not specified, defaults to a blank blueprint and + * allows the application to be defined from scratch. + */ + template?: string; + /** + * @member {AppSkuInfo} sku A valid instance SKU. + */ + sku: AppSkuInfo; +} + +/** + * @interface + * An interface representing AppPatch. + * The description of the IoT Central application. + * + */ +export interface AppPatch { + /** + * @member {{ [propertyName: string]: string }} [tags] Instance tags + */ + tags?: { [propertyName: string]: string }; + /** + * @member {string} [applicationId] The ID of the application. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly applicationId?: string; + /** + * @member {string} [displayName] The display name of the application. + */ + displayName?: string; + /** + * @member {string} [subdomain] The subdomain of the application. + */ + subdomain?: string; + /** + * @member {string} [template] The ID of the application template, which is a + * blueprint that defines the characteristics and behaviors of an + * application. Optional; if not specified, defaults to a blank blueprint and + * allows the application to be defined from scratch. + */ + template?: string; +} + +/** + * @interface + * An interface representing ErrorResponseBody. + * Details of error response. + * + */ +export interface ErrorResponseBody { + /** + * @member {string} [code] The error code. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly code?: string; + /** + * @member {string} [message] The error message. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly message?: string; + /** + * @member {string} [target] The target of the particular error. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly target?: string; + /** + * @member {ErrorResponseBody[]} [details] A list of additional details about + * the error. + */ + details?: ErrorResponseBody[]; +} + +/** + * @interface + * An interface representing ErrorDetails. + * Error details. + * + */ +export interface ErrorDetails { + /** + * @member {string} [code] The error code. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly code?: string; + /** + * @member {string} [message] The error message. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly message?: string; + /** + * @member {string} [target] The target of the particular error. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly target?: string; + /** + * @member {ErrorResponseBody[]} [details] A list of additional details about + * the error. + */ + details?: ErrorResponseBody[]; +} + +/** + * @interface + * An interface representing OperationDisplay. + * The object that represents the operation. + * + */ +export interface OperationDisplay { + /** + * @member {string} [provider] Service provider: Microsoft IoT Central + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly provider?: string; + /** + * @member {string} [resource] Resource Type: IoT Central + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly resource?: string; + /** + * @member {string} [operation] Name of the operation + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly operation?: string; + /** + * @member {string} [description] Friendly description for the operation, + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly description?: string; +} + +/** + * @interface + * An interface representing Operation. + * IoT Central REST API operation + * + */ +export interface Operation { + /** + * @member {string} [name] Operation name: {provider}/{resource}/{read | + * write | action | delete} + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {OperationDisplay} [display] The object that represents the + * operation. + */ + display?: OperationDisplay; +} + +/** + * @interface + * An interface representing OperationInputs. + * Input values. + * + */ +export interface OperationInputs { + /** + * @member {string} name The name of the IoT Central application instance to + * check. + */ + name: string; + /** + * @member {string} [type] The type of the IoT Central resource to query. + * Default value: 'IoTApps' . + */ + type?: string; +} + +/** + * @interface + * An interface representing AppAvailabilityInfo. + * The properties indicating whether a given IoT Central application name or + * subdomain is available. + * + */ +export interface AppAvailabilityInfo { + /** + * @member {boolean} [nameAvailable] The value which indicates whether the + * provided name is available. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly nameAvailable?: boolean; + /** + * @member {string} [reason] The reason for unavailability. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly reason?: string; + /** + * @member {string} [message] The detailed reason message. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly message?: string; +} + +/** + * @interface + * An interface representing AppTemplate. + * IoT Central Application Template. + * + */ +export interface AppTemplate { + /** + * @member {string} [manifestId] The ID of the template. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly manifestId?: string; + /** + * @member {string} [manifestVersion] The version of the template. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly manifestVersion?: string; + /** + * @member {string} [appTemplateName] The name of the template. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly appTemplateName?: string; + /** + * @member {string} [title] The title of the template. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly title?: string; + /** + * @member {number} [order] The order of the template in the templates list. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly order?: number; + /** + * @member {string} [description] The description of the template. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly description?: string; +} + +/** + * @interface + * An interface representing IotCentralClientOptions. + * @extends AzureServiceClientOptions + */ +export interface IotCentralClientOptions extends AzureServiceClientOptions { + /** + * @member {string} [baseUri] + */ + baseUri?: string; +} + + +/** + * @interface + * An interface representing the AppListResult. + * A list of IoT Central Applications with a next link. + * + * @extends Array + */ +export interface AppListResult extends Array { + /** + * @member {string} [nextLink] The link used to get the next page of IoT + * Central Applications. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the AppTemplatesResult. + * A list of IoT Central Application Templates with a next link. + * + * @extends Array + */ +export interface AppTemplatesResult extends Array { + /** + * @member {string} [nextLink] The link used to get the next page of IoT + * Central application templates. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the OperationListResult. + * A list of IoT Central operations. It contains a list of operations and a URL + * link to get the next set of results. + * + * @extends Array + */ +export interface OperationListResult extends Array { + /** + * @member {string} [nextLink] The link used to get the next page of IoT + * Central description objects. + */ + nextLink?: string; +} + +/** + * Defines values for AppSku. + * Possible values include: 'F1', 'S1' + * @readonly + * @enum {string} + */ +export type AppSku = 'F1' | 'S1'; + +/** + * Contains response data for the get operation. + */ +export type AppsGetResponse = App & { + /** + * 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: App; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type AppsCreateOrUpdateResponse = App & { + /** + * 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: App; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type AppsUpdateResponse = App & { + /** + * 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: App; + }; +}; + +/** + * Contains response data for the listBySubscription operation. + */ +export type AppsListBySubscriptionResponse = AppListResult & { + /** + * 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: AppListResult; + }; +}; + +/** + * Contains response data for the listByResourceGroup operation. + */ +export type AppsListByResourceGroupResponse = AppListResult & { + /** + * 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: AppListResult; + }; +}; + +/** + * Contains response data for the checkNameAvailability operation. + */ +export type AppsCheckNameAvailabilityResponse = AppAvailabilityInfo & { + /** + * 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: AppAvailabilityInfo; + }; +}; + +/** + * Contains response data for the checkSubdomainAvailability operation. + */ +export type AppsCheckSubdomainAvailabilityResponse = AppAvailabilityInfo & { + /** + * 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: AppAvailabilityInfo; + }; +}; + +/** + * Contains response data for the listTemplates operation. + */ +export type AppsListTemplatesResponse = AppTemplatesResult & { + /** + * 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: AppTemplatesResult; + }; +}; + +/** + * Contains response data for the beginCreateOrUpdate operation. + */ +export type AppsBeginCreateOrUpdateResponse = App & { + /** + * 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: App; + }; +}; + +/** + * Contains response data for the beginUpdate operation. + */ +export type AppsBeginUpdateResponse = App & { + /** + * 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: App; + }; +}; + +/** + * Contains response data for the listBySubscriptionNext operation. + */ +export type AppsListBySubscriptionNextResponse = AppListResult & { + /** + * 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: AppListResult; + }; +}; + +/** + * Contains response data for the listByResourceGroupNext operation. + */ +export type AppsListByResourceGroupNextResponse = AppListResult & { + /** + * 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: AppListResult; + }; +}; + +/** + * Contains response data for the listTemplatesNext operation. + */ +export type AppsListTemplatesNextResponse = AppTemplatesResult & { + /** + * 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: AppTemplatesResult; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type OperationsListResponse = OperationListResult & { + /** + * 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: OperationListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type OperationsListNextResponse = OperationListResult & { + /** + * 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: OperationListResult; + }; +}; diff --git a/sdk/iotcentral/arm-iotcentral/lib/models/mappers.ts b/sdk/iotcentral/arm-iotcentral/lib/models/mappers.ts new file mode 100644 index 000000000000..5f5e7b0b7549 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/lib/models/mappers.ts @@ -0,0 +1,530 @@ +/* + * 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 AppSkuInfo: msRest.CompositeMapper = { + serializedName: "AppSkuInfo", + type: { + name: "Composite", + className: "AppSkuInfo", + modelProperties: { + name: { + required: true, + serializedName: "name", + 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", + constraints: { + Pattern: /^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,99}[a-zA-Z0-9]$/ + }, + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + location: { + required: true, + serializedName: "location", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const App: msRest.CompositeMapper = { + serializedName: "App", + type: { + name: "Composite", + className: "App", + modelProperties: { + ...Resource.type.modelProperties, + applicationId: { + readOnly: true, + serializedName: "properties.applicationId", + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + constraints: { + Pattern: /^.{1,200}$/ + }, + type: { + name: "String" + } + }, + subdomain: { + serializedName: "properties.subdomain", + constraints: { + Pattern: /^[a-z0-9-]{1,63}$/ + }, + type: { + name: "String" + } + }, + template: { + serializedName: "properties.template", + type: { + name: "String" + } + }, + sku: { + required: true, + serializedName: "sku", + type: { + name: "Composite", + className: "AppSkuInfo" + } + } + } + } +}; + +export const AppPatch: msRest.CompositeMapper = { + serializedName: "AppPatch", + type: { + name: "Composite", + className: "AppPatch", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + applicationId: { + readOnly: true, + serializedName: "properties.applicationId", + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + constraints: { + Pattern: /^.{1,200}$/ + }, + type: { + name: "String" + } + }, + subdomain: { + serializedName: "properties.subdomain", + constraints: { + Pattern: /^[a-z0-9-]{1,63}$/ + }, + type: { + name: "String" + } + }, + template: { + serializedName: "properties.template", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponseBody: msRest.CompositeMapper = { + serializedName: "ErrorResponseBody", + type: { + name: "Composite", + className: "ErrorResponseBody", + modelProperties: { + code: { + readOnly: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "message", + type: { + name: "String" + } + }, + target: { + readOnly: true, + serializedName: "target", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorResponseBody" + } + } + } + } + } + } +}; + +export const ErrorDetails: msRest.CompositeMapper = { + serializedName: "ErrorDetails", + type: { + name: "Composite", + className: "ErrorDetails", + modelProperties: { + code: { + readOnly: true, + serializedName: "error.code", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "error.message", + type: { + name: "String" + } + }, + target: { + readOnly: true, + serializedName: "error.target", + type: { + name: "String" + } + }, + details: { + serializedName: "error.details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorResponseBody" + } + } + } + } + } + } +}; + +export const OperationDisplay: msRest.CompositeMapper = { + serializedName: "OperationDisplay", + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + readOnly: true, + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + readOnly: true, + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + readOnly: true, + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + readOnly: true, + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const Operation: msRest.CompositeMapper = { + serializedName: "Operation", + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + } + } + } +}; + +export const OperationInputs: msRest.CompositeMapper = { + serializedName: "OperationInputs", + type: { + name: "Composite", + className: "OperationInputs", + modelProperties: { + name: { + required: true, + serializedName: "name", + constraints: { + Pattern: /^[a-z0-9-]{1,63}$/ + }, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + defaultValue: 'IoTApps', + type: { + name: "String" + } + } + } + } +}; + +export const AppAvailabilityInfo: msRest.CompositeMapper = { + serializedName: "AppAvailabilityInfo", + type: { + name: "Composite", + className: "AppAvailabilityInfo", + modelProperties: { + nameAvailable: { + readOnly: true, + serializedName: "nameAvailable", + type: { + name: "Boolean" + } + }, + reason: { + readOnly: true, + serializedName: "reason", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const AppTemplate: msRest.CompositeMapper = { + serializedName: "AppTemplate", + type: { + name: "Composite", + className: "AppTemplate", + modelProperties: { + manifestId: { + readOnly: true, + serializedName: "manifestId", + type: { + name: "String" + } + }, + manifestVersion: { + readOnly: true, + serializedName: "manifestVersion", + type: { + name: "String" + } + }, + appTemplateName: { + readOnly: true, + serializedName: "appTemplateName", + type: { + name: "String" + } + }, + title: { + readOnly: true, + serializedName: "title", + type: { + name: "String" + } + }, + order: { + readOnly: true, + serializedName: "order", + type: { + name: "Number" + } + }, + description: { + readOnly: true, + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const AppListResult: msRest.CompositeMapper = { + serializedName: "AppListResult", + type: { + name: "Composite", + className: "AppListResult", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "App" + } + } + } + } + } + } +}; + +export const AppTemplatesResult: msRest.CompositeMapper = { + serializedName: "AppTemplatesResult", + type: { + name: "Composite", + className: "AppTemplatesResult", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + readOnly: true, + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AppTemplate" + } + } + } + } + } + } +}; + +export const OperationListResult: msRest.CompositeMapper = { + serializedName: "OperationListResult", + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + readOnly: true, + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + } + } + } +}; diff --git a/sdk/iotcentral/arm-iotcentral/lib/models/operationsMappers.ts b/sdk/iotcentral/arm-iotcentral/lib/models/operationsMappers.ts new file mode 100644 index 000000000000..ddb8dd74b309 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/lib/models/operationsMappers.ts @@ -0,0 +1,18 @@ +/* + * 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 { + OperationListResult, + Operation, + OperationDisplay, + ErrorDetails, + ErrorResponseBody +} from "../models/mappers"; + diff --git a/sdk/iotcentral/arm-iotcentral/lib/models/parameters.ts b/sdk/iotcentral/arm-iotcentral/lib/models/parameters.ts new file mode 100644 index 000000000000..52c2fc91f383 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/lib/models/parameters.ts @@ -0,0 +1,73 @@ +/* + * 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, + serializedName: "api-version", + type: { + name: "String" + } + } +}; +export const nextPageLink: msRest.OperationURLParameter = { + parameterPath: "nextPageLink", + mapper: { + required: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const resourceGroupName: msRest.OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + required: true, + serializedName: "resourceGroupName", + type: { + name: "String" + } + } +}; +export const resourceName: msRest.OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + required: true, + serializedName: "resourceName", + type: { + name: "String" + } + } +}; +export const subscriptionId: msRest.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + required: true, + serializedName: "subscriptionId", + type: { + name: "String" + } + } +}; diff --git a/sdk/iotcentral/arm-iotcentral/lib/operations/apps.ts b/sdk/iotcentral/arm-iotcentral/lib/operations/apps.ts new file mode 100644 index 000000000000..3c7c4d9d028a --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/lib/operations/apps.ts @@ -0,0 +1,709 @@ +/* + * 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/appsMappers"; +import * as Parameters from "../models/parameters"; +import { IotCentralClientContext } from "../iotCentralClientContext"; + +/** Class representing a Apps. */ +export class Apps { + private readonly client: IotCentralClientContext; + + /** + * Create a Apps. + * @param {IotCentralClientContext} client Reference to the service client. + */ + constructor(client: IotCentralClientContext) { + this.client = client; + } + + /** + * Get the metadata of an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param [options] The optional parameters + * @returns Promise + */ + get(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param callback The callback + */ + get(resourceGroupName: string, resourceName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param options The optional parameters + * @param callback The callback + */ + get(resourceGroupName: string, resourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + resourceName, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a + * property is to retrieve the IoT Central application metadata and security metadata, and then + * combine them with the modified values in a new body to update the IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param [options] The optional parameters + * @returns Promise + */ + createOrUpdate(resourceGroupName: string, resourceName: string, app: Models.App, options?: msRest.RequestOptionsBase): Promise { + return this.beginCreateOrUpdate(resourceGroupName,resourceName,app,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Update the metadata of an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param [options] The optional parameters + * @returns Promise + */ + update(resourceGroupName: string, resourceName: string, appPatch: Models.AppPatch, options?: msRest.RequestOptionsBase): Promise { + return this.beginUpdate(resourceGroupName,resourceName,appPatch,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Delete an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise { + return this.beginDeleteMethod(resourceGroupName,resourceName,options) + .then(lroPoller => lroPoller.pollUntilFinished()); + } + + /** + * Get all IoT Central Applications in a 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; + } + + /** + * Get all the IoT Central Applications in a resource group. + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @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 IoT Central + * application. + * @param callback The callback + */ + listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @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; + } + + /** + * Check if an IoT Central application name is available. + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of + * the IoT Central application to check. + * @param [options] The optional parameters + * @returns Promise + */ + checkNameAvailability(operationInputs: Models.OperationInputs, options?: msRest.RequestOptionsBase): Promise; + /** + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of + * the IoT Central application to check. + * @param callback The callback + */ + checkNameAvailability(operationInputs: Models.OperationInputs, callback: msRest.ServiceCallback): void; + /** + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of + * the IoT Central application to check. + * @param options The optional parameters + * @param callback The callback + */ + checkNameAvailability(operationInputs: Models.OperationInputs, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + checkNameAvailability(operationInputs: Models.OperationInputs, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + operationInputs, + options + }, + checkNameAvailabilityOperationSpec, + callback) as Promise; + } + + /** + * Check if an IoT Central application subdomain is available. + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain + * of the IoT Central application to check. + * @param [options] The optional parameters + * @returns Promise + */ + checkSubdomainAvailability(operationInputs: Models.OperationInputs, options?: msRest.RequestOptionsBase): Promise; + /** + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain + * of the IoT Central application to check. + * @param callback The callback + */ + checkSubdomainAvailability(operationInputs: Models.OperationInputs, callback: msRest.ServiceCallback): void; + /** + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain + * of the IoT Central application to check. + * @param options The optional parameters + * @param callback The callback + */ + checkSubdomainAvailability(operationInputs: Models.OperationInputs, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + checkSubdomainAvailability(operationInputs: Models.OperationInputs, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + operationInputs, + options + }, + checkSubdomainAvailabilityOperationSpec, + callback) as Promise; + } + + /** + * Get all available application templates. + * @param [options] The optional parameters + * @returns Promise + */ + listTemplates(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + listTemplates(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + listTemplates(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listTemplates(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listTemplatesOperationSpec, + callback) as Promise; + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a + * property is to retrieve the IoT Central application metadata and security metadata, and then + * combine them with the modified values in a new body to update the IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param [options] The optional parameters + * @returns Promise + */ + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, app: Models.App, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + resourceName, + app, + options + }, + beginCreateOrUpdateOperationSpec, + options); + } + + /** + * Update the metadata of an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param [options] The optional parameters + * @returns Promise + */ + beginUpdate(resourceGroupName: string, resourceName: string, appPatch: Models.AppPatch, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + resourceName, + appPatch, + options + }, + beginUpdateOperationSpec, + options); + } + + /** + * Delete an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central + * application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param [options] The optional parameters + * @returns Promise + */ + beginDeleteMethod(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + resourceName, + options + }, + beginDeleteMethodOperationSpec, + options); + } + + /** + * Get all IoT Central Applications in a 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; + } + + /** + * Get all the IoT Central Applications in a 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; + } + + /** + * Get all available application templates. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listTemplatesNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listTemplatesNext(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 + */ + listTemplatesNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listTemplatesNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listTemplatesNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.App + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const listBySubscriptionOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/IoTApps", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AppListResult + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const listByResourceGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AppListResult + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const checkNameAvailabilityOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "operationInputs", + mapper: { + ...Mappers.OperationInputs, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.AppAvailabilityInfo + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const checkSubdomainAvailabilityOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "operationInputs", + mapper: { + ...Mappers.OperationInputs, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.AppAvailabilityInfo + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const listTemplatesOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AppTemplatesResult + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "app", + mapper: { + ...Mappers.App, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.App + }, + 201: { + bodyMapper: Mappers.App + }, + 202: {}, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const beginUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "appPatch", + mapper: { + ...Mappers.AppPatch, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.App + }, + 202: {}, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const beginDeleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AppListResult + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AppListResult + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const listTemplatesNextOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AppTemplatesResult + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; diff --git a/sdk/iotcentral/arm-iotcentral/lib/operations/index.ts b/sdk/iotcentral/arm-iotcentral/lib/operations/index.ts new file mode 100644 index 000000000000..70ed2d402d57 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/lib/operations/index.ts @@ -0,0 +1,12 @@ +/* + * 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 "./apps"; +export * from "./operations"; diff --git a/sdk/iotcentral/arm-iotcentral/lib/operations/operations.ts b/sdk/iotcentral/arm-iotcentral/lib/operations/operations.ts new file mode 100644 index 000000000000..1aa32aa10bce --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/lib/operations/operations.ts @@ -0,0 +1,123 @@ +/* + * 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 { IotCentralClientContext } from "../iotCentralClientContext"; + +/** Class representing a Operations. */ +export class Operations { + private readonly client: IotCentralClientContext; + + /** + * Create a Operations. + * @param {IotCentralClientContext} client Reference to the service client. + */ + constructor(client: IotCentralClientContext) { + this.client = client; + } + + /** + * Lists all of the available IoT Central application REST API 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 IoT Central application REST API 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.IoTCentral/operations", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; diff --git a/sdk/iotcentral/arm-iotcentral/package.json b/sdk/iotcentral/arm-iotcentral/package.json new file mode 100644 index 000000000000..163f7c87f07a --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/package.json @@ -0,0 +1,56 @@ +{ + "name": "@azure/arm-iotcentral", + "author": "Microsoft Corporation", + "description": "IotCentralClient Library with typescript type definitions for node.js and browser.", + "version": "2.1.0", + "dependencies": { + "@azure/ms-rest-azure-js": "^1.2.0", + "@azure/ms-rest-js": "^1.2.0", + "tslib": "^1.9.3" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/arm-iotcentral.js", + "module": "./esm/iotCentralClient.js", + "types": "./esm/iotCentralClient.d.ts", + "devDependencies": { + "typescript": "^3.1.1", + "rollup": "^0.66.2", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.4.9" + }, + "homepage": "https://github.com/azure/azure-sdk-for-js", + "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", + "lib/**/*.ts", + "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-iotcentral.js.map'\" -o ./dist/arm-iotcentral.min.js ./dist/arm-iotcentral.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false +} diff --git a/sdk/iotcentral/arm-iotcentral/rollup.config.js b/sdk/iotcentral/arm-iotcentral/rollup.config.js new file mode 100644 index 000000000000..5867cd5ab746 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/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/iotCentralClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/arm-iotcentral.js", + format: "umd", + name: "Azure.ArmIotcentral", + 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({ module: true }), + sourcemaps() + ] +}; + +export default config; diff --git a/sdk/iotcentral/arm-iotcentral/tsconfig.json b/sdk/iotcentral/arm-iotcentral/tsconfig.json new file mode 100644 index 000000000000..51ea90961ce5 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/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"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./lib/**/*.ts"], + "exclude": ["node_modules"] +}