From c3268855bf15447819e9bf41f66e13213cf04e19 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 2 Jan 2019 07:48:37 +0000 Subject: [PATCH] Generated from 9fd537119a0fa74ec60d08f5b16facaf32c15b08 Corrected typo in swagger file name --- .../edgegatewayManagement/LICENSE.txt | 21 + .../lib/dataBoxEdgeManagementClient.d.ts | 72 + .../lib/dataBoxEdgeManagementClient.js | 95 + .../lib/models/aRMBaseModel.js | 75 + .../lib/models/address.js | 100 + .../edgegatewayManagement/lib/models/alert.js | 150 + .../lib/models/alertErrorDetails.js | 71 + .../lib/models/alertList.js | 69 + .../lib/models/asymmetricEncryptedSecret.js | 70 + .../lib/models/authentication.js | 64 + .../lib/models/azureContainerInfo.js | 72 + .../lib/models/bandwidthSchedule.js | 112 + .../lib/models/bandwidthSchedulesList.js | 69 + .../lib/models/clientAccessRight.js | 62 + .../lib/models/contactDetails.js | 83 + .../lib/models/dataBoxEdgeDevice.js | 251 + .../models/dataBoxEdgeDeviceExtendedInfo.js | 108 + .../lib/models/dataBoxEdgeDeviceList.js | 69 + .../lib/models/dataBoxEdgeDevicePatch.js | 60 + .../lib/models/fileEventTrigger.js | 116 + .../lib/models/fileSourceInfo.js | 52 + .../lib/models/index.d.ts | 1413 ++++ .../edgegatewayManagement/lib/models/index.js | 90 + .../lib/models/ioTDeviceInfo.js | 84 + .../lib/models/ioTRole.js | 183 + .../lib/models/ipv4Config.js | 71 + .../lib/models/ipv6Config.js | 71 + .../edgegatewayManagement/lib/models/job.js | 228 + .../lib/models/jobErrorDetails.js | 80 + .../lib/models/jobErrorItem.js | 79 + .../lib/models/metricDimensionV1.js | 68 + .../lib/models/metricSpecificationV1.js | 164 + .../lib/models/mountPointMap.js | 80 + .../lib/models/networkAdapter.js | 207 + .../lib/models/networkAdapterPosition.js | 63 + .../lib/models/networkSettings.js | 90 + .../lib/models/operation.js | 87 + .../lib/models/operationDisplay.js | 78 + .../lib/models/operationsList.js | 68 + .../edgegatewayManagement/lib/models/order.js | 187 + .../lib/models/orderList.js | 69 + .../lib/models/orderStatus.js | 74 + .../lib/models/periodicTimerEventTrigger.js | 122 + .../lib/models/periodicTimerSourceInfo.js | 72 + .../lib/models/refreshDetails.js | 84 + .../edgegatewayManagement/lib/models/role.js | 86 + .../lib/models/roleList.js | 74 + .../lib/models/roleSinkInfo.js | 52 + .../lib/models/securitySettings.js | 92 + .../lib/models/serviceSpecification.js | 61 + .../edgegatewayManagement/lib/models/share.js | 209 + .../lib/models/shareAccessRight.js | 62 + .../lib/models/shareList.js | 69 + .../edgegatewayManagement/lib/models/sku.js | 62 + .../lib/models/storageAccountCredential.js | 140 + .../models/storageAccountCredentialList.js | 69 + .../lib/models/symmetricKey.js | 61 + .../lib/models/trackingInfo.js | 77 + .../lib/models/trigger.js | 86 + .../lib/models/triggerList.js | 74 + .../lib/models/updateDownloadProgress.js | 101 + .../lib/models/updateInstallProgress.js | 72 + .../lib/models/updateSummary.js | 247 + .../lib/models/uploadCertificateRequest.js | 61 + .../lib/models/uploadCertificateResponse.js | 104 + .../edgegatewayManagement/lib/models/user.js | 107 + .../lib/models/userAccessRight.js | 62 + .../lib/models/userList.js | 69 + .../lib/operations/alerts.js | 715 ++ .../lib/operations/bandwidthSchedules.js | 1599 +++++ .../lib/operations/devices.js | 5254 +++++++++++++++ .../lib/operations/index.d.ts | 5900 +++++++++++++++++ .../lib/operations/index.js | 27 + .../lib/operations/operations.js | 449 ++ .../lib/operations/operationsStatus.js | 274 + .../lib/operations/orders.js | 1751 +++++ .../lib/operations/roles.js | 1553 +++++ .../lib/operations/shares.js | 2249 +++++++ .../operations/storageAccountCredentials.js | 1761 +++++ .../lib/operations/triggers.js | 1553 +++++ .../lib/operations/users.js | 1634 +++++ .../edgegatewayManagement/package.json | 25 + 82 files changed, 32494 insertions(+) create mode 100644 lib/services/edgegatewayManagement/LICENSE.txt create mode 100644 lib/services/edgegatewayManagement/lib/dataBoxEdgeManagementClient.d.ts create mode 100644 lib/services/edgegatewayManagement/lib/dataBoxEdgeManagementClient.js create mode 100644 lib/services/edgegatewayManagement/lib/models/aRMBaseModel.js create mode 100644 lib/services/edgegatewayManagement/lib/models/address.js create mode 100644 lib/services/edgegatewayManagement/lib/models/alert.js create mode 100644 lib/services/edgegatewayManagement/lib/models/alertErrorDetails.js create mode 100644 lib/services/edgegatewayManagement/lib/models/alertList.js create mode 100644 lib/services/edgegatewayManagement/lib/models/asymmetricEncryptedSecret.js create mode 100644 lib/services/edgegatewayManagement/lib/models/authentication.js create mode 100644 lib/services/edgegatewayManagement/lib/models/azureContainerInfo.js create mode 100644 lib/services/edgegatewayManagement/lib/models/bandwidthSchedule.js create mode 100644 lib/services/edgegatewayManagement/lib/models/bandwidthSchedulesList.js create mode 100644 lib/services/edgegatewayManagement/lib/models/clientAccessRight.js create mode 100644 lib/services/edgegatewayManagement/lib/models/contactDetails.js create mode 100644 lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDevice.js create mode 100644 lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDeviceExtendedInfo.js create mode 100644 lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDeviceList.js create mode 100644 lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDevicePatch.js create mode 100644 lib/services/edgegatewayManagement/lib/models/fileEventTrigger.js create mode 100644 lib/services/edgegatewayManagement/lib/models/fileSourceInfo.js create mode 100644 lib/services/edgegatewayManagement/lib/models/index.d.ts create mode 100644 lib/services/edgegatewayManagement/lib/models/index.js create mode 100644 lib/services/edgegatewayManagement/lib/models/ioTDeviceInfo.js create mode 100644 lib/services/edgegatewayManagement/lib/models/ioTRole.js create mode 100644 lib/services/edgegatewayManagement/lib/models/ipv4Config.js create mode 100644 lib/services/edgegatewayManagement/lib/models/ipv6Config.js create mode 100644 lib/services/edgegatewayManagement/lib/models/job.js create mode 100644 lib/services/edgegatewayManagement/lib/models/jobErrorDetails.js create mode 100644 lib/services/edgegatewayManagement/lib/models/jobErrorItem.js create mode 100644 lib/services/edgegatewayManagement/lib/models/metricDimensionV1.js create mode 100644 lib/services/edgegatewayManagement/lib/models/metricSpecificationV1.js create mode 100644 lib/services/edgegatewayManagement/lib/models/mountPointMap.js create mode 100644 lib/services/edgegatewayManagement/lib/models/networkAdapter.js create mode 100644 lib/services/edgegatewayManagement/lib/models/networkAdapterPosition.js create mode 100644 lib/services/edgegatewayManagement/lib/models/networkSettings.js create mode 100644 lib/services/edgegatewayManagement/lib/models/operation.js create mode 100644 lib/services/edgegatewayManagement/lib/models/operationDisplay.js create mode 100644 lib/services/edgegatewayManagement/lib/models/operationsList.js create mode 100644 lib/services/edgegatewayManagement/lib/models/order.js create mode 100644 lib/services/edgegatewayManagement/lib/models/orderList.js create mode 100644 lib/services/edgegatewayManagement/lib/models/orderStatus.js create mode 100644 lib/services/edgegatewayManagement/lib/models/periodicTimerEventTrigger.js create mode 100644 lib/services/edgegatewayManagement/lib/models/periodicTimerSourceInfo.js create mode 100644 lib/services/edgegatewayManagement/lib/models/refreshDetails.js create mode 100644 lib/services/edgegatewayManagement/lib/models/role.js create mode 100644 lib/services/edgegatewayManagement/lib/models/roleList.js create mode 100644 lib/services/edgegatewayManagement/lib/models/roleSinkInfo.js create mode 100644 lib/services/edgegatewayManagement/lib/models/securitySettings.js create mode 100644 lib/services/edgegatewayManagement/lib/models/serviceSpecification.js create mode 100644 lib/services/edgegatewayManagement/lib/models/share.js create mode 100644 lib/services/edgegatewayManagement/lib/models/shareAccessRight.js create mode 100644 lib/services/edgegatewayManagement/lib/models/shareList.js create mode 100644 lib/services/edgegatewayManagement/lib/models/sku.js create mode 100644 lib/services/edgegatewayManagement/lib/models/storageAccountCredential.js create mode 100644 lib/services/edgegatewayManagement/lib/models/storageAccountCredentialList.js create mode 100644 lib/services/edgegatewayManagement/lib/models/symmetricKey.js create mode 100644 lib/services/edgegatewayManagement/lib/models/trackingInfo.js create mode 100644 lib/services/edgegatewayManagement/lib/models/trigger.js create mode 100644 lib/services/edgegatewayManagement/lib/models/triggerList.js create mode 100644 lib/services/edgegatewayManagement/lib/models/updateDownloadProgress.js create mode 100644 lib/services/edgegatewayManagement/lib/models/updateInstallProgress.js create mode 100644 lib/services/edgegatewayManagement/lib/models/updateSummary.js create mode 100644 lib/services/edgegatewayManagement/lib/models/uploadCertificateRequest.js create mode 100644 lib/services/edgegatewayManagement/lib/models/uploadCertificateResponse.js create mode 100644 lib/services/edgegatewayManagement/lib/models/user.js create mode 100644 lib/services/edgegatewayManagement/lib/models/userAccessRight.js create mode 100644 lib/services/edgegatewayManagement/lib/models/userList.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/alerts.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/bandwidthSchedules.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/devices.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/index.d.ts create mode 100644 lib/services/edgegatewayManagement/lib/operations/index.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/operations.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/operationsStatus.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/orders.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/roles.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/shares.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/storageAccountCredentials.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/triggers.js create mode 100644 lib/services/edgegatewayManagement/lib/operations/users.js create mode 100644 lib/services/edgegatewayManagement/package.json diff --git a/lib/services/edgegatewayManagement/LICENSE.txt b/lib/services/edgegatewayManagement/LICENSE.txt new file mode 100644 index 0000000000..8f3d856145 --- /dev/null +++ b/lib/services/edgegatewayManagement/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/edgegatewayManagement/lib/dataBoxEdgeManagementClient.d.ts b/lib/services/edgegatewayManagement/lib/dataBoxEdgeManagementClient.d.ts new file mode 100644 index 0000000000..d1de5568b7 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/dataBoxEdgeManagementClient.d.ts @@ -0,0 +1,72 @@ +/* + * 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 DataBoxEdgeManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the DataBoxEdgeManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The subscription ID. + * + * @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] - The preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. 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; + + apiVersion: string; + + subscriptionId: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + operations: operations.Operations; + devices: operations.Devices; + alerts: operations.Alerts; + bandwidthSchedules: operations.BandwidthSchedules; + operationsStatus: operations.OperationsStatus; + orders: operations.Orders; + roles: operations.Roles; + shares: operations.Shares; + storageAccountCredentials: operations.StorageAccountCredentials; + triggers: operations.Triggers; + users: operations.Users; +} + +export { DataBoxEdgeManagementClient, models as DataBoxEdgeManagementModels }; diff --git a/lib/services/edgegatewayManagement/lib/dataBoxEdgeManagementClient.js b/lib/services/edgegatewayManagement/lib/dataBoxEdgeManagementClient.js new file mode 100644 index 0000000000..56f95154c8 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/dataBoxEdgeManagementClient.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* 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 DataBoxEdgeManagementClient. */ +class DataBoxEdgeManagementClient extends ServiceClient { + /** + * Create a DataBoxEdgeManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The subscription ID. + * @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] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. 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 = '2018-07-01'; + 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.operations = new operations.Operations(this); + this.devices = new operations.Devices(this); + this.alerts = new operations.Alerts(this); + this.bandwidthSchedules = new operations.BandwidthSchedules(this); + this.operationsStatus = new operations.OperationsStatus(this); + this.orders = new operations.Orders(this); + this.roles = new operations.Roles(this); + this.shares = new operations.Shares(this); + this.storageAccountCredentials = new operations.StorageAccountCredentials(this); + this.triggers = new operations.Triggers(this); + this.users = new operations.Users(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = DataBoxEdgeManagementClient; +module.exports['default'] = DataBoxEdgeManagementClient; +module.exports.DataBoxEdgeManagementClient = DataBoxEdgeManagementClient; +module.exports.DataBoxEdgeManagementModels = models; diff --git a/lib/services/edgegatewayManagement/lib/models/aRMBaseModel.js b/lib/services/edgegatewayManagement/lib/models/aRMBaseModel.js new file mode 100644 index 0000000000..5c7c4084fa --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/aRMBaseModel.js @@ -0,0 +1,75 @@ +/* + * 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'); + +/** + * Represents the base class for all object models. + * + * @extends models['BaseResource'] + */ +class ARMBaseModel extends models['BaseResource'] { + /** + * Create a ARMBaseModel. + * @property {string} [id] The path ID that uniquely identifies the object. + * @property {string} [name] The name of the object. + * @property {string} [type] The hierarchical type of the object. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ARMBaseModel + * + * @returns {object} metadata of ARMBaseModel + * + */ + mapper() { + return { + required: false, + serializedName: 'ARMBaseModel', + type: { + name: 'Composite', + className: 'ARMBaseModel', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ARMBaseModel; diff --git a/lib/services/edgegatewayManagement/lib/models/address.js b/lib/services/edgegatewayManagement/lib/models/address.js new file mode 100644 index 0000000000..16ea8facc9 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/address.js @@ -0,0 +1,100 @@ +/* + * 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 shipping address of the customer. + * + */ +class Address { + /** + * Create a Address. + * @property {string} addressLine1 The address line1. + * @property {string} addressLine2 The address line2. + * @property {string} addressLine3 The address line3. + * @property {string} postalCode The postal code. + * @property {string} city The city name. + * @property {string} state The state name. + * @property {string} country The country name. + */ + constructor() { + } + + /** + * Defines the metadata of Address + * + * @returns {object} metadata of Address + * + */ + mapper() { + return { + required: false, + serializedName: 'Address', + type: { + name: 'Composite', + className: 'Address', + modelProperties: { + addressLine1: { + required: true, + serializedName: 'addressLine1', + type: { + name: 'String' + } + }, + addressLine2: { + required: true, + serializedName: 'addressLine2', + type: { + name: 'String' + } + }, + addressLine3: { + required: true, + serializedName: 'addressLine3', + type: { + name: 'String' + } + }, + postalCode: { + required: true, + serializedName: 'postalCode', + type: { + name: 'String' + } + }, + city: { + required: true, + serializedName: 'city', + type: { + name: 'String' + } + }, + state: { + required: true, + serializedName: 'state', + type: { + name: 'String' + } + }, + country: { + required: true, + serializedName: 'country', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Address; diff --git a/lib/services/edgegatewayManagement/lib/models/alert.js b/lib/services/edgegatewayManagement/lib/models/alert.js new file mode 100644 index 0000000000..f37a53606b --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/alert.js @@ -0,0 +1,150 @@ +/* + * 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'); + +/** + * Alert on the data box edge/gateway device. + * + * @extends models['ARMBaseModel'] + */ +class Alert extends models['ARMBaseModel'] { + /** + * Create a Alert. + * @property {string} [title] Title of the alert. + * @property {string} [alertType] Type of the alert. + * @property {date} [appearedAtDateTime] UTC time at which the alert + * appeared. + * @property {string} [recommendation] Recommendation for acting on the + * alert. + * @property {string} [severity] Severity of the alert. Possible values + * include: 'Informational', 'Warning', 'Critical' + * @property {object} [errorDetails] Error details of the alert. + * @property {string} [errorDetails.errorCode] Error code. + * @property {string} [errorDetails.errorMessage] Error Message. + * @property {number} [errorDetails.occurrences] Number of occurrences. + * @property {object} [detailedInformation] Detailed information about the + * alert. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Alert + * + * @returns {object} metadata of Alert + * + */ + mapper() { + return { + required: false, + serializedName: 'Alert', + type: { + name: 'Composite', + className: 'Alert', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + title: { + required: false, + readOnly: true, + serializedName: 'properties.title', + type: { + name: 'String' + } + }, + alertType: { + required: false, + readOnly: true, + serializedName: 'properties.alertType', + type: { + name: 'String' + } + }, + appearedAtDateTime: { + required: false, + readOnly: true, + serializedName: 'properties.appearedAtDateTime', + type: { + name: 'DateTime' + } + }, + recommendation: { + required: false, + readOnly: true, + serializedName: 'properties.recommendation', + type: { + name: 'String' + } + }, + severity: { + required: false, + readOnly: true, + serializedName: 'properties.severity', + type: { + name: 'String' + } + }, + errorDetails: { + required: false, + readOnly: true, + serializedName: 'properties.errorDetails', + type: { + name: 'Composite', + className: 'AlertErrorDetails' + } + }, + detailedInformation: { + required: false, + readOnly: true, + serializedName: 'properties.detailedInformation', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Alert; diff --git a/lib/services/edgegatewayManagement/lib/models/alertErrorDetails.js b/lib/services/edgegatewayManagement/lib/models/alertErrorDetails.js new file mode 100644 index 0000000000..28970b91c4 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/alertErrorDetails.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 for the alert. + * + */ +class AlertErrorDetails { + /** + * Create a AlertErrorDetails. + * @property {string} [errorCode] Error code. + * @property {string} [errorMessage] Error Message. + * @property {number} [occurrences] Number of occurrences. + */ + constructor() { + } + + /** + * Defines the metadata of AlertErrorDetails + * + * @returns {object} metadata of AlertErrorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'AlertErrorDetails', + type: { + name: 'Composite', + className: 'AlertErrorDetails', + modelProperties: { + errorCode: { + required: false, + readOnly: true, + serializedName: 'errorCode', + type: { + name: 'String' + } + }, + errorMessage: { + required: false, + readOnly: true, + serializedName: 'errorMessage', + type: { + name: 'String' + } + }, + occurrences: { + required: false, + readOnly: true, + serializedName: 'occurrences', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = AlertErrorDetails; diff --git a/lib/services/edgegatewayManagement/lib/models/alertList.js b/lib/services/edgegatewayManagement/lib/models/alertList.js new file mode 100644 index 0000000000..e480cca06b --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/alertList.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Collection of Alerts. + */ +class AlertList extends Array { + /** + * Create a AlertList. + * @property {string} [nextLink] Link to the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AlertList + * + * @returns {object} metadata of AlertList + * + */ + mapper() { + return { + required: false, + serializedName: 'AlertList', + type: { + name: 'Composite', + className: 'AlertList', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AlertElementType', + type: { + name: 'Composite', + className: 'Alert' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AlertList; diff --git a/lib/services/edgegatewayManagement/lib/models/asymmetricEncryptedSecret.js b/lib/services/edgegatewayManagement/lib/models/asymmetricEncryptedSecret.js new file mode 100644 index 0000000000..b884481173 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/asymmetricEncryptedSecret.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'; + +/** + * Represent the secrets intended for encryption with asymmetric key pair. + * + */ +class AsymmetricEncryptedSecret { + /** + * Create a AsymmetricEncryptedSecret. + * @property {string} value The value of the secret. + * @property {string} [encryptionCertThumbprint] Thumbprint certificate that + * was used to encrypt "Value". If the value in unencrypted, it will be null. + * @property {string} encryptionAlgorithm The algorithm used to encrypt + * "Value". Possible values include: 'None', 'AES256', 'RSAES_PKCS1_v_1_5' + */ + constructor() { + } + + /** + * Defines the metadata of AsymmetricEncryptedSecret + * + * @returns {object} metadata of AsymmetricEncryptedSecret + * + */ + mapper() { + return { + required: false, + serializedName: 'AsymmetricEncryptedSecret', + type: { + name: 'Composite', + className: 'AsymmetricEncryptedSecret', + modelProperties: { + value: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + }, + encryptionCertThumbprint: { + required: false, + serializedName: 'encryptionCertThumbprint', + type: { + name: 'String' + } + }, + encryptionAlgorithm: { + required: true, + serializedName: 'encryptionAlgorithm', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AsymmetricEncryptedSecret; diff --git a/lib/services/edgegatewayManagement/lib/models/authentication.js b/lib/services/edgegatewayManagement/lib/models/authentication.js new file mode 100644 index 0000000000..e309d3659b --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/authentication.js @@ -0,0 +1,64 @@ +/* + * 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'; + +/** + * Authentication mechanism for IoT devices. + * + */ +class Authentication { + /** + * Create a Authentication. + * @property {object} [symmetricKey] Symmetric key for authentication. + * @property {object} [symmetricKey.connectionString] Connection string based + * on symmetric key. + * @property {string} [symmetricKey.connectionString.value] The value of the + * secret. + * @property {string} + * [symmetricKey.connectionString.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * @property {string} [symmetricKey.connectionString.encryptionAlgorithm] The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + */ + constructor() { + } + + /** + * Defines the metadata of Authentication + * + * @returns {object} metadata of Authentication + * + */ + mapper() { + return { + required: false, + serializedName: 'Authentication', + type: { + name: 'Composite', + className: 'Authentication', + modelProperties: { + symmetricKey: { + required: false, + serializedName: 'symmetricKey', + type: { + name: 'Composite', + className: 'SymmetricKey' + } + } + } + } + }; + } +} + +module.exports = Authentication; diff --git a/lib/services/edgegatewayManagement/lib/models/azureContainerInfo.js b/lib/services/edgegatewayManagement/lib/models/azureContainerInfo.js new file mode 100644 index 0000000000..074812b056 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/azureContainerInfo.js @@ -0,0 +1,72 @@ +/* + * 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'; + +/** + * Azure container mapping of the endpoint. + * + */ +class AzureContainerInfo { + /** + * Create a AzureContainerInfo. + * @property {string} storageAccountCredentialId ID of the Storage account + * credential to be used for accessing storage. + * @property {string} containerName Container name (Based on the data format + * specified, represents the name of Azure file/ Page blob / Block blob). + * @property {string} dataFormat Storage format used for the file represented + * by the share. Possible values include: 'BlockBlob', 'PageBlob', + * 'AzureFile' + */ + constructor() { + } + + /** + * Defines the metadata of AzureContainerInfo + * + * @returns {object} metadata of AzureContainerInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureContainerInfo', + type: { + name: 'Composite', + className: 'AzureContainerInfo', + modelProperties: { + storageAccountCredentialId: { + required: true, + serializedName: 'storageAccountCredentialId', + type: { + name: 'String' + } + }, + containerName: { + required: true, + serializedName: 'containerName', + type: { + name: 'String' + } + }, + dataFormat: { + required: true, + serializedName: 'dataFormat', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AzureContainerInfo; diff --git a/lib/services/edgegatewayManagement/lib/models/bandwidthSchedule.js b/lib/services/edgegatewayManagement/lib/models/bandwidthSchedule.js new file mode 100644 index 0000000000..9f76b840f8 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/bandwidthSchedule.js @@ -0,0 +1,112 @@ +/* + * 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 bandwidth schedule details. + * + * @extends models['ARMBaseModel'] + */ +class BandwidthSchedule extends models['ARMBaseModel'] { + /** + * Create a BandwidthSchedule. + * @property {string} start The start time of the schedule in UTC. + * @property {string} stop The stop time of the schedule in UTC. + * @property {number} rateInMbps The bandwidth rate in Mbps. + * @property {array} days The days of the week when this schedule is + * applicable. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BandwidthSchedule + * + * @returns {object} metadata of BandwidthSchedule + * + */ + mapper() { + return { + required: false, + serializedName: 'BandwidthSchedule', + type: { + name: 'Composite', + className: 'BandwidthSchedule', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + start: { + required: true, + serializedName: 'properties.start', + type: { + name: 'String' + } + }, + stop: { + required: true, + serializedName: 'properties.stop', + type: { + name: 'String' + } + }, + rateInMbps: { + required: true, + serializedName: 'properties.rateInMbps', + type: { + name: 'Number' + } + }, + days: { + required: true, + serializedName: 'properties.days', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DayOfWeekElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = BandwidthSchedule; diff --git a/lib/services/edgegatewayManagement/lib/models/bandwidthSchedulesList.js b/lib/services/edgegatewayManagement/lib/models/bandwidthSchedulesList.js new file mode 100644 index 0000000000..3ce02204ea --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/bandwidthSchedulesList.js @@ -0,0 +1,69 @@ +/* + * 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 collection of bandwidth schedules. + */ +class BandwidthSchedulesList extends Array { + /** + * Create a BandwidthSchedulesList. + * @property {string} [nextLink] Link to the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BandwidthSchedulesList + * + * @returns {object} metadata of BandwidthSchedulesList + * + */ + mapper() { + return { + required: false, + serializedName: 'BandwidthSchedulesList', + type: { + name: 'Composite', + className: 'BandwidthSchedulesList', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BandwidthScheduleElementType', + type: { + name: 'Composite', + className: 'BandwidthSchedule' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BandwidthSchedulesList; diff --git a/lib/services/edgegatewayManagement/lib/models/clientAccessRight.js b/lib/services/edgegatewayManagement/lib/models/clientAccessRight.js new file mode 100644 index 0000000000..e18f3af100 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/clientAccessRight.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The mapping between a particular client ip and the type of access client has + * on the NFS share. + * + */ +class ClientAccessRight { + /** + * Create a ClientAccessRight. + * @property {string} client Ip of the client. + * @property {string} accessPermission Type of access to be allowed for the + * client. Possible values include: 'NoAccess', 'ReadOnly', 'ReadWrite' + */ + constructor() { + } + + /** + * Defines the metadata of ClientAccessRight + * + * @returns {object} metadata of ClientAccessRight + * + */ + mapper() { + return { + required: false, + serializedName: 'ClientAccessRight', + type: { + name: 'Composite', + className: 'ClientAccessRight', + modelProperties: { + client: { + required: true, + serializedName: 'client', + type: { + name: 'String' + } + }, + accessPermission: { + required: true, + serializedName: 'accessPermission', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ClientAccessRight; diff --git a/lib/services/edgegatewayManagement/lib/models/contactDetails.js b/lib/services/edgegatewayManagement/lib/models/contactDetails.js new file mode 100644 index 0000000000..38dcfb47d2 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/contactDetails.js @@ -0,0 +1,83 @@ +/* + * 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'; + +/** + * Contains all the contact details of the customer. + * + */ +class ContactDetails { + /** + * Create a ContactDetails. + * @property {string} contactPerson Gets or sets the contact person. + * @property {string} companyName Gets or sets the name of the company. + * @property {string} phone Gets or sets the phone number. + * @property {array} emailList Gets or sets the email list. + */ + constructor() { + } + + /** + * Defines the metadata of ContactDetails + * + * @returns {object} metadata of ContactDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ContactDetails', + type: { + name: 'Composite', + className: 'ContactDetails', + modelProperties: { + contactPerson: { + required: true, + serializedName: 'contactPerson', + type: { + name: 'String' + } + }, + companyName: { + required: true, + serializedName: 'companyName', + type: { + name: 'String' + } + }, + phone: { + required: true, + serializedName: 'phone', + type: { + name: 'String' + } + }, + emailList: { + required: true, + serializedName: 'emailList', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ContactDetails; diff --git a/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDevice.js b/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDevice.js new file mode 100644 index 0000000000..5d2a04ceba --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDevice.js @@ -0,0 +1,251 @@ +/* + * 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 Data Box Edge/Gateway device. + * + * @extends models['ARMBaseModel'] + */ +class DataBoxEdgeDevice extends models['ARMBaseModel'] { + /** + * Create a DataBoxEdgeDevice. + * @property {string} location The location of the device. This will be one + * of the supported and registered Azure Geo Regions (e.g. West US, East US, + * Southeast Asia, etc.). The geo region of a device cannot be changed once + * it is created, but if an identical geo region is specified on update the + * request will succeed. + * @property {object} [tags] The list of tags that describe the device. These + * tags can be used in viewing and grouping this device (across resource + * groups). + * @property {object} [sku] The sku type. + * @property {string} [sku.name] Sku name. Possible values include: + * 'Gateway', 'Edge' + * @property {string} [sku.tier] The SKU tier. This is based on the SKU name. + * Possible values include: 'Standard' + * @property {string} [etag] The etag of the devices. + * @property {string} [dataBoxEdgeDeviceStatus] The status of the Data Box + * Edge/Gateway device. Possible values include: 'ReadyToSetup', 'Online', + * 'Offline', 'NeedsAttention', 'Disconnected', 'PartiallyDisconnected' + * @property {string} [serialNumber] The Serial Number of Data Box + * Edge/Gateway device. + * @property {string} [description] The Description of the Data Box + * Edge/Gateway device. + * @property {string} [modelDescription] The description of the Data Box + * Edge/Gateway device model. + * @property {string} [deviceType] The type of the Data Box Edge/Gateway + * device. Possible values include: 'DataBoxEdgeDevice' + * @property {string} [friendlyName] The Data Box Edge/Gateway device name. + * @property {string} [culture] The Data Box Edge/Gateway device culture. + * @property {string} [deviceModel] The Data Box Edge/Gateway device model. + * @property {string} [deviceSoftwareVersion] The Data Box Edge/Gateway + * device software version. + * @property {number} [deviceLocalCapacity] The Data Box Edge/Gateway device + * local capacity in MB. + * @property {string} [timeZone] The Data Box Edge/Gateway device timezone. + * @property {string} [deviceHcsVersion] The device software version number + * of the device (eg: 1.2.18105.6). + * @property {array} [configuredRoleTypes] Type of compute roles configured. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxEdgeDevice + * + * @returns {object} metadata of DataBoxEdgeDevice + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxEdgeDevice', + type: { + name: 'Composite', + className: 'DataBoxEdgeDevice', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + 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' + } + } + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + dataBoxEdgeDeviceStatus: { + required: false, + serializedName: 'properties.dataBoxEdgeDeviceStatus', + type: { + name: 'String' + } + }, + serialNumber: { + required: false, + readOnly: true, + serializedName: 'properties.serialNumber', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + modelDescription: { + required: false, + serializedName: 'properties.modelDescription', + type: { + name: 'String' + } + }, + deviceType: { + required: false, + readOnly: true, + serializedName: 'properties.deviceType', + type: { + name: 'String' + } + }, + friendlyName: { + required: false, + serializedName: 'properties.friendlyName', + type: { + name: 'String' + } + }, + culture: { + required: false, + readOnly: true, + serializedName: 'properties.culture', + type: { + name: 'String' + } + }, + deviceModel: { + required: false, + readOnly: true, + serializedName: 'properties.deviceModel', + type: { + name: 'String' + } + }, + deviceSoftwareVersion: { + required: false, + readOnly: true, + serializedName: 'properties.deviceSoftwareVersion', + type: { + name: 'String' + } + }, + deviceLocalCapacity: { + required: false, + readOnly: true, + serializedName: 'properties.deviceLocalCapacity', + type: { + name: 'Number' + } + }, + timeZone: { + required: false, + readOnly: true, + serializedName: 'properties.timeZone', + type: { + name: 'String' + } + }, + deviceHcsVersion: { + required: false, + readOnly: true, + serializedName: 'properties.deviceHcsVersion', + type: { + name: 'String' + } + }, + configuredRoleTypes: { + required: false, + readOnly: true, + serializedName: 'properties.configuredRoleTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RoleTypesElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DataBoxEdgeDevice; diff --git a/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDeviceExtendedInfo.js b/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDeviceExtendedInfo.js new file mode 100644 index 0000000000..fda9f23159 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDeviceExtendedInfo.js @@ -0,0 +1,108 @@ +/* + * 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 extended Info of the Data Box Edge/Gateway device. + * + * @extends models['ARMBaseModel'] + */ +class DataBoxEdgeDeviceExtendedInfo extends models['ARMBaseModel'] { + /** + * Create a DataBoxEdgeDeviceExtendedInfo. + * @property {string} integrityKey The Channel Integrity Key (CIK) of the + * device. + * @property {string} [encryptionKeyThumbprint] The certificate thumbprint + * that was used to encrypt the Channel Integrity Key (CIK). + * @property {string} [encryptionKey] The Channel Integrity Key (CIK) of the + * device. + * @property {string} [resourceKey] The Resource Id of the Resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxEdgeDeviceExtendedInfo + * + * @returns {object} metadata of DataBoxEdgeDeviceExtendedInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxEdgeDeviceExtendedInfo', + type: { + name: 'Composite', + className: 'DataBoxEdgeDeviceExtendedInfo', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + integrityKey: { + required: true, + serializedName: 'properties.integrityKey', + type: { + name: 'String' + } + }, + encryptionKeyThumbprint: { + required: false, + serializedName: 'properties.encryptionKeyThumbprint', + type: { + name: 'String' + } + }, + encryptionKey: { + required: false, + serializedName: 'properties.encryptionKey', + type: { + name: 'String' + } + }, + resourceKey: { + required: false, + readOnly: true, + serializedName: 'properties.resourceKey', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DataBoxEdgeDeviceExtendedInfo; diff --git a/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDeviceList.js b/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDeviceList.js new file mode 100644 index 0000000000..4823ed73ed --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDeviceList.js @@ -0,0 +1,69 @@ +/* + * 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 collection of Data Box Edge/Gateway devices. + */ +class DataBoxEdgeDeviceList extends Array { + /** + * Create a DataBoxEdgeDeviceList. + * @property {string} [nextLink] Link to the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxEdgeDeviceList + * + * @returns {object} metadata of DataBoxEdgeDeviceList + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxEdgeDeviceList', + type: { + name: 'Composite', + className: 'DataBoxEdgeDeviceList', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DataBoxEdgeDeviceElementType', + type: { + name: 'Composite', + className: 'DataBoxEdgeDevice' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DataBoxEdgeDeviceList; diff --git a/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDevicePatch.js b/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDevicePatch.js new file mode 100644 index 0000000000..9fc4a615bb --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/dataBoxEdgeDevicePatch.js @@ -0,0 +1,60 @@ +/* + * 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 Data Box Edge/Gateway device patch. + * + */ +class DataBoxEdgeDevicePatch { + /** + * Create a DataBoxEdgeDevicePatch. + * @property {object} [tags] The tags attached to the Data Box Edge/Gateway + * resource. + */ + constructor() { + } + + /** + * Defines the metadata of DataBoxEdgeDevicePatch + * + * @returns {object} metadata of DataBoxEdgeDevicePatch + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxEdgeDevicePatch', + type: { + name: 'Composite', + className: 'DataBoxEdgeDevicePatch', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DataBoxEdgeDevicePatch; diff --git a/lib/services/edgegatewayManagement/lib/models/fileEventTrigger.js b/lib/services/edgegatewayManagement/lib/models/fileEventTrigger.js new file mode 100644 index 0000000000..11f6f7f914 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/fileEventTrigger.js @@ -0,0 +1,116 @@ +/* + * 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'); + +/** + * Trigger details. + * + * @extends models['Trigger'] + */ +class FileEventTrigger extends models['Trigger'] { + /** + * Create a FileEventTrigger. + * @property {object} [sourceInfo] File event source details. + * @property {string} [sourceInfo.shareId] File share ID. + * @property {object} [sinkInfo] Role Sink info. + * @property {string} [sinkInfo.roleId] Compute role ID. + * @property {string} [customContextTag] Custom context tag, typically used + * to co-relate the trigger against its usage. Eg. If a PeriodicTimer trigger + * may be intended for certain specific IOT modules in device, the tag can be + * the name/image url of the module. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of FileEventTrigger + * + * @returns {object} metadata of FileEventTrigger + * + */ + mapper() { + return { + required: false, + serializedName: 'FileEvent', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'kind', + clientName: 'kind' + }, + uberParent: 'BaseResource', + className: 'FileEventTrigger', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + kind: { + required: true, + serializedName: 'kind', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + sourceInfo: { + required: false, + serializedName: 'properties.sourceInfo', + type: { + name: 'Composite', + className: 'FileSourceInfo' + } + }, + sinkInfo: { + required: false, + serializedName: 'properties.sinkInfo', + type: { + name: 'Composite', + className: 'RoleSinkInfo' + } + }, + customContextTag: { + required: false, + serializedName: 'properties.customContextTag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = FileEventTrigger; diff --git a/lib/services/edgegatewayManagement/lib/models/fileSourceInfo.js b/lib/services/edgegatewayManagement/lib/models/fileSourceInfo.js new file mode 100644 index 0000000000..38674d5d45 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/fileSourceInfo.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'; + +/** + * File source details. + * + */ +class FileSourceInfo { + /** + * Create a FileSourceInfo. + * @property {string} shareId File share ID. + */ + constructor() { + } + + /** + * Defines the metadata of FileSourceInfo + * + * @returns {object} metadata of FileSourceInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'FileSourceInfo', + type: { + name: 'Composite', + className: 'FileSourceInfo', + modelProperties: { + shareId: { + required: true, + serializedName: 'shareId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = FileSourceInfo; diff --git a/lib/services/edgegatewayManagement/lib/models/index.d.ts b/lib/services/edgegatewayManagement/lib/models/index.d.ts new file mode 100644 index 0000000000..edccc59d1c --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/index.d.ts @@ -0,0 +1,1413 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { BaseResource, CloudError } from "ms-rest-azure"; +import * as moment from "moment"; + +export { + + BaseResource, + CloudError +}; + +/** + * The shipping address of the customer. + */ +export interface Address { + /** + * The address line1. + */ + addressLine1: string; + /** + * The address line2. + */ + addressLine2: string; + /** + * The address line3. + */ + addressLine3: string; + /** + * The postal code. + */ + postalCode: string; + /** + * The city name. + */ + city: string; + /** + * The state name. + */ + state: string; + /** + * The country name. + */ + country: string; +} + +/** + * Error details for the alert. + */ +export interface AlertErrorDetails { + /** + * Error code. + */ + readonly errorCode?: string; + /** + * Error Message. + */ + readonly errorMessage?: string; + /** + * Number of occurrences. + */ + readonly occurrences?: number; +} + +/** + * Represents the base class for all object models. + */ +export interface ARMBaseModel extends BaseResource { + /** + * The path ID that uniquely identifies the object. + */ + readonly id?: string; + /** + * The name of the object. + */ + readonly name?: string; + /** + * The hierarchical type of the object. + */ + readonly type?: string; +} + +/** + * Alert on the data box edge/gateway device. + */ +export interface Alert extends ARMBaseModel { + /** + * Title of the alert. + */ + readonly title?: string; + /** + * Type of the alert. + */ + readonly alertType?: string; + /** + * UTC time at which the alert appeared. + */ + readonly appearedAtDateTime?: Date; + /** + * Recommendation for acting on the alert. + */ + readonly recommendation?: string; + /** + * Severity of the alert. Possible values include: 'Informational', 'Warning', 'Critical' + */ + readonly severity?: string; + /** + * Error details of the alert. + */ + readonly errorDetails?: AlertErrorDetails; + /** + * Detailed information about the alert. + */ + readonly detailedInformation?: { [propertyName: string]: string }; +} + +/** + * Represent the secrets intended for encryption with asymmetric key pair. + */ +export interface AsymmetricEncryptedSecret { + /** + * The value of the secret. + */ + value: string; + /** + * Thumbprint certificate that was used to encrypt "Value". If the value in unencrypted, it will + * be null. + */ + encryptionCertThumbprint?: string; + /** + * The algorithm used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + */ + encryptionAlgorithm: string; +} + +/** + * Symmetric Key for authentication. + */ +export interface SymmetricKey { + /** + * Connection string based on symmetric key. + */ + connectionString?: AsymmetricEncryptedSecret; +} + +/** + * Authentication mechanism for IoT devices. + */ +export interface Authentication { + /** + * Symmetric key for authentication. + */ + symmetricKey?: SymmetricKey; +} + +/** + * Azure container mapping of the endpoint. + */ +export interface AzureContainerInfo { + /** + * ID of the Storage account credential to be used for accessing storage. + */ + storageAccountCredentialId: string; + /** + * Container name (Based on the data format specified, represents the name of Azure file/ Page + * blob / Block blob). + */ + containerName: string; + /** + * Storage format used for the file represented by the share. Possible values include: + * 'BlockBlob', 'PageBlob', 'AzureFile' + */ + dataFormat: string; +} + +/** + * The bandwidth schedule details. + */ +export interface BandwidthSchedule extends ARMBaseModel { + /** + * The start time of the schedule in UTC. + */ + start: string; + /** + * The stop time of the schedule in UTC. + */ + stop: string; + /** + * The bandwidth rate in Mbps. + */ + rateInMbps: number; + /** + * The days of the week when this schedule is applicable. + */ + days: string[]; +} + +/** + * The mapping between a particular client ip and the type of access client has on the NFS share. + */ +export interface ClientAccessRight { + /** + * Ip of the client. + */ + client: string; + /** + * Type of access to be allowed for the client. Possible values include: 'NoAccess', 'ReadOnly', + * 'ReadWrite' + */ + accessPermission: string; +} + +/** + * Contains all the contact details of the customer. + */ +export interface ContactDetails { + /** + * Gets or sets the contact person. + */ + contactPerson: string; + /** + * Gets or sets the name of the company. + */ + companyName: string; + /** + * Gets or sets the phone number. + */ + phone: string; + /** + * Gets or sets the email list. + */ + emailList: string[]; +} + +/** + * The SKU type. + */ +export interface Sku { + /** + * Sku name. Possible values include: 'Gateway', 'Edge' + */ + name?: string; + /** + * The SKU tier. This is based on the SKU name. Possible values include: 'Standard' + */ + tier?: string; +} + +/** + * The Data Box Edge/Gateway device. + */ +export interface DataBoxEdgeDevice extends ARMBaseModel { + /** + * The location of the device. This will be one of the supported and registered Azure Geo Regions + * (e.g. West US, East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update the request will + * succeed. + */ + location: string; + /** + * The list of tags that describe the device. These tags can be used in viewing and grouping this + * device (across resource groups). + */ + tags?: { [propertyName: string]: string }; + /** + * The sku type. + */ + sku?: Sku; + /** + * The etag of the devices. + */ + etag?: string; + /** + * The status of the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', 'PartiallyDisconnected' + */ + dataBoxEdgeDeviceStatus?: string; + /** + * The Serial Number of Data Box Edge/Gateway device. + */ + readonly serialNumber?: string; + /** + * The Description of the Data Box Edge/Gateway device. + */ + description?: string; + /** + * The description of the Data Box Edge/Gateway device model. + */ + modelDescription?: string; + /** + * The type of the Data Box Edge/Gateway device. Possible values include: 'DataBoxEdgeDevice' + */ + readonly deviceType?: string; + /** + * The Data Box Edge/Gateway device name. + */ + friendlyName?: string; + /** + * The Data Box Edge/Gateway device culture. + */ + readonly culture?: string; + /** + * The Data Box Edge/Gateway device model. + */ + readonly deviceModel?: string; + /** + * The Data Box Edge/Gateway device software version. + */ + readonly deviceSoftwareVersion?: string; + /** + * The Data Box Edge/Gateway device local capacity in MB. + */ + readonly deviceLocalCapacity?: number; + /** + * The Data Box Edge/Gateway device timezone. + */ + readonly timeZone?: string; + /** + * The device software version number of the device (eg: 1.2.18105.6). + */ + readonly deviceHcsVersion?: string; + /** + * Type of compute roles configured. + */ + readonly configuredRoleTypes?: string[]; +} + +/** + * The extended Info of the Data Box Edge/Gateway device. + */ +export interface DataBoxEdgeDeviceExtendedInfo extends ARMBaseModel { + /** + * The Channel Integrity Key (CIK) of the device. + */ + integrityKey: string; + /** + * The certificate thumbprint that was used to encrypt the Channel Integrity Key (CIK). + */ + encryptionKeyThumbprint?: string; + /** + * The Channel Integrity Key (CIK) of the device. + */ + encryptionKey?: string; + /** + * The Resource Id of the Resource. + */ + readonly resourceKey?: string; +} + +/** + * The Data Box Edge/Gateway device patch. + */ +export interface DataBoxEdgeDevicePatch { + /** + * The tags attached to the Data Box Edge/Gateway resource. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * File source details. + */ +export interface FileSourceInfo { + /** + * File share ID. + */ + shareId: string; +} + +/** + * Compute role against which events will be raised. + */ +export interface RoleSinkInfo { + /** + * Compute role ID. + */ + roleId: string; +} + +/** + * Trigger details. + */ +export interface Trigger extends ARMBaseModel { + /** + * Polymorphic Discriminator + */ + kind: string; +} + +/** + * Trigger details. + */ +export interface FileEventTrigger extends Trigger { + /** + * File event source details. + */ + sourceInfo?: FileSourceInfo; + /** + * Role Sink info. + */ + sinkInfo?: RoleSinkInfo; + /** + * Custom context tag, typically used to co-relate the trigger against its usage. Eg. If a + * PeriodicTimer trigger may be intended for certain specific IOT modules in device, the tag can + * be the name/image url of the module. + */ + customContextTag?: string; +} + +/** + * Metadata of IoT device/IoT edge device to be configured. + */ +export interface IoTDeviceInfo { + /** + * Id of the IoT device/edge device. + */ + deviceId: string; + /** + * Host name for IoT hub which is associated to the device. + */ + ioTHostHub: string; + /** + * IoT device authentication info. + */ + authentication?: Authentication; +} + +/** + * The share mount point. + */ +export interface MountPointMap { + /** + * ID of the share which is mounted to role VM. + */ + shareId: string; + /** + * ID of the role to which share is mounted. + */ + readonly roleId?: string; + /** + * Mount point for the share. + */ + readonly mountPoint?: string; + /** + * Role type. Possible values include: 'IOT', 'ASA', 'Functions', 'Cognitive' + */ + readonly roleType?: string; +} + +/** + * Compute role. + */ +export interface Role extends ARMBaseModel { + /** + * Polymorphic Discriminator + */ + kind: string; +} + +/** + * Compute role. + */ +export interface IoTRole extends Role { + /** + * Host OS which IoT role support. Possible values include: 'Windows', 'Linux' + */ + hostPlatform: string; + /** + * IoT device metadata to which data box edge device needs to be connected. + */ + ioTDeviceDetails: IoTDeviceInfo; + /** + * IoT edge device to which the IoT role needs to be configured. + */ + ioTEdgeDeviceDetails: IoTDeviceInfo; + /** + * Mount points of shares in role(s). + */ + shareMappings?: MountPointMap[]; + /** + * Role status. Possible values include: 'Enabled', 'Disabled' + */ + roleStatus: string; +} + +/** + * Details related to the IPv4 address configuration. + */ +export interface Ipv4Config { + /** + * The IPv4 address of the network adapter. + */ + readonly ipAddress?: string; + /** + * The IPv4 subnet of the network adapter. + */ + readonly subnet?: string; + /** + * The IPv4 gateway of the network adapter. + */ + readonly gateway?: string; +} + +/** + * Details related to the IPv6 address configuration. + */ +export interface Ipv6Config { + /** + * The IPv6 address of the network adapter. + */ + readonly ipAddress?: string; + /** + * The IPv6 prefix of the network adapter. + */ + readonly prefixLength?: number; + /** + * The IPv6 gateway of the network adapter. + */ + readonly gateway?: string; +} + +/** + * The job error items. + */ +export interface JobErrorItem { + /** + * The recommended actions. + */ + readonly recommendations?: string[]; + /** + * The code intended for programmatic access. + */ + readonly code?: string; + /** + * The message intended to describe the error in detail. + */ + readonly message?: string; +} + +/** + * The job error information containing List of JobErrorItem. + */ +export interface JobErrorDetails { + /** + * The error details. + */ + readonly errorDetails?: JobErrorItem[]; + /** + * The code intended for programmatic access. + */ + readonly code?: string; + /** + * The message intended to describe the error in detail. + */ + readonly message?: string; +} + +/** + * Details about the download progress of update. + */ +export interface UpdateDownloadProgress { + /** + * The download phase. Possible values include: 'Unknown', 'Initializing', 'Downloading', + * 'Verifying' + */ + readonly downloadPhase?: string; + /** + * Percentage of completion. + */ + readonly percentComplete?: number; + /** + * Total bytes to download. + */ + readonly totalBytesToDownload?: number; + /** + * Total bytes downloaded. + */ + readonly totalBytesDownloaded?: number; + /** + * Number of updates to download. + */ + readonly numberOfUpdatesToDownload?: number; + /** + * Number of updates downloaded. + */ + readonly numberOfUpdatesDownloaded?: number; +} + +/** + * Details about the progress during installation of updates. + */ +export interface UpdateInstallProgress { + /** + * Percentage of completion. + */ + readonly percentComplete?: number; + /** + * Number of updates to install. + */ + readonly numberOfUpdatesToInstall?: number; + /** + * Number of updates installed. + */ + readonly numberOfUpdatesInstalled?: number; +} + +/** + * A device job. + */ +export interface Job { + /** + * The path ID that uniquely identifies the object. + */ + readonly id?: string; + /** + * The name of the object. + */ + readonly name?: string; + /** + * The hierarchical type of the object. + */ + readonly type?: string; + /** + * The current status of the job. Possible values include: 'Invalid', 'Running', 'Succeeded', + * 'Failed', 'Canceled', 'Paused', 'Scheduled' + */ + readonly status?: string; + /** + * The UTC datetime at which the job was started. + */ + readonly startTime?: Date; + /** + * The UTC datetime at which the job completed. + */ + readonly endTime?: Date; + /** + * The percentage of the job that is already complete. + */ + readonly percentComplete?: number; + /** + * The Error details. + */ + readonly error?: JobErrorDetails; + /** + * The type of the job. Possible values include: 'Invalid', 'ScanForUpdates', 'DownloadUpdates', + * 'InstallUpdates', 'RefreshShare' + */ + readonly jobType?: string; + /** + * Current stage of the update operation. Possible values include: 'Unknown', 'Initial', + * 'ScanStarted', 'ScanComplete', 'ScanFailed', 'DownloadStarted', 'DownloadComplete', + * 'DownloadFailed', 'InstallStarted', 'InstallComplete', 'InstallFailed', 'RebootInitiated', + * 'Success', 'Failure', 'RescanStarted', 'RescanComplete', 'RescanFailed' + */ + readonly currentStage?: string; + /** + * The download progress. + */ + readonly downloadProgress?: UpdateDownloadProgress; + /** + * The install progress. + */ + readonly installProgress?: UpdateInstallProgress; + /** + * Total number of errors encountered during the refresh process. + */ + readonly totalRefreshErrors?: number; + /** + * Local Share/Remote Container relative path to the error manifest file of the refresh. + */ + readonly errorManifestFile?: string; + /** + * ARM id of the Share on which the Refresh operation was done. + */ + readonly shareId?: string; + /** + * If only subfolders need to be refreshed, then the sub folder path inside the share. Empty + * otherwise. + */ + folder?: string; +} + +/** + * Metric Dimension v1. + */ +export interface MetricDimensionV1 { + /** + * Name of the metrics dimension. + */ + name?: string; + /** + * Display name of the metrics dimension. + */ + displayName?: string; + /** + * To be exported to shoe box. + */ + toBeExportedForShoebox?: boolean; +} + +/** + * Metric specification version 1. + */ +export interface MetricSpecificationV1 { + /** + * Name of the metric. + */ + name?: string; + /** + * Display name of the metric. + */ + displayName?: string; + /** + * Description of the metric to be displayed. + */ + displayDescription?: string; + /** + * Metric units. Possible values include: 'NotSpecified', 'Percent', 'Count', 'Seconds', + * 'Milliseconds', 'Bytes', 'BytesPerSecond', 'CountPerSecond' + */ + unit?: string; + /** + * Metric aggregation type. Possible values include: 'NotSpecified', 'None', 'Average', + * 'Minimum', 'Maximum', 'Total', 'Count' + */ + aggregationType?: string; + /** + * Metric dimensions, other than default dimension which is resource. + */ + dimensions?: MetricDimensionV1[]; + /** + * set true to fill the gaps with zero. + */ + fillGapWithZero?: boolean; + /** + * Metric category. Possible values include: 'Capacity', 'Transaction' + */ + category?: string; + /** + * Resource name override. + */ + resourceIdDimensionNameOverride?: string; + /** + * Support granularity of metrics. + */ + supportedTimeGrainTypes?: string[]; + /** + * Support metric aggregation type. + */ + supportedAggregationTypes?: string[]; +} + +/** + * The network adapter position. + */ +export interface NetworkAdapterPosition { + /** + * The network group. Possible values include: 'None', 'NonRDMA', 'RDMA' + */ + readonly networkGroup?: string; + /** + * The port. + */ + readonly port?: number; +} + +/** + * Represents the networkAdapter on a device. + */ +export interface NetworkAdapter { + /** + * Instance ID of network adapter. + */ + readonly adapterId?: string; + /** + * Hardware position of network adapter. + */ + readonly adapterPosition?: NetworkAdapterPosition; + /** + * Logical index of the adapter. + */ + readonly index?: number; + /** + * Node ID of the network adapter. + */ + readonly nodeId?: string; + /** + * Network Adapter Name. + */ + readonly networkAdapterName?: string; + /** + * Hardware label for the adapter. + */ + readonly label?: string; + /** + * MAC Address. + */ + readonly macAddress?: string; + /** + * Link Speed. + */ + readonly linkSpeed?: number; + /** + * Value indicating whether this adapter is valid. Possible values include: 'Inactive', 'Active' + */ + readonly status?: string; + /** + * Value indicating whether this adapter is RDMA Capable. Possible values include: 'Incapable', + * 'Capable' + */ + rdmaStatus?: string; + /** + * Value indicating whether this adapter has DHCP Enabled. Possible values include: 'Disabled', + * 'Enabled' + */ + dhcpStatus?: string; + /** + * The IPv4 configuration of the network adapter. + */ + readonly ipv4Configuration?: Ipv4Config; + /** + * The IPv6 configuration of the network adapter. + */ + readonly ipv6Configuration?: Ipv6Config; + /** + * The IPv6 local address. + */ + readonly ipv6LinkLocalAddress?: string; + /** + * The list DNS Servers of the device. + */ + readonly dnsServers?: string[]; +} + +/** + * The NetworkSettings of a device. + */ +export interface NetworkSettings extends ARMBaseModel { + /** + * The network adapter list on the device. + */ + readonly networkAdapters?: NetworkAdapter[]; +} + +/** + * Operation display properties. + */ +export interface OperationDisplay { + /** + * Provider name. + */ + provider?: string; + /** + * The type of resource in which the operation is performed. + */ + resource?: string; + /** + * Operation to be performed on the resource. + */ + operation?: string; + /** + * Description of the operation to be performed. + */ + description?: string; +} + +/** + * Service specification. + */ +export interface ServiceSpecification { + /** + * Metric specification as defined by shoebox. + */ + metricSpecifications?: MetricSpecificationV1[]; +} + +/** + * Operations. + */ +export interface Operation { + /** + * Name of the operation. + */ + name?: string; + /** + * Properties to displayed for the operation. + */ + display?: OperationDisplay; + /** + * Origin of the operation. + */ + origin?: string; + /** + * Service specification. + */ + serviceSpecification?: ServiceSpecification; +} + +/** + * Represents a single status change. + */ +export interface OrderStatus { + /** + * Status of the order pertaining to the allowed StatusTypes. Possible values include: + * 'Untracked', 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', 'ReturnInitiated', + * 'AwaitingReturnShipment', 'ShippedBack', 'CollectedAtMicrosoft' + */ + status: string; + /** + * Time of status update. + */ + readonly updateDateTime?: Date; + /** + * Comments related to this status change. + */ + comments?: string; +} + +/** + * Tracking courier information. + */ +export interface TrackingInfo { + /** + * Serial number of the device being tracked. + */ + serialNumber?: string; + /** + * Name of the carrier used in the delivery. + */ + carrierName?: string; + /** + * Tracking ID of the shipment. + */ + trackingId?: string; + /** + * Tracking URL of the shipment. + */ + trackingUrl?: string; +} + +/** + * The order details. + */ +export interface Order extends ARMBaseModel { + /** + * The contact details. + */ + contactInformation?: ContactDetails; + /** + * The shipping address. + */ + shippingAddress?: Address; + /** + * Current status of the Order. + */ + changeStatusTo?: OrderStatus; + /** + * List of status changes in the order. + */ + readonly orderHistory?: OrderStatus[]; + /** + * Serial number of the device. + */ + readonly serialNumber?: string; + /** + * Tracking information related to the packages being delivered to the customer whether original + * or replacement devices. + */ + readonly deliveryTrackingInfo?: TrackingInfo[]; + /** + * Tracking information related to the package being returned from the customer whether original + * or replacement devices. + */ + readonly returnTrackingInfo?: TrackingInfo[]; +} + +/** + * Periodic timer event source. + */ +export interface PeriodicTimerSourceInfo { + /** + * Time time [UTC] of the day, from which the trigger will be valid. Schedule will be computed + * with reference to the time specified. + */ + startTime: Date; + /** + * Periodic frequency at which timer event needs to be raised. Supports Daily, Hourly, Minutes + * and seconds. + */ + schedule: string; + /** + * Topic with which periodic events needs to be published to IOT device. + */ + topic?: string; +} + +/** + * Trigger details. + */ +export interface PeriodicTimerEventTrigger extends Trigger { + /** + * Periodic timer details. + */ + sourceInfo?: PeriodicTimerSourceInfo; + /** + * Role Sink info. + */ + sinkInfo?: RoleSinkInfo; + /** + * Custom context tag, typically used to co-relate the trigger against its usage. Eg. If a + * PeriodicTimer trigger may be intended for certain specific IOT modules in device, the tag can + * be the name/image url of the module. + */ + customContextTag?: string; +} + +/** + * Fields for tracking refresh job on the share. + */ +export interface RefreshDetails { + /** + * If a RefreshShare job is currently inprogress on this share - this field indicates the ArmId + * of that job. Empty otherwise. + */ + inProgressRefreshJobId?: string; + /** + * Indicates the job completed time of the last refresh job on this particular share, if any. + * This could be a failed job or a successful job. + */ + lastCompletedRefreshJobTimeInUTC?: Date; + /** + * Indicates the relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + */ + errorManifestFile?: string; + /** + * Indicates the id of the last refresh job on this particular share,if any. + * This could be a failed job or a successful job. + */ + lastJob?: string; +} + +/** + * The security settings of a device. + */ +export interface SecuritySettings extends ARMBaseModel { + /** + * Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to + * log into the local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special characters. + */ + deviceAdminPassword: AsymmetricEncryptedSecret; +} + +/** + * The mapping between a particular user and the type of access they have on the SMB share. + */ +export interface UserAccessRight { + /** + * Id of the user (already existing in the device). + */ + userId: string; + /** + * Type of access to be allowed for the user. Possible values include: 'Change', 'Read', 'Custom' + */ + accessType: string; +} + +/** + * Represents a share on the Data Box Edge/Gateway device. + */ +export interface Share extends ARMBaseModel { + /** + * Description for the share. + */ + description?: string; + /** + * Current status of the share. Possible values include: 'Online', 'Offline' + */ + shareStatus: string; + /** + * Current monitoring status of the share. Possible values include: 'Enabled', 'Disabled' + */ + monitoringStatus: string; + /** + * Azure container mapping for the share. + */ + azureContainerInfo?: AzureContainerInfo; + /** + * Access protocol to be used by the share. Possible values include: 'SMB', 'NFS' + */ + accessProtocol: string; + /** + * Mapping of Users and corresponding access rights on the share (mandatory for SMB protocol). + */ + userAccessRights?: UserAccessRight[]; + /** + * List of IP addresses and corresponding access rights on the share(mandatory for NFS protocol). + */ + clientAccessRights?: ClientAccessRight[]; + /** + * Details of the refresh job on this share. + */ + refreshDetails?: RefreshDetails; + /** + * Share mount point to the role. + */ + readonly shareMappings?: MountPointMap[]; + /** + * Data policy of the share. Possible values include: 'Cloud', 'Local' + */ + dataPolicy?: string; +} + +/** + * Specifies the mapping between this particular user and the type of access he has on shares on + * this device. + */ +export interface ShareAccessRight { + /** + * Id of the share. + */ + shareId: string; + /** + * Type of access to be allowed on the share for this user. Possible values include: 'Change', + * 'Read', 'Custom' + */ + accessType: string; +} + +/** + * The storage account credential. + */ +export interface StorageAccountCredential extends ARMBaseModel { + /** + * Alias for the storage account. + */ + alias: string; + /** + * UserName for the storage account. + */ + userName?: string; + /** + * Encrypted storage key. + */ + accountKey?: AsymmetricEncryptedSecret; + /** + * ConnectionString for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + */ + connectionString?: string; + /** + * Signifies whether SSL needs to be enabled or not. Possible values include: 'Enabled', + * 'Disabled' + */ + sslStatus: string; + /** + * Blob end point for private clouds. + */ + blobDomainName?: string; + /** + * Type of storage accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + */ + accountType: string; +} + +/** + * Details about ongoing updates and availability of updates on the device. + */ +export interface UpdateSummary extends ARMBaseModel { + /** + * The current version of the device, of format: 1.2.17312.13. + */ + deviceVersionNumber?: string; + /** + * The current version of the device represented in text format. + */ + friendlyDeviceVersionName?: string; + /** + * The last time when a scan was done on the device. + */ + deviceLastScannedDateTime?: Date; + /** + * The time when the last scan job was completed (success/cancelled/failed) on the appliance. + */ + lastCompletedScanJobDateTime?: Date; + /** + * The time when the last Download job was completed (success/cancelled/failed) on the appliance. + */ + readonly lastCompletedDownloadJobDateTime?: Date; + /** + * The time when the last Install job was completed (success/cancelled/failed) on the appliance. + */ + readonly lastCompletedInstallJobDateTime?: Date; + /** + * Count of updates that are available for the current device version as per the last scan on the + * device. + */ + readonly totalNumberOfUpdatesAvailable?: number; + /** + * The total number of items pending download. + */ + readonly totalNumberOfUpdatesPendingDownload?: number; + /** + * The total number of items pending install. + */ + readonly totalNumberOfUpdatesPendingInstall?: number; + /** + * Indicates if updates are available and at least one of the update items detected needs a + * reboot. Possible values include: 'NeverReboots', 'RequiresReboot', 'RequestReboot' + */ + readonly rebootBehavior?: string; + /** + * The current update operation. Possible values include: 'None', 'Scan', 'Download', 'Install' + */ + readonly ongoingUpdateOperation?: string; + /** + * The Job ID of the download job if a download is in progress. + */ + readonly inProgressDownloadJobId?: string; + /** + * The Job ID of the install job if an install is in progress. + */ + readonly inProgressInstallJobId?: string; + /** + * The time when the currently running download (if any) started. + */ + readonly inProgressDownloadJobStartedDateTime?: Date; + /** + * The time when the currently running install (if any) started. + */ + readonly inProgressInstallJobStartedDateTime?: Date; + /** + * The list of update titles which are available for install. + */ + readonly updateTitles?: string[]; + /** + * The total size of updates available for download in bytes. + */ + readonly totalUpdateSizeInBytes?: number; +} + +/** + * The Upload certificate request. + */ +export interface UploadCertificateRequest { + /** + * The authentication type. Possible values include: 'Invalid', 'AzureActiveDirectory' + */ + authenticationType?: string; + /** + * The base64 encoded certificate raw data. + */ + certificate: string; +} + +/** + * The upload registration certificate response. + */ +export interface UploadCertificateResponse { + /** + * Specifies the Authentication type. Possible values include: 'Invalid', 'AzureActiveDirectory' + */ + authType?: string; + /** + * The resource ID of the edge device. + */ + resourceId: string; + /** + * Azure Active Directory tenant authority. + */ + aadAuthority: string; + /** + * Azure Active Directory tenant ID. + */ + aadTenantId: string; + /** + * Azure Active Directory service principal client ID. + */ + servicePrincipalClientId: string; + /** + * Azure Active Directory service principal Object ID. + */ + servicePrincipalObjectId: string; + /** + * The Azure Management Endpoint Audience. + */ + azureManagementEndpointAudience: string; +} + +/** + * Represents a user who has access to one or more shares on the Edge storage device. + */ +export interface User extends ARMBaseModel { + /** + * The details of the password specified for the user. + */ + encryptedPassword?: AsymmetricEncryptedSecret; + /** + * List of shares that the user has rights on. This field should not be specified during user + * creation. + */ + shareAccessRights?: ShareAccessRight[]; +} + +/** + * Class for set of operations used for discovery of available provider operations. + */ +export interface OperationsList extends Array { + /** + * Link to the next set of results. + */ + nextLink?: string; +} + +/** + * The collection of Data Box Edge/Gateway devices. + */ +export interface DataBoxEdgeDeviceList extends Array { + /** + * Link to the next set of results. + */ + readonly nextLink?: string; +} + +/** + * Collection of Alerts. + */ +export interface AlertList extends Array { + /** + * Link to the next set of results. + */ + readonly nextLink?: string; +} + +/** + * The collection of bandwidth schedules. + */ +export interface BandwidthSchedulesList extends Array { + /** + * Link to the next set of results. + */ + readonly nextLink?: string; +} + +/** + * List of order entities. + */ +export interface OrderList extends Array { + /** + * Link to the next set of results. + */ + readonly nextLink?: string; +} + +/** + * Collection of all role on the data box edge device. + */ +export interface RoleList extends Array { + /** + * Link to the next set of results. + */ + readonly nextLink?: string; +} + +/** + * Collection of all shares on the Data Box Edge/Gateway device. + */ +export interface ShareList extends Array { + /** + * Link to the next set of results. + */ + readonly nextLink?: string; +} + +/** + * The collection of storage account credential entities. + */ +export interface StorageAccountCredentialList extends Array { + /** + * Link to the next set of results. + */ + readonly nextLink?: string; +} + +/** + * Collection of all trigger on the data box edge device. + */ +export interface TriggerList extends Array { + /** + * Link to the next set of results. + */ + readonly nextLink?: string; +} + +/** + * Collection of users. + */ +export interface UserList extends Array { + /** + * Link to the next set of results. + */ + readonly nextLink?: string; +} diff --git a/lib/services/edgegatewayManagement/lib/models/index.js b/lib/services/edgegatewayManagement/lib/models/index.js new file mode 100644 index 0000000000..26911241ed --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/index.js @@ -0,0 +1,90 @@ +/* + * 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.Address = require('./address'); +exports.AlertErrorDetails = require('./alertErrorDetails'); +exports.ARMBaseModel = require('./aRMBaseModel'); +exports.Alert = require('./alert'); +exports.AsymmetricEncryptedSecret = require('./asymmetricEncryptedSecret'); +exports.SymmetricKey = require('./symmetricKey'); +exports.Authentication = require('./authentication'); +exports.AzureContainerInfo = require('./azureContainerInfo'); +exports.BandwidthSchedule = require('./bandwidthSchedule'); +exports.ClientAccessRight = require('./clientAccessRight'); +exports.ContactDetails = require('./contactDetails'); +exports.Sku = require('./sku'); +exports.DataBoxEdgeDevice = require('./dataBoxEdgeDevice'); +exports.DataBoxEdgeDeviceExtendedInfo = require('./dataBoxEdgeDeviceExtendedInfo'); +exports.DataBoxEdgeDevicePatch = require('./dataBoxEdgeDevicePatch'); +exports.FileSourceInfo = require('./fileSourceInfo'); +exports.RoleSinkInfo = require('./roleSinkInfo'); +exports.Trigger = require('./trigger'); +exports.FileEventTrigger = require('./fileEventTrigger'); +exports.IoTDeviceInfo = require('./ioTDeviceInfo'); +exports.MountPointMap = require('./mountPointMap'); +exports.Role = require('./role'); +exports.IoTRole = require('./ioTRole'); +exports.Ipv4Config = require('./ipv4Config'); +exports.Ipv6Config = require('./ipv6Config'); +exports.JobErrorItem = require('./jobErrorItem'); +exports.JobErrorDetails = require('./jobErrorDetails'); +exports.UpdateDownloadProgress = require('./updateDownloadProgress'); +exports.UpdateInstallProgress = require('./updateInstallProgress'); +exports.Job = require('./job'); +exports.MetricDimensionV1 = require('./metricDimensionV1'); +exports.MetricSpecificationV1 = require('./metricSpecificationV1'); +exports.NetworkAdapterPosition = require('./networkAdapterPosition'); +exports.NetworkAdapter = require('./networkAdapter'); +exports.NetworkSettings = require('./networkSettings'); +exports.OperationDisplay = require('./operationDisplay'); +exports.ServiceSpecification = require('./serviceSpecification'); +exports.Operation = require('./operation'); +exports.OrderStatus = require('./orderStatus'); +exports.TrackingInfo = require('./trackingInfo'); +exports.Order = require('./order'); +exports.PeriodicTimerSourceInfo = require('./periodicTimerSourceInfo'); +exports.PeriodicTimerEventTrigger = require('./periodicTimerEventTrigger'); +exports.RefreshDetails = require('./refreshDetails'); +exports.SecuritySettings = require('./securitySettings'); +exports.UserAccessRight = require('./userAccessRight'); +exports.Share = require('./share'); +exports.ShareAccessRight = require('./shareAccessRight'); +exports.StorageAccountCredential = require('./storageAccountCredential'); +exports.UpdateSummary = require('./updateSummary'); +exports.UploadCertificateRequest = require('./uploadCertificateRequest'); +exports.UploadCertificateResponse = require('./uploadCertificateResponse'); +exports.User = require('./user'); +exports.OperationsList = require('./operationsList'); +exports.DataBoxEdgeDeviceList = require('./dataBoxEdgeDeviceList'); +exports.AlertList = require('./alertList'); +exports.BandwidthSchedulesList = require('./bandwidthSchedulesList'); +exports.OrderList = require('./orderList'); +exports.RoleList = require('./roleList'); +exports.ShareList = require('./shareList'); +exports.StorageAccountCredentialList = require('./storageAccountCredentialList'); +exports.TriggerList = require('./triggerList'); +exports.UserList = require('./userList'); +exports.discriminators = { + 'BaseResource.FileEvent' : exports.FileEventTrigger, + 'BaseResource.IOT' : exports.IoTRole, + 'BaseResource.PeriodicTimerEvent' : exports.PeriodicTimerEventTrigger, + 'BaseResource.Role' : exports.Role, + 'BaseResource.Trigger' : exports.Trigger +}; diff --git a/lib/services/edgegatewayManagement/lib/models/ioTDeviceInfo.js b/lib/services/edgegatewayManagement/lib/models/ioTDeviceInfo.js new file mode 100644 index 0000000000..96e8f37459 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/ioTDeviceInfo.js @@ -0,0 +1,84 @@ +/* + * 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'; + +/** + * Metadata of IoT device/IoT edge device to be configured. + * + */ +class IoTDeviceInfo { + /** + * Create a IoTDeviceInfo. + * @property {string} deviceId Id of the IoT device/edge device. + * @property {string} ioTHostHub Host name for IoT hub which is associated to + * the device. + * @property {object} [authentication] IoT device authentication info. + * @property {object} [authentication.symmetricKey] Symmetric key for + * authentication. + * @property {object} [authentication.symmetricKey.connectionString] + * Connection string based on symmetric key. + * @property {string} [authentication.symmetricKey.connectionString.value] + * The value of the secret. + * @property {string} + * [authentication.symmetricKey.connectionString.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * @property {string} + * [authentication.symmetricKey.connectionString.encryptionAlgorithm] The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + */ + constructor() { + } + + /** + * Defines the metadata of IoTDeviceInfo + * + * @returns {object} metadata of IoTDeviceInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'IoTDeviceInfo', + type: { + name: 'Composite', + className: 'IoTDeviceInfo', + modelProperties: { + deviceId: { + required: true, + serializedName: 'deviceId', + type: { + name: 'String' + } + }, + ioTHostHub: { + required: true, + serializedName: 'ioTHostHub', + type: { + name: 'String' + } + }, + authentication: { + required: false, + serializedName: 'authentication', + type: { + name: 'Composite', + className: 'Authentication' + } + } + } + } + }; + } +} + +module.exports = IoTDeviceInfo; diff --git a/lib/services/edgegatewayManagement/lib/models/ioTRole.js b/lib/services/edgegatewayManagement/lib/models/ioTRole.js new file mode 100644 index 0000000000..b3412b3af2 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/ioTRole.js @@ -0,0 +1,183 @@ +/* + * 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'); + +/** + * Compute role. + * + * @extends models['Role'] + */ +class IoTRole extends models['Role'] { + /** + * Create a IoTRole. + * @property {string} hostPlatform Host OS which IoT role support. Possible + * values include: 'Windows', 'Linux' + * @property {object} ioTDeviceDetails IoT device metadata to which data box + * edge device needs to be connected. + * @property {string} [ioTDeviceDetails.deviceId] Id of the IoT device/edge + * device. + * @property {string} [ioTDeviceDetails.ioTHostHub] Host name for IoT hub + * which is associated to the device. + * @property {object} [ioTDeviceDetails.authentication] IoT device + * authentication info. + * @property {object} [ioTDeviceDetails.authentication.symmetricKey] + * Symmetric key for authentication. + * @property {object} + * [ioTDeviceDetails.authentication.symmetricKey.connectionString] Connection + * string based on symmetric key. + * @property {string} + * [ioTDeviceDetails.authentication.symmetricKey.connectionString.value] The + * value of the secret. + * @property {string} + * [ioTDeviceDetails.authentication.symmetricKey.connectionString.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * @property {string} + * [ioTDeviceDetails.authentication.symmetricKey.connectionString.encryptionAlgorithm] + * The algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * @property {object} ioTEdgeDeviceDetails IoT edge device to which the IoT + * role needs to be configured. + * @property {string} [ioTEdgeDeviceDetails.deviceId] Id of the IoT + * device/edge device. + * @property {string} [ioTEdgeDeviceDetails.ioTHostHub] Host name for IoT hub + * which is associated to the device. + * @property {object} [ioTEdgeDeviceDetails.authentication] IoT device + * authentication info. + * @property {object} [ioTEdgeDeviceDetails.authentication.symmetricKey] + * Symmetric key for authentication. + * @property {object} + * [ioTEdgeDeviceDetails.authentication.symmetricKey.connectionString] + * Connection string based on symmetric key. + * @property {string} + * [ioTEdgeDeviceDetails.authentication.symmetricKey.connectionString.value] + * The value of the secret. + * @property {string} + * [ioTEdgeDeviceDetails.authentication.symmetricKey.connectionString.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * @property {string} + * [ioTEdgeDeviceDetails.authentication.symmetricKey.connectionString.encryptionAlgorithm] + * The algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * @property {array} [shareMappings] Mount points of shares in role(s). + * @property {string} roleStatus Role status. Possible values include: + * 'Enabled', 'Disabled' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IoTRole + * + * @returns {object} metadata of IoTRole + * + */ + mapper() { + return { + required: false, + serializedName: 'IOT', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'kind', + clientName: 'kind' + }, + uberParent: 'BaseResource', + className: 'IoTRole', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + kind: { + required: true, + serializedName: 'kind', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + hostPlatform: { + required: true, + serializedName: 'properties.hostPlatform', + type: { + name: 'String' + } + }, + ioTDeviceDetails: { + required: true, + serializedName: 'properties.ioTDeviceDetails', + type: { + name: 'Composite', + className: 'IoTDeviceInfo' + } + }, + ioTEdgeDeviceDetails: { + required: true, + serializedName: 'properties.ioTEdgeDeviceDetails', + type: { + name: 'Composite', + className: 'IoTDeviceInfo' + } + }, + shareMappings: { + required: false, + serializedName: 'properties.shareMappings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MountPointMapElementType', + type: { + name: 'Composite', + className: 'MountPointMap' + } + } + } + }, + roleStatus: { + required: true, + serializedName: 'properties.roleStatus', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IoTRole; diff --git a/lib/services/edgegatewayManagement/lib/models/ipv4Config.js b/lib/services/edgegatewayManagement/lib/models/ipv4Config.js new file mode 100644 index 0000000000..68e76ae575 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/ipv4Config.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'; + +/** + * Details related to the IPv4 address configuration. + * + */ +class Ipv4Config { + /** + * Create a Ipv4Config. + * @property {string} [ipAddress] The IPv4 address of the network adapter. + * @property {string} [subnet] The IPv4 subnet of the network adapter. + * @property {string} [gateway] The IPv4 gateway of the network adapter. + */ + constructor() { + } + + /** + * Defines the metadata of Ipv4Config + * + * @returns {object} metadata of Ipv4Config + * + */ + mapper() { + return { + required: false, + serializedName: 'Ipv4Config', + type: { + name: 'Composite', + className: 'Ipv4Config', + modelProperties: { + ipAddress: { + required: false, + readOnly: true, + serializedName: 'ipAddress', + type: { + name: 'String' + } + }, + subnet: { + required: false, + readOnly: true, + serializedName: 'subnet', + type: { + name: 'String' + } + }, + gateway: { + required: false, + readOnly: true, + serializedName: 'gateway', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Ipv4Config; diff --git a/lib/services/edgegatewayManagement/lib/models/ipv6Config.js b/lib/services/edgegatewayManagement/lib/models/ipv6Config.js new file mode 100644 index 0000000000..0e97f20fbf --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/ipv6Config.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'; + +/** + * Details related to the IPv6 address configuration. + * + */ +class Ipv6Config { + /** + * Create a Ipv6Config. + * @property {string} [ipAddress] The IPv6 address of the network adapter. + * @property {number} [prefixLength] The IPv6 prefix of the network adapter. + * @property {string} [gateway] The IPv6 gateway of the network adapter. + */ + constructor() { + } + + /** + * Defines the metadata of Ipv6Config + * + * @returns {object} metadata of Ipv6Config + * + */ + mapper() { + return { + required: false, + serializedName: 'Ipv6Config', + type: { + name: 'Composite', + className: 'Ipv6Config', + modelProperties: { + ipAddress: { + required: false, + readOnly: true, + serializedName: 'ipAddress', + type: { + name: 'String' + } + }, + prefixLength: { + required: false, + readOnly: true, + serializedName: 'prefixLength', + type: { + name: 'Number' + } + }, + gateway: { + required: false, + readOnly: true, + serializedName: 'gateway', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Ipv6Config; diff --git a/lib/services/edgegatewayManagement/lib/models/job.js b/lib/services/edgegatewayManagement/lib/models/job.js new file mode 100644 index 0000000000..f2dfe70505 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/job.js @@ -0,0 +1,228 @@ +/* + * 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 device job. + * + */ +class Job { + /** + * Create a Job. + * @property {string} [id] The path ID that uniquely identifies the object. + * @property {string} [name] The name of the object. + * @property {string} [type] The hierarchical type of the object. + * @property {string} [status] The current status of the job. Possible values + * include: 'Invalid', 'Running', 'Succeeded', 'Failed', 'Canceled', + * 'Paused', 'Scheduled' + * @property {date} [startTime] The UTC datetime at which the job was + * started. + * @property {date} [endTime] The UTC datetime at which the job completed. + * @property {number} [percentComplete] The percentage of the job that is + * already complete. + * @property {object} [error] The Error details. + * @property {array} [error.errorDetails] The error details. + * @property {string} [error.code] The code intended for programmatic access. + * @property {string} [error.message] The message intended to describe the + * error in detail. + * @property {string} [jobType] The type of the job. Possible values include: + * 'Invalid', 'ScanForUpdates', 'DownloadUpdates', 'InstallUpdates', + * 'RefreshShare' + * @property {string} [currentStage] Current stage of the update operation. + * Possible values include: 'Unknown', 'Initial', 'ScanStarted', + * 'ScanComplete', 'ScanFailed', 'DownloadStarted', 'DownloadComplete', + * 'DownloadFailed', 'InstallStarted', 'InstallComplete', 'InstallFailed', + * 'RebootInitiated', 'Success', 'Failure', 'RescanStarted', + * 'RescanComplete', 'RescanFailed' + * @property {object} [downloadProgress] The download progress. + * @property {string} [downloadProgress.downloadPhase] The download phase. + * Possible values include: 'Unknown', 'Initializing', 'Downloading', + * 'Verifying' + * @property {number} [downloadProgress.percentComplete] Percentage of + * completion. + * @property {number} [downloadProgress.totalBytesToDownload] Total bytes to + * download. + * @property {number} [downloadProgress.totalBytesDownloaded] Total bytes + * downloaded. + * @property {number} [downloadProgress.numberOfUpdatesToDownload] Number of + * updates to download. + * @property {number} [downloadProgress.numberOfUpdatesDownloaded] Number of + * updates downloaded. + * @property {object} [installProgress] The install progress. + * @property {number} [installProgress.percentComplete] Percentage of + * completion. + * @property {number} [installProgress.numberOfUpdatesToInstall] Number of + * updates to install. + * @property {number} [installProgress.numberOfUpdatesInstalled] Number of + * updates installed. + * @property {number} [totalRefreshErrors] Total number of errors encountered + * during the refresh process. + * @property {string} [errorManifestFile] Local Share/Remote Container + * relative path to the error manifest file of the refresh. + * @property {string} [shareId] ARM id of the Share on which the Refresh + * operation was done. + * @property {string} [folder] If only subfolders need to be refreshed, then + * the sub folder path inside the share. Empty otherwise. + */ + constructor() { + } + + /** + * Defines the metadata of Job + * + * @returns {object} metadata of Job + * + */ + mapper() { + return { + required: false, + serializedName: 'Job', + type: { + name: 'Composite', + className: 'Job', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + }, + percentComplete: { + required: false, + readOnly: true, + serializedName: 'percentComplete', + type: { + name: 'Number' + } + }, + error: { + required: false, + readOnly: true, + serializedName: 'error', + type: { + name: 'Composite', + className: 'JobErrorDetails' + } + }, + jobType: { + required: false, + readOnly: true, + serializedName: 'properties.jobType', + type: { + name: 'String' + } + }, + currentStage: { + required: false, + readOnly: true, + serializedName: 'properties.currentStage', + type: { + name: 'String' + } + }, + downloadProgress: { + required: false, + readOnly: true, + serializedName: 'properties.downloadProgress', + type: { + name: 'Composite', + className: 'UpdateDownloadProgress' + } + }, + installProgress: { + required: false, + readOnly: true, + serializedName: 'properties.installProgress', + type: { + name: 'Composite', + className: 'UpdateInstallProgress' + } + }, + totalRefreshErrors: { + required: false, + readOnly: true, + serializedName: 'properties.totalRefreshErrors', + type: { + name: 'Number' + } + }, + errorManifestFile: { + required: false, + readOnly: true, + serializedName: 'properties.errorManifestFile', + type: { + name: 'String' + } + }, + shareId: { + required: false, + readOnly: true, + serializedName: 'properties.shareId', + type: { + name: 'String' + } + }, + folder: { + required: false, + serializedName: 'properties.folder', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Job; diff --git a/lib/services/edgegatewayManagement/lib/models/jobErrorDetails.js b/lib/services/edgegatewayManagement/lib/models/jobErrorDetails.js new file mode 100644 index 0000000000..64ba3db016 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/jobErrorDetails.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 job error information containing List of JobErrorItem. + * + */ +class JobErrorDetails { + /** + * Create a JobErrorDetails. + * @property {array} [errorDetails] The error details. + * @property {string} [code] The code intended for programmatic access. + * @property {string} [message] The message intended to describe the error in + * detail. + */ + constructor() { + } + + /** + * Defines the metadata of JobErrorDetails + * + * @returns {object} metadata of JobErrorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'JobErrorDetails', + type: { + name: 'Composite', + className: 'JobErrorDetails', + modelProperties: { + errorDetails: { + required: false, + readOnly: true, + serializedName: 'errorDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobErrorItemElementType', + type: { + name: 'Composite', + className: 'JobErrorItem' + } + } + } + }, + code: { + required: false, + readOnly: true, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobErrorDetails; diff --git a/lib/services/edgegatewayManagement/lib/models/jobErrorItem.js b/lib/services/edgegatewayManagement/lib/models/jobErrorItem.js new file mode 100644 index 0000000000..c0481a76e1 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/jobErrorItem.js @@ -0,0 +1,79 @@ +/* + * 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 job error items. + * + */ +class JobErrorItem { + /** + * Create a JobErrorItem. + * @property {array} [recommendations] The recommended actions. + * @property {string} [code] The code intended for programmatic access. + * @property {string} [message] The message intended to describe the error in + * detail. + */ + constructor() { + } + + /** + * Defines the metadata of JobErrorItem + * + * @returns {object} metadata of JobErrorItem + * + */ + mapper() { + return { + required: false, + serializedName: 'JobErrorItem', + type: { + name: 'Composite', + className: 'JobErrorItem', + modelProperties: { + recommendations: { + required: false, + readOnly: true, + serializedName: 'recommendations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + code: { + required: false, + readOnly: true, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobErrorItem; diff --git a/lib/services/edgegatewayManagement/lib/models/metricDimensionV1.js b/lib/services/edgegatewayManagement/lib/models/metricDimensionV1.js new file mode 100644 index 0000000000..ff0f59118a --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/metricDimensionV1.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'; + +/** + * Metric Dimension v1. + * + */ +class MetricDimensionV1 { + /** + * Create a MetricDimensionV1. + * @property {string} [name] Name of the metrics dimension. + * @property {string} [displayName] Display name of the metrics dimension. + * @property {boolean} [toBeExportedForShoebox] To be exported to shoe box. + */ + constructor() { + } + + /** + * Defines the metadata of MetricDimensionV1 + * + * @returns {object} metadata of MetricDimensionV1 + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricDimension_V1', + type: { + name: 'Composite', + className: 'MetricDimensionV1', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + toBeExportedForShoebox: { + required: false, + serializedName: 'toBeExportedForShoebox', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = MetricDimensionV1; diff --git a/lib/services/edgegatewayManagement/lib/models/metricSpecificationV1.js b/lib/services/edgegatewayManagement/lib/models/metricSpecificationV1.js new file mode 100644 index 0000000000..22108d73b1 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/metricSpecificationV1.js @@ -0,0 +1,164 @@ +/* + * 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'; + +/** + * Metric specification version 1. + * + */ +class MetricSpecificationV1 { + /** + * Create a MetricSpecificationV1. + * @property {string} [name] Name of the metric. + * @property {string} [displayName] Display name of the metric. + * @property {string} [displayDescription] Description of the metric to be + * displayed. + * @property {string} [unit] Metric units. Possible values include: + * 'NotSpecified', 'Percent', 'Count', 'Seconds', 'Milliseconds', 'Bytes', + * 'BytesPerSecond', 'CountPerSecond' + * @property {string} [aggregationType] Metric aggregation type. Possible + * values include: 'NotSpecified', 'None', 'Average', 'Minimum', 'Maximum', + * 'Total', 'Count' + * @property {array} [dimensions] Metric dimensions, other than default + * dimension which is resource. + * @property {boolean} [fillGapWithZero] set true to fill the gaps with zero. + * @property {string} [category] Metric category. Possible values include: + * 'Capacity', 'Transaction' + * @property {string} [resourceIdDimensionNameOverride] Resource name + * override. + * @property {array} [supportedTimeGrainTypes] Support granularity of + * metrics. + * @property {array} [supportedAggregationTypes] Support metric aggregation + * type. + */ + constructor() { + } + + /** + * Defines the metadata of MetricSpecificationV1 + * + * @returns {object} metadata of MetricSpecificationV1 + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricSpecification_V1', + type: { + name: 'Composite', + className: 'MetricSpecificationV1', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + displayDescription: { + required: false, + serializedName: 'displayDescription', + type: { + name: 'String' + } + }, + unit: { + required: false, + serializedName: 'unit', + type: { + name: 'String' + } + }, + aggregationType: { + required: false, + serializedName: 'aggregationType', + type: { + name: 'String' + } + }, + dimensions: { + required: false, + serializedName: 'dimensions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricDimensionV1ElementType', + type: { + name: 'Composite', + className: 'MetricDimensionV1' + } + } + } + }, + fillGapWithZero: { + required: false, + serializedName: 'fillGapWithZero', + type: { + name: 'Boolean' + } + }, + category: { + required: false, + serializedName: 'category', + type: { + name: 'String' + } + }, + resourceIdDimensionNameOverride: { + required: false, + serializedName: 'resourceIdDimensionNameOverride', + type: { + name: 'String' + } + }, + supportedTimeGrainTypes: { + required: false, + serializedName: 'supportedTimeGrainTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TimeGrainElementType', + type: { + name: 'String' + } + } + } + }, + supportedAggregationTypes: { + required: false, + serializedName: 'supportedAggregationTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricAggregationTypeElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricSpecificationV1; diff --git a/lib/services/edgegatewayManagement/lib/models/mountPointMap.js b/lib/services/edgegatewayManagement/lib/models/mountPointMap.js new file mode 100644 index 0000000000..6f6455461b --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/mountPointMap.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 share mount point. + * + */ +class MountPointMap { + /** + * Create a MountPointMap. + * @property {string} shareId ID of the share which is mounted to role VM. + * @property {string} [roleId] ID of the role to which share is mounted. + * @property {string} [mountPoint] Mount point for the share. + * @property {string} [roleType] Role type. Possible values include: 'IOT', + * 'ASA', 'Functions', 'Cognitive' + */ + constructor() { + } + + /** + * Defines the metadata of MountPointMap + * + * @returns {object} metadata of MountPointMap + * + */ + mapper() { + return { + required: false, + serializedName: 'MountPointMap', + type: { + name: 'Composite', + className: 'MountPointMap', + modelProperties: { + shareId: { + required: true, + serializedName: 'shareId', + type: { + name: 'String' + } + }, + roleId: { + required: false, + readOnly: true, + serializedName: 'roleId', + type: { + name: 'String' + } + }, + mountPoint: { + required: false, + readOnly: true, + serializedName: 'mountPoint', + type: { + name: 'String' + } + }, + roleType: { + required: false, + readOnly: true, + serializedName: 'roleType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = MountPointMap; diff --git a/lib/services/edgegatewayManagement/lib/models/networkAdapter.js b/lib/services/edgegatewayManagement/lib/models/networkAdapter.js new file mode 100644 index 0000000000..0b3f88ec29 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/networkAdapter.js @@ -0,0 +1,207 @@ +/* + * 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'; + +/** + * Represents the networkAdapter on a device. + * + */ +class NetworkAdapter { + /** + * Create a NetworkAdapter. + * @property {string} [adapterId] Instance ID of network adapter. + * @property {object} [adapterPosition] Hardware position of network adapter. + * @property {string} [adapterPosition.networkGroup] The network group. + * Possible values include: 'None', 'NonRDMA', 'RDMA' + * @property {number} [adapterPosition.port] The port. + * @property {number} [index] Logical index of the adapter. + * @property {string} [nodeId] Node ID of the network adapter. + * @property {string} [networkAdapterName] Network Adapter Name. + * @property {string} [label] Hardware label for the adapter. + * @property {string} [macAddress] MAC Address. + * @property {number} [linkSpeed] Link Speed. + * @property {string} [status] Value indicating whether this adapter is + * valid. Possible values include: 'Inactive', 'Active' + * @property {string} [rdmaStatus] Value indicating whether this adapter is + * RDMA Capable. Possible values include: 'Incapable', 'Capable' + * @property {string} [dhcpStatus] Value indicating whether this adapter has + * DHCP Enabled. Possible values include: 'Disabled', 'Enabled' + * @property {object} [ipv4Configuration] The IPv4 configuration of the + * network adapter. + * @property {string} [ipv4Configuration.ipAddress] The IPv4 address of the + * network adapter. + * @property {string} [ipv4Configuration.subnet] The IPv4 subnet of the + * network adapter. + * @property {string} [ipv4Configuration.gateway] The IPv4 gateway of the + * network adapter. + * @property {object} [ipv6Configuration] The IPv6 configuration of the + * network adapter. + * @property {string} [ipv6Configuration.ipAddress] The IPv6 address of the + * network adapter. + * @property {number} [ipv6Configuration.prefixLength] The IPv6 prefix of the + * network adapter. + * @property {string} [ipv6Configuration.gateway] The IPv6 gateway of the + * network adapter. + * @property {string} [ipv6LinkLocalAddress] The IPv6 local address. + * @property {array} [dnsServers] The list DNS Servers of the device. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkAdapter + * + * @returns {object} metadata of NetworkAdapter + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkAdapter', + type: { + name: 'Composite', + className: 'NetworkAdapter', + modelProperties: { + adapterId: { + required: false, + readOnly: true, + serializedName: 'adapterId', + type: { + name: 'String' + } + }, + adapterPosition: { + required: false, + readOnly: true, + serializedName: 'adapterPosition', + type: { + name: 'Composite', + className: 'NetworkAdapterPosition' + } + }, + index: { + required: false, + readOnly: true, + serializedName: 'index', + type: { + name: 'Number' + } + }, + nodeId: { + required: false, + readOnly: true, + serializedName: 'nodeId', + type: { + name: 'String' + } + }, + networkAdapterName: { + required: false, + readOnly: true, + serializedName: 'networkAdapterName', + type: { + name: 'String' + } + }, + label: { + required: false, + readOnly: true, + serializedName: 'label', + type: { + name: 'String' + } + }, + macAddress: { + required: false, + readOnly: true, + serializedName: 'macAddress', + type: { + name: 'String' + } + }, + linkSpeed: { + required: false, + readOnly: true, + serializedName: 'linkSpeed', + type: { + name: 'Number' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + }, + rdmaStatus: { + required: false, + serializedName: 'rdmaStatus', + type: { + name: 'String' + } + }, + dhcpStatus: { + required: false, + serializedName: 'dhcpStatus', + type: { + name: 'String' + } + }, + ipv4Configuration: { + required: false, + readOnly: true, + serializedName: 'ipv4Configuration', + type: { + name: 'Composite', + className: 'Ipv4Config' + } + }, + ipv6Configuration: { + required: false, + readOnly: true, + serializedName: 'ipv6Configuration', + type: { + name: 'Composite', + className: 'Ipv6Config' + } + }, + ipv6LinkLocalAddress: { + required: false, + readOnly: true, + serializedName: 'ipv6LinkLocalAddress', + type: { + name: 'String' + } + }, + dnsServers: { + required: false, + readOnly: true, + serializedName: 'dnsServers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = NetworkAdapter; diff --git a/lib/services/edgegatewayManagement/lib/models/networkAdapterPosition.js b/lib/services/edgegatewayManagement/lib/models/networkAdapterPosition.js new file mode 100644 index 0000000000..2a39489e67 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/networkAdapterPosition.js @@ -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. + */ + +'use strict'; + +/** + * The network adapter position. + * + */ +class NetworkAdapterPosition { + /** + * Create a NetworkAdapterPosition. + * @property {string} [networkGroup] The network group. Possible values + * include: 'None', 'NonRDMA', 'RDMA' + * @property {number} [port] The port. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkAdapterPosition + * + * @returns {object} metadata of NetworkAdapterPosition + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkAdapterPosition', + type: { + name: 'Composite', + className: 'NetworkAdapterPosition', + modelProperties: { + networkGroup: { + required: false, + readOnly: true, + serializedName: 'networkGroup', + type: { + name: 'String' + } + }, + port: { + required: false, + readOnly: true, + serializedName: 'port', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = NetworkAdapterPosition; diff --git a/lib/services/edgegatewayManagement/lib/models/networkSettings.js b/lib/services/edgegatewayManagement/lib/models/networkSettings.js new file mode 100644 index 0000000000..4f77bdc8a0 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/networkSettings.js @@ -0,0 +1,90 @@ +/* + * 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 NetworkSettings of a device. + * + * @extends models['ARMBaseModel'] + */ +class NetworkSettings extends models['ARMBaseModel'] { + /** + * Create a NetworkSettings. + * @property {array} [networkAdapters] The network adapter list on the + * device. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkSettings + * + * @returns {object} metadata of NetworkSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkSettings', + type: { + name: 'Composite', + className: 'NetworkSettings', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + networkAdapters: { + required: false, + readOnly: true, + serializedName: 'properties.networkAdapters', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkAdapterElementType', + type: { + name: 'Composite', + className: 'NetworkAdapter' + } + } + } + } + } + } + }; + } +} + +module.exports = NetworkSettings; diff --git a/lib/services/edgegatewayManagement/lib/models/operation.js b/lib/services/edgegatewayManagement/lib/models/operation.js new file mode 100644 index 0000000000..63aa4d6f61 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/operation.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'; + +/** + * Operations. + * + */ +class Operation { + /** + * Create a Operation. + * @property {string} [name] Name of the operation. + * @property {object} [display] Properties to displayed for the operation. + * @property {string} [display.provider] Provider name. + * @property {string} [display.resource] The type of resource in which the + * operation is performed. + * @property {string} [display.operation] Operation to be performed on the + * resource. + * @property {string} [display.description] Description of the operation to + * be performed. + * @property {string} [origin] Origin of the operation. + * @property {object} [serviceSpecification] Service specification. + * @property {array} [serviceSpecification.metricSpecifications] Metric + * specification as defined by shoebox. + */ + 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, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + }, + origin: { + required: false, + serializedName: 'origin', + type: { + name: 'String' + } + }, + serviceSpecification: { + required: false, + serializedName: 'properties.serviceSpecification', + type: { + name: 'Composite', + className: 'ServiceSpecification' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/edgegatewayManagement/lib/models/operationDisplay.js b/lib/services/edgegatewayManagement/lib/models/operationDisplay.js new file mode 100644 index 0000000000..8d624d3c02 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/operationDisplay.js @@ -0,0 +1,78 @@ +/* + * 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'; + +/** + * Operation display properties. + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @property {string} [provider] Provider name. + * @property {string} [resource] The type of resource in which the operation + * is performed. + * @property {string} [operation] Operation to be performed on the resource. + * @property {string} [description] Description of the operation to be + * performed. + */ + 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, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplay; diff --git a/lib/services/edgegatewayManagement/lib/models/operationsList.js b/lib/services/edgegatewayManagement/lib/models/operationsList.js new file mode 100644 index 0000000000..2f2d6a870c --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/operationsList.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'; + +/** + * Class for set of operations used for discovery of available provider + * operations. + */ +class OperationsList extends Array { + /** + * Create a OperationsList. + * @property {string} [nextLink] Link to the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OperationsList + * + * @returns {object} metadata of OperationsList + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationsList', + type: { + name: 'Composite', + className: 'OperationsList', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationsList; diff --git a/lib/services/edgegatewayManagement/lib/models/order.js b/lib/services/edgegatewayManagement/lib/models/order.js new file mode 100644 index 0000000000..a5873c0352 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/order.js @@ -0,0 +1,187 @@ +/* + * 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 order details. + * + * @extends models['ARMBaseModel'] + */ +class Order extends models['ARMBaseModel'] { + /** + * Create a Order. + * @property {object} [contactInformation] The contact details. + * @property {string} [contactInformation.contactPerson] Gets or sets the + * contact person. + * @property {string} [contactInformation.companyName] Gets or sets the name + * of the company. + * @property {string} [contactInformation.phone] Gets or sets the phone + * number. + * @property {array} [contactInformation.emailList] Gets or sets the email + * list. + * @property {object} [shippingAddress] The shipping address. + * @property {string} [shippingAddress.addressLine1] The address line1. + * @property {string} [shippingAddress.addressLine2] The address line2. + * @property {string} [shippingAddress.addressLine3] The address line3. + * @property {string} [shippingAddress.postalCode] The postal code. + * @property {string} [shippingAddress.city] The city name. + * @property {string} [shippingAddress.state] The state name. + * @property {string} [shippingAddress.country] The country name. + * @property {object} [changeStatusTo] Current status of the Order. + * @property {string} [changeStatusTo.status] Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', + * 'Shipped', 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', + * 'Declined', 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * @property {date} [changeStatusTo.updateDateTime] Time of status update. + * @property {string} [changeStatusTo.comments] Comments related to this + * status change. + * @property {array} [orderHistory] List of status changes in the order. + * @property {string} [serialNumber] Serial number of the device. + * @property {array} [deliveryTrackingInfo] Tracking information related to + * the packages being delivered to the customer whether original or + * replacement devices. + * @property {array} [returnTrackingInfo] Tracking information related to the + * package being returned from the customer whether original or replacement + * devices. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Order + * + * @returns {object} metadata of Order + * + */ + mapper() { + return { + required: false, + serializedName: 'Order', + type: { + name: 'Composite', + className: 'Order', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + contactInformation: { + required: false, + serializedName: 'properties.contactInformation', + type: { + name: 'Composite', + className: 'ContactDetails' + } + }, + shippingAddress: { + required: false, + serializedName: 'properties.shippingAddress', + type: { + name: 'Composite', + className: 'Address' + } + }, + changeStatusTo: { + required: false, + serializedName: 'properties.changeStatusTo', + type: { + name: 'Composite', + className: 'OrderStatus' + } + }, + orderHistory: { + required: false, + readOnly: true, + serializedName: 'properties.orderHistory', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OrderStatusElementType', + type: { + name: 'Composite', + className: 'OrderStatus' + } + } + } + }, + serialNumber: { + required: false, + readOnly: true, + serializedName: 'properties.serialNumber', + type: { + name: 'String' + } + }, + deliveryTrackingInfo: { + required: false, + readOnly: true, + serializedName: 'properties.deliveryTrackingInfo', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TrackingInfoElementType', + type: { + name: 'Composite', + className: 'TrackingInfo' + } + } + } + }, + returnTrackingInfo: { + required: false, + readOnly: true, + serializedName: 'properties.returnTrackingInfo', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TrackingInfoElementType', + type: { + name: 'Composite', + className: 'TrackingInfo' + } + } + } + } + } + } + }; + } +} + +module.exports = Order; diff --git a/lib/services/edgegatewayManagement/lib/models/orderList.js b/lib/services/edgegatewayManagement/lib/models/orderList.js new file mode 100644 index 0000000000..18742d7467 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/orderList.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * List of order entities. + */ +class OrderList extends Array { + /** + * Create a OrderList. + * @property {string} [nextLink] Link to the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OrderList + * + * @returns {object} metadata of OrderList + * + */ + mapper() { + return { + required: false, + serializedName: 'OrderList', + type: { + name: 'Composite', + className: 'OrderList', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OrderElementType', + type: { + name: 'Composite', + className: 'Order' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OrderList; diff --git a/lib/services/edgegatewayManagement/lib/models/orderStatus.js b/lib/services/edgegatewayManagement/lib/models/orderStatus.js new file mode 100644 index 0000000000..ce1ca33156 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/orderStatus.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'; + +/** + * Represents a single status change. + * + */ +class OrderStatus { + /** + * Create a OrderStatus. + * @property {string} status Status of the order pertaining to the allowed + * StatusTypes. Possible values include: 'Untracked', 'AwaitingFulfilment', + * 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', 'Arriving', + * 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * @property {date} [updateDateTime] Time of status update. + * @property {string} [comments] Comments related to this status change. + */ + constructor() { + } + + /** + * Defines the metadata of OrderStatus + * + * @returns {object} metadata of OrderStatus + * + */ + mapper() { + return { + required: false, + serializedName: 'OrderStatus', + type: { + name: 'Composite', + className: 'OrderStatus', + modelProperties: { + status: { + required: true, + serializedName: 'status', + type: { + name: 'String' + } + }, + updateDateTime: { + required: false, + readOnly: true, + serializedName: 'updateDateTime', + type: { + name: 'DateTime' + } + }, + comments: { + required: false, + serializedName: 'comments', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OrderStatus; diff --git a/lib/services/edgegatewayManagement/lib/models/periodicTimerEventTrigger.js b/lib/services/edgegatewayManagement/lib/models/periodicTimerEventTrigger.js new file mode 100644 index 0000000000..2708ae66e2 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/periodicTimerEventTrigger.js @@ -0,0 +1,122 @@ +/* + * 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'); + +/** + * Trigger details. + * + * @extends models['Trigger'] + */ +class PeriodicTimerEventTrigger extends models['Trigger'] { + /** + * Create a PeriodicTimerEventTrigger. + * @property {object} [sourceInfo] Periodic timer details. + * @property {date} [sourceInfo.startTime] Time time [UTC] of the day, from + * which the trigger will be valid. Schedule will be computed with reference + * to the time specified. + * @property {string} [sourceInfo.schedule] Periodic frequency at which timer + * event needs to be raised. Supports Daily, Hourly, Minutes and seconds. + * @property {string} [sourceInfo.topic] Topic with which periodic events + * needs to be published to IOT device. + * @property {object} [sinkInfo] Role Sink info. + * @property {string} [sinkInfo.roleId] Compute role ID. + * @property {string} [customContextTag] Custom context tag, typically used + * to co-relate the trigger against its usage. Eg. If a PeriodicTimer trigger + * may be intended for certain specific IOT modules in device, the tag can be + * the name/image url of the module. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PeriodicTimerEventTrigger + * + * @returns {object} metadata of PeriodicTimerEventTrigger + * + */ + mapper() { + return { + required: false, + serializedName: 'PeriodicTimerEvent', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'kind', + clientName: 'kind' + }, + uberParent: 'BaseResource', + className: 'PeriodicTimerEventTrigger', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + kind: { + required: true, + serializedName: 'kind', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + sourceInfo: { + required: false, + serializedName: 'properties.sourceInfo', + type: { + name: 'Composite', + className: 'PeriodicTimerSourceInfo' + } + }, + sinkInfo: { + required: false, + serializedName: 'properties.sinkInfo', + type: { + name: 'Composite', + className: 'RoleSinkInfo' + } + }, + customContextTag: { + required: false, + serializedName: 'properties.customContextTag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PeriodicTimerEventTrigger; diff --git a/lib/services/edgegatewayManagement/lib/models/periodicTimerSourceInfo.js b/lib/services/edgegatewayManagement/lib/models/periodicTimerSourceInfo.js new file mode 100644 index 0000000000..278ef88098 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/periodicTimerSourceInfo.js @@ -0,0 +1,72 @@ +/* + * 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'; + +/** + * Periodic timer event source. + * + */ +class PeriodicTimerSourceInfo { + /** + * Create a PeriodicTimerSourceInfo. + * @property {date} startTime Time time [UTC] of the day, from which the + * trigger will be valid. Schedule will be computed with reference to the + * time specified. + * @property {string} schedule Periodic frequency at which timer event needs + * to be raised. Supports Daily, Hourly, Minutes and seconds. + * @property {string} [topic] Topic with which periodic events needs to be + * published to IOT device. + */ + constructor() { + } + + /** + * Defines the metadata of PeriodicTimerSourceInfo + * + * @returns {object} metadata of PeriodicTimerSourceInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'PeriodicTimerSourceInfo', + type: { + name: 'Composite', + className: 'PeriodicTimerSourceInfo', + modelProperties: { + startTime: { + required: true, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + schedule: { + required: true, + serializedName: 'schedule', + type: { + name: 'String' + } + }, + topic: { + required: false, + serializedName: 'topic', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PeriodicTimerSourceInfo; diff --git a/lib/services/edgegatewayManagement/lib/models/refreshDetails.js b/lib/services/edgegatewayManagement/lib/models/refreshDetails.js new file mode 100644 index 0000000000..726a3c7208 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/refreshDetails.js @@ -0,0 +1,84 @@ +/* + * 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'; + +/** + * Fields for tracking refresh job on the share. + * + */ +class RefreshDetails { + /** + * Create a RefreshDetails. + * @property {string} [inProgressRefreshJobId] If a RefreshShare job is + * currently inprogress on this share - this field indicates the ArmId of + * that job. Empty otherwise. + * @property {date} [lastCompletedRefreshJobTimeInUTC] Indicates the job + * completed time of the last refresh job on this particular share, if any. + * This could be a failed job or a successful job. + * @property {string} [errorManifestFile] Indicates the relative path of the + * error xml for the last refresh job on this particular share, if any. + * This could be a failed job or a successful job. + * @property {string} [lastJob] Indicates the id of the last refresh job on + * this particular share,if any. + * This could be a failed job or a successful job. + */ + constructor() { + } + + /** + * Defines the metadata of RefreshDetails + * + * @returns {object} metadata of RefreshDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'RefreshDetails', + type: { + name: 'Composite', + className: 'RefreshDetails', + modelProperties: { + inProgressRefreshJobId: { + required: false, + serializedName: 'inProgressRefreshJobId', + type: { + name: 'String' + } + }, + lastCompletedRefreshJobTimeInUTC: { + required: false, + serializedName: 'lastCompletedRefreshJobTimeInUTC', + type: { + name: 'DateTime' + } + }, + errorManifestFile: { + required: false, + serializedName: 'errorManifestFile', + type: { + name: 'String' + } + }, + lastJob: { + required: false, + serializedName: 'lastJob', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RefreshDetails; diff --git a/lib/services/edgegatewayManagement/lib/models/role.js b/lib/services/edgegatewayManagement/lib/models/role.js new file mode 100644 index 0000000000..ddb025ff47 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/role.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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Compute role. + * + * @extends models['ARMBaseModel'] + */ +class Role extends models['ARMBaseModel'] { + /** + * Create a Role. + * @property {string} kind Polymorphic Discriminator + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Role + * + * @returns {object} metadata of Role + * + */ + mapper() { + return { + required: false, + serializedName: 'Role', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'kind', + clientName: 'kind' + }, + uberParent: 'BaseResource', + className: 'Role', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + kind: { + required: true, + serializedName: 'kind', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Role; diff --git a/lib/services/edgegatewayManagement/lib/models/roleList.js b/lib/services/edgegatewayManagement/lib/models/roleList.js new file mode 100644 index 0000000000..f0e6faf593 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/roleList.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'; + +/** + * Collection of all role on the data box edge device. + */ +class RoleList extends Array { + /** + * Create a RoleList. + * @property {string} [nextLink] Link to the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RoleList + * + * @returns {object} metadata of RoleList + * + */ + mapper() { + return { + required: false, + serializedName: 'RoleList', + type: { + name: 'Composite', + className: 'RoleList', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RoleElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'kind', + clientName: 'kind' + }, + uberParent: 'BaseResource', + className: 'Role' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RoleList; diff --git a/lib/services/edgegatewayManagement/lib/models/roleSinkInfo.js b/lib/services/edgegatewayManagement/lib/models/roleSinkInfo.js new file mode 100644 index 0000000000..a466d31cbe --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/roleSinkInfo.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'; + +/** + * Compute role against which events will be raised. + * + */ +class RoleSinkInfo { + /** + * Create a RoleSinkInfo. + * @property {string} roleId Compute role ID. + */ + constructor() { + } + + /** + * Defines the metadata of RoleSinkInfo + * + * @returns {object} metadata of RoleSinkInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'RoleSinkInfo', + type: { + name: 'Composite', + className: 'RoleSinkInfo', + modelProperties: { + roleId: { + required: true, + serializedName: 'roleId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RoleSinkInfo; diff --git a/lib/services/edgegatewayManagement/lib/models/securitySettings.js b/lib/services/edgegatewayManagement/lib/models/securitySettings.js new file mode 100644 index 0000000000..eb96186917 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/securitySettings.js @@ -0,0 +1,92 @@ +/* + * 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 security settings of a device. + * + * @extends models['ARMBaseModel'] + */ +class SecuritySettings extends models['ARMBaseModel'] { + /** + * Create a SecuritySettings. + * @property {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 + * characters that are a combination of uppercase, lowercase, numeric, and + * special characters. + * @property {string} [deviceAdminPassword.value] The value of the secret. + * @property {string} [deviceAdminPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * @property {string} [deviceAdminPassword.encryptionAlgorithm] The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SecuritySettings + * + * @returns {object} metadata of SecuritySettings + * + */ + mapper() { + return { + required: false, + serializedName: 'SecuritySettings', + type: { + name: 'Composite', + className: 'SecuritySettings', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + deviceAdminPassword: { + required: true, + serializedName: 'properties.deviceAdminPassword', + type: { + name: 'Composite', + className: 'AsymmetricEncryptedSecret' + } + } + } + } + }; + } +} + +module.exports = SecuritySettings; diff --git a/lib/services/edgegatewayManagement/lib/models/serviceSpecification.js b/lib/services/edgegatewayManagement/lib/models/serviceSpecification.js new file mode 100644 index 0000000000..21093e730a --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/serviceSpecification.js @@ -0,0 +1,61 @@ +/* + * 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'; + +/** + * Service specification. + * + */ +class ServiceSpecification { + /** + * Create a ServiceSpecification. + * @property {array} [metricSpecifications] Metric specification as defined + * by shoebox. + */ + constructor() { + } + + /** + * Defines the metadata of ServiceSpecification + * + * @returns {object} metadata of ServiceSpecification + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceSpecification', + type: { + name: 'Composite', + className: 'ServiceSpecification', + modelProperties: { + metricSpecifications: { + required: false, + serializedName: 'metricSpecifications', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricSpecificationV1ElementType', + type: { + name: 'Composite', + className: 'MetricSpecificationV1' + } + } + } + } + } + } + }; + } +} + +module.exports = ServiceSpecification; diff --git a/lib/services/edgegatewayManagement/lib/models/share.js b/lib/services/edgegatewayManagement/lib/models/share.js new file mode 100644 index 0000000000..8dc4ce144c --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/share.js @@ -0,0 +1,209 @@ +/* + * 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'); + +/** + * Represents a share on the Data Box Edge/Gateway device. + * + * @extends models['ARMBaseModel'] + */ +class Share extends models['ARMBaseModel'] { + /** + * Create a Share. + * @property {string} [description] Description for the share. + * @property {string} shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * @property {string} monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * @property {object} [azureContainerInfo] Azure container mapping for the + * share. + * @property {string} [azureContainerInfo.storageAccountCredentialId] ID of + * the Storage account credential to be used for accessing storage. + * @property {string} [azureContainerInfo.containerName] Container name + * (Based on the data format specified, represents the name of Azure file/ + * Page blob / Block blob). + * @property {string} [azureContainerInfo.dataFormat] Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * @property {string} accessProtocol Access protocol to be used by the share. + * Possible values include: 'SMB', 'NFS' + * @property {array} [userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * @property {array} [clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * @property {object} [refreshDetails] Details of the refresh job on this + * share. + * @property {string} [refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * @property {date} [refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this + * particular share, if any. + * This could be a failed job or a successful job. + * @property {string} [refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * @property {string} [refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * @property {array} [shareMappings] Share mount point to the role. + * @property {string} [dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Share + * + * @returns {object} metadata of Share + * + */ + mapper() { + return { + required: false, + serializedName: 'Share', + type: { + name: 'Composite', + className: 'Share', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + shareStatus: { + required: true, + serializedName: 'properties.shareStatus', + type: { + name: 'String' + } + }, + monitoringStatus: { + required: true, + serializedName: 'properties.monitoringStatus', + type: { + name: 'String' + } + }, + azureContainerInfo: { + required: false, + serializedName: 'properties.azureContainerInfo', + type: { + name: 'Composite', + className: 'AzureContainerInfo' + } + }, + accessProtocol: { + required: true, + serializedName: 'properties.accessProtocol', + type: { + name: 'String' + } + }, + userAccessRights: { + required: false, + serializedName: 'properties.userAccessRights', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'UserAccessRightElementType', + type: { + name: 'Composite', + className: 'UserAccessRight' + } + } + } + }, + clientAccessRights: { + required: false, + serializedName: 'properties.clientAccessRights', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ClientAccessRightElementType', + type: { + name: 'Composite', + className: 'ClientAccessRight' + } + } + } + }, + refreshDetails: { + required: false, + serializedName: 'properties.refreshDetails', + type: { + name: 'Composite', + className: 'RefreshDetails' + } + }, + shareMappings: { + required: false, + readOnly: true, + serializedName: 'properties.shareMappings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MountPointMapElementType', + type: { + name: 'Composite', + className: 'MountPointMap' + } + } + } + }, + dataPolicy: { + required: false, + serializedName: 'properties.dataPolicy', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Share; diff --git a/lib/services/edgegatewayManagement/lib/models/shareAccessRight.js b/lib/services/edgegatewayManagement/lib/models/shareAccessRight.js new file mode 100644 index 0000000000..a5a346983b --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/shareAccessRight.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Specifies the mapping between this particular user and the type of access he + * has on shares on this device. + * + */ +class ShareAccessRight { + /** + * Create a ShareAccessRight. + * @property {string} shareId Id of the share. + * @property {string} accessType Type of access to be allowed on the share + * for this user. Possible values include: 'Change', 'Read', 'Custom' + */ + constructor() { + } + + /** + * Defines the metadata of ShareAccessRight + * + * @returns {object} metadata of ShareAccessRight + * + */ + mapper() { + return { + required: false, + serializedName: 'ShareAccessRight', + type: { + name: 'Composite', + className: 'ShareAccessRight', + modelProperties: { + shareId: { + required: true, + serializedName: 'shareId', + type: { + name: 'String' + } + }, + accessType: { + required: true, + serializedName: 'accessType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ShareAccessRight; diff --git a/lib/services/edgegatewayManagement/lib/models/shareList.js b/lib/services/edgegatewayManagement/lib/models/shareList.js new file mode 100644 index 0000000000..540488dde9 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/shareList.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Collection of all shares on the Data Box Edge/Gateway device. + */ +class ShareList extends Array { + /** + * Create a ShareList. + * @property {string} [nextLink] Link to the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ShareList + * + * @returns {object} metadata of ShareList + * + */ + mapper() { + return { + required: false, + serializedName: 'ShareList', + type: { + name: 'Composite', + className: 'ShareList', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ShareElementType', + type: { + name: 'Composite', + className: 'Share' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ShareList; diff --git a/lib/services/edgegatewayManagement/lib/models/sku.js b/lib/services/edgegatewayManagement/lib/models/sku.js new file mode 100644 index 0000000000..20bc99542b --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/sku.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The SKU type. + * + */ +class Sku { + /** + * Create a Sku. + * @property {string} [name] Sku name. Possible values include: 'Gateway', + * 'Edge' + * @property {string} [tier] The SKU tier. This is based on the SKU name. + * Possible values include: 'Standard' + */ + constructor() { + } + + /** + * Defines the metadata of Sku + * + * @returns {object} metadata of Sku + * + */ + mapper() { + return { + required: false, + serializedName: 'Sku', + type: { + name: 'Composite', + className: 'Sku', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + tier: { + required: false, + serializedName: 'tier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Sku; diff --git a/lib/services/edgegatewayManagement/lib/models/storageAccountCredential.js b/lib/services/edgegatewayManagement/lib/models/storageAccountCredential.js new file mode 100644 index 0000000000..51ceb49d87 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/storageAccountCredential.js @@ -0,0 +1,140 @@ +/* + * 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 storage account credential. + * + * @extends models['ARMBaseModel'] + */ +class StorageAccountCredential extends models['ARMBaseModel'] { + /** + * Create a StorageAccountCredential. + * @property {string} alias Alias for the storage account. + * @property {string} [userName] UserName for the storage account. + * @property {object} [accountKey] Encrypted storage key. + * @property {string} [accountKey.value] The value of the secret. + * @property {string} [accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * @property {string} [accountKey.encryptionAlgorithm] The algorithm used to + * encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * @property {string} [connectionString] ConnectionString for the storage + * account. This needs to be specified if UserName/AccountKey are not + * specified. + * @property {string} sslStatus Signifies whether SSL needs to be enabled or + * not. Possible values include: 'Enabled', 'Disabled' + * @property {string} [blobDomainName] Blob end point for private clouds. + * @property {string} accountType Type of storage accessed on the storage + * account. Possible values include: 'GeneralPurposeStorage', 'BlobStorage' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StorageAccountCredential + * + * @returns {object} metadata of StorageAccountCredential + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageAccountCredential', + type: { + name: 'Composite', + className: 'StorageAccountCredential', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + alias: { + required: true, + serializedName: 'properties.alias', + type: { + name: 'String' + } + }, + userName: { + required: false, + serializedName: 'properties.userName', + type: { + name: 'String' + } + }, + accountKey: { + required: false, + serializedName: 'properties.accountKey', + type: { + name: 'Composite', + className: 'AsymmetricEncryptedSecret' + } + }, + connectionString: { + required: false, + serializedName: 'properties.connectionString', + type: { + name: 'String' + } + }, + sslStatus: { + required: true, + serializedName: 'properties.sslStatus', + type: { + name: 'String' + } + }, + blobDomainName: { + required: false, + serializedName: 'properties.blobDomainName', + type: { + name: 'String' + } + }, + accountType: { + required: true, + serializedName: 'properties.accountType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = StorageAccountCredential; diff --git a/lib/services/edgegatewayManagement/lib/models/storageAccountCredentialList.js b/lib/services/edgegatewayManagement/lib/models/storageAccountCredentialList.js new file mode 100644 index 0000000000..dec3b6acd6 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/storageAccountCredentialList.js @@ -0,0 +1,69 @@ +/* + * 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 collection of storage account credential entities. + */ +class StorageAccountCredentialList extends Array { + /** + * Create a StorageAccountCredentialList. + * @property {string} [nextLink] Link to the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StorageAccountCredentialList + * + * @returns {object} metadata of StorageAccountCredentialList + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageAccountCredentialList', + type: { + name: 'Composite', + className: 'StorageAccountCredentialList', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StorageAccountCredentialElementType', + type: { + name: 'Composite', + className: 'StorageAccountCredential' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = StorageAccountCredentialList; diff --git a/lib/services/edgegatewayManagement/lib/models/symmetricKey.js b/lib/services/edgegatewayManagement/lib/models/symmetricKey.js new file mode 100644 index 0000000000..cfc79707cc --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/symmetricKey.js @@ -0,0 +1,61 @@ +/* + * 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'; + +/** + * Symmetric Key for authentication. + * + */ +class SymmetricKey { + /** + * Create a SymmetricKey. + * @property {object} [connectionString] Connection string based on symmetric + * key. + * @property {string} [connectionString.value] The value of the secret. + * @property {string} [connectionString.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * @property {string} [connectionString.encryptionAlgorithm] The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + */ + constructor() { + } + + /** + * Defines the metadata of SymmetricKey + * + * @returns {object} metadata of SymmetricKey + * + */ + mapper() { + return { + required: false, + serializedName: 'SymmetricKey', + type: { + name: 'Composite', + className: 'SymmetricKey', + modelProperties: { + connectionString: { + required: false, + serializedName: 'connectionString', + type: { + name: 'Composite', + className: 'AsymmetricEncryptedSecret' + } + } + } + } + }; + } +} + +module.exports = SymmetricKey; diff --git a/lib/services/edgegatewayManagement/lib/models/trackingInfo.js b/lib/services/edgegatewayManagement/lib/models/trackingInfo.js new file mode 100644 index 0000000000..6f643c8c85 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/trackingInfo.js @@ -0,0 +1,77 @@ +/* + * 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'; + +/** + * Tracking courier information. + * + */ +class TrackingInfo { + /** + * Create a TrackingInfo. + * @property {string} [serialNumber] Serial number of the device being + * tracked. + * @property {string} [carrierName] Name of the carrier used in the delivery. + * @property {string} [trackingId] Tracking ID of the shipment. + * @property {string} [trackingUrl] Tracking URL of the shipment. + */ + constructor() { + } + + /** + * Defines the metadata of TrackingInfo + * + * @returns {object} metadata of TrackingInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'TrackingInfo', + type: { + name: 'Composite', + className: 'TrackingInfo', + modelProperties: { + serialNumber: { + required: false, + serializedName: 'serialNumber', + type: { + name: 'String' + } + }, + carrierName: { + required: false, + serializedName: 'carrierName', + type: { + name: 'String' + } + }, + trackingId: { + required: false, + serializedName: 'trackingId', + type: { + name: 'String' + } + }, + trackingUrl: { + required: false, + serializedName: 'trackingUrl', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TrackingInfo; diff --git a/lib/services/edgegatewayManagement/lib/models/trigger.js b/lib/services/edgegatewayManagement/lib/models/trigger.js new file mode 100644 index 0000000000..fbe2cefc6b --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/trigger.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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Trigger details. + * + * @extends models['ARMBaseModel'] + */ +class Trigger extends models['ARMBaseModel'] { + /** + * Create a Trigger. + * @property {string} kind Polymorphic Discriminator + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Trigger + * + * @returns {object} metadata of Trigger + * + */ + mapper() { + return { + required: false, + serializedName: 'Trigger', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'kind', + clientName: 'kind' + }, + uberParent: 'BaseResource', + className: 'Trigger', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + kind: { + required: true, + serializedName: 'kind', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Trigger; diff --git a/lib/services/edgegatewayManagement/lib/models/triggerList.js b/lib/services/edgegatewayManagement/lib/models/triggerList.js new file mode 100644 index 0000000000..48d3a48ccc --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/triggerList.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'; + +/** + * Collection of all trigger on the data box edge device. + */ +class TriggerList extends Array { + /** + * Create a TriggerList. + * @property {string} [nextLink] Link to the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of TriggerList + * + * @returns {object} metadata of TriggerList + * + */ + mapper() { + return { + required: false, + serializedName: 'TriggerList', + type: { + name: 'Composite', + className: 'TriggerList', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TriggerElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'kind', + clientName: 'kind' + }, + uberParent: 'BaseResource', + className: 'Trigger' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TriggerList; diff --git a/lib/services/edgegatewayManagement/lib/models/updateDownloadProgress.js b/lib/services/edgegatewayManagement/lib/models/updateDownloadProgress.js new file mode 100644 index 0000000000..c452e61e01 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/updateDownloadProgress.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'; + +/** + * Details about the download progress of update. + * + */ +class UpdateDownloadProgress { + /** + * Create a UpdateDownloadProgress. + * @property {string} [downloadPhase] The download phase. Possible values + * include: 'Unknown', 'Initializing', 'Downloading', 'Verifying' + * @property {number} [percentComplete] Percentage of completion. + * @property {number} [totalBytesToDownload] Total bytes to download. + * @property {number} [totalBytesDownloaded] Total bytes downloaded. + * @property {number} [numberOfUpdatesToDownload] Number of updates to + * download. + * @property {number} [numberOfUpdatesDownloaded] Number of updates + * downloaded. + */ + constructor() { + } + + /** + * Defines the metadata of UpdateDownloadProgress + * + * @returns {object} metadata of UpdateDownloadProgress + * + */ + mapper() { + return { + required: false, + serializedName: 'UpdateDownloadProgress', + type: { + name: 'Composite', + className: 'UpdateDownloadProgress', + modelProperties: { + downloadPhase: { + required: false, + readOnly: true, + serializedName: 'downloadPhase', + type: { + name: 'String' + } + }, + percentComplete: { + required: false, + readOnly: true, + serializedName: 'percentComplete', + type: { + name: 'Number' + } + }, + totalBytesToDownload: { + required: false, + readOnly: true, + serializedName: 'totalBytesToDownload', + type: { + name: 'Number' + } + }, + totalBytesDownloaded: { + required: false, + readOnly: true, + serializedName: 'totalBytesDownloaded', + type: { + name: 'Number' + } + }, + numberOfUpdatesToDownload: { + required: false, + readOnly: true, + serializedName: 'numberOfUpdatesToDownload', + type: { + name: 'Number' + } + }, + numberOfUpdatesDownloaded: { + required: false, + readOnly: true, + serializedName: 'numberOfUpdatesDownloaded', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = UpdateDownloadProgress; diff --git a/lib/services/edgegatewayManagement/lib/models/updateInstallProgress.js b/lib/services/edgegatewayManagement/lib/models/updateInstallProgress.js new file mode 100644 index 0000000000..f16e879adb --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/updateInstallProgress.js @@ -0,0 +1,72 @@ +/* + * 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'; + +/** + * Details about the progress during installation of updates. + * + */ +class UpdateInstallProgress { + /** + * Create a UpdateInstallProgress. + * @property {number} [percentComplete] Percentage of completion. + * @property {number} [numberOfUpdatesToInstall] Number of updates to + * install. + * @property {number} [numberOfUpdatesInstalled] Number of updates installed. + */ + constructor() { + } + + /** + * Defines the metadata of UpdateInstallProgress + * + * @returns {object} metadata of UpdateInstallProgress + * + */ + mapper() { + return { + required: false, + serializedName: 'UpdateInstallProgress', + type: { + name: 'Composite', + className: 'UpdateInstallProgress', + modelProperties: { + percentComplete: { + required: false, + readOnly: true, + serializedName: 'percentComplete', + type: { + name: 'Number' + } + }, + numberOfUpdatesToInstall: { + required: false, + readOnly: true, + serializedName: 'numberOfUpdatesToInstall', + type: { + name: 'Number' + } + }, + numberOfUpdatesInstalled: { + required: false, + readOnly: true, + serializedName: 'numberOfUpdatesInstalled', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = UpdateInstallProgress; diff --git a/lib/services/edgegatewayManagement/lib/models/updateSummary.js b/lib/services/edgegatewayManagement/lib/models/updateSummary.js new file mode 100644 index 0000000000..d682f76097 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/updateSummary.js @@ -0,0 +1,247 @@ +/* + * 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'); + +/** + * Details about ongoing updates and availability of updates on the device. + * + * @extends models['ARMBaseModel'] + */ +class UpdateSummary extends models['ARMBaseModel'] { + /** + * Create a UpdateSummary. + * @property {string} [deviceVersionNumber] The current version of the + * device, of format: 1.2.17312.13. + * @property {string} [friendlyDeviceVersionName] The current version of the + * device represented in text format. + * @property {date} [deviceLastScannedDateTime] The last time when a scan was + * done on the device. + * @property {date} [lastCompletedScanJobDateTime] The time when the last + * scan job was completed (success/cancelled/failed) on the appliance. + * @property {date} [lastCompletedDownloadJobDateTime] The time when the last + * Download job was completed (success/cancelled/failed) on the appliance. + * @property {date} [lastCompletedInstallJobDateTime] The time when the last + * Install job was completed (success/cancelled/failed) on the appliance. + * @property {number} [totalNumberOfUpdatesAvailable] Count of updates that + * are available for the current device version as per the last scan on the + * device. + * @property {number} [totalNumberOfUpdatesPendingDownload] The total number + * of items pending download. + * @property {number} [totalNumberOfUpdatesPendingInstall] The total number + * of items pending install. + * @property {string} [rebootBehavior] Indicates if updates are available and + * at least one of the update items detected needs a reboot. Possible values + * include: 'NeverReboots', 'RequiresReboot', 'RequestReboot' + * @property {string} [ongoingUpdateOperation] The current update operation. + * Possible values include: 'None', 'Scan', 'Download', 'Install' + * @property {string} [inProgressDownloadJobId] The Job ID of the download + * job if a download is in progress. + * @property {string} [inProgressInstallJobId] The Job ID of the install job + * if an install is in progress. + * @property {date} [inProgressDownloadJobStartedDateTime] The time when the + * currently running download (if any) started. + * @property {date} [inProgressInstallJobStartedDateTime] The time when the + * currently running install (if any) started. + * @property {array} [updateTitles] The list of update titles which are + * available for install. + * @property {number} [totalUpdateSizeInBytes] The total size of updates + * available for download in bytes. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of UpdateSummary + * + * @returns {object} metadata of UpdateSummary + * + */ + mapper() { + return { + required: false, + serializedName: 'UpdateSummary', + type: { + name: 'Composite', + className: 'UpdateSummary', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + deviceVersionNumber: { + required: false, + serializedName: 'properties.deviceVersionNumber', + type: { + name: 'String' + } + }, + friendlyDeviceVersionName: { + required: false, + serializedName: 'properties.friendlyDeviceVersionName', + type: { + name: 'String' + } + }, + deviceLastScannedDateTime: { + required: false, + serializedName: 'properties.deviceLastScannedDateTime', + type: { + name: 'DateTime' + } + }, + lastCompletedScanJobDateTime: { + required: false, + serializedName: 'properties.lastCompletedScanJobDateTime', + type: { + name: 'DateTime' + } + }, + lastCompletedDownloadJobDateTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastCompletedDownloadJobDateTime', + type: { + name: 'DateTime' + } + }, + lastCompletedInstallJobDateTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastCompletedInstallJobDateTime', + type: { + name: 'DateTime' + } + }, + totalNumberOfUpdatesAvailable: { + required: false, + readOnly: true, + serializedName: 'properties.totalNumberOfUpdatesAvailable', + type: { + name: 'Number' + } + }, + totalNumberOfUpdatesPendingDownload: { + required: false, + readOnly: true, + serializedName: 'properties.totalNumberOfUpdatesPendingDownload', + type: { + name: 'Number' + } + }, + totalNumberOfUpdatesPendingInstall: { + required: false, + readOnly: true, + serializedName: 'properties.totalNumberOfUpdatesPendingInstall', + type: { + name: 'Number' + } + }, + rebootBehavior: { + required: false, + readOnly: true, + serializedName: 'properties.rebootBehavior', + type: { + name: 'String' + } + }, + ongoingUpdateOperation: { + required: false, + readOnly: true, + serializedName: 'properties.ongoingUpdateOperation', + type: { + name: 'String' + } + }, + inProgressDownloadJobId: { + required: false, + readOnly: true, + serializedName: 'properties.inProgressDownloadJobId', + type: { + name: 'String' + } + }, + inProgressInstallJobId: { + required: false, + readOnly: true, + serializedName: 'properties.inProgressInstallJobId', + type: { + name: 'String' + } + }, + inProgressDownloadJobStartedDateTime: { + required: false, + readOnly: true, + serializedName: 'properties.inProgressDownloadJobStartedDateTime', + type: { + name: 'DateTime' + } + }, + inProgressInstallJobStartedDateTime: { + required: false, + readOnly: true, + serializedName: 'properties.inProgressInstallJobStartedDateTime', + type: { + name: 'DateTime' + } + }, + updateTitles: { + required: false, + readOnly: true, + serializedName: 'properties.updateTitles', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + totalUpdateSizeInBytes: { + required: false, + readOnly: true, + serializedName: 'properties.totalUpdateSizeInBytes', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = UpdateSummary; diff --git a/lib/services/edgegatewayManagement/lib/models/uploadCertificateRequest.js b/lib/services/edgegatewayManagement/lib/models/uploadCertificateRequest.js new file mode 100644 index 0000000000..8077ddba45 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/uploadCertificateRequest.js @@ -0,0 +1,61 @@ +/* + * 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 Upload certificate request. + * + */ +class UploadCertificateRequest { + /** + * Create a UploadCertificateRequest. + * @property {string} [authenticationType] The authentication type. Possible + * values include: 'Invalid', 'AzureActiveDirectory' + * @property {string} certificate The base64 encoded certificate raw data. + */ + constructor() { + } + + /** + * Defines the metadata of UploadCertificateRequest + * + * @returns {object} metadata of UploadCertificateRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'UploadCertificateRequest', + type: { + name: 'Composite', + className: 'UploadCertificateRequest', + modelProperties: { + authenticationType: { + required: false, + serializedName: 'properties.authenticationType', + type: { + name: 'String' + } + }, + certificate: { + required: true, + serializedName: 'properties.certificate', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UploadCertificateRequest; diff --git a/lib/services/edgegatewayManagement/lib/models/uploadCertificateResponse.js b/lib/services/edgegatewayManagement/lib/models/uploadCertificateResponse.js new file mode 100644 index 0000000000..abdbbe2f8f --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/uploadCertificateResponse.js @@ -0,0 +1,104 @@ +/* + * 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 upload registration certificate response. + * + */ +class UploadCertificateResponse { + /** + * Create a UploadCertificateResponse. + * @property {string} [authType] Specifies the Authentication type. Possible + * values include: 'Invalid', 'AzureActiveDirectory' + * @property {string} resourceId The resource ID of the edge device. + * @property {string} aadAuthority Azure Active Directory tenant authority. + * @property {string} aadTenantId Azure Active Directory tenant ID. + * @property {string} servicePrincipalClientId Azure Active Directory service + * principal client ID. + * @property {string} servicePrincipalObjectId Azure Active Directory service + * principal Object ID. + * @property {string} azureManagementEndpointAudience The Azure Management + * Endpoint Audience. + */ + constructor() { + } + + /** + * Defines the metadata of UploadCertificateResponse + * + * @returns {object} metadata of UploadCertificateResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'UploadCertificateResponse', + type: { + name: 'Composite', + className: 'UploadCertificateResponse', + modelProperties: { + authType: { + required: false, + serializedName: 'authType', + type: { + name: 'String' + } + }, + resourceId: { + required: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + aadAuthority: { + required: true, + serializedName: 'aadAuthority', + type: { + name: 'String' + } + }, + aadTenantId: { + required: true, + serializedName: 'aadTenantId', + type: { + name: 'String' + } + }, + servicePrincipalClientId: { + required: true, + serializedName: 'servicePrincipalClientId', + type: { + name: 'String' + } + }, + servicePrincipalObjectId: { + required: true, + serializedName: 'servicePrincipalObjectId', + type: { + name: 'String' + } + }, + azureManagementEndpointAudience: { + required: true, + serializedName: 'azureManagementEndpointAudience', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UploadCertificateResponse; diff --git a/lib/services/edgegatewayManagement/lib/models/user.js b/lib/services/edgegatewayManagement/lib/models/user.js new file mode 100644 index 0000000000..8bbe264479 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/user.js @@ -0,0 +1,107 @@ +/* + * 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'); + +/** + * Represents a user who has access to one or more shares on the Edge storage + * device. + * + * @extends models['ARMBaseModel'] + */ +class User extends models['ARMBaseModel'] { + /** + * Create a User. + * @property {object} [encryptedPassword] The details of the password + * specified for the user. + * @property {string} [encryptedPassword.value] The value of the secret. + * @property {string} [encryptedPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * @property {string} [encryptedPassword.encryptionAlgorithm] The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * @property {array} [shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of User + * + * @returns {object} metadata of User + * + */ + mapper() { + return { + required: false, + serializedName: 'User', + type: { + name: 'Composite', + className: 'User', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + encryptedPassword: { + required: false, + serializedName: 'properties.encryptedPassword', + type: { + name: 'Composite', + className: 'AsymmetricEncryptedSecret' + } + }, + shareAccessRights: { + required: false, + serializedName: 'properties.shareAccessRights', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ShareAccessRightElementType', + type: { + name: 'Composite', + className: 'ShareAccessRight' + } + } + } + } + } + } + }; + } +} + +module.exports = User; diff --git a/lib/services/edgegatewayManagement/lib/models/userAccessRight.js b/lib/services/edgegatewayManagement/lib/models/userAccessRight.js new file mode 100644 index 0000000000..fb726772b0 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/userAccessRight.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The mapping between a particular user and the type of access they have on + * the SMB share. + * + */ +class UserAccessRight { + /** + * Create a UserAccessRight. + * @property {string} userId Id of the user (already existing in the device). + * @property {string} accessType Type of access to be allowed for the user. + * Possible values include: 'Change', 'Read', 'Custom' + */ + constructor() { + } + + /** + * Defines the metadata of UserAccessRight + * + * @returns {object} metadata of UserAccessRight + * + */ + mapper() { + return { + required: false, + serializedName: 'UserAccessRight', + type: { + name: 'Composite', + className: 'UserAccessRight', + modelProperties: { + userId: { + required: true, + serializedName: 'userId', + type: { + name: 'String' + } + }, + accessType: { + required: true, + serializedName: 'accessType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UserAccessRight; diff --git a/lib/services/edgegatewayManagement/lib/models/userList.js b/lib/services/edgegatewayManagement/lib/models/userList.js new file mode 100644 index 0000000000..0defc94213 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/models/userList.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Collection of users. + */ +class UserList extends Array { + /** + * Create a UserList. + * @property {string} [nextLink] Link to the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of UserList + * + * @returns {object} metadata of UserList + * + */ + mapper() { + return { + required: false, + serializedName: 'UserList', + type: { + name: 'Composite', + className: 'UserList', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'UserElementType', + type: { + name: 'Composite', + className: 'User' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UserList; diff --git a/lib/services/edgegatewayManagement/lib/operations/alerts.js b/lib/services/edgegatewayManagement/lib/operations/alerts.js new file mode 100644 index 0000000000..8ccd2c97e2 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/alerts.js @@ -0,0 +1,715 @@ +/* + * 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; + +/** + * Retrieves all the alerts for a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 AlertList} 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 _listByDataBoxEdgeDevice(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['AlertList']().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); + }); +} + +/** + * @summary Returns an alert by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the alert which needs to be retrieved. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Alert} 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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['Alert']().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); + }); +} + +/** + * Retrieves all the alerts for a data box edge/gateway device. + * + * @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 AlertList} 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 _listByDataBoxEdgeDeviceNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['AlertList']().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 Alerts. */ +class Alerts { + /** + * Create a Alerts. + * @param {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByDataBoxEdgeDevice = _listByDataBoxEdgeDevice; + this._get = _get; + this._listByDataBoxEdgeDeviceNext = _listByDataBoxEdgeDeviceNext; + } + + /** + * Retrieves all the alerts for a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves all the alerts for a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {AlertList} - 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 AlertList} 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. + */ + listByDataBoxEdgeDevice(deviceName, 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._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Returns an alert by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the alert which needs to be retrieved. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Returns an alert by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the alert which needs to be retrieved. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Alert} - 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 Alert} 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(deviceName, name, 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._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Retrieves all the alerts for a data box edge/gateway device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves all the alerts for a data box edge/gateway device. + * + * @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 {AlertList} - 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 AlertList} 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. + */ + listByDataBoxEdgeDeviceNext(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._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDeviceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Alerts; diff --git a/lib/services/edgegatewayManagement/lib/operations/bandwidthSchedules.js b/lib/services/edgegatewayManagement/lib/operations/bandwidthSchedules.js new file mode 100644 index 0000000000..e181236efe --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/bandwidthSchedules.js @@ -0,0 +1,1599 @@ +/* + * 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; + +/** + * Returns all the bandwidth Schedules for a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 BandwidthSchedulesList} 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 _listByDataBoxEdgeDevice(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['BandwidthSchedulesList']().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); + }); +} + +/** + * Returns the properties of the specified bandwidth schedule name. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 BandwidthSchedule} 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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['BandwidthSchedule']().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); + }); +} + + +/** + * Creates or updates a bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name which needs to be + * added/updated. + * + * @param {object} parameters The bandwidth schedule to be added or updated. + * + * @param {string} parameters.start The start time of the schedule in UTC. + * + * @param {string} parameters.stop The stop time of the schedule in UTC. + * + * @param {number} parameters.rateInMbps The bandwidth rate in Mbps. + * + * @param {array} parameters.days The days of the week when this schedule is + * applicable. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 BandwidthSchedule} 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(deviceName, name, parameters, 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.'); + } + + // Send request + this.beginCreateOrUpdate(deviceName, name, parameters, resourceGroupName, 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['BandwidthSchedule']().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); + }); + }); +} + + +/** + * Deletes the specified bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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.'); + } + + // Send request + this.beginDeleteMethod(deviceName, name, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates or updates a bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name which needs to be + * added/updated. + * + * @param {object} parameters The bandwidth schedule to be added or updated. + * + * @param {string} parameters.start The start time of the schedule in UTC. + * + * @param {string} parameters.stop The stop time of the schedule in UTC. + * + * @param {number} parameters.rateInMbps The bandwidth rate in Mbps. + * + * @param {array} parameters.days The days of the week when this schedule is + * applicable. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 BandwidthSchedule} 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(deviceName, name, parameters, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['BandwidthSchedule']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['BandwidthSchedule']().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); + }); +} + +/** + * Deletes the specified bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Returns all the bandwidth Schedules for a data box edge/gateway device. + * + * @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 BandwidthSchedulesList} 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 _listByDataBoxEdgeDeviceNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['BandwidthSchedulesList']().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 BandwidthSchedules. */ +class BandwidthSchedules { + /** + * Create a BandwidthSchedules. + * @param {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByDataBoxEdgeDevice = _listByDataBoxEdgeDevice; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByDataBoxEdgeDeviceNext = _listByDataBoxEdgeDeviceNext; + } + + /** + * Returns all the bandwidth Schedules for a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns all the bandwidth Schedules for a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {BandwidthSchedulesList} - 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 BandwidthSchedulesList} 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. + */ + listByDataBoxEdgeDevice(deviceName, 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._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Returns the properties of the specified bandwidth schedule name. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns the properties of the specified bandwidth schedule name. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {BandwidthSchedule} - 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 BandwidthSchedule} 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(deviceName, name, 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._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates a bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name which needs to be + * added/updated. + * + * @param {object} parameters The bandwidth schedule to be added or updated. + * + * @param {string} parameters.start The start time of the schedule in UTC. + * + * @param {string} parameters.stop The stop time of the schedule in UTC. + * + * @param {number} parameters.rateInMbps The bandwidth rate in Mbps. + * + * @param {array} parameters.days The days of the week when this schedule is + * applicable. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, parameters, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(deviceName, name, parameters, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates a bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name which needs to be + * added/updated. + * + * @param {object} parameters The bandwidth schedule to be added or updated. + * + * @param {string} parameters.start The start time of the schedule in UTC. + * + * @param {string} parameters.stop The stop time of the schedule in UTC. + * + * @param {number} parameters.rateInMbps The bandwidth rate in Mbps. + * + * @param {array} parameters.days The days of the week when this schedule is + * applicable. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {BandwidthSchedule} - 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 BandwidthSchedule} 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(deviceName, name, parameters, 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._createOrUpdate(deviceName, name, parameters, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(deviceName, name, parameters, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the specified bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates a bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name which needs to be + * added/updated. + * + * @param {object} parameters The bandwidth schedule to be added or updated. + * + * @param {string} parameters.start The start time of the schedule in UTC. + * + * @param {string} parameters.stop The stop time of the schedule in UTC. + * + * @param {number} parameters.rateInMbps The bandwidth rate in Mbps. + * + * @param {array} parameters.days The days of the week when this schedule is + * applicable. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, parameters, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(deviceName, name, parameters, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates a bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name which needs to be + * added/updated. + * + * @param {object} parameters The bandwidth schedule to be added or updated. + * + * @param {string} parameters.start The start time of the schedule in UTC. + * + * @param {string} parameters.stop The stop time of the schedule in UTC. + * + * @param {number} parameters.rateInMbps The bandwidth rate in Mbps. + * + * @param {array} parameters.days The days of the week when this schedule is + * applicable. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {BandwidthSchedule} - 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 BandwidthSchedule} 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(deviceName, name, parameters, 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._beginCreateOrUpdate(deviceName, name, parameters, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(deviceName, name, parameters, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the specified bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Returns all the bandwidth Schedules for a data box edge/gateway device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns all the bandwidth Schedules for a data box edge/gateway device. + * + * @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 {BandwidthSchedulesList} - 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 BandwidthSchedulesList} 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. + */ + listByDataBoxEdgeDeviceNext(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._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDeviceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = BandwidthSchedules; diff --git a/lib/services/edgegatewayManagement/lib/operations/devices.js b/lib/services/edgegatewayManagement/lib/operations/devices.js new file mode 100644 index 0000000000..32ed4f34ef --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/devices.js @@ -0,0 +1,5254 @@ +/* + * 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; + +/** + * Retrieves all data box edge/gateway devices in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify $expand=details to populate + * additional fields related to the resource or Specify $skipToken= to + * populate the next page in the list. + * + * @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 DataBoxEdgeDeviceList} 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 _listBySubscription(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.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['DataBoxEdgeDeviceList']().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); + }); +} + +/** + * Retrieves all data box edge/gateway devices in a resource group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify $expand=details to populate + * additional fields related to the resource or Specify $skipToken= to + * populate the next page in the list. + * + * @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 DataBoxEdgeDeviceList} 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.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['DataBoxEdgeDeviceList']().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); + }); +} + +/** + * Returns the properties of the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 DataBoxEdgeDevice} 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(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['DataBoxEdgeDevice']().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); + }); +} + + +/** + * Creates or updates a Data Box Edge/Gateway resource. + * + * @param {string} deviceName The device name. + * + * @param {object} dataBoxEdgeDevice The resource object. + * + * @param {string} dataBoxEdgeDevice.location The location of the device. This + * will be one of the supported and registered Azure Geo Regions (e.g. West US, + * East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update + * the request will succeed. + * + * @param {object} [dataBoxEdgeDevice.tags] The list of tags that describe the + * device. These tags can be used in viewing and grouping this device (across + * resource groups). + * + * @param {object} [dataBoxEdgeDevice.sku] The sku type. + * + * @param {string} [dataBoxEdgeDevice.sku.name] Sku name. Possible values + * include: 'Gateway', 'Edge' + * + * @param {string} [dataBoxEdgeDevice.sku.tier] The SKU tier. This is based on + * the SKU name. Possible values include: 'Standard' + * + * @param {string} [dataBoxEdgeDevice.etag] The etag of the devices. + * + * @param {string} [dataBoxEdgeDevice.dataBoxEdgeDeviceStatus] The status of + * the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', + * 'PartiallyDisconnected' + * + * @param {string} [dataBoxEdgeDevice.description] The Description of the Data + * Box Edge/Gateway device. + * + * @param {string} [dataBoxEdgeDevice.modelDescription] The description of the + * Data Box Edge/Gateway device model. + * + * @param {string} [dataBoxEdgeDevice.friendlyName] The Data Box Edge/Gateway + * device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 DataBoxEdgeDevice} 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(deviceName, dataBoxEdgeDevice, 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.'); + } + + // Send request + this.beginCreateOrUpdate(deviceName, dataBoxEdgeDevice, resourceGroupName, 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['DataBoxEdgeDevice']().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); + }); + }); +} + + +/** + * Deletes the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, 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.'); + } + + // Send request + this.beginDeleteMethod(deviceName, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Updates data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.tags] The tags attached to the Data Box + * Edge/Gateway resource. + * + * @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 DataBoxEdgeDevice} 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(deviceName, 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.'); + } + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] 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); + } + let parameters; + if (tags !== null && tags !== undefined) { + parameters = new client.models['DataBoxEdgeDevicePatch'](); + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DataBoxEdgeDevicePatch']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['DataBoxEdgeDevice']().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); + }); +} + + +/** + * @summary Downloads the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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 _downloadUpdates(deviceName, 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.'); + } + + // Send request + this.beginDownloadUpdates(deviceName, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates or updates the extended info of the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {object} parameters The device extended information. + * + * @param {string} parameters.integrityKey The Channel Integrity Key (CIK) of + * the device. + * + * @param {string} [parameters.encryptionKeyThumbprint] The certificate + * thumbprint that was used to encrypt the Channel Integrity Key (CIK). + * + * @param {string} [parameters.encryptionKey] The Channel Integrity Key (CIK) + * of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 DataBoxEdgeDeviceExtendedInfo} 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 _createOrUpdateExtendedInfo(deviceName, parameters, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DataBoxEdgeDeviceExtendedInfo']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['DataBoxEdgeDeviceExtendedInfo']().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); + }); +} + +/** + * Returns the extended information of the specified data box edge/gateway + * device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 DataBoxEdgeDeviceExtendedInfo} 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 _getExtendedInformation(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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]; + } + } + } + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['DataBoxEdgeDeviceExtendedInfo']().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); + }); +} + + +/** + * @summary Installs the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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 _installUpdates(deviceName, 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.'); + } + + // Send request + this.beginInstallUpdates(deviceName, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Returns the network settings of the specified data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 NetworkSettings} 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 _getNetworkSettings(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['NetworkSettings']().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); + }); +} + + +/** + * @summary Scans for updates on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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 _scanForUpdates(deviceName, 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.'); + } + + // Send request + this.beginScanForUpdates(deviceName, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates the security settings on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special + * characters. + * + * @param {string} deviceAdminPassword.value The value of the secret. + * + * @param {string} [deviceAdminPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} deviceAdminPassword.encryptionAlgorithm The algorithm used + * to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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 _createOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, 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.beginCreateOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * @summary Returns information about the availability of updates as per the + * last scan done on the device. It also returns information about any ongoing + * download or install jobs on the device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 UpdateSummary} 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 _getUpdateSummary(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['UpdateSummary']().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); + }); +} + +/** + * Uploads registration certificate for the device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} certificate The base64 encoded certificate raw data. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.authenticationType] The authentication type. + * Possible values include: 'Invalid', 'AzureActiveDirectory' + * + * @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 UploadCertificateResponse} 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 _uploadCertificate(deviceName, resourceGroupName, certificate, 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.'); + } + let authenticationType = (options && options.authenticationType !== undefined) ? options.authenticationType : undefined; + // Validate + try { + if (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (authenticationType !== null && authenticationType !== undefined && typeof authenticationType.valueOf() !== 'string') { + throw new Error('authenticationType must be of type string.'); + } + if (certificate === null || certificate === undefined || typeof certificate.valueOf() !== 'string') { + throw new Error('certificate 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); + } + let parameters; + if ((authenticationType !== null && authenticationType !== undefined) || (certificate !== null && certificate !== undefined)) { + parameters = new client.models['UploadCertificateRequest'](); + parameters.authenticationType = authenticationType; + parameters.certificate = certificate; + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['UploadCertificateRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['UploadCertificateResponse']().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); + }); +} + +/** + * Creates or updates a Data Box Edge/Gateway resource. + * + * @param {string} deviceName The device name. + * + * @param {object} dataBoxEdgeDevice The resource object. + * + * @param {string} dataBoxEdgeDevice.location The location of the device. This + * will be one of the supported and registered Azure Geo Regions (e.g. West US, + * East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update + * the request will succeed. + * + * @param {object} [dataBoxEdgeDevice.tags] The list of tags that describe the + * device. These tags can be used in viewing and grouping this device (across + * resource groups). + * + * @param {object} [dataBoxEdgeDevice.sku] The sku type. + * + * @param {string} [dataBoxEdgeDevice.sku.name] Sku name. Possible values + * include: 'Gateway', 'Edge' + * + * @param {string} [dataBoxEdgeDevice.sku.tier] The SKU tier. This is based on + * the SKU name. Possible values include: 'Standard' + * + * @param {string} [dataBoxEdgeDevice.etag] The etag of the devices. + * + * @param {string} [dataBoxEdgeDevice.dataBoxEdgeDeviceStatus] The status of + * the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', + * 'PartiallyDisconnected' + * + * @param {string} [dataBoxEdgeDevice.description] The Description of the Data + * Box Edge/Gateway device. + * + * @param {string} [dataBoxEdgeDevice.modelDescription] The description of the + * Data Box Edge/Gateway device model. + * + * @param {string} [dataBoxEdgeDevice.friendlyName] The Data Box Edge/Gateway + * device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 DataBoxEdgeDevice} 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(deviceName, dataBoxEdgeDevice, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (dataBoxEdgeDevice === null || dataBoxEdgeDevice === undefined) { + throw new Error('dataBoxEdgeDevice cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (dataBoxEdgeDevice !== null && dataBoxEdgeDevice !== undefined) { + let requestModelMapper = new client.models['DataBoxEdgeDevice']().mapper(); + requestModel = client.serialize(requestModelMapper, dataBoxEdgeDevice, 'dataBoxEdgeDevice'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(dataBoxEdgeDevice, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['DataBoxEdgeDevice']().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); + }); +} + +/** + * Deletes the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Downloads the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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 _beginDownloadUpdates(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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]; + } + } + } + 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) { + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Installs the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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 _beginInstallUpdates(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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]; + } + } + } + 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) { + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Scans for updates on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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 _beginScanForUpdates(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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]; + } + } + } + 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) { + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates the security settings on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special + * characters. + * + * @param {string} deviceAdminPassword.value The value of the secret. + * + * @param {string} [deviceAdminPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} deviceAdminPassword.encryptionAlgorithm The algorithm used + * to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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 _beginCreateOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (deviceAdminPassword === null || deviceAdminPassword === undefined) { + throw new Error('deviceAdminPassword 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); + } + let securitySettings = new client.models['SecuritySettings'](); + try { + if (deviceAdminPassword !== null && deviceAdminPassword !== undefined) + { + securitySettings.deviceAdminPassword = deviceAdminPassword; + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (securitySettings !== null && securitySettings !== undefined) { + let requestModelMapper = new client.models['SecuritySettings']().mapper(); + requestModel = client.serialize(requestModelMapper, securitySettings, 'securitySettings'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(securitySettings, 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 !== 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieves all data box edge/gateway devices 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 DataBoxEdgeDeviceList} 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 _listBySubscriptionNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['DataBoxEdgeDeviceList']().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); + }); +} + +/** + * Retrieves all data box edge/gateway devices 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 DataBoxEdgeDeviceList} 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['DataBoxEdgeDeviceList']().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 Devices. */ +class Devices { + /** + * Create a Devices. + * @param {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listBySubscription = _listBySubscription; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._downloadUpdates = _downloadUpdates; + this._createOrUpdateExtendedInfo = _createOrUpdateExtendedInfo; + this._getExtendedInformation = _getExtendedInformation; + this._installUpdates = _installUpdates; + this._getNetworkSettings = _getNetworkSettings; + this._scanForUpdates = _scanForUpdates; + this._createOrUpdateSecuritySettings = _createOrUpdateSecuritySettings; + this._getUpdateSummary = _getUpdateSummary; + this._uploadCertificate = _uploadCertificate; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginDownloadUpdates = _beginDownloadUpdates; + this._beginInstallUpdates = _beginInstallUpdates; + this._beginScanForUpdates = _beginScanForUpdates; + this._beginCreateOrUpdateSecuritySettings = _beginCreateOrUpdateSecuritySettings; + this._listBySubscriptionNext = _listBySubscriptionNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Retrieves all data box edge/gateway devices in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify $expand=details to populate + * additional fields related to the resource or Specify $skipToken= to + * populate the next page in the list. + * + * @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. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves all data box edge/gateway devices in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify $expand=details to populate + * additional fields related to the resource or Specify $skipToken= to + * populate the next page in the list. + * + * @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 {DataBoxEdgeDeviceList} - 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 DataBoxEdgeDeviceList} 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. + */ + listBySubscription(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._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + + /** + * Retrieves all data box edge/gateway devices in a resource group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify $expand=details to populate + * additional fields related to the resource or Specify $skipToken= to + * populate the next page in the list. + * + * @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; + }); + }); + } + + /** + * Retrieves all data box edge/gateway devices in a resource group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify $expand=details to populate + * additional fields related to the resource or Specify $skipToken= to + * populate the next page in the list. + * + * @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 {DataBoxEdgeDeviceList} - 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 DataBoxEdgeDeviceList} 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); + } + } + + /** + * Returns the properties of the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns the properties of the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {DataBoxEdgeDevice} - 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 DataBoxEdgeDevice} 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(deviceName, 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._get(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates a Data Box Edge/Gateway resource. + * + * @param {string} deviceName The device name. + * + * @param {object} dataBoxEdgeDevice The resource object. + * + * @param {string} dataBoxEdgeDevice.location The location of the device. This + * will be one of the supported and registered Azure Geo Regions (e.g. West US, + * East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update + * the request will succeed. + * + * @param {object} [dataBoxEdgeDevice.tags] The list of tags that describe the + * device. These tags can be used in viewing and grouping this device (across + * resource groups). + * + * @param {object} [dataBoxEdgeDevice.sku] The sku type. + * + * @param {string} [dataBoxEdgeDevice.sku.name] Sku name. Possible values + * include: 'Gateway', 'Edge' + * + * @param {string} [dataBoxEdgeDevice.sku.tier] The SKU tier. This is based on + * the SKU name. Possible values include: 'Standard' + * + * @param {string} [dataBoxEdgeDevice.etag] The etag of the devices. + * + * @param {string} [dataBoxEdgeDevice.dataBoxEdgeDeviceStatus] The status of + * the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', + * 'PartiallyDisconnected' + * + * @param {string} [dataBoxEdgeDevice.description] The Description of the Data + * Box Edge/Gateway device. + * + * @param {string} [dataBoxEdgeDevice.modelDescription] The description of the + * Data Box Edge/Gateway device model. + * + * @param {string} [dataBoxEdgeDevice.friendlyName] The Data Box Edge/Gateway + * device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, dataBoxEdgeDevice, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(deviceName, dataBoxEdgeDevice, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates a Data Box Edge/Gateway resource. + * + * @param {string} deviceName The device name. + * + * @param {object} dataBoxEdgeDevice The resource object. + * + * @param {string} dataBoxEdgeDevice.location The location of the device. This + * will be one of the supported and registered Azure Geo Regions (e.g. West US, + * East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update + * the request will succeed. + * + * @param {object} [dataBoxEdgeDevice.tags] The list of tags that describe the + * device. These tags can be used in viewing and grouping this device (across + * resource groups). + * + * @param {object} [dataBoxEdgeDevice.sku] The sku type. + * + * @param {string} [dataBoxEdgeDevice.sku.name] Sku name. Possible values + * include: 'Gateway', 'Edge' + * + * @param {string} [dataBoxEdgeDevice.sku.tier] The SKU tier. This is based on + * the SKU name. Possible values include: 'Standard' + * + * @param {string} [dataBoxEdgeDevice.etag] The etag of the devices. + * + * @param {string} [dataBoxEdgeDevice.dataBoxEdgeDeviceStatus] The status of + * the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', + * 'PartiallyDisconnected' + * + * @param {string} [dataBoxEdgeDevice.description] The Description of the Data + * Box Edge/Gateway device. + * + * @param {string} [dataBoxEdgeDevice.modelDescription] The description of the + * Data Box Edge/Gateway device model. + * + * @param {string} [dataBoxEdgeDevice.friendlyName] The Data Box Edge/Gateway + * device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {DataBoxEdgeDevice} - 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 DataBoxEdgeDevice} 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(deviceName, dataBoxEdgeDevice, 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._createOrUpdate(deviceName, dataBoxEdgeDevice, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(deviceName, dataBoxEdgeDevice, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, 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._deleteMethod(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Updates data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.tags] The tags attached to the Data Box + * Edge/Gateway resource. + * + * @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(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.tags] The tags attached to the Data Box + * Edge/Gateway resource. + * + * @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 {DataBoxEdgeDevice} - 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 DataBoxEdgeDevice} 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(deviceName, 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._update(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Downloads the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + downloadUpdatesWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._downloadUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Downloads the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + downloadUpdates(deviceName, 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._downloadUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._downloadUpdates(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates the extended info of the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {object} parameters The device extended information. + * + * @param {string} parameters.integrityKey The Channel Integrity Key (CIK) of + * the device. + * + * @param {string} [parameters.encryptionKeyThumbprint] The certificate + * thumbprint that was used to encrypt the Channel Integrity Key (CIK). + * + * @param {string} [parameters.encryptionKey] The Channel Integrity Key (CIK) + * of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + createOrUpdateExtendedInfoWithHttpOperationResponse(deviceName, parameters, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdateExtendedInfo(deviceName, parameters, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates the extended info of the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {object} parameters The device extended information. + * + * @param {string} parameters.integrityKey The Channel Integrity Key (CIK) of + * the device. + * + * @param {string} [parameters.encryptionKeyThumbprint] The certificate + * thumbprint that was used to encrypt the Channel Integrity Key (CIK). + * + * @param {string} [parameters.encryptionKey] The Channel Integrity Key (CIK) + * of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {DataBoxEdgeDeviceExtendedInfo} - 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 DataBoxEdgeDeviceExtendedInfo} 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. + */ + createOrUpdateExtendedInfo(deviceName, parameters, 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._createOrUpdateExtendedInfo(deviceName, parameters, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdateExtendedInfo(deviceName, parameters, resourceGroupName, options, optionalCallback); + } + } + + /** + * Returns the extended information of the specified data box edge/gateway + * device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + getExtendedInformationWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getExtendedInformation(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns the extended information of the specified data box edge/gateway + * device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {DataBoxEdgeDeviceExtendedInfo} - 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 DataBoxEdgeDeviceExtendedInfo} 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. + */ + getExtendedInformation(deviceName, 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._getExtendedInformation(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getExtendedInformation(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Installs the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + installUpdatesWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._installUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Installs the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + installUpdates(deviceName, 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._installUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._installUpdates(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Returns the network settings of the specified data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + getNetworkSettingsWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getNetworkSettings(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns the network settings of the specified data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {NetworkSettings} - 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 NetworkSettings} 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. + */ + getNetworkSettings(deviceName, 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._getNetworkSettings(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getNetworkSettings(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Scans for updates on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + scanForUpdatesWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._scanForUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Scans for updates on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + scanForUpdates(deviceName, 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._scanForUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._scanForUpdates(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Updates the security settings on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special + * characters. + * + * @param {string} deviceAdminPassword.value The value of the secret. + * + * @param {string} [deviceAdminPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} deviceAdminPassword.encryptionAlgorithm The algorithm used + * to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @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. + */ + createOrUpdateSecuritySettingsWithHttpOperationResponse(deviceName, resourceGroupName, deviceAdminPassword, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates the security settings on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special + * characters. + * + * @param {string} deviceAdminPassword.value The value of the secret. + * + * @param {string} [deviceAdminPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} deviceAdminPassword.encryptionAlgorithm The algorithm used + * to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, 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._createOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, options, optionalCallback); + } + } + + /** + * @summary Returns information about the availability of updates as per the + * last scan done on the device. It also returns information about any ongoing + * download or install jobs on the device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + getUpdateSummaryWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getUpdateSummary(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Returns information about the availability of updates as per the + * last scan done on the device. It also returns information about any ongoing + * download or install jobs on the device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {UpdateSummary} - 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 UpdateSummary} 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. + */ + getUpdateSummary(deviceName, 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._getUpdateSummary(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getUpdateSummary(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Uploads registration certificate for the device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} certificate The base64 encoded certificate raw data. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.authenticationType] The authentication type. + * Possible values include: 'Invalid', 'AzureActiveDirectory' + * + * @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. + */ + uploadCertificateWithHttpOperationResponse(deviceName, resourceGroupName, certificate, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._uploadCertificate(deviceName, resourceGroupName, certificate, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Uploads registration certificate for the device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} certificate The base64 encoded certificate raw data. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.authenticationType] The authentication type. + * Possible values include: 'Invalid', 'AzureActiveDirectory' + * + * @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 {UploadCertificateResponse} - 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 UploadCertificateResponse} 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. + */ + uploadCertificate(deviceName, resourceGroupName, certificate, 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._uploadCertificate(deviceName, resourceGroupName, certificate, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._uploadCertificate(deviceName, resourceGroupName, certificate, options, optionalCallback); + } + } + + /** + * Creates or updates a Data Box Edge/Gateway resource. + * + * @param {string} deviceName The device name. + * + * @param {object} dataBoxEdgeDevice The resource object. + * + * @param {string} dataBoxEdgeDevice.location The location of the device. This + * will be one of the supported and registered Azure Geo Regions (e.g. West US, + * East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update + * the request will succeed. + * + * @param {object} [dataBoxEdgeDevice.tags] The list of tags that describe the + * device. These tags can be used in viewing and grouping this device (across + * resource groups). + * + * @param {object} [dataBoxEdgeDevice.sku] The sku type. + * + * @param {string} [dataBoxEdgeDevice.sku.name] Sku name. Possible values + * include: 'Gateway', 'Edge' + * + * @param {string} [dataBoxEdgeDevice.sku.tier] The SKU tier. This is based on + * the SKU name. Possible values include: 'Standard' + * + * @param {string} [dataBoxEdgeDevice.etag] The etag of the devices. + * + * @param {string} [dataBoxEdgeDevice.dataBoxEdgeDeviceStatus] The status of + * the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', + * 'PartiallyDisconnected' + * + * @param {string} [dataBoxEdgeDevice.description] The Description of the Data + * Box Edge/Gateway device. + * + * @param {string} [dataBoxEdgeDevice.modelDescription] The description of the + * Data Box Edge/Gateway device model. + * + * @param {string} [dataBoxEdgeDevice.friendlyName] The Data Box Edge/Gateway + * device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, dataBoxEdgeDevice, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(deviceName, dataBoxEdgeDevice, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates a Data Box Edge/Gateway resource. + * + * @param {string} deviceName The device name. + * + * @param {object} dataBoxEdgeDevice The resource object. + * + * @param {string} dataBoxEdgeDevice.location The location of the device. This + * will be one of the supported and registered Azure Geo Regions (e.g. West US, + * East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update + * the request will succeed. + * + * @param {object} [dataBoxEdgeDevice.tags] The list of tags that describe the + * device. These tags can be used in viewing and grouping this device (across + * resource groups). + * + * @param {object} [dataBoxEdgeDevice.sku] The sku type. + * + * @param {string} [dataBoxEdgeDevice.sku.name] Sku name. Possible values + * include: 'Gateway', 'Edge' + * + * @param {string} [dataBoxEdgeDevice.sku.tier] The SKU tier. This is based on + * the SKU name. Possible values include: 'Standard' + * + * @param {string} [dataBoxEdgeDevice.etag] The etag of the devices. + * + * @param {string} [dataBoxEdgeDevice.dataBoxEdgeDeviceStatus] The status of + * the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', + * 'PartiallyDisconnected' + * + * @param {string} [dataBoxEdgeDevice.description] The Description of the Data + * Box Edge/Gateway device. + * + * @param {string} [dataBoxEdgeDevice.modelDescription] The description of the + * Data Box Edge/Gateway device model. + * + * @param {string} [dataBoxEdgeDevice.friendlyName] The Data Box Edge/Gateway + * device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {DataBoxEdgeDevice} - 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 DataBoxEdgeDevice} 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(deviceName, dataBoxEdgeDevice, 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._beginCreateOrUpdate(deviceName, dataBoxEdgeDevice, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(deviceName, dataBoxEdgeDevice, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, 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._beginDeleteMethod(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Downloads the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + beginDownloadUpdatesWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDownloadUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Downloads the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDownloadUpdates(deviceName, 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._beginDownloadUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDownloadUpdates(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Installs the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + beginInstallUpdatesWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginInstallUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Installs the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginInstallUpdates(deviceName, 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._beginInstallUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginInstallUpdates(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Scans for updates on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + beginScanForUpdatesWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginScanForUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Scans for updates on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginScanForUpdates(deviceName, 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._beginScanForUpdates(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginScanForUpdates(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Updates the security settings on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special + * characters. + * + * @param {string} deviceAdminPassword.value The value of the secret. + * + * @param {string} [deviceAdminPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} deviceAdminPassword.encryptionAlgorithm The algorithm used + * to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @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. + */ + beginCreateOrUpdateSecuritySettingsWithHttpOperationResponse(deviceName, resourceGroupName, deviceAdminPassword, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates the security settings on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special + * characters. + * + * @param {string} deviceAdminPassword.value The value of the secret. + * + * @param {string} [deviceAdminPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} deviceAdminPassword.encryptionAlgorithm The algorithm used + * to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, 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._beginCreateOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdateSecuritySettings(deviceName, resourceGroupName, deviceAdminPassword, options, optionalCallback); + } + } + + /** + * Retrieves all data box edge/gateway devices 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. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves all data box edge/gateway devices 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 {DataBoxEdgeDeviceList} - 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 DataBoxEdgeDeviceList} 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. + */ + listBySubscriptionNext(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._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Retrieves all data box edge/gateway devices 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; + }); + }); + } + + /** + * Retrieves all data box edge/gateway devices 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 {DataBoxEdgeDeviceList} - 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 DataBoxEdgeDeviceList} 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 = Devices; diff --git a/lib/services/edgegatewayManagement/lib/operations/index.d.ts b/lib/services/edgegatewayManagement/lib/operations/index.d.ts new file mode 100644 index 0000000000..d6b0f2ec6b --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/index.d.ts @@ -0,0 +1,5900 @@ +/* + * 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 + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface Operations { + + + /** + * @summary Lists all the operations supported. + * + * @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>; + + /** + * @summary Lists all the operations supported. + * + * @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 {OperationsList} - 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. + * + * {OperationsList} [result] - The deserialized result object if an error did not occur. + * See {@link OperationsList} 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; + + + /** + * @summary Lists all the operations supported. + * + * @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>; + + /** + * @summary Lists all the operations supported. + * + * @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 {OperationsList} - 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. + * + * {OperationsList} [result] - The deserialized result object if an error did not occur. + * See {@link OperationsList} 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; +} + +/** + * @class + * Devices + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface Devices { + + + /** + * Retrieves all data box edge/gateway devices in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify $expand=details to populate + * additional fields related to the resource or Specify $skipToken= to + * populate the next page in the list. + * + * @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. + */ + listBySubscriptionWithHttpOperationResponse(options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all data box edge/gateway devices in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify $expand=details to populate + * additional fields related to the resource or Specify $skipToken= to + * populate the next page in the list. + * + * @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 {DataBoxEdgeDeviceList} - 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. + * + * {DataBoxEdgeDeviceList} [result] - The deserialized result object if an error did not occur. + * See {@link DataBoxEdgeDeviceList} 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. + */ + listBySubscription(options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves all data box edge/gateway devices in a resource group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify $expand=details to populate + * additional fields related to the resource or Specify $skipToken= to + * populate the next page in the list. + * + * @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?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all data box edge/gateway devices in a resource group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify $expand=details to populate + * additional fields related to the resource or Specify $skipToken= to + * populate the next page in the list. + * + * @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 {DataBoxEdgeDeviceList} - 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. + * + * {DataBoxEdgeDeviceList} [result] - The deserialized result object if an error did not occur. + * See {@link DataBoxEdgeDeviceList} 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?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns the properties of the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns the properties of the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {DataBoxEdgeDevice} - 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. + * + * {DataBoxEdgeDevice} [result] - The deserialized result object if an error did not occur. + * See {@link DataBoxEdgeDevice} 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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + get(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a Data Box Edge/Gateway resource. + * + * @param {string} deviceName The device name. + * + * @param {object} dataBoxEdgeDevice The resource object. + * + * @param {string} dataBoxEdgeDevice.location The location of the device. This + * will be one of the supported and registered Azure Geo Regions (e.g. West US, + * East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update + * the request will succeed. + * + * @param {object} [dataBoxEdgeDevice.tags] The list of tags that describe the + * device. These tags can be used in viewing and grouping this device (across + * resource groups). + * + * @param {object} [dataBoxEdgeDevice.sku] The sku type. + * + * @param {string} [dataBoxEdgeDevice.sku.name] Sku name. Possible values + * include: 'Gateway', 'Edge' + * + * @param {string} [dataBoxEdgeDevice.sku.tier] The SKU tier. This is based on + * the SKU name. Possible values include: 'Standard' + * + * @param {string} [dataBoxEdgeDevice.etag] The etag of the devices. + * + * @param {string} [dataBoxEdgeDevice.dataBoxEdgeDeviceStatus] The status of + * the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', + * 'PartiallyDisconnected' + * + * @param {string} [dataBoxEdgeDevice.description] The Description of the Data + * Box Edge/Gateway device. + * + * @param {string} [dataBoxEdgeDevice.modelDescription] The description of the + * Data Box Edge/Gateway device model. + * + * @param {string} [dataBoxEdgeDevice.friendlyName] The Data Box Edge/Gateway + * device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, dataBoxEdgeDevice: models.DataBoxEdgeDevice, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a Data Box Edge/Gateway resource. + * + * @param {string} deviceName The device name. + * + * @param {object} dataBoxEdgeDevice The resource object. + * + * @param {string} dataBoxEdgeDevice.location The location of the device. This + * will be one of the supported and registered Azure Geo Regions (e.g. West US, + * East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update + * the request will succeed. + * + * @param {object} [dataBoxEdgeDevice.tags] The list of tags that describe the + * device. These tags can be used in viewing and grouping this device (across + * resource groups). + * + * @param {object} [dataBoxEdgeDevice.sku] The sku type. + * + * @param {string} [dataBoxEdgeDevice.sku.name] Sku name. Possible values + * include: 'Gateway', 'Edge' + * + * @param {string} [dataBoxEdgeDevice.sku.tier] The SKU tier. This is based on + * the SKU name. Possible values include: 'Standard' + * + * @param {string} [dataBoxEdgeDevice.etag] The etag of the devices. + * + * @param {string} [dataBoxEdgeDevice.dataBoxEdgeDeviceStatus] The status of + * the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', + * 'PartiallyDisconnected' + * + * @param {string} [dataBoxEdgeDevice.description] The Description of the Data + * Box Edge/Gateway device. + * + * @param {string} [dataBoxEdgeDevice.modelDescription] The description of the + * Data Box Edge/Gateway device model. + * + * @param {string} [dataBoxEdgeDevice.friendlyName] The Data Box Edge/Gateway + * device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {DataBoxEdgeDevice} - 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. + * + * {DataBoxEdgeDevice} [result] - The deserialized result object if an error did not occur. + * See {@link DataBoxEdgeDevice} 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(deviceName: string, dataBoxEdgeDevice: models.DataBoxEdgeDevice, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(deviceName: string, dataBoxEdgeDevice: models.DataBoxEdgeDevice, resourceGroupName: string, callback: ServiceCallback): void; + createOrUpdate(deviceName: string, dataBoxEdgeDevice: models.DataBoxEdgeDevice, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + deleteMethod(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.tags] The tags attached to the Data Box + * Edge/Gateway resource. + * + * @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(deviceName: string, resourceGroupName: string, options?: { tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.tags] The tags attached to the Data Box + * Edge/Gateway resource. + * + * @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 {DataBoxEdgeDevice} - 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. + * + * {DataBoxEdgeDevice} [result] - The deserialized result object if an error did not occur. + * See {@link DataBoxEdgeDevice} 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(deviceName: string, resourceGroupName: string, options?: { tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + update(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + update(deviceName: string, resourceGroupName: string, options: { tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Downloads the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + downloadUpdatesWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Downloads the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + downloadUpdates(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + downloadUpdates(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + downloadUpdates(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates the extended info of the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {object} parameters The device extended information. + * + * @param {string} parameters.integrityKey The Channel Integrity Key (CIK) of + * the device. + * + * @param {string} [parameters.encryptionKeyThumbprint] The certificate + * thumbprint that was used to encrypt the Channel Integrity Key (CIK). + * + * @param {string} [parameters.encryptionKey] The Channel Integrity Key (CIK) + * of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + createOrUpdateExtendedInfoWithHttpOperationResponse(deviceName: string, parameters: models.DataBoxEdgeDeviceExtendedInfo, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates the extended info of the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {object} parameters The device extended information. + * + * @param {string} parameters.integrityKey The Channel Integrity Key (CIK) of + * the device. + * + * @param {string} [parameters.encryptionKeyThumbprint] The certificate + * thumbprint that was used to encrypt the Channel Integrity Key (CIK). + * + * @param {string} [parameters.encryptionKey] The Channel Integrity Key (CIK) + * of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {DataBoxEdgeDeviceExtendedInfo} - 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. + * + * {DataBoxEdgeDeviceExtendedInfo} [result] - The deserialized result object if an error did not occur. + * See {@link DataBoxEdgeDeviceExtendedInfo} 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. + */ + createOrUpdateExtendedInfo(deviceName: string, parameters: models.DataBoxEdgeDeviceExtendedInfo, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdateExtendedInfo(deviceName: string, parameters: models.DataBoxEdgeDeviceExtendedInfo, resourceGroupName: string, callback: ServiceCallback): void; + createOrUpdateExtendedInfo(deviceName: string, parameters: models.DataBoxEdgeDeviceExtendedInfo, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns the extended information of the specified data box edge/gateway + * device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + getExtendedInformationWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns the extended information of the specified data box edge/gateway + * device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {DataBoxEdgeDeviceExtendedInfo} - 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. + * + * {DataBoxEdgeDeviceExtendedInfo} [result] - The deserialized result object if an error did not occur. + * See {@link DataBoxEdgeDeviceExtendedInfo} 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. + */ + getExtendedInformation(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getExtendedInformation(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + getExtendedInformation(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Installs the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + installUpdatesWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Installs the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + installUpdates(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + installUpdates(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + installUpdates(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns the network settings of the specified data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + getNetworkSettingsWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns the network settings of the specified data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {NetworkSettings} - 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. + * + * {NetworkSettings} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSettings} 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. + */ + getNetworkSettings(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getNetworkSettings(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + getNetworkSettings(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Scans for updates on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + scanForUpdatesWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Scans for updates on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + scanForUpdates(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + scanForUpdates(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + scanForUpdates(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates the security settings on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special + * characters. + * + * @param {string} deviceAdminPassword.value The value of the secret. + * + * @param {string} [deviceAdminPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} deviceAdminPassword.encryptionAlgorithm The algorithm used + * to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @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. + */ + createOrUpdateSecuritySettingsWithHttpOperationResponse(deviceName: string, resourceGroupName: string, deviceAdminPassword: models.AsymmetricEncryptedSecret, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates the security settings on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special + * characters. + * + * @param {string} deviceAdminPassword.value The value of the secret. + * + * @param {string} [deviceAdminPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} deviceAdminPassword.encryptionAlgorithm The algorithm used + * to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + createOrUpdateSecuritySettings(deviceName: string, resourceGroupName: string, deviceAdminPassword: models.AsymmetricEncryptedSecret, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdateSecuritySettings(deviceName: string, resourceGroupName: string, deviceAdminPassword: models.AsymmetricEncryptedSecret, callback: ServiceCallback): void; + createOrUpdateSecuritySettings(deviceName: string, resourceGroupName: string, deviceAdminPassword: models.AsymmetricEncryptedSecret, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Returns information about the availability of updates as per the + * last scan done on the device. It also returns information about any ongoing + * download or install jobs on the device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + getUpdateSummaryWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Returns information about the availability of updates as per the + * last scan done on the device. It also returns information about any ongoing + * download or install jobs on the device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {UpdateSummary} - 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. + * + * {UpdateSummary} [result] - The deserialized result object if an error did not occur. + * See {@link UpdateSummary} 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. + */ + getUpdateSummary(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getUpdateSummary(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + getUpdateSummary(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Uploads registration certificate for the device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} certificate The base64 encoded certificate raw data. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.authenticationType] The authentication type. + * Possible values include: 'Invalid', 'AzureActiveDirectory' + * + * @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. + */ + uploadCertificateWithHttpOperationResponse(deviceName: string, resourceGroupName: string, certificate: string, options?: { authenticationType? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Uploads registration certificate for the device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} certificate The base64 encoded certificate raw data. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.authenticationType] The authentication type. + * Possible values include: 'Invalid', 'AzureActiveDirectory' + * + * @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 {UploadCertificateResponse} - 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. + * + * {UploadCertificateResponse} [result] - The deserialized result object if an error did not occur. + * See {@link UploadCertificateResponse} 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. + */ + uploadCertificate(deviceName: string, resourceGroupName: string, certificate: string, options?: { authenticationType? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + uploadCertificate(deviceName: string, resourceGroupName: string, certificate: string, callback: ServiceCallback): void; + uploadCertificate(deviceName: string, resourceGroupName: string, certificate: string, options: { authenticationType? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a Data Box Edge/Gateway resource. + * + * @param {string} deviceName The device name. + * + * @param {object} dataBoxEdgeDevice The resource object. + * + * @param {string} dataBoxEdgeDevice.location The location of the device. This + * will be one of the supported and registered Azure Geo Regions (e.g. West US, + * East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update + * the request will succeed. + * + * @param {object} [dataBoxEdgeDevice.tags] The list of tags that describe the + * device. These tags can be used in viewing and grouping this device (across + * resource groups). + * + * @param {object} [dataBoxEdgeDevice.sku] The sku type. + * + * @param {string} [dataBoxEdgeDevice.sku.name] Sku name. Possible values + * include: 'Gateway', 'Edge' + * + * @param {string} [dataBoxEdgeDevice.sku.tier] The SKU tier. This is based on + * the SKU name. Possible values include: 'Standard' + * + * @param {string} [dataBoxEdgeDevice.etag] The etag of the devices. + * + * @param {string} [dataBoxEdgeDevice.dataBoxEdgeDeviceStatus] The status of + * the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', + * 'PartiallyDisconnected' + * + * @param {string} [dataBoxEdgeDevice.description] The Description of the Data + * Box Edge/Gateway device. + * + * @param {string} [dataBoxEdgeDevice.modelDescription] The description of the + * Data Box Edge/Gateway device model. + * + * @param {string} [dataBoxEdgeDevice.friendlyName] The Data Box Edge/Gateway + * device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, dataBoxEdgeDevice: models.DataBoxEdgeDevice, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a Data Box Edge/Gateway resource. + * + * @param {string} deviceName The device name. + * + * @param {object} dataBoxEdgeDevice The resource object. + * + * @param {string} dataBoxEdgeDevice.location The location of the device. This + * will be one of the supported and registered Azure Geo Regions (e.g. West US, + * East US, Southeast Asia, etc.). The geo region of a device cannot be changed + * once it is created, but if an identical geo region is specified on update + * the request will succeed. + * + * @param {object} [dataBoxEdgeDevice.tags] The list of tags that describe the + * device. These tags can be used in viewing and grouping this device (across + * resource groups). + * + * @param {object} [dataBoxEdgeDevice.sku] The sku type. + * + * @param {string} [dataBoxEdgeDevice.sku.name] Sku name. Possible values + * include: 'Gateway', 'Edge' + * + * @param {string} [dataBoxEdgeDevice.sku.tier] The SKU tier. This is based on + * the SKU name. Possible values include: 'Standard' + * + * @param {string} [dataBoxEdgeDevice.etag] The etag of the devices. + * + * @param {string} [dataBoxEdgeDevice.dataBoxEdgeDeviceStatus] The status of + * the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', + * 'Online', 'Offline', 'NeedsAttention', 'Disconnected', + * 'PartiallyDisconnected' + * + * @param {string} [dataBoxEdgeDevice.description] The Description of the Data + * Box Edge/Gateway device. + * + * @param {string} [dataBoxEdgeDevice.modelDescription] The description of the + * Data Box Edge/Gateway device model. + * + * @param {string} [dataBoxEdgeDevice.friendlyName] The Data Box Edge/Gateway + * device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {DataBoxEdgeDevice} - 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. + * + * {DataBoxEdgeDevice} [result] - The deserialized result object if an error did not occur. + * See {@link DataBoxEdgeDevice} 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(deviceName: string, dataBoxEdgeDevice: models.DataBoxEdgeDevice, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(deviceName: string, dataBoxEdgeDevice: models.DataBoxEdgeDevice, resourceGroupName: string, callback: ServiceCallback): void; + beginCreateOrUpdate(deviceName: string, dataBoxEdgeDevice: models.DataBoxEdgeDevice, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Downloads the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + beginDownloadUpdatesWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Downloads the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + beginDownloadUpdates(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDownloadUpdates(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + beginDownloadUpdates(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Installs the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + beginInstallUpdatesWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Installs the updates on the data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + beginInstallUpdates(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginInstallUpdates(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + beginInstallUpdates(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Scans for updates on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + beginScanForUpdatesWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Scans for updates on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + beginScanForUpdates(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginScanForUpdates(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + beginScanForUpdates(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates the security settings on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special + * characters. + * + * @param {string} deviceAdminPassword.value The value of the secret. + * + * @param {string} [deviceAdminPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} deviceAdminPassword.encryptionAlgorithm The algorithm used + * to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @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. + */ + beginCreateOrUpdateSecuritySettingsWithHttpOperationResponse(deviceName: string, resourceGroupName: string, deviceAdminPassword: models.AsymmetricEncryptedSecret, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates the security settings on a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} deviceAdminPassword Device administrator password as an + * encrypted string (encrypted using RSA PKCS #1) is used to log into the + * local web UI of the device. Actual password could have at least 8 characters + * that are a combination of uppercase, lowercase, numeric, and special + * characters. + * + * @param {string} deviceAdminPassword.value The value of the secret. + * + * @param {string} [deviceAdminPassword.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} deviceAdminPassword.encryptionAlgorithm The algorithm used + * to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + beginCreateOrUpdateSecuritySettings(deviceName: string, resourceGroupName: string, deviceAdminPassword: models.AsymmetricEncryptedSecret, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdateSecuritySettings(deviceName: string, resourceGroupName: string, deviceAdminPassword: models.AsymmetricEncryptedSecret, callback: ServiceCallback): void; + beginCreateOrUpdateSecuritySettings(deviceName: string, resourceGroupName: string, deviceAdminPassword: models.AsymmetricEncryptedSecret, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves all data box edge/gateway devices 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. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all data box edge/gateway devices 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 {DataBoxEdgeDeviceList} - 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. + * + * {DataBoxEdgeDeviceList} [result] - The deserialized result object if an error did not occur. + * See {@link DataBoxEdgeDeviceList} 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. + */ + listBySubscriptionNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionNext(nextPageLink: string, callback: ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves all data box edge/gateway devices 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>; + + /** + * Retrieves all data box edge/gateway devices 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 {DataBoxEdgeDeviceList} - 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. + * + * {DataBoxEdgeDeviceList} [result] - The deserialized result object if an error did not occur. + * See {@link DataBoxEdgeDeviceList} 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 + * Alerts + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface Alerts { + + + /** + * Retrieves all the alerts for a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all the alerts for a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {AlertList} - 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. + * + * {AlertList} [result] - The deserialized result object if an error did not occur. + * See {@link AlertList} 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. + */ + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Returns an alert by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the alert which needs to be retrieved. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Returns an alert by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the alert which needs to be retrieved. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Alert} - 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. + * + * {Alert} [result] - The deserialized result object if an error did not occur. + * See {@link Alert} 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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + get(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves all the alerts for a data box edge/gateway device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all the alerts for a data box edge/gateway device. + * + * @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 {AlertList} - 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. + * + * {AlertList} [result] - The deserialized result object if an error did not occur. + * See {@link AlertList} 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. + */ + listByDataBoxEdgeDeviceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDeviceNext(nextPageLink: string, callback: ServiceCallback): void; + listByDataBoxEdgeDeviceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * BandwidthSchedules + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface BandwidthSchedules { + + + /** + * Returns all the bandwidth Schedules for a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns all the bandwidth Schedules for a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {BandwidthSchedulesList} - 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. + * + * {BandwidthSchedulesList} [result] - The deserialized result object if an error did not occur. + * See {@link BandwidthSchedulesList} 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. + */ + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns the properties of the specified bandwidth schedule name. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns the properties of the specified bandwidth schedule name. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {BandwidthSchedule} - 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. + * + * {BandwidthSchedule} [result] - The deserialized result object if an error did not occur. + * See {@link BandwidthSchedule} 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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + get(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name which needs to be + * added/updated. + * + * @param {object} parameters The bandwidth schedule to be added or updated. + * + * @param {string} parameters.start The start time of the schedule in UTC. + * + * @param {string} parameters.stop The stop time of the schedule in UTC. + * + * @param {number} parameters.rateInMbps The bandwidth rate in Mbps. + * + * @param {array} parameters.days The days of the week when this schedule is + * applicable. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, parameters: models.BandwidthSchedule, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name which needs to be + * added/updated. + * + * @param {object} parameters The bandwidth schedule to be added or updated. + * + * @param {string} parameters.start The start time of the schedule in UTC. + * + * @param {string} parameters.stop The stop time of the schedule in UTC. + * + * @param {number} parameters.rateInMbps The bandwidth rate in Mbps. + * + * @param {array} parameters.days The days of the week when this schedule is + * applicable. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {BandwidthSchedule} - 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. + * + * {BandwidthSchedule} [result] - The deserialized result object if an error did not occur. + * See {@link BandwidthSchedule} 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(deviceName: string, name: string, parameters: models.BandwidthSchedule, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(deviceName: string, name: string, parameters: models.BandwidthSchedule, resourceGroupName: string, callback: ServiceCallback): void; + createOrUpdate(deviceName: string, name: string, parameters: models.BandwidthSchedule, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name which needs to be + * added/updated. + * + * @param {object} parameters The bandwidth schedule to be added or updated. + * + * @param {string} parameters.start The start time of the schedule in UTC. + * + * @param {string} parameters.stop The stop time of the schedule in UTC. + * + * @param {number} parameters.rateInMbps The bandwidth rate in Mbps. + * + * @param {array} parameters.days The days of the week when this schedule is + * applicable. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, parameters: models.BandwidthSchedule, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name which needs to be + * added/updated. + * + * @param {object} parameters The bandwidth schedule to be added or updated. + * + * @param {string} parameters.start The start time of the schedule in UTC. + * + * @param {string} parameters.stop The stop time of the schedule in UTC. + * + * @param {number} parameters.rateInMbps The bandwidth rate in Mbps. + * + * @param {array} parameters.days The days of the week when this schedule is + * applicable. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {BandwidthSchedule} - 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. + * + * {BandwidthSchedule} [result] - The deserialized result object if an error did not occur. + * See {@link BandwidthSchedule} 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(deviceName: string, name: string, parameters: models.BandwidthSchedule, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(deviceName: string, name: string, parameters: models.BandwidthSchedule, resourceGroupName: string, callback: ServiceCallback): void; + beginCreateOrUpdate(deviceName: string, name: string, parameters: models.BandwidthSchedule, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified bandwidth schedule. + * + * @param {string} deviceName The device name. + * + * @param {string} name The bandwidth schedule name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns all the bandwidth Schedules for a data box edge/gateway device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns all the bandwidth Schedules for a data box edge/gateway device. + * + * @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 {BandwidthSchedulesList} - 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. + * + * {BandwidthSchedulesList} [result] - The deserialized result object if an error did not occur. + * See {@link BandwidthSchedulesList} 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. + */ + listByDataBoxEdgeDeviceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDeviceNext(nextPageLink: string, callback: ServiceCallback): void; + listByDataBoxEdgeDeviceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * OperationsStatus + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface OperationsStatus { + + + /** + * @summary Returns the job details of the specified job on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The job name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Returns the job details of the specified job on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The job name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Job} - 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. + * + * {Job} [result] - The deserialized result object if an error did not occur. + * See {@link Job} 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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + get(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Orders + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface Orders { + + + /** + * @summary List all the orders related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List all the orders related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {OrderList} - 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. + * + * {OrderList} [result] - The deserialized result object if an error did not occur. + * See {@link OrderList} 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. + */ + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Get a specific order by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Get a specific order by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Order} - 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. + * + * {Order} [result] - The deserialized result object if an error did not occur. + * See {@link Order} 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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + get(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Creates or updates an order. + * + * @param {string} deviceName Name of the edge device for which order needs to + * be added or updated. + * + * @param {object} order Order to be added. + * + * @param {object} [order.contactInformation] The contact details. + * + * @param {string} order.contactInformation.contactPerson Gets or sets the + * contact person. + * + * @param {string} order.contactInformation.companyName Gets or sets the name + * of the company. + * + * @param {string} order.contactInformation.phone Gets or sets the phone + * number. + * + * @param {array} order.contactInformation.emailList Gets or sets the email + * list. + * + * @param {object} [order.shippingAddress] The shipping address. + * + * @param {string} order.shippingAddress.addressLine1 The address line1. + * + * @param {string} order.shippingAddress.addressLine2 The address line2. + * + * @param {string} order.shippingAddress.addressLine3 The address line3. + * + * @param {string} order.shippingAddress.postalCode The postal code. + * + * @param {string} order.shippingAddress.city The city name. + * + * @param {string} order.shippingAddress.state The state name. + * + * @param {string} order.shippingAddress.country The country name. + * + * @param {object} [order.changeStatusTo] Current status of the Order. + * + * @param {string} order.changeStatusTo.status Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * + * @param {string} [order.changeStatusTo.comments] Comments related to this + * status change. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, order: models.Order, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates an order. + * + * @param {string} deviceName Name of the edge device for which order needs to + * be added or updated. + * + * @param {object} order Order to be added. + * + * @param {object} [order.contactInformation] The contact details. + * + * @param {string} order.contactInformation.contactPerson Gets or sets the + * contact person. + * + * @param {string} order.contactInformation.companyName Gets or sets the name + * of the company. + * + * @param {string} order.contactInformation.phone Gets or sets the phone + * number. + * + * @param {array} order.contactInformation.emailList Gets or sets the email + * list. + * + * @param {object} [order.shippingAddress] The shipping address. + * + * @param {string} order.shippingAddress.addressLine1 The address line1. + * + * @param {string} order.shippingAddress.addressLine2 The address line2. + * + * @param {string} order.shippingAddress.addressLine3 The address line3. + * + * @param {string} order.shippingAddress.postalCode The postal code. + * + * @param {string} order.shippingAddress.city The city name. + * + * @param {string} order.shippingAddress.state The state name. + * + * @param {string} order.shippingAddress.country The country name. + * + * @param {object} [order.changeStatusTo] Current status of the Order. + * + * @param {string} order.changeStatusTo.status Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * + * @param {string} [order.changeStatusTo.comments] Comments related to this + * status change. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Order} - 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. + * + * {Order} [result] - The deserialized result object if an error did not occur. + * See {@link Order} 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(deviceName: string, order: models.Order, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(deviceName: string, order: models.Order, resourceGroupName: string, callback: ServiceCallback): void; + createOrUpdate(deviceName: string, order: models.Order, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes the order related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes the order related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + deleteMethod(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Creates or updates an order. + * + * @param {string} deviceName Name of the edge device for which order needs to + * be added or updated. + * + * @param {object} order Order to be added. + * + * @param {object} [order.contactInformation] The contact details. + * + * @param {string} order.contactInformation.contactPerson Gets or sets the + * contact person. + * + * @param {string} order.contactInformation.companyName Gets or sets the name + * of the company. + * + * @param {string} order.contactInformation.phone Gets or sets the phone + * number. + * + * @param {array} order.contactInformation.emailList Gets or sets the email + * list. + * + * @param {object} [order.shippingAddress] The shipping address. + * + * @param {string} order.shippingAddress.addressLine1 The address line1. + * + * @param {string} order.shippingAddress.addressLine2 The address line2. + * + * @param {string} order.shippingAddress.addressLine3 The address line3. + * + * @param {string} order.shippingAddress.postalCode The postal code. + * + * @param {string} order.shippingAddress.city The city name. + * + * @param {string} order.shippingAddress.state The state name. + * + * @param {string} order.shippingAddress.country The country name. + * + * @param {object} [order.changeStatusTo] Current status of the Order. + * + * @param {string} order.changeStatusTo.status Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * + * @param {string} [order.changeStatusTo.comments] Comments related to this + * status change. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, order: models.Order, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates an order. + * + * @param {string} deviceName Name of the edge device for which order needs to + * be added or updated. + * + * @param {object} order Order to be added. + * + * @param {object} [order.contactInformation] The contact details. + * + * @param {string} order.contactInformation.contactPerson Gets or sets the + * contact person. + * + * @param {string} order.contactInformation.companyName Gets or sets the name + * of the company. + * + * @param {string} order.contactInformation.phone Gets or sets the phone + * number. + * + * @param {array} order.contactInformation.emailList Gets or sets the email + * list. + * + * @param {object} [order.shippingAddress] The shipping address. + * + * @param {string} order.shippingAddress.addressLine1 The address line1. + * + * @param {string} order.shippingAddress.addressLine2 The address line2. + * + * @param {string} order.shippingAddress.addressLine3 The address line3. + * + * @param {string} order.shippingAddress.postalCode The postal code. + * + * @param {string} order.shippingAddress.city The city name. + * + * @param {string} order.shippingAddress.state The state name. + * + * @param {string} order.shippingAddress.country The country name. + * + * @param {object} [order.changeStatusTo] Current status of the Order. + * + * @param {string} order.changeStatusTo.status Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * + * @param {string} [order.changeStatusTo.comments] Comments related to this + * status change. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Order} - 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. + * + * {Order} [result] - The deserialized result object if an error did not occur. + * See {@link Order} 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(deviceName: string, order: models.Order, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(deviceName: string, order: models.Order, resourceGroupName: string, callback: ServiceCallback): void; + beginCreateOrUpdate(deviceName: string, order: models.Order, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes the order related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes the order related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List all the orders related to the device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List all the orders related to the device. + * + * @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 {OrderList} - 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. + * + * {OrderList} [result] - The deserialized result object if an error did not occur. + * See {@link OrderList} 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. + */ + listByDataBoxEdgeDeviceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDeviceNext(nextPageLink: string, callback: ServiceCallback): void; + listByDataBoxEdgeDeviceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Roles + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface Roles { + + + /** + * Lists all the roles configured in a data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the roles configured in a data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {RoleList} - 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. + * + * {RoleList} [result] - The deserialized result object if an error did not occur. + * See {@link RoleList} 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. + */ + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a specific role by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of role to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a specific role by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of role to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Role} - 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. + * + * {Role} [result] - The deserialized result object if an error did not occur. + * See {@link Role} 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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + get(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update a role. + * + * @param {string} deviceName Name of the device in which the role needs to be + * added or updated. + * + * @param {string} name Name of the role to be updated. + * + * @param {object} role Role to be added. + * + * @param {string} role.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, role: models.Role, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a role. + * + * @param {string} deviceName Name of the device in which the role needs to be + * added or updated. + * + * @param {string} name Name of the role to be updated. + * + * @param {object} role Role to be added. + * + * @param {string} role.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Role} - 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. + * + * {Role} [result] - The deserialized result object if an error did not occur. + * See {@link Role} 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(deviceName: string, name: string, role: models.Role, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(deviceName: string, name: string, role: models.Role, resourceGroupName: string, callback: ServiceCallback): void; + createOrUpdate(deviceName: string, name: string, role: models.Role, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the role on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the role which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the role on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the role which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update a role. + * + * @param {string} deviceName Name of the device in which the role needs to be + * added or updated. + * + * @param {string} name Name of the role to be updated. + * + * @param {object} role Role to be added. + * + * @param {string} role.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, role: models.Role, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a role. + * + * @param {string} deviceName Name of the device in which the role needs to be + * added or updated. + * + * @param {string} name Name of the role to be updated. + * + * @param {object} role Role to be added. + * + * @param {string} role.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Role} - 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. + * + * {Role} [result] - The deserialized result object if an error did not occur. + * See {@link Role} 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(deviceName: string, name: string, role: models.Role, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(deviceName: string, name: string, role: models.Role, resourceGroupName: string, callback: ServiceCallback): void; + beginCreateOrUpdate(deviceName: string, name: string, role: models.Role, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the role on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the role which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the role on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the role which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the roles configured in a data box edge/gateway device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the roles configured in a data box edge/gateway device. + * + * @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 {RoleList} - 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. + * + * {RoleList} [result] - The deserialized result object if an error did not occur. + * See {@link RoleList} 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. + */ + listByDataBoxEdgeDeviceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDeviceNext(nextPageLink: string, callback: ServiceCallback): void; + listByDataBoxEdgeDeviceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Shares + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface Shares { + + + /** + * @summary Lists all the shares in a data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists all the shares in a data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {ShareList} - 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. + * + * {ShareList} [result] - The deserialized result object if an error did not occur. + * See {@link ShareList} 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. + */ + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Returns a particular share by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Returns a particular share by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Share} - 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. + * + * {Share} [result] - The deserialized result object if an error did not occur. + * See {@link Share} 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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + get(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Creates a new share or update an existing share on the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be added/updated. + * + * @param {object} share The share object containing the share details. + * + * @param {string} [share.description] Description for the share. + * + * @param {string} share.shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * + * @param {string} share.monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [share.azureContainerInfo] Azure container mapping for the + * share. + * + * @param {string} share.azureContainerInfo.storageAccountCredentialId ID of + * the Storage account credential to be used for accessing storage. + * + * @param {string} share.azureContainerInfo.containerName Container name (Based + * on the data format specified, represents the name of Azure file/ Page blob / + * Block blob). + * + * @param {string} share.azureContainerInfo.dataFormat Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * + * @param {string} share.accessProtocol Access protocol to be used by the + * share. Possible values include: 'SMB', 'NFS' + * + * @param {array} [share.userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * + * @param {array} [share.clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * + * @param {object} [share.refreshDetails] Details of the refresh job on this + * share. + * + * @param {string} [share.refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * + * @param {date} [share.refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, share: models.Share, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates a new share or update an existing share on the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be added/updated. + * + * @param {object} share The share object containing the share details. + * + * @param {string} [share.description] Description for the share. + * + * @param {string} share.shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * + * @param {string} share.monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [share.azureContainerInfo] Azure container mapping for the + * share. + * + * @param {string} share.azureContainerInfo.storageAccountCredentialId ID of + * the Storage account credential to be used for accessing storage. + * + * @param {string} share.azureContainerInfo.containerName Container name (Based + * on the data format specified, represents the name of Azure file/ Page blob / + * Block blob). + * + * @param {string} share.azureContainerInfo.dataFormat Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * + * @param {string} share.accessProtocol Access protocol to be used by the + * share. Possible values include: 'SMB', 'NFS' + * + * @param {array} [share.userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * + * @param {array} [share.clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * + * @param {object} [share.refreshDetails] Details of the refresh job on this + * share. + * + * @param {string} [share.refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * + * @param {date} [share.refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Share} - 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. + * + * {Share} [result] - The deserialized result object if an error did not occur. + * See {@link Share} 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(deviceName: string, name: string, share: models.Share, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(deviceName: string, name: string, share: models.Share, resourceGroupName: string, callback: ServiceCallback): void; + createOrUpdate(deviceName: string, name: string, share: models.Share, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the share on the data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the share on the data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Triggers a manual refresh of the share metadata with the actual + * cloud storage account. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + refreshWithHttpOperationResponse(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Triggers a manual refresh of the share metadata with the actual + * cloud storage account. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + refresh(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + refresh(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + refresh(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Creates a new share or update an existing share on the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be added/updated. + * + * @param {object} share The share object containing the share details. + * + * @param {string} [share.description] Description for the share. + * + * @param {string} share.shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * + * @param {string} share.monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [share.azureContainerInfo] Azure container mapping for the + * share. + * + * @param {string} share.azureContainerInfo.storageAccountCredentialId ID of + * the Storage account credential to be used for accessing storage. + * + * @param {string} share.azureContainerInfo.containerName Container name (Based + * on the data format specified, represents the name of Azure file/ Page blob / + * Block blob). + * + * @param {string} share.azureContainerInfo.dataFormat Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * + * @param {string} share.accessProtocol Access protocol to be used by the + * share. Possible values include: 'SMB', 'NFS' + * + * @param {array} [share.userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * + * @param {array} [share.clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * + * @param {object} [share.refreshDetails] Details of the refresh job on this + * share. + * + * @param {string} [share.refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * + * @param {date} [share.refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, share: models.Share, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates a new share or update an existing share on the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be added/updated. + * + * @param {object} share The share object containing the share details. + * + * @param {string} [share.description] Description for the share. + * + * @param {string} share.shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * + * @param {string} share.monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [share.azureContainerInfo] Azure container mapping for the + * share. + * + * @param {string} share.azureContainerInfo.storageAccountCredentialId ID of + * the Storage account credential to be used for accessing storage. + * + * @param {string} share.azureContainerInfo.containerName Container name (Based + * on the data format specified, represents the name of Azure file/ Page blob / + * Block blob). + * + * @param {string} share.azureContainerInfo.dataFormat Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * + * @param {string} share.accessProtocol Access protocol to be used by the + * share. Possible values include: 'SMB', 'NFS' + * + * @param {array} [share.userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * + * @param {array} [share.clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * + * @param {object} [share.refreshDetails] Details of the refresh job on this + * share. + * + * @param {string} [share.refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * + * @param {date} [share.refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Share} - 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. + * + * {Share} [result] - The deserialized result object if an error did not occur. + * See {@link Share} 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(deviceName: string, name: string, share: models.Share, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(deviceName: string, name: string, share: models.Share, resourceGroupName: string, callback: ServiceCallback): void; + beginCreateOrUpdate(deviceName: string, name: string, share: models.Share, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the share on the data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the share on the data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Triggers a manual refresh of the share metadata with the actual + * cloud storage account. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + beginRefreshWithHttpOperationResponse(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Triggers a manual refresh of the share metadata with the actual + * cloud storage account. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + beginRefresh(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginRefresh(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + beginRefresh(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists all the shares in a data box edge/gateway device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists all the shares in a data box edge/gateway device. + * + * @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 {ShareList} - 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. + * + * {ShareList} [result] - The deserialized result object if an error did not occur. + * See {@link ShareList} 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. + */ + listByDataBoxEdgeDeviceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDeviceNext(nextPageLink: string, callback: ServiceCallback): void; + listByDataBoxEdgeDeviceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * StorageAccountCredentials + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface StorageAccountCredentials { + + + /** + * @summary Gets all the storage account credentials in a data box edge/gateway + * device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the storage account credentials in a data box edge/gateway + * device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {StorageAccountCredentialList} - 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. + * + * {StorageAccountCredentialList} [result] - The deserialized result object if an error did not occur. + * See {@link StorageAccountCredentialList} 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. + */ + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the properties of the specified storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the properties of the specified storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {StorageAccountCredential} - 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. + * + * {StorageAccountCredential} [result] - The deserialized result object if an error did not occur. + * See {@link StorageAccountCredential} 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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + get(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name The storage account credential name. + * + * @param {object} storageAccountCredential The storage account credential to + * be added or updated. + * + * @param {string} storageAccountCredential.alias Alias for the storage + * account. + * + * @param {string} [storageAccountCredential.userName] UserName for the storage + * account. + * + * @param {object} [storageAccountCredential.accountKey] Encrypted storage key. + * + * @param {string} storageAccountCredential.accountKey.value The value of the + * secret. + * + * @param {string} + * [storageAccountCredential.accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} storageAccountCredential.accountKey.encryptionAlgorithm The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * + * @param {string} [storageAccountCredential.connectionString] ConnectionString + * for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + * + * @param {string} storageAccountCredential.sslStatus Signifies whether SSL + * needs to be enabled or not. Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [storageAccountCredential.blobDomainName] Blob end point for + * private clouds. + * + * @param {string} storageAccountCredential.accountType Type of storage + * accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, storageAccountCredential: models.StorageAccountCredential, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name The storage account credential name. + * + * @param {object} storageAccountCredential The storage account credential to + * be added or updated. + * + * @param {string} storageAccountCredential.alias Alias for the storage + * account. + * + * @param {string} [storageAccountCredential.userName] UserName for the storage + * account. + * + * @param {object} [storageAccountCredential.accountKey] Encrypted storage key. + * + * @param {string} storageAccountCredential.accountKey.value The value of the + * secret. + * + * @param {string} + * [storageAccountCredential.accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} storageAccountCredential.accountKey.encryptionAlgorithm The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * + * @param {string} [storageAccountCredential.connectionString] ConnectionString + * for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + * + * @param {string} storageAccountCredential.sslStatus Signifies whether SSL + * needs to be enabled or not. Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [storageAccountCredential.blobDomainName] Blob end point for + * private clouds. + * + * @param {string} storageAccountCredential.accountType Type of storage + * accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {StorageAccountCredential} - 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. + * + * {StorageAccountCredential} [result] - The deserialized result object if an error did not occur. + * See {@link StorageAccountCredential} 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(deviceName: string, name: string, storageAccountCredential: models.StorageAccountCredential, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(deviceName: string, name: string, storageAccountCredential: models.StorageAccountCredential, resourceGroupName: string, callback: ServiceCallback): void; + createOrUpdate(deviceName: string, name: string, storageAccountCredential: models.StorageAccountCredential, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name The storage account credential name. + * + * @param {object} storageAccountCredential The storage account credential to + * be added or updated. + * + * @param {string} storageAccountCredential.alias Alias for the storage + * account. + * + * @param {string} [storageAccountCredential.userName] UserName for the storage + * account. + * + * @param {object} [storageAccountCredential.accountKey] Encrypted storage key. + * + * @param {string} storageAccountCredential.accountKey.value The value of the + * secret. + * + * @param {string} + * [storageAccountCredential.accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} storageAccountCredential.accountKey.encryptionAlgorithm The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * + * @param {string} [storageAccountCredential.connectionString] ConnectionString + * for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + * + * @param {string} storageAccountCredential.sslStatus Signifies whether SSL + * needs to be enabled or not. Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [storageAccountCredential.blobDomainName] Blob end point for + * private clouds. + * + * @param {string} storageAccountCredential.accountType Type of storage + * accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, storageAccountCredential: models.StorageAccountCredential, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name The storage account credential name. + * + * @param {object} storageAccountCredential The storage account credential to + * be added or updated. + * + * @param {string} storageAccountCredential.alias Alias for the storage + * account. + * + * @param {string} [storageAccountCredential.userName] UserName for the storage + * account. + * + * @param {object} [storageAccountCredential.accountKey] Encrypted storage key. + * + * @param {string} storageAccountCredential.accountKey.value The value of the + * secret. + * + * @param {string} + * [storageAccountCredential.accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} storageAccountCredential.accountKey.encryptionAlgorithm The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * + * @param {string} [storageAccountCredential.connectionString] ConnectionString + * for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + * + * @param {string} storageAccountCredential.sslStatus Signifies whether SSL + * needs to be enabled or not. Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [storageAccountCredential.blobDomainName] Blob end point for + * private clouds. + * + * @param {string} storageAccountCredential.accountType Type of storage + * accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {StorageAccountCredential} - 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. + * + * {StorageAccountCredential} [result] - The deserialized result object if an error did not occur. + * See {@link StorageAccountCredential} 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(deviceName: string, name: string, storageAccountCredential: models.StorageAccountCredential, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(deviceName: string, name: string, storageAccountCredential: models.StorageAccountCredential, resourceGroupName: string, callback: ServiceCallback): void; + beginCreateOrUpdate(deviceName: string, name: string, storageAccountCredential: models.StorageAccountCredential, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets all the storage account credentials in a data box edge/gateway + * device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the storage account credentials in a data box edge/gateway + * device. + * + * @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 {StorageAccountCredentialList} - 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. + * + * {StorageAccountCredentialList} [result] - The deserialized result object if an error did not occur. + * See {@link StorageAccountCredentialList} 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. + */ + listByDataBoxEdgeDeviceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDeviceNext(nextPageLink: string, callback: ServiceCallback): void; + listByDataBoxEdgeDeviceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Triggers + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface Triggers { + + + /** + * List all the triggers configured in the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List all the triggers configured in the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {TriggerList} - 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. + * + * {TriggerList} [result] - The deserialized result object if an error did not occur. + * See {@link TriggerList} 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. + */ + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a specific trigger by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of trigger to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a specific trigger by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of trigger to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Trigger} - 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. + * + * {Trigger} [result] - The deserialized result object if an error did not occur. + * See {@link Trigger} 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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + get(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update a trigger. + * + * @param {string} deviceName Name of the edge device in which trigger needs to + * be added or updated. + * + * @param {string} name Name of trigger to be added or updated. + * + * @param {object} trigger Trigger to be added. + * + * @param {string} trigger.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, trigger: models.Trigger, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a trigger. + * + * @param {string} deviceName Name of the edge device in which trigger needs to + * be added or updated. + * + * @param {string} name Name of trigger to be added or updated. + * + * @param {object} trigger Trigger to be added. + * + * @param {string} trigger.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Trigger} - 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. + * + * {Trigger} [result] - The deserialized result object if an error did not occur. + * See {@link Trigger} 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(deviceName: string, name: string, trigger: models.Trigger, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(deviceName: string, name: string, trigger: models.Trigger, resourceGroupName: string, callback: ServiceCallback): void; + createOrUpdate(deviceName: string, name: string, trigger: models.Trigger, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the trigger on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the trigger which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the trigger on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the trigger which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update a trigger. + * + * @param {string} deviceName Name of the edge device in which trigger needs to + * be added or updated. + * + * @param {string} name Name of trigger to be added or updated. + * + * @param {object} trigger Trigger to be added. + * + * @param {string} trigger.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, trigger: models.Trigger, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a trigger. + * + * @param {string} deviceName Name of the edge device in which trigger needs to + * be added or updated. + * + * @param {string} name Name of trigger to be added or updated. + * + * @param {object} trigger Trigger to be added. + * + * @param {string} trigger.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Trigger} - 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. + * + * {Trigger} [result] - The deserialized result object if an error did not occur. + * See {@link Trigger} 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(deviceName: string, name: string, trigger: models.Trigger, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(deviceName: string, name: string, trigger: models.Trigger, resourceGroupName: string, callback: ServiceCallback): void; + beginCreateOrUpdate(deviceName: string, name: string, trigger: models.Trigger, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the trigger on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the trigger which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the trigger on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the trigger which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List all the triggers configured in the device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List all the triggers configured in the device. + * + * @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 {TriggerList} - 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. + * + * {TriggerList} [result] - The deserialized result object if an error did not occur. + * See {@link TriggerList} 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. + */ + listByDataBoxEdgeDeviceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDeviceNext(nextPageLink: string, callback: ServiceCallback): void; + listByDataBoxEdgeDeviceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Users + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxEdgeManagementClient. + */ +export interface Users { + + + /** + * Returns all the users registered in a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns all the users registered in a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {UserList} - 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. + * + * {UserList} [result] - The deserialized result object if an error did not occur. + * See {@link UserList} 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. + */ + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, callback: ServiceCallback): void; + listByDataBoxEdgeDevice(deviceName: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns the properties of the specified user. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be retrieved. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns the properties of the specified user. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be retrieved. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {User} - 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. + * + * {User} [result] - The deserialized result object if an error did not occur. + * See {@link User} 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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + get(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a new user or update an existing user's information on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be added/updated. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.encryptedPassword] The details of the password + * specified for the user. + * + * @param {string} options.encryptedPassword.value The value of the secret. + * + * @param {string} [options.encryptedPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * + * @param {string} options.encryptedPassword.encryptionAlgorithm The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @param {array} [options.shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { encryptedPassword? : models.AsymmetricEncryptedSecret, shareAccessRights? : models.ShareAccessRight[], customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new user or update an existing user's information on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be added/updated. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.encryptedPassword] The details of the password + * specified for the user. + * + * @param {string} options.encryptedPassword.value The value of the secret. + * + * @param {string} [options.encryptedPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * + * @param {string} options.encryptedPassword.encryptionAlgorithm The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @param {array} [options.shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + * + * @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 {User} - 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. + * + * {User} [result] - The deserialized result object if an error did not occur. + * See {@link User} 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(deviceName: string, name: string, resourceGroupName: string, options?: { encryptedPassword? : models.AsymmetricEncryptedSecret, shareAccessRights? : models.ShareAccessRight[], customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + createOrUpdate(deviceName: string, name: string, resourceGroupName: string, options: { encryptedPassword? : models.AsymmetricEncryptedSecret, shareAccessRights? : models.ShareAccessRight[], customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the user on a databox edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the user on a databox edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + deleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a new user or update an existing user's information on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be added/updated. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.encryptedPassword] The details of the password + * specified for the user. + * + * @param {string} options.encryptedPassword.value The value of the secret. + * + * @param {string} [options.encryptedPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * + * @param {string} options.encryptedPassword.encryptionAlgorithm The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @param {array} [options.shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { encryptedPassword? : models.AsymmetricEncryptedSecret, shareAccessRights? : models.ShareAccessRight[], customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new user or update an existing user's information on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be added/updated. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.encryptedPassword] The details of the password + * specified for the user. + * + * @param {string} options.encryptedPassword.value The value of the secret. + * + * @param {string} [options.encryptedPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * + * @param {string} options.encryptedPassword.encryptionAlgorithm The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @param {array} [options.shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + * + * @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 {User} - 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. + * + * {User} [result] - The deserialized result object if an error did not occur. + * See {@link User} 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(deviceName: string, name: string, resourceGroupName: string, options?: { encryptedPassword? : models.AsymmetricEncryptedSecret, shareAccessRights? : models.ShareAccessRight[], customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + beginCreateOrUpdate(deviceName: string, name: string, resourceGroupName: string, options: { encryptedPassword? : models.AsymmetricEncryptedSecret, shareAccessRights? : models.ShareAccessRight[], customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the user on a databox edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the user on a databox edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName: string, name: string, resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(deviceName: string, name: string, resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns all the users registered in a data box edge/gateway device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns all the users registered in a data box edge/gateway device. + * + * @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 {UserList} - 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. + * + * {UserList} [result] - The deserialized result object if an error did not occur. + * See {@link UserList} 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. + */ + listByDataBoxEdgeDeviceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDataBoxEdgeDeviceNext(nextPageLink: string, callback: ServiceCallback): void; + listByDataBoxEdgeDeviceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/edgegatewayManagement/lib/operations/index.js b/lib/services/edgegatewayManagement/lib/operations/index.js new file mode 100644 index 0000000000..db5e505f00 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/index.js @@ -0,0 +1,27 @@ +/* + * 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.Operations = require('./operations'); +exports.Devices = require('./devices'); +exports.Alerts = require('./alerts'); +exports.BandwidthSchedules = require('./bandwidthSchedules'); +exports.OperationsStatus = require('./operationsStatus'); +exports.Orders = require('./orders'); +exports.Roles = require('./roles'); +exports.Shares = require('./shares'); +exports.StorageAccountCredentials = require('./storageAccountCredentials'); +exports.Triggers = require('./triggers'); +exports.Users = require('./users'); diff --git a/lib/services/edgegatewayManagement/lib/operations/operations.js b/lib/services/edgegatewayManagement/lib/operations/operations.js new file mode 100644 index 0000000000..8976860479 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/operations.js @@ -0,0 +1,449 @@ +/* + * 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; + +/** + * @summary Lists all the operations supported. + * + * @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 OperationsList} 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.DataBoxEdge/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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['OperationsList']().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); + }); +} + +/** + * @summary Lists all the operations supported. + * + * @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 OperationsList} 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['OperationsList']().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 {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * @summary Lists all the operations supported. + * + * @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; + }); + }); + } + + /** + * @summary Lists all the operations supported. + * + * @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 {OperationsList} - 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 OperationsList} 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); + } + } + + /** + * @summary Lists all the operations supported. + * + * @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; + }); + }); + } + + /** + * @summary Lists all the operations supported. + * + * @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 {OperationsList} - 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 OperationsList} 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/edgegatewayManagement/lib/operations/operationsStatus.js b/lib/services/edgegatewayManagement/lib/operations/operationsStatus.js new file mode 100644 index 0000000000..3560b89d43 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/operationsStatus.js @@ -0,0 +1,274 @@ +/* + * 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; + +/** + * @summary Returns the job details of the specified job on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The job name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Job} 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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['Job']().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 OperationsStatus. */ +class OperationsStatus { + /** + * Create a OperationsStatus. + * @param {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + } + + /** + * @summary Returns the job details of the specified job on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The job name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Returns the job details of the specified job on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The job name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Job} - 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 Job} 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(deviceName, name, 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._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + +} + +module.exports = OperationsStatus; diff --git a/lib/services/edgegatewayManagement/lib/operations/orders.js b/lib/services/edgegatewayManagement/lib/operations/orders.js new file mode 100644 index 0000000000..fad37d82ae --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/orders.js @@ -0,0 +1,1751 @@ +/* + * 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; + +/** + * @summary List all the orders related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 OrderList} 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 _listByDataBoxEdgeDevice(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['OrderList']().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); + }); +} + +/** + * @summary Get a specific order by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Order} 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(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['Order']().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); + }); +} + + +/** + * @summary Creates or updates an order. + * + * @param {string} deviceName Name of the edge device for which order needs to + * be added or updated. + * + * @param {object} order Order to be added. + * + * @param {object} [order.contactInformation] The contact details. + * + * @param {string} order.contactInformation.contactPerson Gets or sets the + * contact person. + * + * @param {string} order.contactInformation.companyName Gets or sets the name + * of the company. + * + * @param {string} order.contactInformation.phone Gets or sets the phone + * number. + * + * @param {array} order.contactInformation.emailList Gets or sets the email + * list. + * + * @param {object} [order.shippingAddress] The shipping address. + * + * @param {string} order.shippingAddress.addressLine1 The address line1. + * + * @param {string} order.shippingAddress.addressLine2 The address line2. + * + * @param {string} order.shippingAddress.addressLine3 The address line3. + * + * @param {string} order.shippingAddress.postalCode The postal code. + * + * @param {string} order.shippingAddress.city The city name. + * + * @param {string} order.shippingAddress.state The state name. + * + * @param {string} order.shippingAddress.country The country name. + * + * @param {object} [order.changeStatusTo] Current status of the Order. + * + * @param {string} order.changeStatusTo.status Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * + * @param {string} [order.changeStatusTo.comments] Comments related to this + * status change. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Order} 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(deviceName, order, 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.'); + } + + // Send request + this.beginCreateOrUpdate(deviceName, order, resourceGroupName, 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['Order']().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); + }); + }); +} + + +/** + * @summary Deletes the order related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, 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.'); + } + + // Send request + this.beginDeleteMethod(deviceName, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * @summary Creates or updates an order. + * + * @param {string} deviceName Name of the edge device for which order needs to + * be added or updated. + * + * @param {object} order Order to be added. + * + * @param {object} [order.contactInformation] The contact details. + * + * @param {string} order.contactInformation.contactPerson Gets or sets the + * contact person. + * + * @param {string} order.contactInformation.companyName Gets or sets the name + * of the company. + * + * @param {string} order.contactInformation.phone Gets or sets the phone + * number. + * + * @param {array} order.contactInformation.emailList Gets or sets the email + * list. + * + * @param {object} [order.shippingAddress] The shipping address. + * + * @param {string} order.shippingAddress.addressLine1 The address line1. + * + * @param {string} order.shippingAddress.addressLine2 The address line2. + * + * @param {string} order.shippingAddress.addressLine3 The address line3. + * + * @param {string} order.shippingAddress.postalCode The postal code. + * + * @param {string} order.shippingAddress.city The city name. + * + * @param {string} order.shippingAddress.state The state name. + * + * @param {string} order.shippingAddress.country The country name. + * + * @param {object} [order.changeStatusTo] Current status of the Order. + * + * @param {string} order.changeStatusTo.status Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * + * @param {string} [order.changeStatusTo.comments] Comments related to this + * status change. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Order} 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(deviceName, order, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (order === null || order === undefined) { + throw new Error('order cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (order !== null && order !== undefined) { + let requestModelMapper = new client.models['Order']().mapper(); + requestModel = client.serialize(requestModelMapper, order, 'order'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(order, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['Order']().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); + }); +} + +/** + * @summary Deletes the order related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List all the orders related to the device. + * + * @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 OrderList} 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 _listByDataBoxEdgeDeviceNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['OrderList']().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 Orders. */ +class Orders { + /** + * Create a Orders. + * @param {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByDataBoxEdgeDevice = _listByDataBoxEdgeDevice; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByDataBoxEdgeDeviceNext = _listByDataBoxEdgeDeviceNext; + } + + /** + * @summary List all the orders related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List all the orders related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {OrderList} - 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 OrderList} 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. + */ + listByDataBoxEdgeDevice(deviceName, 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._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Get a specific order by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Get a specific order by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Order} - 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 Order} 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(deviceName, 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._get(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Creates or updates an order. + * + * @param {string} deviceName Name of the edge device for which order needs to + * be added or updated. + * + * @param {object} order Order to be added. + * + * @param {object} [order.contactInformation] The contact details. + * + * @param {string} order.contactInformation.contactPerson Gets or sets the + * contact person. + * + * @param {string} order.contactInformation.companyName Gets or sets the name + * of the company. + * + * @param {string} order.contactInformation.phone Gets or sets the phone + * number. + * + * @param {array} order.contactInformation.emailList Gets or sets the email + * list. + * + * @param {object} [order.shippingAddress] The shipping address. + * + * @param {string} order.shippingAddress.addressLine1 The address line1. + * + * @param {string} order.shippingAddress.addressLine2 The address line2. + * + * @param {string} order.shippingAddress.addressLine3 The address line3. + * + * @param {string} order.shippingAddress.postalCode The postal code. + * + * @param {string} order.shippingAddress.city The city name. + * + * @param {string} order.shippingAddress.state The state name. + * + * @param {string} order.shippingAddress.country The country name. + * + * @param {object} [order.changeStatusTo] Current status of the Order. + * + * @param {string} order.changeStatusTo.status Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * + * @param {string} [order.changeStatusTo.comments] Comments related to this + * status change. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, order, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(deviceName, order, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates an order. + * + * @param {string} deviceName Name of the edge device for which order needs to + * be added or updated. + * + * @param {object} order Order to be added. + * + * @param {object} [order.contactInformation] The contact details. + * + * @param {string} order.contactInformation.contactPerson Gets or sets the + * contact person. + * + * @param {string} order.contactInformation.companyName Gets or sets the name + * of the company. + * + * @param {string} order.contactInformation.phone Gets or sets the phone + * number. + * + * @param {array} order.contactInformation.emailList Gets or sets the email + * list. + * + * @param {object} [order.shippingAddress] The shipping address. + * + * @param {string} order.shippingAddress.addressLine1 The address line1. + * + * @param {string} order.shippingAddress.addressLine2 The address line2. + * + * @param {string} order.shippingAddress.addressLine3 The address line3. + * + * @param {string} order.shippingAddress.postalCode The postal code. + * + * @param {string} order.shippingAddress.city The city name. + * + * @param {string} order.shippingAddress.state The state name. + * + * @param {string} order.shippingAddress.country The country name. + * + * @param {object} [order.changeStatusTo] Current status of the Order. + * + * @param {string} order.changeStatusTo.status Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * + * @param {string} [order.changeStatusTo.comments] Comments related to this + * status change. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Order} - 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 Order} 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(deviceName, order, 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._createOrUpdate(deviceName, order, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(deviceName, order, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Deletes the order related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes the order related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, 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._deleteMethod(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Creates or updates an order. + * + * @param {string} deviceName Name of the edge device for which order needs to + * be added or updated. + * + * @param {object} order Order to be added. + * + * @param {object} [order.contactInformation] The contact details. + * + * @param {string} order.contactInformation.contactPerson Gets or sets the + * contact person. + * + * @param {string} order.contactInformation.companyName Gets or sets the name + * of the company. + * + * @param {string} order.contactInformation.phone Gets or sets the phone + * number. + * + * @param {array} order.contactInformation.emailList Gets or sets the email + * list. + * + * @param {object} [order.shippingAddress] The shipping address. + * + * @param {string} order.shippingAddress.addressLine1 The address line1. + * + * @param {string} order.shippingAddress.addressLine2 The address line2. + * + * @param {string} order.shippingAddress.addressLine3 The address line3. + * + * @param {string} order.shippingAddress.postalCode The postal code. + * + * @param {string} order.shippingAddress.city The city name. + * + * @param {string} order.shippingAddress.state The state name. + * + * @param {string} order.shippingAddress.country The country name. + * + * @param {object} [order.changeStatusTo] Current status of the Order. + * + * @param {string} order.changeStatusTo.status Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * + * @param {string} [order.changeStatusTo.comments] Comments related to this + * status change. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, order, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(deviceName, order, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates an order. + * + * @param {string} deviceName Name of the edge device for which order needs to + * be added or updated. + * + * @param {object} order Order to be added. + * + * @param {object} [order.contactInformation] The contact details. + * + * @param {string} order.contactInformation.contactPerson Gets or sets the + * contact person. + * + * @param {string} order.contactInformation.companyName Gets or sets the name + * of the company. + * + * @param {string} order.contactInformation.phone Gets or sets the phone + * number. + * + * @param {array} order.contactInformation.emailList Gets or sets the email + * list. + * + * @param {object} [order.shippingAddress] The shipping address. + * + * @param {string} order.shippingAddress.addressLine1 The address line1. + * + * @param {string} order.shippingAddress.addressLine2 The address line2. + * + * @param {string} order.shippingAddress.addressLine3 The address line3. + * + * @param {string} order.shippingAddress.postalCode The postal code. + * + * @param {string} order.shippingAddress.city The city name. + * + * @param {string} order.shippingAddress.state The state name. + * + * @param {string} order.shippingAddress.country The country name. + * + * @param {object} [order.changeStatusTo] Current status of the Order. + * + * @param {string} order.changeStatusTo.status Status of the order pertaining + * to the allowed StatusTypes. Possible values include: 'Untracked', + * 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', + * 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', + * 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', + * 'CollectedAtMicrosoft' + * + * @param {string} [order.changeStatusTo.comments] Comments related to this + * status change. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Order} - 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 Order} 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(deviceName, order, 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._beginCreateOrUpdate(deviceName, order, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(deviceName, order, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Deletes the order related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes the order related to the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, 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._beginDeleteMethod(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary List all the orders related to the device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List all the orders related to the device. + * + * @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 {OrderList} - 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 OrderList} 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. + */ + listByDataBoxEdgeDeviceNext(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._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDeviceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Orders; diff --git a/lib/services/edgegatewayManagement/lib/operations/roles.js b/lib/services/edgegatewayManagement/lib/operations/roles.js new file mode 100644 index 0000000000..5e9232ef22 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/roles.js @@ -0,0 +1,1553 @@ +/* + * 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 the roles configured in a data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 RoleList} 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 _listByDataBoxEdgeDevice(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['RoleList']().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 a specific role by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of role to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Role} 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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['Role']().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 a role. + * + * @param {string} deviceName Name of the device in which the role needs to be + * added or updated. + * + * @param {string} name Name of the role to be updated. + * + * @param {object} role Role to be added. + * + * @param {string} role.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Role} 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(deviceName, name, role, 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.'); + } + + // Send request + this.beginCreateOrUpdate(deviceName, name, role, resourceGroupName, 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['Role']().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); + }); + }); +} + + +/** + * Deletes the role on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the role which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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.'); + } + + // Send request + this.beginDeleteMethod(deviceName, name, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Create or update a role. + * + * @param {string} deviceName Name of the device in which the role needs to be + * added or updated. + * + * @param {string} name Name of the role to be updated. + * + * @param {object} role Role to be added. + * + * @param {string} role.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Role} 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(deviceName, name, role, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (role === null || role === undefined) { + throw new Error('role cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (role !== null && role !== undefined) { + let requestModelMapper = new client.models['Role']().mapper(); + requestModel = client.serialize(requestModelMapper, role, 'role'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(role, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['Role']().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); + }); +} + +/** + * Deletes the role on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the role which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the roles configured in a data box edge/gateway device. + * + * @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 RoleList} 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 _listByDataBoxEdgeDeviceNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['RoleList']().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 Roles. */ +class Roles { + /** + * Create a Roles. + * @param {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByDataBoxEdgeDevice = _listByDataBoxEdgeDevice; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByDataBoxEdgeDeviceNext = _listByDataBoxEdgeDeviceNext; + } + + /** + * Lists all the roles configured in a data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, 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 the roles configured in a data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {RoleList} - 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 RoleList} 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. + */ + listByDataBoxEdgeDevice(deviceName, 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._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Get a specific role by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of role to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(deviceName, name, 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 a specific role by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of role to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Role} - 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 Role} 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(deviceName, name, 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._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Create or update a role. + * + * @param {string} deviceName Name of the device in which the role needs to be + * added or updated. + * + * @param {string} name Name of the role to be updated. + * + * @param {object} role Role to be added. + * + * @param {string} role.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, role, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(deviceName, name, role, resourceGroupName, 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 a role. + * + * @param {string} deviceName Name of the device in which the role needs to be + * added or updated. + * + * @param {string} name Name of the role to be updated. + * + * @param {object} role Role to be added. + * + * @param {string} role.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Role} - 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 Role} 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(deviceName, name, role, 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._createOrUpdate(deviceName, name, role, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(deviceName, name, role, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the role on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the role which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the role on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the role which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Create or update a role. + * + * @param {string} deviceName Name of the device in which the role needs to be + * added or updated. + * + * @param {string} name Name of the role to be updated. + * + * @param {object} role Role to be added. + * + * @param {string} role.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, role, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(deviceName, name, role, resourceGroupName, 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 a role. + * + * @param {string} deviceName Name of the device in which the role needs to be + * added or updated. + * + * @param {string} name Name of the role to be updated. + * + * @param {object} role Role to be added. + * + * @param {string} role.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Role} - 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 Role} 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(deviceName, name, role, 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._beginCreateOrUpdate(deviceName, name, role, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(deviceName, name, role, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the role on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the role which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the role on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the role which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Lists all the roles configured in a data box edge/gateway device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDeviceNext(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 the roles configured in a data box edge/gateway device. + * + * @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 {RoleList} - 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 RoleList} 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. + */ + listByDataBoxEdgeDeviceNext(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._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDeviceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Roles; diff --git a/lib/services/edgegatewayManagement/lib/operations/shares.js b/lib/services/edgegatewayManagement/lib/operations/shares.js new file mode 100644 index 0000000000..6eec4d7604 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/shares.js @@ -0,0 +1,2249 @@ +/* + * 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; + +/** + * @summary Lists all the shares in a data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 ShareList} 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 _listByDataBoxEdgeDevice(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['ShareList']().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); + }); +} + +/** + * @summary Returns a particular share by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Share} 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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['Share']().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); + }); +} + + +/** + * @summary Creates a new share or update an existing share on the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be added/updated. + * + * @param {object} share The share object containing the share details. + * + * @param {string} [share.description] Description for the share. + * + * @param {string} share.shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * + * @param {string} share.monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [share.azureContainerInfo] Azure container mapping for the + * share. + * + * @param {string} share.azureContainerInfo.storageAccountCredentialId ID of + * the Storage account credential to be used for accessing storage. + * + * @param {string} share.azureContainerInfo.containerName Container name (Based + * on the data format specified, represents the name of Azure file/ Page blob / + * Block blob). + * + * @param {string} share.azureContainerInfo.dataFormat Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * + * @param {string} share.accessProtocol Access protocol to be used by the + * share. Possible values include: 'SMB', 'NFS' + * + * @param {array} [share.userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * + * @param {array} [share.clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * + * @param {object} [share.refreshDetails] Details of the refresh job on this + * share. + * + * @param {string} [share.refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * + * @param {date} [share.refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Share} 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(deviceName, name, share, 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.'); + } + + // Send request + this.beginCreateOrUpdate(deviceName, name, share, resourceGroupName, 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['Share']().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); + }); + }); +} + + +/** + * Deletes the share on the data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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.'); + } + + // Send request + this.beginDeleteMethod(deviceName, name, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * @summary Triggers a manual refresh of the share metadata with the actual + * cloud storage account. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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 _refresh(deviceName, name, 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.'); + } + + // Send request + this.beginRefresh(deviceName, name, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * @summary Creates a new share or update an existing share on the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be added/updated. + * + * @param {object} share The share object containing the share details. + * + * @param {string} [share.description] Description for the share. + * + * @param {string} share.shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * + * @param {string} share.monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [share.azureContainerInfo] Azure container mapping for the + * share. + * + * @param {string} share.azureContainerInfo.storageAccountCredentialId ID of + * the Storage account credential to be used for accessing storage. + * + * @param {string} share.azureContainerInfo.containerName Container name (Based + * on the data format specified, represents the name of Azure file/ Page blob / + * Block blob). + * + * @param {string} share.azureContainerInfo.dataFormat Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * + * @param {string} share.accessProtocol Access protocol to be used by the + * share. Possible values include: 'SMB', 'NFS' + * + * @param {array} [share.userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * + * @param {array} [share.clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * + * @param {object} [share.refreshDetails] Details of the refresh job on this + * share. + * + * @param {string} [share.refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * + * @param {date} [share.refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Share} 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(deviceName, name, share, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (share === null || share === undefined) { + throw new Error('share cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (share !== null && share !== undefined) { + let requestModelMapper = new client.models['Share']().mapper(); + requestModel = client.serialize(requestModelMapper, share, 'share'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(share, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['Share']().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); + }); +} + +/** + * Deletes the share on the data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Triggers a manual refresh of the share metadata with the actual + * cloud storage account. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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 _beginRefresh(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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]; + } + } + } + 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) { + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists all the shares in a data box edge/gateway device. + * + * @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 ShareList} 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 _listByDataBoxEdgeDeviceNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['ShareList']().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 Shares. */ +class Shares { + /** + * Create a Shares. + * @param {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByDataBoxEdgeDevice = _listByDataBoxEdgeDevice; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._refresh = _refresh; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginRefresh = _beginRefresh; + this._listByDataBoxEdgeDeviceNext = _listByDataBoxEdgeDeviceNext; + } + + /** + * @summary Lists all the shares in a data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists all the shares in a data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {ShareList} - 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 ShareList} 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. + */ + listByDataBoxEdgeDevice(deviceName, 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._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Returns a particular share by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Returns a particular share by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Share} - 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 Share} 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(deviceName, name, 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._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Creates a new share or update an existing share on the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be added/updated. + * + * @param {object} share The share object containing the share details. + * + * @param {string} [share.description] Description for the share. + * + * @param {string} share.shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * + * @param {string} share.monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [share.azureContainerInfo] Azure container mapping for the + * share. + * + * @param {string} share.azureContainerInfo.storageAccountCredentialId ID of + * the Storage account credential to be used for accessing storage. + * + * @param {string} share.azureContainerInfo.containerName Container name (Based + * on the data format specified, represents the name of Azure file/ Page blob / + * Block blob). + * + * @param {string} share.azureContainerInfo.dataFormat Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * + * @param {string} share.accessProtocol Access protocol to be used by the + * share. Possible values include: 'SMB', 'NFS' + * + * @param {array} [share.userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * + * @param {array} [share.clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * + * @param {object} [share.refreshDetails] Details of the refresh job on this + * share. + * + * @param {string} [share.refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * + * @param {date} [share.refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, share, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(deviceName, name, share, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates a new share or update an existing share on the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be added/updated. + * + * @param {object} share The share object containing the share details. + * + * @param {string} [share.description] Description for the share. + * + * @param {string} share.shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * + * @param {string} share.monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [share.azureContainerInfo] Azure container mapping for the + * share. + * + * @param {string} share.azureContainerInfo.storageAccountCredentialId ID of + * the Storage account credential to be used for accessing storage. + * + * @param {string} share.azureContainerInfo.containerName Container name (Based + * on the data format specified, represents the name of Azure file/ Page blob / + * Block blob). + * + * @param {string} share.azureContainerInfo.dataFormat Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * + * @param {string} share.accessProtocol Access protocol to be used by the + * share. Possible values include: 'SMB', 'NFS' + * + * @param {array} [share.userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * + * @param {array} [share.clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * + * @param {object} [share.refreshDetails] Details of the refresh job on this + * share. + * + * @param {string} [share.refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * + * @param {date} [share.refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Share} - 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 Share} 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(deviceName, name, share, 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._createOrUpdate(deviceName, name, share, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(deviceName, name, share, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the share on the data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the share on the data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Triggers a manual refresh of the share metadata with the actual + * cloud storage account. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + refreshWithHttpOperationResponse(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._refresh(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Triggers a manual refresh of the share metadata with the actual + * cloud storage account. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + refresh(deviceName, name, 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._refresh(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._refresh(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Creates a new share or update an existing share on the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be added/updated. + * + * @param {object} share The share object containing the share details. + * + * @param {string} [share.description] Description for the share. + * + * @param {string} share.shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * + * @param {string} share.monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [share.azureContainerInfo] Azure container mapping for the + * share. + * + * @param {string} share.azureContainerInfo.storageAccountCredentialId ID of + * the Storage account credential to be used for accessing storage. + * + * @param {string} share.azureContainerInfo.containerName Container name (Based + * on the data format specified, represents the name of Azure file/ Page blob / + * Block blob). + * + * @param {string} share.azureContainerInfo.dataFormat Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * + * @param {string} share.accessProtocol Access protocol to be used by the + * share. Possible values include: 'SMB', 'NFS' + * + * @param {array} [share.userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * + * @param {array} [share.clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * + * @param {object} [share.refreshDetails] Details of the refresh job on this + * share. + * + * @param {string} [share.refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * + * @param {date} [share.refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, share, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(deviceName, name, share, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates a new share or update an existing share on the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be added/updated. + * + * @param {object} share The share object containing the share details. + * + * @param {string} [share.description] Description for the share. + * + * @param {string} share.shareStatus Current status of the share. Possible + * values include: 'Online', 'Offline' + * + * @param {string} share.monitoringStatus Current monitoring status of the + * share. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [share.azureContainerInfo] Azure container mapping for the + * share. + * + * @param {string} share.azureContainerInfo.storageAccountCredentialId ID of + * the Storage account credential to be used for accessing storage. + * + * @param {string} share.azureContainerInfo.containerName Container name (Based + * on the data format specified, represents the name of Azure file/ Page blob / + * Block blob). + * + * @param {string} share.azureContainerInfo.dataFormat Storage format used for + * the file represented by the share. Possible values include: 'BlockBlob', + * 'PageBlob', 'AzureFile' + * + * @param {string} share.accessProtocol Access protocol to be used by the + * share. Possible values include: 'SMB', 'NFS' + * + * @param {array} [share.userAccessRights] Mapping of Users and corresponding + * access rights on the share (mandatory for SMB protocol). + * + * @param {array} [share.clientAccessRights] List of IP addresses and + * corresponding access rights on the share(mandatory for NFS protocol). + * + * @param {object} [share.refreshDetails] Details of the refresh job on this + * share. + * + * @param {string} [share.refreshDetails.inProgressRefreshJobId] If a + * RefreshShare job is currently inprogress on this share - this field + * indicates the ArmId of that job. Empty otherwise. + * + * @param {date} [share.refreshDetails.lastCompletedRefreshJobTimeInUTC] + * Indicates the job completed time of the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.errorManifestFile] Indicates the + * relative path of the error xml for the last refresh job on this particular + * share, if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.refreshDetails.lastJob] Indicates the id of the last + * refresh job on this particular share,if any. + * This could be a failed job or a successful job. + * + * @param {string} [share.dataPolicy] Data policy of the share. Possible values + * include: 'Cloud', 'Local' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Share} - 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 Share} 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(deviceName, name, share, 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._beginCreateOrUpdate(deviceName, name, share, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(deviceName, name, share, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the share on the data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the share on the data box edge/gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Triggers a manual refresh of the share metadata with the actual + * cloud storage account. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + beginRefreshWithHttpOperationResponse(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginRefresh(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Triggers a manual refresh of the share metadata with the actual + * cloud storage account. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the share. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginRefresh(deviceName, name, 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._beginRefresh(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginRefresh(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Lists all the shares in a data box edge/gateway device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists all the shares in a data box edge/gateway device. + * + * @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 {ShareList} - 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 ShareList} 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. + */ + listByDataBoxEdgeDeviceNext(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._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDeviceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Shares; diff --git a/lib/services/edgegatewayManagement/lib/operations/storageAccountCredentials.js b/lib/services/edgegatewayManagement/lib/operations/storageAccountCredentials.js new file mode 100644 index 0000000000..991db54dc1 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/storageAccountCredentials.js @@ -0,0 +1,1761 @@ +/* + * 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; + +/** + * @summary Gets all the storage account credentials in a data box edge/gateway + * device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 StorageAccountCredentialList} 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 _listByDataBoxEdgeDevice(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['StorageAccountCredentialList']().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); + }); +} + +/** + * Gets the properties of the specified storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 StorageAccountCredential} 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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['StorageAccountCredential']().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); + }); +} + + +/** + * Creates or updates the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name The storage account credential name. + * + * @param {object} storageAccountCredential The storage account credential to + * be added or updated. + * + * @param {string} storageAccountCredential.alias Alias for the storage + * account. + * + * @param {string} [storageAccountCredential.userName] UserName for the storage + * account. + * + * @param {object} [storageAccountCredential.accountKey] Encrypted storage key. + * + * @param {string} storageAccountCredential.accountKey.value The value of the + * secret. + * + * @param {string} + * [storageAccountCredential.accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} storageAccountCredential.accountKey.encryptionAlgorithm The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * + * @param {string} [storageAccountCredential.connectionString] ConnectionString + * for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + * + * @param {string} storageAccountCredential.sslStatus Signifies whether SSL + * needs to be enabled or not. Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [storageAccountCredential.blobDomainName] Blob end point for + * private clouds. + * + * @param {string} storageAccountCredential.accountType Type of storage + * accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 StorageAccountCredential} 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(deviceName, name, storageAccountCredential, 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.'); + } + + // Send request + this.beginCreateOrUpdate(deviceName, name, storageAccountCredential, resourceGroupName, 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['StorageAccountCredential']().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); + }); + }); +} + + +/** + * Deletes the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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.'); + } + + // Send request + this.beginDeleteMethod(deviceName, name, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates or updates the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name The storage account credential name. + * + * @param {object} storageAccountCredential The storage account credential to + * be added or updated. + * + * @param {string} storageAccountCredential.alias Alias for the storage + * account. + * + * @param {string} [storageAccountCredential.userName] UserName for the storage + * account. + * + * @param {object} [storageAccountCredential.accountKey] Encrypted storage key. + * + * @param {string} storageAccountCredential.accountKey.value The value of the + * secret. + * + * @param {string} + * [storageAccountCredential.accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} storageAccountCredential.accountKey.encryptionAlgorithm The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * + * @param {string} [storageAccountCredential.connectionString] ConnectionString + * for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + * + * @param {string} storageAccountCredential.sslStatus Signifies whether SSL + * needs to be enabled or not. Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [storageAccountCredential.blobDomainName] Blob end point for + * private clouds. + * + * @param {string} storageAccountCredential.accountType Type of storage + * accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 StorageAccountCredential} 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(deviceName, name, storageAccountCredential, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (storageAccountCredential === null || storageAccountCredential === undefined) { + throw new Error('storageAccountCredential cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (storageAccountCredential !== null && storageAccountCredential !== undefined) { + let requestModelMapper = new client.models['StorageAccountCredential']().mapper(); + requestModel = client.serialize(requestModelMapper, storageAccountCredential, 'storageAccountCredential'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(storageAccountCredential, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['StorageAccountCredential']().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); + }); +} + +/** + * Deletes the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets all the storage account credentials in a data box edge/gateway + * device. + * + * @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 StorageAccountCredentialList} 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 _listByDataBoxEdgeDeviceNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['StorageAccountCredentialList']().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 StorageAccountCredentials. */ +class StorageAccountCredentials { + /** + * Create a StorageAccountCredentials. + * @param {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByDataBoxEdgeDevice = _listByDataBoxEdgeDevice; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByDataBoxEdgeDeviceNext = _listByDataBoxEdgeDeviceNext; + } + + /** + * @summary Gets all the storage account credentials in a data box edge/gateway + * device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the storage account credentials in a data box edge/gateway + * device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {StorageAccountCredentialList} - 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 StorageAccountCredentialList} 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. + */ + listByDataBoxEdgeDevice(deviceName, 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._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets the properties of the specified storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the properties of the specified storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {StorageAccountCredential} - 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 StorageAccountCredential} 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(deviceName, name, 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._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name The storage account credential name. + * + * @param {object} storageAccountCredential The storage account credential to + * be added or updated. + * + * @param {string} storageAccountCredential.alias Alias for the storage + * account. + * + * @param {string} [storageAccountCredential.userName] UserName for the storage + * account. + * + * @param {object} [storageAccountCredential.accountKey] Encrypted storage key. + * + * @param {string} storageAccountCredential.accountKey.value The value of the + * secret. + * + * @param {string} + * [storageAccountCredential.accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} storageAccountCredential.accountKey.encryptionAlgorithm The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * + * @param {string} [storageAccountCredential.connectionString] ConnectionString + * for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + * + * @param {string} storageAccountCredential.sslStatus Signifies whether SSL + * needs to be enabled or not. Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [storageAccountCredential.blobDomainName] Blob end point for + * private clouds. + * + * @param {string} storageAccountCredential.accountType Type of storage + * accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, storageAccountCredential, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(deviceName, name, storageAccountCredential, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name The storage account credential name. + * + * @param {object} storageAccountCredential The storage account credential to + * be added or updated. + * + * @param {string} storageAccountCredential.alias Alias for the storage + * account. + * + * @param {string} [storageAccountCredential.userName] UserName for the storage + * account. + * + * @param {object} [storageAccountCredential.accountKey] Encrypted storage key. + * + * @param {string} storageAccountCredential.accountKey.value The value of the + * secret. + * + * @param {string} + * [storageAccountCredential.accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} storageAccountCredential.accountKey.encryptionAlgorithm The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * + * @param {string} [storageAccountCredential.connectionString] ConnectionString + * for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + * + * @param {string} storageAccountCredential.sslStatus Signifies whether SSL + * needs to be enabled or not. Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [storageAccountCredential.blobDomainName] Blob end point for + * private clouds. + * + * @param {string} storageAccountCredential.accountType Type of storage + * accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {StorageAccountCredential} - 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 StorageAccountCredential} 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(deviceName, name, storageAccountCredential, 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._createOrUpdate(deviceName, name, storageAccountCredential, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(deviceName, name, storageAccountCredential, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name The storage account credential name. + * + * @param {object} storageAccountCredential The storage account credential to + * be added or updated. + * + * @param {string} storageAccountCredential.alias Alias for the storage + * account. + * + * @param {string} [storageAccountCredential.userName] UserName for the storage + * account. + * + * @param {object} [storageAccountCredential.accountKey] Encrypted storage key. + * + * @param {string} storageAccountCredential.accountKey.value The value of the + * secret. + * + * @param {string} + * [storageAccountCredential.accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} storageAccountCredential.accountKey.encryptionAlgorithm The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * + * @param {string} [storageAccountCredential.connectionString] ConnectionString + * for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + * + * @param {string} storageAccountCredential.sslStatus Signifies whether SSL + * needs to be enabled or not. Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [storageAccountCredential.blobDomainName] Blob end point for + * private clouds. + * + * @param {string} storageAccountCredential.accountType Type of storage + * accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, storageAccountCredential, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(deviceName, name, storageAccountCredential, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name The storage account credential name. + * + * @param {object} storageAccountCredential The storage account credential to + * be added or updated. + * + * @param {string} storageAccountCredential.alias Alias for the storage + * account. + * + * @param {string} [storageAccountCredential.userName] UserName for the storage + * account. + * + * @param {object} [storageAccountCredential.accountKey] Encrypted storage key. + * + * @param {string} storageAccountCredential.accountKey.value The value of the + * secret. + * + * @param {string} + * [storageAccountCredential.accountKey.encryptionCertThumbprint] Thumbprint + * certificate that was used to encrypt "Value". If the value in unencrypted, + * it will be null. + * + * @param {string} storageAccountCredential.accountKey.encryptionAlgorithm The + * algorithm used to encrypt "Value". Possible values include: 'None', + * 'AES256', 'RSAES_PKCS1_v_1_5' + * + * @param {string} [storageAccountCredential.connectionString] ConnectionString + * for the storage account. This needs to be specified if UserName/AccountKey + * are not specified. + * + * @param {string} storageAccountCredential.sslStatus Signifies whether SSL + * needs to be enabled or not. Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [storageAccountCredential.blobDomainName] Blob end point for + * private clouds. + * + * @param {string} storageAccountCredential.accountType Type of storage + * accessed on the storage account. Possible values include: + * 'GeneralPurposeStorage', 'BlobStorage' + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {StorageAccountCredential} - 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 StorageAccountCredential} 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(deviceName, name, storageAccountCredential, 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._beginCreateOrUpdate(deviceName, name, storageAccountCredential, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(deviceName, name, storageAccountCredential, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the storage account credential. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the storage account credential. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Gets all the storage account credentials in a data box edge/gateway + * device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the storage account credentials in a data box edge/gateway + * device. + * + * @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 {StorageAccountCredentialList} - 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 StorageAccountCredentialList} 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. + */ + listByDataBoxEdgeDeviceNext(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._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDeviceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = StorageAccountCredentials; diff --git a/lib/services/edgegatewayManagement/lib/operations/triggers.js b/lib/services/edgegatewayManagement/lib/operations/triggers.js new file mode 100644 index 0000000000..f19f0cd531 --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/triggers.js @@ -0,0 +1,1553 @@ +/* + * 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; + +/** + * List all the triggers configured in the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 TriggerList} 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 _listByDataBoxEdgeDevice(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['TriggerList']().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 a specific trigger by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of trigger to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Trigger} 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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['Trigger']().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 a trigger. + * + * @param {string} deviceName Name of the edge device in which trigger needs to + * be added or updated. + * + * @param {string} name Name of trigger to be added or updated. + * + * @param {object} trigger Trigger to be added. + * + * @param {string} trigger.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Trigger} 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(deviceName, name, trigger, 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.'); + } + + // Send request + this.beginCreateOrUpdate(deviceName, name, trigger, resourceGroupName, 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['Trigger']().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); + }); + }); +} + + +/** + * Deletes the trigger on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the trigger which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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.'); + } + + // Send request + this.beginDeleteMethod(deviceName, name, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Create or update a trigger. + * + * @param {string} deviceName Name of the edge device in which trigger needs to + * be added or updated. + * + * @param {string} name Name of trigger to be added or updated. + * + * @param {object} trigger Trigger to be added. + * + * @param {string} trigger.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 Trigger} 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(deviceName, name, trigger, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (trigger === null || trigger === undefined) { + throw new Error('trigger cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (trigger !== null && trigger !== undefined) { + let requestModelMapper = new client.models['Trigger']().mapper(); + requestModel = client.serialize(requestModelMapper, trigger, 'trigger'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(trigger, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['Trigger']().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); + }); +} + +/** + * Deletes the trigger on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the trigger which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List all the triggers configured in the device. + * + * @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 TriggerList} 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 _listByDataBoxEdgeDeviceNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['TriggerList']().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 Triggers. */ +class Triggers { + /** + * Create a Triggers. + * @param {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByDataBoxEdgeDevice = _listByDataBoxEdgeDevice; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByDataBoxEdgeDeviceNext = _listByDataBoxEdgeDeviceNext; + } + + /** + * List all the triggers configured in the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List all the triggers configured in the device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {TriggerList} - 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 TriggerList} 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. + */ + listByDataBoxEdgeDevice(deviceName, 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._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Get a specific trigger by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of trigger to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(deviceName, name, 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 a specific trigger by name. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of trigger to be fetched. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Trigger} - 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 Trigger} 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(deviceName, name, 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._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Create or update a trigger. + * + * @param {string} deviceName Name of the edge device in which trigger needs to + * be added or updated. + * + * @param {string} name Name of trigger to be added or updated. + * + * @param {object} trigger Trigger to be added. + * + * @param {string} trigger.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, trigger, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(deviceName, name, trigger, resourceGroupName, 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 a trigger. + * + * @param {string} deviceName Name of the edge device in which trigger needs to + * be added or updated. + * + * @param {string} name Name of trigger to be added or updated. + * + * @param {object} trigger Trigger to be added. + * + * @param {string} trigger.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Trigger} - 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 Trigger} 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(deviceName, name, trigger, 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._createOrUpdate(deviceName, name, trigger, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(deviceName, name, trigger, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the trigger on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the trigger which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the trigger on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the trigger which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Create or update a trigger. + * + * @param {string} deviceName Name of the edge device in which trigger needs to + * be added or updated. + * + * @param {string} name Name of trigger to be added or updated. + * + * @param {object} trigger Trigger to be added. + * + * @param {string} trigger.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, trigger, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(deviceName, name, trigger, resourceGroupName, 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 a trigger. + * + * @param {string} deviceName Name of the edge device in which trigger needs to + * be added or updated. + * + * @param {string} name Name of trigger to be added or updated. + * + * @param {object} trigger Trigger to be added. + * + * @param {string} trigger.kind Polymorphic Discriminator + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {Trigger} - 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 Trigger} 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(deviceName, name, trigger, 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._beginCreateOrUpdate(deviceName, name, trigger, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(deviceName, name, trigger, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the trigger on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the trigger which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the trigger on the gateway device. + * + * @param {string} deviceName Name of the device. + * + * @param {string} name Name of the trigger which needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * List all the triggers configured in the device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List all the triggers configured in the device. + * + * @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 {TriggerList} - 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 TriggerList} 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. + */ + listByDataBoxEdgeDeviceNext(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._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDeviceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Triggers; diff --git a/lib/services/edgegatewayManagement/lib/operations/users.js b/lib/services/edgegatewayManagement/lib/operations/users.js new file mode 100644 index 0000000000..7d770ce2ba --- /dev/null +++ b/lib/services/edgegatewayManagement/lib/operations/users.js @@ -0,0 +1,1634 @@ +/* + * 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; + +/** + * Returns all the users registered in a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 UserList} 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 _listByDataBoxEdgeDevice(deviceName, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['UserList']().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); + }); +} + +/** + * Returns the properties of the specified user. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be retrieved. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 User} 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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['User']().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 a new user or update an existing user's information on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be added/updated. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.encryptedPassword] The details of the password + * specified for the user. + * + * @param {string} options.encryptedPassword.value The value of the secret. + * + * @param {string} [options.encryptedPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * + * @param {string} options.encryptedPassword.encryptionAlgorithm The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @param {array} [options.shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + * + * @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 User} 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(deviceName, name, 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.'); + } + + // Send request + this.beginCreateOrUpdate(deviceName, name, resourceGroupName, 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['User']().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); + }); + }); +} + + +/** + * Deletes the user on a databox edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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.'); + } + + // Send request + this.beginDeleteMethod(deviceName, name, resourceGroupName, 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 + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Create a new user or update an existing user's information on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be added/updated. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.encryptedPassword] The details of the password + * specified for the user. + * + * @param {string} options.encryptedPassword.value The value of the secret. + * + * @param {string} [options.encryptedPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * + * @param {string} options.encryptedPassword.encryptionAlgorithm The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @param {array} [options.shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + * + * @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 User} 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(deviceName, name, 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.'); + } + let encryptedPassword = (options && options.encryptedPassword !== undefined) ? options.encryptedPassword : undefined; + let shareAccessRights = (options && options.shareAccessRights !== undefined) ? options.shareAccessRights : undefined; + // Validate + try { + if (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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); + } + let user = new client.models['User'](); + try { + if ((encryptedPassword !== null && encryptedPassword !== undefined) || (shareAccessRights !== null && shareAccessRights !== undefined)) + { + user.encryptedPassword = encryptedPassword; + user.shareAccessRights = shareAccessRights; + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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 (user !== null && user !== undefined) { + let requestModelMapper = new client.models['User']().mapper(); + requestModel = client.serialize(requestModelMapper, user, 'user'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(user, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['User']().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); + }); +} + +/** + * Deletes the user on a databox edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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 (deviceName === null || deviceName === undefined || typeof deviceName.valueOf() !== 'string') { + throw new Error('deviceName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'; + requestUrl = requestUrl.replace('{deviceName}', encodeURIComponent(deviceName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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 = '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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Returns all the users registered in a data box edge/gateway device. + * + * @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 UserList} 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 _listByDataBoxEdgeDeviceNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().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['UserList']().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 Users. */ +class Users { + /** + * Create a Users. + * @param {DataBoxEdgeManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByDataBoxEdgeDevice = _listByDataBoxEdgeDevice; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByDataBoxEdgeDeviceNext = _listByDataBoxEdgeDeviceNext; + } + + /** + * Returns all the users registered in a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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. + */ + listByDataBoxEdgeDeviceWithHttpOperationResponse(deviceName, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns all the users registered in a data box edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {UserList} - 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 UserList} 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. + */ + listByDataBoxEdgeDevice(deviceName, 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._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDevice(deviceName, resourceGroupName, options, optionalCallback); + } + } + + /** + * Returns the properties of the specified user. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be retrieved. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns the properties of the specified user. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be retrieved. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {User} - 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 User} 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(deviceName, name, 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._get(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Create a new user or update an existing user's information on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be added/updated. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.encryptedPassword] The details of the password + * specified for the user. + * + * @param {string} options.encryptedPassword.value The value of the secret. + * + * @param {string} [options.encryptedPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * + * @param {string} options.encryptedPassword.encryptionAlgorithm The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @param {array} [options.shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new user or update an existing user's information on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be added/updated. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.encryptedPassword] The details of the password + * specified for the user. + * + * @param {string} options.encryptedPassword.value The value of the secret. + * + * @param {string} [options.encryptedPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * + * @param {string} options.encryptedPassword.encryptionAlgorithm The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @param {array} [options.shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + * + * @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 {User} - 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 User} 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(deviceName, name, 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._createOrUpdate(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the user on a databox edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the user on a databox edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._deleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Create a new user or update an existing user's information on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be added/updated. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.encryptedPassword] The details of the password + * specified for the user. + * + * @param {string} options.encryptedPassword.value The value of the secret. + * + * @param {string} [options.encryptedPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * + * @param {string} options.encryptedPassword.encryptionAlgorithm The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @param {array} [options.shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new user or update an existing user's information on a data box + * edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be added/updated. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.encryptedPassword] The details of the password + * specified for the user. + * + * @param {string} options.encryptedPassword.value The value of the secret. + * + * @param {string} [options.encryptedPassword.encryptionCertThumbprint] + * Thumbprint certificate that was used to encrypt "Value". If the value in + * unencrypted, it will be null. + * + * @param {string} options.encryptedPassword.encryptionAlgorithm The algorithm + * used to encrypt "Value". Possible values include: 'None', 'AES256', + * 'RSAES_PKCS1_v_1_5' + * + * @param {array} [options.shareAccessRights] List of shares that the user has + * rights on. This field should not be specified during user creation. + * + * @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 {User} - 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 User} 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(deviceName, name, 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._beginCreateOrUpdate(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the user on a databox edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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(deviceName, name, resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the user on a databox edge/gateway device. + * + * @param {string} deviceName The device name. + * + * @param {string} name The name of the user who needs to be deleted. + * + * @param {string} resourceGroupName The resource group name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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(deviceName, name, 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._beginDeleteMethod(deviceName, name, resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(deviceName, name, resourceGroupName, options, optionalCallback); + } + } + + /** + * Returns all the users registered in a data box edge/gateway device. + * + * @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. + */ + listByDataBoxEdgeDeviceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns all the users registered in a data box edge/gateway device. + * + * @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 {UserList} - 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 UserList} 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. + */ + listByDataBoxEdgeDeviceNext(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._listByDataBoxEdgeDeviceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDataBoxEdgeDeviceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Users; diff --git a/lib/services/edgegatewayManagement/package.json b/lib/services/edgegatewayManagement/package.json new file mode 100644 index 0000000000..790c833097 --- /dev/null +++ b/lib/services/edgegatewayManagement/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-edgegateway", + "author": "Microsoft Corporation", + "description": "DataBoxEdgeManagementClient Library with typescript type definitions for node", + "version": "1.0.0", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ + "node", + "azure" + ], + "license": "MIT", + "main": "./lib/dataBoxEdgeManagementClient.js", + "types": "./lib/dataBoxEdgeManagementClient.d.ts", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/edgegatewayManagement", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-node/issues" + } +}