diff --git a/codegen_mappings.json b/codegen_mappings.json index 67df66955c..22e75e4501 100644 --- a/codegen_mappings.json +++ b/codegen_mappings.json @@ -688,5 +688,15 @@ "dir": "deviceprovisioningservicesManagement/lib", "source": "deviceprovisioningservices/resource-manager/readme.md" } + }, + "iotspaces": { + "resource-manager": { + "packageName": "azure-arm-iotspaces", + "packageVersion": "1.0.0-preview", + "generatePackageJson": true, + "generateReadmeMd": true, + "dir": "iotspacesManagement/lib", + "source": "iotspaces/resource-manager/readme.md" + } } } \ No newline at end of file diff --git a/lib/services/iotspacesManagement/lib/README.md b/lib/services/iotspacesManagement/lib/README.md new file mode 100644 index 0000000000..e4cbf7075f --- /dev/null +++ b/lib/services/iotspacesManagement/lib/README.md @@ -0,0 +1,37 @@ +# Microsoft Azure SDK for Node.js - IoTSpacesClient +This project provides a Node.js package for accessing Azure. Right now it supports: +- **Node.js version 6.x.x or higher** + +## Features + + +## How to Install + +```bash +npm install azure-arm-iotspaces +``` + +## How to use + +### Authentication, client creation and get ioTSpaces as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const IoTSpacesClient = require("azure-arm-iotspaces"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new IoTSpacesClient(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + const resourceName = "testresourceName"; + return client.ioTSpaces.get(resourceGroupName, resourceName).then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error ocurred:'); + console.dir(err, {depth: null, colors: true}); +}); + +## Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/iotspacesManagement/lib/ioTSpacesClient.d.ts b/lib/services/iotspacesManagement/lib/ioTSpacesClient.d.ts new file mode 100644 index 0000000000..543d914399 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/ioTSpacesClient.d.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 { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class IoTSpacesClient extends AzureServiceClient { + /** + * Initializes a new instance of the IoTSpacesClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {uuid} subscriptionId - The subscription identifier. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + apiVersion: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + ioTSpaces: operations.IoTSpaces; + operations: operations.Operations; +} + +export { IoTSpacesClient, models as IoTSpacesModels }; diff --git a/lib/services/iotspacesManagement/lib/ioTSpacesClient.js b/lib/services/iotspacesManagement/lib/ioTSpacesClient.js new file mode 100644 index 0000000000..8d600b3932 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/ioTSpacesClient.js @@ -0,0 +1,86 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a IoTSpacesClient. */ +class IoTSpacesClient extends ServiceClient { + /** + * Create a IoTSpacesClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {uuid} subscriptionId - The subscription identifier. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2017-10-01-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.ioTSpaces = new operations.IoTSpaces(this); + this.operations = new operations.Operations(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = IoTSpacesClient; +module.exports['default'] = IoTSpacesClient; +module.exports.IoTSpacesClient = IoTSpacesClient; +module.exports.IoTSpacesModels = models; diff --git a/lib/services/iotspacesManagement/lib/models/errorDetails.js b/lib/services/iotspacesManagement/lib/models/errorDetails.js new file mode 100644 index 0000000000..ecf7b7ce09 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/errorDetails.js @@ -0,0 +1,71 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Error details. + * + */ +class ErrorDetails { + /** + * Create a ErrorDetails. + * @member {string} [code] The error code. + * @member {string} [message] The error message. + * @member {string} [target] The target of the particular error. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorDetails + * + * @returns {object} metadata of ErrorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorDetails', + type: { + name: 'Composite', + className: 'ErrorDetails', + modelProperties: { + code: { + required: false, + readOnly: true, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + target: { + required: false, + readOnly: true, + serializedName: 'target', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorDetails; diff --git a/lib/services/iotspacesManagement/lib/models/index.d.ts b/lib/services/iotspacesManagement/lib/models/index.d.ts new file mode 100644 index 0000000000..85108acf96 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/index.d.ts @@ -0,0 +1,273 @@ +/* + * 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 } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the StorageContainerProperties class. + * @constructor + * The properties of the Azure Storage Container for file archive. + * + * @member {string} [connectionString] The connection string of the storage + * account. + * @member {string} [subscriptionId] The subscription identifier of the storage + * account. + * @member {string} [resourceGroup] The name of the resource group of the + * storage account. + * @member {string} [containerName] The name of storage container in the + * storage account. + */ +export interface StorageContainerProperties { + connectionString?: string; + subscriptionId?: string; + resourceGroup?: string; + containerName?: string; +} + +/** + * @class + * Initializes a new instance of the IoTSpacesProperties class. + * @constructor + * The properties of an IoTSpaces instance. + * + * @member {string} [provisioningState] The provisioning state. Possible values + * include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + * @member {string} [managementApiUrl] The management Api endpoint. + * @member {string} [webPortalUrl] The management UI endpoint. + * @member {object} [storageContainer] The properties of the designated storage + * container. + * @member {string} [storageContainer.connectionString] The connection string + * of the storage account. + * @member {string} [storageContainer.subscriptionId] The subscription + * identifier of the storage account. + * @member {string} [storageContainer.resourceGroup] The name of the resource + * group of the storage account. + * @member {string} [storageContainer.containerName] The name of storage + * container in the storage account. + */ +export interface IoTSpacesProperties { + readonly provisioningState?: string; + readonly managementApiUrl?: string; + readonly webPortalUrl?: string; + storageContainer?: StorageContainerProperties; +} + +/** + * @class + * Initializes a new instance of the IoTSpacesSkuInfo class. + * @constructor + * Information about the SKU of the IoTSpaces instance. + * + * @member {string} name The name of the SKU. Possible values include: 'F1', + * 'S1', 'S2', 'S3' + */ +export interface IoTSpacesSkuInfo { + name: string; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * The common properties of an IoTSpaces service. + * + * @member {string} [id] The resource identifier. + * @member {string} [name] The resource name. + * @member {string} [type] The resource type. + * @member {string} location The resource location. + * @member {object} [tags] The resource tags. + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + location: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the IoTSpacesDescription class. + * @constructor + * The description of the IoTSpaces service. + * + * @member {object} [properties] The common properties of a IoTSpaces service. + * @member {string} [properties.provisioningState] The provisioning state. + * Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', + * 'Canceled' + * @member {string} [properties.managementApiUrl] The management Api endpoint. + * @member {string} [properties.webPortalUrl] The management UI endpoint. + * @member {object} [properties.storageContainer] The properties of the + * designated storage container. + * @member {string} [properties.storageContainer.connectionString] The + * connection string of the storage account. + * @member {string} [properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * @member {string} [properties.storageContainer.resourceGroup] The name of the + * resource group of the storage account. + * @member {string} [properties.storageContainer.containerName] The name of + * storage container in the storage account. + * @member {object} sku A valid instance SKU. + * @member {string} [sku.name] The name of the SKU. Possible values include: + * 'F1', 'S1', 'S2', 'S3' + */ +export interface IoTSpacesDescription extends Resource { + properties?: IoTSpacesProperties; + sku: IoTSpacesSkuInfo; +} + +/** + * @class + * Initializes a new instance of the IoTSpacesPatchDescription class. + * @constructor + * The description of the IoTSpaces service. + * + * @member {object} [tags] Instance tags + * @member {object} [properties] The common properties of an IoTSpaces service. + * @member {string} [properties.provisioningState] The provisioning state. + * Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', + * 'Canceled' + * @member {string} [properties.managementApiUrl] The management Api endpoint. + * @member {string} [properties.webPortalUrl] The management UI endpoint. + * @member {object} [properties.storageContainer] The properties of the + * designated storage container. + * @member {string} [properties.storageContainer.connectionString] The + * connection string of the storage account. + * @member {string} [properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * @member {string} [properties.storageContainer.resourceGroup] The name of the + * resource group of the storage account. + * @member {string} [properties.storageContainer.containerName] The name of + * storage container in the storage account. + */ +export interface IoTSpacesPatchDescription { + tags?: { [propertyName: string]: string }; + properties?: IoTSpacesProperties; +} + +/** + * @class + * Initializes a new instance of the ErrorDetails class. + * @constructor + * Error details. + * + * @member {string} [code] The error code. + * @member {string} [message] The error message. + * @member {string} [target] The target of the particular error. + */ +export interface ErrorDetails { + readonly code?: string; + readonly message?: string; + readonly target?: string; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * The object that represents the operation. + * + * @member {string} [provider] Service provider: Microsoft IoTSpaces + * @member {string} [resource] Resource Type: IoTSpaces + * @member {string} [operation] Name of the operation + * @member {string} [description] Friendly description for the operation, + */ +export interface OperationDisplay { + readonly provider?: string; + readonly resource?: string; + readonly operation?: string; + readonly description?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * IoTSpaces service REST API operation + * + * @member {string} [name] Operation name: {provider}/{resource}/{read | write + * | action | delete} + * @member {object} [display] + * @member {string} [display.provider] Service provider: Microsoft IoTSpaces + * @member {string} [display.resource] Resource Type: IoTSpaces + * @member {string} [display.operation] Name of the operation + * @member {string} [display.description] Friendly description for the + * operation, + */ +export interface Operation { + readonly name?: string; + display?: OperationDisplay; +} + +/** + * @class + * Initializes a new instance of the OperationInputs class. + * @constructor + * Input values. + * + * @member {string} name The name of the IoTSpaces service instance to check. + */ +export interface OperationInputs { + name: string; +} + +/** + * @class + * Initializes a new instance of the IoTSpacesNameAvailabilityInfo class. + * @constructor + * The properties indicating whether a given IoTSpaces service name is + * available. + * + * @member {boolean} [nameAvailable] The value which indicates whether the + * provided name is available. + * @member {string} [reason] The reason for unavailability. Possible values + * include: 'Invalid', 'AlreadyExists' + * @member {string} [message] The detailed reason message. + */ +export interface IoTSpacesNameAvailabilityInfo { + readonly nameAvailable?: boolean; + readonly reason?: string; + message?: string; +} + + +/** + * @class + * Initializes a new instance of the IoTSpacesDescriptionListResult class. + * @constructor + * A list of IoTSpaces description objects with a next link. + * + * @member {string} [nextLink] The link used to get the next page of IoTSpaces + * description objects. + */ +export interface IoTSpacesDescriptionListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the OperationListResult class. + * @constructor + * A list of IoTSpaces service operations. It contains a list of operations and + * a URL link to get the next set of results. + * + * @member {string} [nextLink] The link used to get the next page of IoTSpaces + * description objects. + */ +export interface OperationListResult extends Array { + nextLink?: string; +} diff --git a/lib/services/iotspacesManagement/lib/models/index.js b/lib/services/iotspacesManagement/lib/models/index.js new file mode 100644 index 0000000000..888502d744 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/index.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.StorageContainerProperties = require('./storageContainerProperties'); +exports.IoTSpacesProperties = require('./ioTSpacesProperties'); +exports.IoTSpacesSkuInfo = require('./ioTSpacesSkuInfo'); +exports.Resource = require('./resource'); +exports.IoTSpacesDescription = require('./ioTSpacesDescription'); +exports.IoTSpacesPatchDescription = require('./ioTSpacesPatchDescription'); +exports.ErrorDetails = require('./errorDetails'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Operation = require('./operation'); +exports.OperationInputs = require('./operationInputs'); +exports.IoTSpacesNameAvailabilityInfo = require('./ioTSpacesNameAvailabilityInfo'); +exports.IoTSpacesDescriptionListResult = require('./ioTSpacesDescriptionListResult'); +exports.OperationListResult = require('./operationListResult'); diff --git a/lib/services/iotspacesManagement/lib/models/ioTSpacesDescription.js b/lib/services/iotspacesManagement/lib/models/ioTSpacesDescription.js new file mode 100644 index 0000000000..fa25272c2a --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/ioTSpacesDescription.js @@ -0,0 +1,133 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The description of the IoTSpaces service. + * + * @extends models['Resource'] + */ +class IoTSpacesDescription extends models['Resource'] { + /** + * Create a IoTSpacesDescription. + * @member {object} [properties] The common properties of a IoTSpaces + * service. + * @member {string} [properties.provisioningState] The provisioning state. + * Possible values include: 'Provisioning', 'Deleting', 'Succeeded', + * 'Failed', 'Canceled' + * @member {string} [properties.managementApiUrl] The management Api + * endpoint. + * @member {string} [properties.webPortalUrl] The management UI endpoint. + * @member {object} [properties.storageContainer] The properties of the + * designated storage container. + * @member {string} [properties.storageContainer.connectionString] The + * connection string of the storage account. + * @member {string} [properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * @member {string} [properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * @member {string} [properties.storageContainer.containerName] The name of + * storage container in the storage account. + * @member {object} sku A valid instance SKU. + * @member {string} [sku.name] The name of the SKU. Possible values include: + * 'F1', 'S1', 'S2', 'S3' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IoTSpacesDescription + * + * @returns {object} metadata of IoTSpacesDescription + * + */ + mapper() { + return { + required: false, + serializedName: 'IoTSpacesDescription', + type: { + name: 'Composite', + className: 'IoTSpacesDescription', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + constraints: { + Pattern: '^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$' + }, + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Composite', + className: 'IoTSpacesProperties' + } + }, + sku: { + required: true, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'IoTSpacesSkuInfo' + } + } + } + } + }; + } +} + +module.exports = IoTSpacesDescription; diff --git a/lib/services/iotspacesManagement/lib/models/ioTSpacesDescriptionListResult.js b/lib/services/iotspacesManagement/lib/models/ioTSpacesDescriptionListResult.js new file mode 100644 index 0000000000..cc86904588 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/ioTSpacesDescriptionListResult.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A list of IoTSpaces description objects with a next link. + */ +class IoTSpacesDescriptionListResult extends Array { + /** + * Create a IoTSpacesDescriptionListResult. + * @member {string} [nextLink] The link used to get the next page of + * IoTSpaces description objects. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IoTSpacesDescriptionListResult + * + * @returns {object} metadata of IoTSpacesDescriptionListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'IoTSpacesDescriptionListResult', + type: { + name: 'Composite', + className: 'IoTSpacesDescriptionListResult', + modelProperties: { + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IoTSpacesDescriptionElementType', + type: { + name: 'Composite', + className: 'IoTSpacesDescription' + } + } + } + } + } + } + }; + } +} + +module.exports = IoTSpacesDescriptionListResult; diff --git a/lib/services/iotspacesManagement/lib/models/ioTSpacesNameAvailabilityInfo.js b/lib/services/iotspacesManagement/lib/models/ioTSpacesNameAvailabilityInfo.js new file mode 100644 index 0000000000..ef6f0bc644 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/ioTSpacesNameAvailabilityInfo.js @@ -0,0 +1,74 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The properties indicating whether a given IoTSpaces service name is + * available. + * + */ +class IoTSpacesNameAvailabilityInfo { + /** + * Create a IoTSpacesNameAvailabilityInfo. + * @member {boolean} [nameAvailable] The value which indicates whether the + * provided name is available. + * @member {string} [reason] The reason for unavailability. Possible values + * include: 'Invalid', 'AlreadyExists' + * @member {string} [message] The detailed reason message. + */ + constructor() { + } + + /** + * Defines the metadata of IoTSpacesNameAvailabilityInfo + * + * @returns {object} metadata of IoTSpacesNameAvailabilityInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'IoTSpacesNameAvailabilityInfo', + type: { + name: 'Composite', + className: 'IoTSpacesNameAvailabilityInfo', + modelProperties: { + nameAvailable: { + required: false, + readOnly: true, + serializedName: 'nameAvailable', + type: { + name: 'Boolean' + } + }, + reason: { + required: false, + readOnly: true, + serializedName: 'reason', + type: { + name: 'Enum', + allowedValues: [ 'Invalid', 'AlreadyExists' ] + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IoTSpacesNameAvailabilityInfo; diff --git a/lib/services/iotspacesManagement/lib/models/ioTSpacesPatchDescription.js b/lib/services/iotspacesManagement/lib/models/ioTSpacesPatchDescription.js new file mode 100644 index 0000000000..2908874d00 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/ioTSpacesPatchDescription.js @@ -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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The description of the IoTSpaces service. + * + */ +class IoTSpacesPatchDescription { + /** + * Create a IoTSpacesPatchDescription. + * @member {object} [tags] Instance tags + * @member {object} [properties] The common properties of an IoTSpaces + * service. + * @member {string} [properties.provisioningState] The provisioning state. + * Possible values include: 'Provisioning', 'Deleting', 'Succeeded', + * 'Failed', 'Canceled' + * @member {string} [properties.managementApiUrl] The management Api + * endpoint. + * @member {string} [properties.webPortalUrl] The management UI endpoint. + * @member {object} [properties.storageContainer] The properties of the + * designated storage container. + * @member {string} [properties.storageContainer.connectionString] The + * connection string of the storage account. + * @member {string} [properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * @member {string} [properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * @member {string} [properties.storageContainer.containerName] The name of + * storage container in the storage account. + */ + constructor() { + } + + /** + * Defines the metadata of IoTSpacesPatchDescription + * + * @returns {object} metadata of IoTSpacesPatchDescription + * + */ + mapper() { + return { + required: false, + serializedName: 'IoTSpacesPatchDescription', + type: { + name: 'Composite', + className: 'IoTSpacesPatchDescription', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Composite', + className: 'IoTSpacesProperties' + } + } + } + } + }; + } +} + +module.exports = IoTSpacesPatchDescription; diff --git a/lib/services/iotspacesManagement/lib/models/ioTSpacesProperties.js b/lib/services/iotspacesManagement/lib/models/ioTSpacesProperties.js new file mode 100644 index 0000000000..d95e598882 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/ioTSpacesProperties.js @@ -0,0 +1,93 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The properties of an IoTSpaces instance. + * + */ +class IoTSpacesProperties { + /** + * Create a IoTSpacesProperties. + * @member {string} [provisioningState] The provisioning state. Possible + * values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', + * 'Canceled' + * @member {string} [managementApiUrl] The management Api endpoint. + * @member {string} [webPortalUrl] The management UI endpoint. + * @member {object} [storageContainer] The properties of the designated + * storage container. + * @member {string} [storageContainer.connectionString] The connection string + * of the storage account. + * @member {string} [storageContainer.subscriptionId] The subscription + * identifier of the storage account. + * @member {string} [storageContainer.resourceGroup] The name of the resource + * group of the storage account. + * @member {string} [storageContainer.containerName] The name of storage + * container in the storage account. + */ + constructor() { + } + + /** + * Defines the metadata of IoTSpacesProperties + * + * @returns {object} metadata of IoTSpacesProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'IoTSpacesProperties', + type: { + name: 'Composite', + className: 'IoTSpacesProperties', + modelProperties: { + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + managementApiUrl: { + required: false, + readOnly: true, + serializedName: 'managementApiUrl', + type: { + name: 'String' + } + }, + webPortalUrl: { + required: false, + readOnly: true, + serializedName: 'webPortalUrl', + type: { + name: 'String' + } + }, + storageContainer: { + required: false, + serializedName: 'storageContainer', + type: { + name: 'Composite', + className: 'StorageContainerProperties' + } + } + } + } + }; + } +} + +module.exports = IoTSpacesProperties; diff --git a/lib/services/iotspacesManagement/lib/models/ioTSpacesSkuInfo.js b/lib/services/iotspacesManagement/lib/models/ioTSpacesSkuInfo.js new file mode 100644 index 0000000000..25c4b3276b --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/ioTSpacesSkuInfo.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Information about the SKU of the IoTSpaces instance. + * + */ +class IoTSpacesSkuInfo { + /** + * Create a IoTSpacesSkuInfo. + * @member {string} name The name of the SKU. Possible values include: 'F1', + * 'S1', 'S2', 'S3' + */ + constructor() { + } + + /** + * Defines the metadata of IoTSpacesSkuInfo + * + * @returns {object} metadata of IoTSpacesSkuInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'IoTSpacesSkuInfo', + type: { + name: 'Composite', + className: 'IoTSpacesSkuInfo', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IoTSpacesSkuInfo; diff --git a/lib/services/iotspacesManagement/lib/models/operation.js b/lib/services/iotspacesManagement/lib/models/operation.js new file mode 100644 index 0000000000..960febe28b --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/operation.js @@ -0,0 +1,70 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * IoTSpaces service REST API operation + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} [name] Operation name: {provider}/{resource}/{read | + * write | action | delete} + * @member {object} [display] + * @member {string} [display.provider] Service provider: Microsoft IoTSpaces + * @member {string} [display.resource] Resource Type: IoTSpaces + * @member {string} [display.operation] Name of the operation + * @member {string} [display.description] Friendly description for the + * operation, + */ + constructor() { + } + + /** + * Defines the metadata of Operation + * + * @returns {object} metadata of Operation + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation', + type: { + name: 'Composite', + className: 'Operation', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/iotspacesManagement/lib/models/operationDisplay.js b/lib/services/iotspacesManagement/lib/models/operationDisplay.js new file mode 100644 index 0000000000..7661d46623 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/operationDisplay.js @@ -0,0 +1,80 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The object that represents the operation. + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @member {string} [provider] Service provider: Microsoft IoTSpaces + * @member {string} [resource] Resource Type: IoTSpaces + * @member {string} [operation] Name of the operation + * @member {string} [description] Friendly description for the operation, + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplay + * + * @returns {object} metadata of OperationDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationDisplay', + type: { + name: 'Composite', + className: 'OperationDisplay', + modelProperties: { + provider: { + required: false, + readOnly: true, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + readOnly: true, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + readOnly: true, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplay; diff --git a/lib/services/iotspacesManagement/lib/models/operationInputs.js b/lib/services/iotspacesManagement/lib/models/operationInputs.js new file mode 100644 index 0000000000..256fe9f223 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/operationInputs.js @@ -0,0 +1,52 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Input values. + * + */ +class OperationInputs { + /** + * Create a OperationInputs. + * @member {string} name The name of the IoTSpaces service instance to check. + */ + constructor() { + } + + /** + * Defines the metadata of OperationInputs + * + * @returns {object} metadata of OperationInputs + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationInputs', + type: { + name: 'Composite', + className: 'OperationInputs', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationInputs; diff --git a/lib/services/iotspacesManagement/lib/models/operationListResult.js b/lib/services/iotspacesManagement/lib/models/operationListResult.js new file mode 100644 index 0000000000..3cfefeb8e0 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/operationListResult.js @@ -0,0 +1,70 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A list of IoTSpaces service operations. It contains a list of operations and + * a URL link to get the next set of results. + */ +class OperationListResult extends Array { + /** + * Create a OperationListResult. + * @member {string} [nextLink] The link used to get the next page of + * IoTSpaces description objects. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OperationListResult + * + * @returns {object} metadata of OperationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationListResult', + type: { + name: 'Composite', + className: 'OperationListResult', + modelProperties: { + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + }, + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + } + } + } + }; + } +} + +module.exports = OperationListResult; diff --git a/lib/services/iotspacesManagement/lib/models/resource.js b/lib/services/iotspacesManagement/lib/models/resource.js new file mode 100644 index 0000000000..a26fbfb525 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/resource.js @@ -0,0 +1,101 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The common properties of an IoTSpaces service. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] The resource identifier. + * @member {string} [name] The resource name. + * @member {string} [type] The resource type. + * @member {string} location The resource location. + * @member {object} [tags] The resource tags. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + constraints: { + Pattern: '^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$' + }, + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/iotspacesManagement/lib/models/storageContainerProperties.js b/lib/services/iotspacesManagement/lib/models/storageContainerProperties.js new file mode 100644 index 0000000000..6f34cc1cc5 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/models/storageContainerProperties.js @@ -0,0 +1,80 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The properties of the Azure Storage Container for file archive. + * + */ +class StorageContainerProperties { + /** + * Create a StorageContainerProperties. + * @member {string} [connectionString] The connection string of the storage + * account. + * @member {string} [subscriptionId] The subscription identifier of the + * storage account. + * @member {string} [resourceGroup] The name of the resource group of the + * storage account. + * @member {string} [containerName] The name of storage container in the + * storage account. + */ + constructor() { + } + + /** + * Defines the metadata of StorageContainerProperties + * + * @returns {object} metadata of StorageContainerProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageContainerProperties', + type: { + name: 'Composite', + className: 'StorageContainerProperties', + modelProperties: { + connectionString: { + required: false, + serializedName: 'connectionString', + type: { + name: 'String' + } + }, + subscriptionId: { + required: false, + serializedName: 'subscriptionId', + type: { + name: 'String' + } + }, + resourceGroup: { + required: false, + serializedName: 'resourceGroup', + type: { + name: 'String' + } + }, + containerName: { + required: false, + serializedName: 'containerName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = StorageContainerProperties; diff --git a/lib/services/iotspacesManagement/lib/operations/index.d.ts b/lib/services/iotspacesManagement/lib/operations/index.d.ts new file mode 100644 index 0000000000..c86bcd498d --- /dev/null +++ b/lib/services/iotspacesManagement/lib/operations/index.d.ts @@ -0,0 +1,1112 @@ +/* + * 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 { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as models from '../models'; + + +/** + * @class + * IoTSpaces + * __NOTE__: An instance of this class is automatically created for an + * instance of the IoTSpacesClient. + */ +export interface IoTSpaces { + + + /** + * Get the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescription} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update the metadata of an IoTSpaces instance. The usual pattern to + * modify a property is to retrieve the IoTSpaces instance metadata and + * security metadata, and then combine them with the modified values in a new + * body to update the IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpaceDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpaceDescription.properties] The common properties of a + * IoTSpaces service. + * + * @param {object} [iotSpaceDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.containerName] The name of + * storage container in the storage account. + * + * @param {object} iotSpaceDescription.sku A valid instance SKU. + * + * @param {string} iotSpaceDescription.sku.name The name of the SKU. Possible + * values include: 'F1', 'S1', 'S2', 'S3' + * + * @param {string} iotSpaceDescription.location The resource location. + * + * @param {object} [iotSpaceDescription.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, resourceName: string, iotSpaceDescription: models.IoTSpacesDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update the metadata of an IoTSpaces instance. The usual pattern to + * modify a property is to retrieve the IoTSpaces instance metadata and + * security metadata, and then combine them with the modified values in a new + * body to update the IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpaceDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpaceDescription.properties] The common properties of a + * IoTSpaces service. + * + * @param {object} [iotSpaceDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.containerName] The name of + * storage container in the storage account. + * + * @param {object} iotSpaceDescription.sku A valid instance SKU. + * + * @param {string} iotSpaceDescription.sku.name The name of the SKU. Possible + * values include: 'F1', 'S1', 'S2', 'S3' + * + * @param {string} iotSpaceDescription.location The resource location. + * + * @param {object} [iotSpaceDescription.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescription} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, resourceName: string, iotSpaceDescription: models.IoTSpacesDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, resourceName: string, iotSpaceDescription: models.IoTSpacesDescription, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, resourceName: string, iotSpaceDescription: models.IoTSpacesDescription, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpacePatchDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpacePatchDescription.tags] Instance tags + * + * @param {object} [iotSpacePatchDescription.properties] The common properties + * of an IoTSpaces service. + * + * @param {object} [iotSpacePatchDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.resourceGroup] The + * name of the resource group of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.containerName] The + * name of storage container in the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, resourceName: string, iotSpacePatchDescription: models.IoTSpacesPatchDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpacePatchDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpacePatchDescription.tags] Instance tags + * + * @param {object} [iotSpacePatchDescription.properties] The common properties + * of an IoTSpaces service. + * + * @param {object} [iotSpacePatchDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.resourceGroup] The + * name of the resource group of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.containerName] The + * name of storage container in the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescription} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, resourceName: string, iotSpacePatchDescription: models.IoTSpacesPatchDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, resourceName: string, iotSpacePatchDescription: models.IoTSpacesPatchDescription, callback: ServiceCallback): void; + update(resourceGroupName: string, resourceName: string, iotSpacePatchDescription: models.IoTSpacesPatchDescription, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete an IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete an IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescription} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get all the IoTSpaces instances in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get all the IoTSpaces instances in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescriptionListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescriptionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get all the IoTSpaces instances in a resource group. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get all the IoTSpaces instances in a resource group. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescriptionListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescriptionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Check if an IoTSpaces instance name is available. + * + * @param {object} operationInputs Set the name parameter in the + * OperationInputs structure to the name of the IoTSpaces instance to check. + * + * @param {string} operationInputs.name The name of the IoTSpaces service + * instance to check. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + checkNameAvailabilityWithHttpOperationResponse(operationInputs: models.OperationInputs, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Check if an IoTSpaces instance name is available. + * + * @param {object} operationInputs Set the name parameter in the + * OperationInputs structure to the name of the IoTSpaces instance to check. + * + * @param {string} operationInputs.name The name of the IoTSpaces service + * instance to check. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesNameAvailabilityInfo} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesNameAvailabilityInfo} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesNameAvailabilityInfo} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + checkNameAvailability(operationInputs: models.OperationInputs, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkNameAvailability(operationInputs: models.OperationInputs, callback: ServiceCallback): void; + checkNameAvailability(operationInputs: models.OperationInputs, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update the metadata of an IoTSpaces instance. The usual pattern to + * modify a property is to retrieve the IoTSpaces instance metadata and + * security metadata, and then combine them with the modified values in a new + * body to update the IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpaceDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpaceDescription.properties] The common properties of a + * IoTSpaces service. + * + * @param {object} [iotSpaceDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.containerName] The name of + * storage container in the storage account. + * + * @param {object} iotSpaceDescription.sku A valid instance SKU. + * + * @param {string} iotSpaceDescription.sku.name The name of the SKU. Possible + * values include: 'F1', 'S1', 'S2', 'S3' + * + * @param {string} iotSpaceDescription.location The resource location. + * + * @param {object} [iotSpaceDescription.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, resourceName: string, iotSpaceDescription: models.IoTSpacesDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update the metadata of an IoTSpaces instance. The usual pattern to + * modify a property is to retrieve the IoTSpaces instance metadata and + * security metadata, and then combine them with the modified values in a new + * body to update the IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpaceDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpaceDescription.properties] The common properties of a + * IoTSpaces service. + * + * @param {object} [iotSpaceDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.containerName] The name of + * storage container in the storage account. + * + * @param {object} iotSpaceDescription.sku A valid instance SKU. + * + * @param {string} iotSpaceDescription.sku.name The name of the SKU. Possible + * values include: 'F1', 'S1', 'S2', 'S3' + * + * @param {string} iotSpaceDescription.location The resource location. + * + * @param {object} [iotSpaceDescription.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescription} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, iotSpaceDescription: models.IoTSpacesDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, iotSpaceDescription: models.IoTSpacesDescription, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, iotSpaceDescription: models.IoTSpacesDescription, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpacePatchDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpacePatchDescription.tags] Instance tags + * + * @param {object} [iotSpacePatchDescription.properties] The common properties + * of an IoTSpaces service. + * + * @param {object} [iotSpacePatchDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.resourceGroup] The + * name of the resource group of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.containerName] The + * name of storage container in the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, resourceName: string, iotSpacePatchDescription: models.IoTSpacesPatchDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpacePatchDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpacePatchDescription.tags] Instance tags + * + * @param {object} [iotSpacePatchDescription.properties] The common properties + * of an IoTSpaces service. + * + * @param {object} [iotSpacePatchDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.resourceGroup] The + * name of the resource group of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.containerName] The + * name of storage container in the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescription} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, resourceName: string, iotSpacePatchDescription: models.IoTSpacesPatchDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, resourceName: string, iotSpacePatchDescription: models.IoTSpacesPatchDescription, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, resourceName: string, iotSpacePatchDescription: models.IoTSpacesPatchDescription, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete an IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete an IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescription} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get all the IoTSpaces instances in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get all the IoTSpaces instances in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescriptionListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescriptionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get all the IoTSpaces instances in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get all the IoTSpaces instances in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IoTSpacesDescriptionListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IoTSpacesDescriptionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the IoTSpacesClient. + */ +export interface Operations { + + + /** + * Lists all of the available IoTSpaces service REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available IoTSpaces service REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the available IoTSpaces service REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available IoTSpaces service REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/iotspacesManagement/lib/operations/index.js b/lib/services/iotspacesManagement/lib/operations/index.js new file mode 100644 index 0000000000..1980005849 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/operations/index.js @@ -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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.IoTSpaces = require('./ioTSpaces'); +exports.Operations = require('./operations'); diff --git a/lib/services/iotspacesManagement/lib/operations/ioTSpaces.js b/lib/services/iotspacesManagement/lib/operations/ioTSpaces.js new file mode 100644 index 0000000000..8238a1ede3 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/operations/ioTSpaces.js @@ -0,0 +1,3087 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, resourceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 64) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 64'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + } + if (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (resourceName !== null && resourceName !== undefined) { + if (resourceName.length > 64) + { + throw new Error('"resourceName" should satisfy the constraint - "MaxLength": 64'); + } + if (resourceName.length < 1) + { + throw new Error('"resourceName" should satisfy the constraint - "MinLength": 1'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTSpaces/Graph/{resourceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescription']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Create or update the metadata of an IoTSpaces instance. The usual pattern to + * modify a property is to retrieve the IoTSpaces instance metadata and + * security metadata, and then combine them with the modified values in a new + * body to update the IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpaceDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpaceDescription.properties] The common properties of a + * IoTSpaces service. + * + * @param {object} [iotSpaceDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.containerName] The name of + * storage container in the storage account. + * + * @param {object} iotSpaceDescription.sku A valid instance SKU. + * + * @param {string} iotSpaceDescription.sku.name The name of the SKU. Possible + * values include: 'F1', 'S1', 'S2', 'S3' + * + * @param {string} iotSpaceDescription.location The resource location. + * + * @param {object} [iotSpaceDescription.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescription']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Update the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpacePatchDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpacePatchDescription.tags] Instance tags + * + * @param {object} [iotSpacePatchDescription.properties] The common properties + * of an IoTSpaces service. + * + * @param {object} [iotSpacePatchDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.resourceGroup] The + * name of the resource group of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.containerName] The + * name of storage container in the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, resourceName, iotSpacePatchDescription, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, resourceName, iotSpacePatchDescription, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescription']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Delete an IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, resourceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, resourceName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescription']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Get all the IoTSpaces instances in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.IoTSpaces/Graph'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescriptionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get all the IoTSpaces instances in a resource group. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 64) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 64'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTSpaces/Graph'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescriptionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Check if an IoTSpaces instance name is available. + * + * @param {object} operationInputs Set the name parameter in the + * OperationInputs structure to the name of the IoTSpaces instance to check. + * + * @param {string} operationInputs.name The name of the IoTSpaces service + * instance to check. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesNameAvailabilityInfo} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _checkNameAvailability(operationInputs, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (operationInputs === null || operationInputs === undefined) { + throw new Error('operationInputs cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.IoTSpaces/checkNameAvailability'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (operationInputs !== null && operationInputs !== undefined) { + let requestModelMapper = new client.models['OperationInputs']().mapper(); + requestModel = client.serialize(requestModelMapper, operationInputs, 'operationInputs'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(operationInputs, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesNameAvailabilityInfo']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or update the metadata of an IoTSpaces instance. The usual pattern to + * modify a property is to retrieve the IoTSpaces instance metadata and + * security metadata, and then combine them with the modified values in a new + * body to update the IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpaceDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpaceDescription.properties] The common properties of a + * IoTSpaces service. + * + * @param {object} [iotSpaceDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.containerName] The name of + * storage container in the storage account. + * + * @param {object} iotSpaceDescription.sku A valid instance SKU. + * + * @param {string} iotSpaceDescription.sku.name The name of the SKU. Possible + * values include: 'F1', 'S1', 'S2', 'S3' + * + * @param {string} iotSpaceDescription.location The resource location. + * + * @param {object} [iotSpaceDescription.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 64) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 64'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + } + if (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (resourceName !== null && resourceName !== undefined) { + if (resourceName.length > 64) + { + throw new Error('"resourceName" should satisfy the constraint - "MaxLength": 64'); + } + if (resourceName.length < 1) + { + throw new Error('"resourceName" should satisfy the constraint - "MinLength": 1'); + } + } + if (iotSpaceDescription === null || iotSpaceDescription === undefined) { + throw new Error('iotSpaceDescription cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTSpaces/Graph/{resourceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (iotSpaceDescription !== null && iotSpaceDescription !== undefined) { + let requestModelMapper = new client.models['IoTSpacesDescription']().mapper(); + requestModel = client.serialize(requestModelMapper, iotSpaceDescription, 'iotSpaceDescription'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(iotSpaceDescription, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescription']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Update the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpacePatchDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpacePatchDescription.tags] Instance tags + * + * @param {object} [iotSpacePatchDescription.properties] The common properties + * of an IoTSpaces service. + * + * @param {object} [iotSpacePatchDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.resourceGroup] The + * name of the resource group of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.containerName] The + * name of storage container in the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, resourceName, iotSpacePatchDescription, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 64) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 64'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + } + if (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (resourceName !== null && resourceName !== undefined) { + if (resourceName.length > 64) + { + throw new Error('"resourceName" should satisfy the constraint - "MaxLength": 64'); + } + if (resourceName.length < 1) + { + throw new Error('"resourceName" should satisfy the constraint - "MinLength": 1'); + } + } + if (iotSpacePatchDescription === null || iotSpacePatchDescription === undefined) { + throw new Error('iotSpacePatchDescription cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTSpaces/Graph/{resourceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (iotSpacePatchDescription !== null && iotSpacePatchDescription !== undefined) { + let requestModelMapper = new client.models['IoTSpacesPatchDescription']().mapper(); + requestModel = client.serialize(requestModelMapper, iotSpacePatchDescription, 'iotSpacePatchDescription'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(iotSpacePatchDescription, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescription']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete an IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, resourceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 64) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 64'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + } + if (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (resourceName !== null && resourceName !== undefined) { + if (resourceName.length > 64) + { + throw new Error('"resourceName" should satisfy the constraint - "MaxLength": 64'); + } + if (resourceName.length < 1) + { + throw new Error('"resourceName" should satisfy the constraint - "MinLength": 1'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTSpaces/Graph/{resourceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescription']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get all the IoTSpaces instances in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescriptionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get all the IoTSpaces instances in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IoTSpacesDescriptionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a IoTSpaces. */ +class IoTSpaces { + /** + * Create a IoTSpaces. + * @param {IoTSpacesClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._list = _list; + this._listByResourceGroup = _listByResourceGroup; + this._checkNameAvailability = _checkNameAvailability; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdate = _beginUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listNext = _listNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Get the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, resourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, resourceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, resourceName, options, optionalCallback); + } + } + + /** + * Create or update the metadata of an IoTSpaces instance. The usual pattern to + * modify a property is to retrieve the IoTSpaces instance metadata and + * security metadata, and then combine them with the modified values in a new + * body to update the IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpaceDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpaceDescription.properties] The common properties of a + * IoTSpaces service. + * + * @param {object} [iotSpaceDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.containerName] The name of + * storage container in the storage account. + * + * @param {object} iotSpaceDescription.sku A valid instance SKU. + * + * @param {string} iotSpaceDescription.sku.name The name of the SKU. Possible + * values include: 'F1', 'S1', 'S2', 'S3' + * + * @param {string} iotSpaceDescription.location The resource location. + * + * @param {object} [iotSpaceDescription.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, resourceName, iotSpaceDescription, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update the metadata of an IoTSpaces instance. The usual pattern to + * modify a property is to retrieve the IoTSpaces instance metadata and + * security metadata, and then combine them with the modified values in a new + * body to update the IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpaceDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpaceDescription.properties] The common properties of a + * IoTSpaces service. + * + * @param {object} [iotSpaceDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.containerName] The name of + * storage container in the storage account. + * + * @param {object} iotSpaceDescription.sku A valid instance SKU. + * + * @param {string} iotSpaceDescription.sku.name The name of the SKU. Possible + * values include: 'F1', 'S1', 'S2', 'S3' + * + * @param {string} iotSpaceDescription.location The resource location. + * + * @param {object} [iotSpaceDescription.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, optionalCallback); + } + } + + /** + * Update the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpacePatchDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpacePatchDescription.tags] Instance tags + * + * @param {object} [iotSpacePatchDescription.properties] The common properties + * of an IoTSpaces service. + * + * @param {object} [iotSpacePatchDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.resourceGroup] The + * name of the resource group of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.containerName] The + * name of storage container in the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, resourceName, iotSpacePatchDescription, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, resourceName, iotSpacePatchDescription, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpacePatchDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpacePatchDescription.tags] Instance tags + * + * @param {object} [iotSpacePatchDescription.properties] The common properties + * of an IoTSpaces service. + * + * @param {object} [iotSpacePatchDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.resourceGroup] The + * name of the resource group of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.containerName] The + * name of storage container in the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, resourceName, iotSpacePatchDescription, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, resourceName, iotSpacePatchDescription, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, resourceName, iotSpacePatchDescription, options, optionalCallback); + } + } + + /** + * Delete an IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete an IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, resourceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, resourceName, options, optionalCallback); + } + } + + /** + * Get all the IoTSpaces instances in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all the IoTSpaces instances in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescriptionListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Get all the IoTSpaces instances in a resource group. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all the IoTSpaces instances in a resource group. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescriptionListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Check if an IoTSpaces instance name is available. + * + * @param {object} operationInputs Set the name parameter in the + * OperationInputs structure to the name of the IoTSpaces instance to check. + * + * @param {string} operationInputs.name The name of the IoTSpaces service + * instance to check. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + checkNameAvailabilityWithHttpOperationResponse(operationInputs, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._checkNameAvailability(operationInputs, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Check if an IoTSpaces instance name is available. + * + * @param {object} operationInputs Set the name parameter in the + * OperationInputs structure to the name of the IoTSpaces instance to check. + * + * @param {string} operationInputs.name The name of the IoTSpaces service + * instance to check. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesNameAvailabilityInfo} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesNameAvailabilityInfo} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + checkNameAvailability(operationInputs, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._checkNameAvailability(operationInputs, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkNameAvailability(operationInputs, options, optionalCallback); + } + } + + /** + * Create or update the metadata of an IoTSpaces instance. The usual pattern to + * modify a property is to retrieve the IoTSpaces instance metadata and + * security metadata, and then combine them with the modified values in a new + * body to update the IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpaceDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpaceDescription.properties] The common properties of a + * IoTSpaces service. + * + * @param {object} [iotSpaceDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.containerName] The name of + * storage container in the storage account. + * + * @param {object} iotSpaceDescription.sku A valid instance SKU. + * + * @param {string} iotSpaceDescription.sku.name The name of the SKU. Possible + * values include: 'F1', 'S1', 'S2', 'S3' + * + * @param {string} iotSpaceDescription.location The resource location. + * + * @param {object} [iotSpaceDescription.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, resourceName, iotSpaceDescription, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update the metadata of an IoTSpaces instance. The usual pattern to + * modify a property is to retrieve the IoTSpaces instance metadata and + * security metadata, and then combine them with the modified values in a new + * body to update the IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpaceDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpaceDescription.properties] The common properties of a + * IoTSpaces service. + * + * @param {object} [iotSpaceDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.resourceGroup] The name of + * the resource group of the storage account. + * + * @param {string} + * [iotSpaceDescription.properties.storageContainer.containerName] The name of + * storage container in the storage account. + * + * @param {object} iotSpaceDescription.sku A valid instance SKU. + * + * @param {string} iotSpaceDescription.sku.name The name of the SKU. Possible + * values include: 'F1', 'S1', 'S2', 'S3' + * + * @param {string} iotSpaceDescription.location The resource location. + * + * @param {object} [iotSpaceDescription.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, resourceName, iotSpaceDescription, options, optionalCallback); + } + } + + /** + * Update the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpacePatchDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpacePatchDescription.tags] Instance tags + * + * @param {object} [iotSpacePatchDescription.properties] The common properties + * of an IoTSpaces service. + * + * @param {object} [iotSpacePatchDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.resourceGroup] The + * name of the resource group of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.containerName] The + * name of storage container in the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, resourceName, iotSpacePatchDescription, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, resourceName, iotSpacePatchDescription, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update the metadata of a IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} iotSpacePatchDescription The IoTSpaces instance metadata and + * security metadata. + * + * @param {object} [iotSpacePatchDescription.tags] Instance tags + * + * @param {object} [iotSpacePatchDescription.properties] The common properties + * of an IoTSpaces service. + * + * @param {object} [iotSpacePatchDescription.properties.storageContainer] The + * properties of the designated storage container. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.connectionString] The + * connection string of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.subscriptionId] The + * subscription identifier of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.resourceGroup] The + * name of the resource group of the storage account. + * + * @param {string} + * [iotSpacePatchDescription.properties.storageContainer.containerName] The + * name of storage container in the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, resourceName, iotSpacePatchDescription, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, resourceName, iotSpacePatchDescription, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, resourceName, iotSpacePatchDescription, options, optionalCallback); + } + } + + /** + * Delete an IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete an IoTSpaces instance. + * + * @param {string} resourceGroupName The name of the resource group that + * contains the IoTSpaces instance. + * + * @param {string} resourceName The name of the IoTSpaces instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescription} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescription} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, resourceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, resourceName, options, optionalCallback); + } + } + + /** + * Get all the IoTSpaces instances in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all the IoTSpaces instances in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescriptionListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Get all the IoTSpaces instances in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all the IoTSpaces instances in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IoTSpacesDescriptionListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IoTSpacesDescriptionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = IoTSpaces; diff --git a/lib/services/iotspacesManagement/lib/operations/operations.js b/lib/services/iotspacesManagement/lib/operations/operations.js new file mode 100644 index 0000000000..773c62a2c3 --- /dev/null +++ b/lib/services/iotspacesManagement/lib/operations/operations.js @@ -0,0 +1,448 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Lists all of the available IoTSpaces service REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.IoTSpaces/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all of the available IoTSpaces service REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorDetails']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Operations. */ +class Operations { + /** + * Create a Operations. + * @param {IoTSpacesClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Lists all of the available IoTSpaces service REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available IoTSpaces service REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all of the available IoTSpaces service REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available IoTSpaces service REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/iotspacesManagement/lib/package.json b/lib/services/iotspacesManagement/lib/package.json new file mode 100644 index 0000000000..2d754aecdb --- /dev/null +++ b/lib/services/iotspacesManagement/lib/package.json @@ -0,0 +1,22 @@ +{ + "name": "azure-arm-iotspaces", + "author": "Microsoft Corporation", + "description": "IoTSpacesClient Library with typescript type definitions for node", + "version": "1.0.0-preview", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ "node", "azure" ], + "license": "MIT", + "main": "./lib/ioTSpacesClient.js", + "types": "./lib/ioTSpacesClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "http://github.com/Azure/azure-sdk-for-node/issues" + } +}