diff --git a/lib/services/databox/LICENSE.txt b/lib/services/databox/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/databox/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 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/databox/README.md b/lib/services/databox/README.md new file mode 100644 index 0000000000..cc1d63daed --- /dev/null +++ b/lib/services/databox/README.md @@ -0,0 +1,40 @@ +--- +uid: azure-arm-databox +summary: *content + +--- +# Microsoft Azure SDK for Node.js - DataBoxManagementClient +This project provides a Node.js package for accessing Azure. Right now it supports: +- **Node.js version 6.x.x or higher** + +## Features + + +## How to Install + +```bash +npm install azure-arm-databox +``` + +## How to use + +### Authentication, client creation and list operations as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const DataBoxManagementClient = require("azure-arm-databox"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new DataBoxManagementClient(creds, subscriptionId); + return client.operations.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error occurred:'); + console.dir(err, {depth: null, colors: true}); +}); + +## Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/databox/lib/dataBoxManagementClient.d.ts b/lib/services/databox/lib/dataBoxManagementClient.d.ts new file mode 100644 index 0000000000..be7c0f4b6c --- /dev/null +++ b/lib/services/databox/lib/dataBoxManagementClient.d.ts @@ -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. + */ + +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 DataBoxManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the DataBoxManagementClient 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; + jobs: operations.Jobs; + service: operations.Service; +} + +export { DataBoxManagementClient, models as DataBoxManagementModels }; diff --git a/lib/services/databox/lib/dataBoxManagementClient.js b/lib/services/databox/lib/dataBoxManagementClient.js new file mode 100644 index 0000000000..0ecbe860ab --- /dev/null +++ b/lib/services/databox/lib/dataBoxManagementClient.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. + */ + +/* 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 DataBoxManagementClient. */ +class DataBoxManagementClient extends ServiceClient { + /** + * Create a DataBoxManagementClient. + * @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-01-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.jobs = new operations.Jobs(this); + this.service = new operations.Service(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = DataBoxManagementClient; +module.exports['default'] = DataBoxManagementClient; +module.exports.DataBoxManagementClient = DataBoxManagementClient; +module.exports.DataBoxManagementModels = models; diff --git a/lib/services/databox/lib/models/accountCopyLogDetails.js b/lib/services/databox/lib/models/accountCopyLogDetails.js new file mode 100644 index 0000000000..dcf96065ff --- /dev/null +++ b/lib/services/databox/lib/models/accountCopyLogDetails.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'; + +const models = require('./index'); + +/** + * Copy log details for an storage account + * + * @extends models['CopyLogDetails'] + */ +class AccountCopyLogDetails extends models['CopyLogDetails'] { + /** + * Create a AccountCopyLogDetails. + * @member {string} accountName Destination account name. + * @member {string} copyLogLink Link for copy logs. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AccountCopyLogDetails + * + * @returns {object} metadata of AccountCopyLogDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'Pod', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'AccountCopyLogDetails', + modelProperties: { + copyLogDetailsType: { + required: true, + serializedName: 'copyLogDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + accountName: { + required: true, + serializedName: 'accountName', + type: { + name: 'String' + } + }, + copyLogLink: { + required: true, + serializedName: 'copyLogLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AccountCopyLogDetails; diff --git a/lib/services/databox/lib/models/accountCredentialDetails.js b/lib/services/databox/lib/models/accountCredentialDetails.js new file mode 100644 index 0000000000..7e61fc5d4e --- /dev/null +++ b/lib/services/databox/lib/models/accountCredentialDetails.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'; + +const models = require('./index'); + +/** + * Credential details of the account. + * + */ +class AccountCredentialDetails { + /** + * Create a AccountCredentialDetails. + * @member {string} [accountName] Name of the account. + * @member {array} shareCredentialDetails Per share level unencrypted access + * credentials. + */ + constructor() { + } + + /** + * Defines the metadata of AccountCredentialDetails + * + * @returns {object} metadata of AccountCredentialDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'AccountCredentialDetails', + type: { + name: 'Composite', + className: 'AccountCredentialDetails', + modelProperties: { + accountName: { + required: false, + serializedName: 'accountName', + type: { + name: 'String' + } + }, + shareCredentialDetails: { + required: true, + serializedName: 'shareCredentialDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ShareCredentialDetailsElementType', + type: { + name: 'Composite', + className: 'ShareCredentialDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = AccountCredentialDetails; diff --git a/lib/services/databox/lib/models/addressValidationOutput.js b/lib/services/databox/lib/models/addressValidationOutput.js new file mode 100644 index 0000000000..6a714b7a18 --- /dev/null +++ b/lib/services/databox/lib/models/addressValidationOutput.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'; + +const models = require('./index'); + +/** + * Output of the address validation api. + * + */ +class AddressValidationOutput { + /** + * Create a AddressValidationOutput. + * @member {string} [validationStatus] The address validation status. + * Possible values include: 'Valid', 'Invalid', 'Ambiguous' + * @member {array} [alternateAddresses] List of alternate addresses. + */ + constructor() { + } + + /** + * Defines the metadata of AddressValidationOutput + * + * @returns {object} metadata of AddressValidationOutput + * + */ + mapper() { + return { + required: false, + serializedName: 'AddressValidationOutput', + type: { + name: 'Composite', + className: 'AddressValidationOutput', + modelProperties: { + validationStatus: { + required: false, + serializedName: 'properties.validationStatus', + type: { + name: 'Enum', + allowedValues: [ 'Valid', 'Invalid', 'Ambiguous' ] + } + }, + alternateAddresses: { + required: false, + serializedName: 'properties.alternateAddresses', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ShippingAddressElementType', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + } + } + } + } + } + }; + } +} + +module.exports = AddressValidationOutput; diff --git a/lib/services/databox/lib/models/armBaseObject.js b/lib/services/databox/lib/models/armBaseObject.js new file mode 100644 index 0000000000..a20f3e73cf --- /dev/null +++ b/lib/services/databox/lib/models/armBaseObject.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'; + +/** + * Base class for all objects under resource. + * + */ +class ArmBaseObject { + /** + * Create a ArmBaseObject. + * @member {string} [name] Name of the object. + * @member {string} [id] Id of the object. + * @member {string} [type] Type of the object. + */ + constructor() { + } + + /** + * Defines the metadata of ArmBaseObject + * + * @returns {object} metadata of ArmBaseObject + * + */ + mapper() { + return { + required: false, + serializedName: 'ArmBaseObject', + type: { + name: 'Composite', + className: 'ArmBaseObject', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ArmBaseObject; diff --git a/lib/services/databox/lib/models/availableSkuRequest.js b/lib/services/databox/lib/models/availableSkuRequest.js new file mode 100644 index 0000000000..764639e032 --- /dev/null +++ b/lib/services/databox/lib/models/availableSkuRequest.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'; + +/** + * The filters for showing the available skus. + * + */ +class AvailableSkuRequest { + /** + * Create a AvailableSkuRequest. + * @member {string} country ISO country code. Country for hardware shipment. + * For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * @member {string} location Location for data transfer. For locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + */ + constructor() { + } + + /** + * Defines the metadata of AvailableSkuRequest + * + * @returns {object} metadata of AvailableSkuRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'AvailableSkuRequest', + type: { + name: 'Composite', + className: 'AvailableSkuRequest', + modelProperties: { + transferType: { + required: true, + isConstant: true, + serializedName: 'transferType', + defaultValue: 'ImportToAzure', + type: { + name: 'String' + } + }, + country: { + required: true, + serializedName: 'country', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AvailableSkuRequest; diff --git a/lib/services/databox/lib/models/availableSkusResult.js b/lib/services/databox/lib/models/availableSkusResult.js new file mode 100644 index 0000000000..30d34e2ab7 --- /dev/null +++ b/lib/services/databox/lib/models/availableSkusResult.js @@ -0,0 +1,67 @@ +/* + * 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 available skus operation response. + */ +class AvailableSkusResult extends Array { + /** + * Create a AvailableSkusResult. + * @member {string} [nextLink] Link for the next set of skus. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AvailableSkusResult + * + * @returns {object} metadata of AvailableSkusResult + * + */ + mapper() { + return { + required: false, + serializedName: 'AvailableSkusResult', + type: { + name: 'Composite', + className: 'AvailableSkusResult', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SkuInformationElementType', + type: { + name: 'Composite', + className: 'SkuInformation' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AvailableSkusResult; diff --git a/lib/services/databox/lib/models/cabinetJobSecrets.js b/lib/services/databox/lib/models/cabinetJobSecrets.js new file mode 100644 index 0000000000..ea5c5f3cf1 --- /dev/null +++ b/lib/services/databox/lib/models/cabinetJobSecrets.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'; + +const models = require('./index'); + +/** + * The secrets related to a cabinet job. + * + * @extends models['JobSecrets'] + */ +class CabinetJobSecrets extends models['JobSecrets'] { + /** + * Create a CabinetJobSecrets. + * @member {array} [cabinetPodSecrets] Contains the list of secret objects + * for a cabinet job. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of CabinetJobSecrets + * + * @returns {object} metadata of CabinetJobSecrets + * + */ + mapper() { + return { + required: false, + serializedName: 'Cabinet', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobSecretsType', + clientName: 'jobSecretsType' + }, + uberParent: 'JobSecrets', + className: 'CabinetJobSecrets', + modelProperties: { + jobSecretsType: { + required: true, + serializedName: 'jobSecretsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + cabinetPodSecrets: { + required: false, + serializedName: 'cabinetPodSecrets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CabinetPodSecretElementType', + type: { + name: 'Composite', + className: 'CabinetPodSecret' + } + } + } + } + } + } + }; + } +} + +module.exports = CabinetJobSecrets; diff --git a/lib/services/databox/lib/models/cabinetPodSecret.js b/lib/services/databox/lib/models/cabinetPodSecret.js new file mode 100644 index 0000000000..e3750c7098 --- /dev/null +++ b/lib/services/databox/lib/models/cabinetPodSecret.js @@ -0,0 +1,81 @@ +/* + * 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 secrets related to a cabinet pod. + * + */ +class CabinetPodSecret { + /** + * Create a CabinetPodSecret. + * @member {string} [deviceSerialNumber] Serial number of the assigned + * device. + * @member {string} [devicePassword] Password for out of the box experience + * on device. + * @member {array} [accountCredentialDetails] Per account level access + * credentials. + */ + constructor() { + } + + /** + * Defines the metadata of CabinetPodSecret + * + * @returns {object} metadata of CabinetPodSecret + * + */ + mapper() { + return { + required: false, + serializedName: 'CabinetPodSecret', + type: { + name: 'Composite', + className: 'CabinetPodSecret', + modelProperties: { + deviceSerialNumber: { + required: false, + serializedName: 'deviceSerialNumber', + type: { + name: 'String' + } + }, + devicePassword: { + required: false, + serializedName: 'devicePassword', + type: { + name: 'String' + } + }, + accountCredentialDetails: { + required: false, + serializedName: 'accountCredentialDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AccountCredentialDetailsElementType', + type: { + name: 'Composite', + className: 'AccountCredentialDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = CabinetPodSecret; diff --git a/lib/services/databox/lib/models/cancellationReason.js b/lib/services/databox/lib/models/cancellationReason.js new file mode 100644 index 0000000000..ad05bc05e3 --- /dev/null +++ b/lib/services/databox/lib/models/cancellationReason.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'; + +/** + * Reason for cancellation. + * + */ +class CancellationReason { + /** + * Create a CancellationReason. + * @member {string} reason Reason for cancellation. + */ + constructor() { + } + + /** + * Defines the metadata of CancellationReason + * + * @returns {object} metadata of CancellationReason + * + */ + mapper() { + return { + required: false, + serializedName: 'CancellationReason', + type: { + name: 'Composite', + className: 'CancellationReason', + modelProperties: { + reason: { + required: true, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CancellationReason; diff --git a/lib/services/databox/lib/models/contactDetails.js b/lib/services/databox/lib/models/contactDetails.js new file mode 100644 index 0000000000..1d5c8bc645 --- /dev/null +++ b/lib/services/databox/lib/models/contactDetails.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'); + +/** + * Contact Details. + * + */ +class ContactDetails { + /** + * Create a ContactDetails. + * @member {string} [contactName] Contact name of the person. + * @member {string} phone Phone number of the contact person. + * @member {string} [phoneExtension] Phone extension number of the contact + * person. + * @member {string} [mobile] Mobile number of the contact person. + * @member {array} emailList List of Email-ids to be notified about job + * progress. + * @member {array} [notificationPreference] Notification preference for a job + * stage. + */ + constructor() { + } + + /** + * Defines the metadata of ContactDetails + * + * @returns {object} metadata of ContactDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ContactDetails', + type: { + name: 'Composite', + className: 'ContactDetails', + modelProperties: { + contactName: { + required: false, + serializedName: 'contactName', + type: { + name: 'String' + } + }, + phone: { + required: true, + serializedName: 'phone', + type: { + name: 'String' + } + }, + phoneExtension: { + required: false, + serializedName: 'phoneExtension', + type: { + name: 'String' + } + }, + mobile: { + required: false, + serializedName: 'mobile', + type: { + name: 'String' + } + }, + emailList: { + required: true, + serializedName: 'emailList', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + notificationPreference: { + required: false, + serializedName: 'notificationPreference', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NotificationPreferenceElementType', + type: { + name: 'Composite', + className: 'NotificationPreference' + } + } + } + } + } + } + }; + } +} + +module.exports = ContactDetails; diff --git a/lib/services/databox/lib/models/copyLogDetails.js b/lib/services/databox/lib/models/copyLogDetails.js new file mode 100644 index 0000000000..0e75a970ff --- /dev/null +++ b/lib/services/databox/lib/models/copyLogDetails.js @@ -0,0 +1,58 @@ +/* + * 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 for log generated during copy. + * + */ +class CopyLogDetails { + /** + * Create a CopyLogDetails. + * @member {string} copyLogDetailsType Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of CopyLogDetails + * + * @returns {object} metadata of CopyLogDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'CopyLogDetails', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'CopyLogDetails', + modelProperties: { + copyLogDetailsType: { + required: true, + serializedName: 'copyLogDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CopyLogDetails; diff --git a/lib/services/databox/lib/models/copyProgress.js b/lib/services/databox/lib/models/copyProgress.js new file mode 100644 index 0000000000..059996be29 --- /dev/null +++ b/lib/services/databox/lib/models/copyProgress.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'; + +/** + * Copy progress. + * + */ +class CopyProgress { + /** + * Create a CopyProgress. + * @member {string} [storageAccountName] Name of the storage account where + * the data needs to be uploaded. + * @member {number} [bytesSentToCloud] Amount of data uploaded by the job as + * of now. + * @member {number} [totalBytesToProcess] Total amount of data to be + * processed by the job. + */ + constructor() { + } + + /** + * Defines the metadata of CopyProgress + * + * @returns {object} metadata of CopyProgress + * + */ + mapper() { + return { + required: false, + serializedName: 'CopyProgress', + type: { + name: 'Composite', + className: 'CopyProgress', + modelProperties: { + storageAccountName: { + required: false, + serializedName: 'storageAccountName', + type: { + name: 'String' + } + }, + bytesSentToCloud: { + required: false, + serializedName: 'bytesSentToCloud', + type: { + name: 'Number' + } + }, + totalBytesToProcess: { + required: false, + serializedName: 'totalBytesToProcess', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = CopyProgress; diff --git a/lib/services/databox/lib/models/destinationAccountDetails.js b/lib/services/databox/lib/models/destinationAccountDetails.js new file mode 100644 index 0000000000..c1a7a7c680 --- /dev/null +++ b/lib/services/databox/lib/models/destinationAccountDetails.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'; + +/** + * Details for the destination account. + * + */ +class DestinationAccountDetails { + /** + * Create a DestinationAccountDetails. + * @member {string} accountId Destination storage account id. + */ + constructor() { + } + + /** + * Defines the metadata of DestinationAccountDetails + * + * @returns {object} metadata of DestinationAccountDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'DestinationAccountDetails', + type: { + name: 'Composite', + className: 'DestinationAccountDetails', + modelProperties: { + accountId: { + required: true, + serializedName: 'accountId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DestinationAccountDetails; diff --git a/lib/services/databox/lib/models/destinationToServiceLocationMap.js b/lib/services/databox/lib/models/destinationToServiceLocationMap.js new file mode 100644 index 0000000000..3cc7439239 --- /dev/null +++ b/lib/services/databox/lib/models/destinationToServiceLocationMap.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'; + +/** + * Map of destination location to service location + * + */ +class DestinationToServiceLocationMap { + /** + * Create a DestinationToServiceLocationMap. + * @member {string} [destinationLocation] Location of the destination. + * @member {string} [serviceLocation] Location of the service. + */ + constructor() { + } + + /** + * Defines the metadata of DestinationToServiceLocationMap + * + * @returns {object} metadata of DestinationToServiceLocationMap + * + */ + mapper() { + return { + required: false, + serializedName: 'DestinationToServiceLocationMap', + type: { + name: 'Composite', + className: 'DestinationToServiceLocationMap', + modelProperties: { + destinationLocation: { + required: false, + serializedName: 'destinationLocation', + type: { + name: 'String' + } + }, + serviceLocation: { + required: false, + serializedName: 'serviceLocation', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DestinationToServiceLocationMap; diff --git a/lib/services/databox/lib/models/diskCopyLogDetails.js b/lib/services/databox/lib/models/diskCopyLogDetails.js new file mode 100644 index 0000000000..cc97df9eb0 --- /dev/null +++ b/lib/services/databox/lib/models/diskCopyLogDetails.js @@ -0,0 +1,85 @@ +/* + * 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'); + +/** + * Copy Log Details for a disk + * + * @extends models['CopyLogDetails'] + */ +class DiskCopyLogDetails extends models['CopyLogDetails'] { + /** + * Create a DiskCopyLogDetails. + * @member {string} diskSerialNumber Disk Serial Number. + * @member {string} errorLogLink Link for copy error logs. + * @member {string} verboseLogLink Link for copy verbose logs. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DiskCopyLogDetails + * + * @returns {object} metadata of DiskCopyLogDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'Disk', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'DiskCopyLogDetails', + modelProperties: { + copyLogDetailsType: { + required: true, + serializedName: 'copyLogDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + diskSerialNumber: { + required: true, + serializedName: 'diskSerialNumber', + type: { + name: 'String' + } + }, + errorLogLink: { + required: true, + serializedName: 'errorLogLink', + type: { + name: 'String' + } + }, + verboseLogLink: { + required: true, + serializedName: 'verboseLogLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DiskCopyLogDetails; diff --git a/lib/services/databox/lib/models/diskCopyProgress.js b/lib/services/databox/lib/models/diskCopyProgress.js new file mode 100644 index 0000000000..00f9fe4e44 --- /dev/null +++ b/lib/services/databox/lib/models/diskCopyProgress.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'; + +/** + * Disk Copy Progress + * + */ +class DiskCopyProgress { + /** + * Create a DiskCopyProgress. + * @member {string} [serialNumber] The serial number of the disk + * @member {number} [percentComplete] Indicates the percentage completed for + * the copy of the disk. + * @member {string} [status] The Status of the copy. Possible values include: + * 'NotStarted', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed' + */ + constructor() { + } + + /** + * Defines the metadata of DiskCopyProgress + * + * @returns {object} metadata of DiskCopyProgress + * + */ + mapper() { + return { + required: false, + serializedName: 'DiskCopyProgress', + type: { + name: 'Composite', + className: 'DiskCopyProgress', + modelProperties: { + serialNumber: { + required: false, + serializedName: 'serialNumber', + type: { + name: 'String' + } + }, + percentComplete: { + required: false, + serializedName: 'percentComplete', + type: { + name: 'Number' + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'NotStarted', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed' ] + } + } + } + } + }; + } +} + +module.exports = DiskCopyProgress; diff --git a/lib/services/databox/lib/models/diskJobDetails.js b/lib/services/databox/lib/models/diskJobDetails.js new file mode 100644 index 0000000000..c173737812 --- /dev/null +++ b/lib/services/databox/lib/models/diskJobDetails.js @@ -0,0 +1,165 @@ +/* + * 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'); + +/** + * Disk Job Details. + * + * @extends models['JobDetails'] + */ +class DiskJobDetails extends models['JobDetails'] { + /** + * Create a DiskJobDetails. + * @member {object} [preferredDisks] User preference on what size disks are + * needed for the job. The map is from the disk size in TB to the count. Eg. + * {2,5} means 5 disks of 2 TB size. Key is string but will be checked + * against an int. + * @member {array} [copyProgress] Copy progress per disk. + * @member {object} [disksAndSizeDetails] Contains the map of disk serial + * number to the disk size being used for the job. Is returned only after the + * disks are shipped to the customer. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DiskJobDetails + * + * @returns {object} metadata of DiskJobDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'Disk', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobDetailsType', + clientName: 'jobDetailsType' + }, + uberParent: 'JobDetails', + className: 'DiskJobDetails', + modelProperties: { + expectedDataSizeInTeraBytes: { + required: false, + serializedName: 'expectedDataSizeInTeraBytes', + type: { + name: 'Number' + } + }, + jobStages: { + required: false, + serializedName: 'jobStages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobStagesElementType', + type: { + name: 'Composite', + className: 'JobStages' + } + } + } + }, + contactDetails: { + required: true, + serializedName: 'contactDetails', + type: { + name: 'Composite', + className: 'ContactDetails' + } + }, + shippingAddress: { + required: true, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + }, + errorDetails: { + required: false, + serializedName: 'errorDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobErrorDetailsElementType', + type: { + name: 'Composite', + className: 'JobErrorDetails' + } + } + } + }, + jobDetailsType: { + required: true, + serializedName: 'jobDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + preferredDisks: { + required: false, + serializedName: 'preferredDisks', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + copyProgress: { + required: false, + serializedName: 'copyProgress', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DiskCopyProgressElementType', + type: { + name: 'Composite', + className: 'DiskCopyProgress' + } + } + } + }, + disksAndSizeDetails: { + required: false, + serializedName: 'disksAndSizeDetails', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + } + } + } + }; + } +} + +module.exports = DiskJobDetails; diff --git a/lib/services/databox/lib/models/diskJobSecrets.js b/lib/services/databox/lib/models/diskJobSecrets.js new file mode 100644 index 0000000000..79a07b08c8 --- /dev/null +++ b/lib/services/databox/lib/models/diskJobSecrets.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'; + +const models = require('./index'); + +/** + * The secrets related to disk job. + * + * @extends models['JobSecrets'] + */ +class DiskJobSecrets extends models['JobSecrets'] { + /** + * Create a DiskJobSecrets. + * @member {array} [diskSecrets] Contains the list of secrets object for that + * device. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DiskJobSecrets + * + * @returns {object} metadata of DiskJobSecrets + * + */ + mapper() { + return { + required: false, + serializedName: 'Disk', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobSecretsType', + clientName: 'jobSecretsType' + }, + uberParent: 'JobSecrets', + className: 'DiskJobSecrets', + modelProperties: { + jobSecretsType: { + required: true, + serializedName: 'jobSecretsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + diskSecrets: { + required: false, + serializedName: 'diskSecrets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DiskSecretElementType', + type: { + name: 'Composite', + className: 'DiskSecret' + } + } + } + } + } + } + }; + } +} + +module.exports = DiskJobSecrets; diff --git a/lib/services/databox/lib/models/diskSecret.js b/lib/services/databox/lib/models/diskSecret.js new file mode 100644 index 0000000000..be43889867 --- /dev/null +++ b/lib/services/databox/lib/models/diskSecret.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'; + +/** + * Contains all the secrets of a Disk. + * + */ +class DiskSecret { + /** + * Create a DiskSecret. + * @member {string} [diskSerialNumber] Serial number of the assigned disk. + * @member {string} [bitLockerKey] Bit Locker key of the disk which can be + * used to unlock the disk to copy data. + */ + constructor() { + } + + /** + * Defines the metadata of DiskSecret + * + * @returns {object} metadata of DiskSecret + * + */ + mapper() { + return { + required: false, + serializedName: 'DiskSecret', + type: { + name: 'Composite', + className: 'DiskSecret', + modelProperties: { + diskSerialNumber: { + required: false, + serializedName: 'diskSerialNumber', + type: { + name: 'String' + } + }, + bitLockerKey: { + required: false, + serializedName: 'bitLockerKey', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DiskSecret; diff --git a/lib/services/databox/lib/models/errorModel.js b/lib/services/databox/lib/models/errorModel.js new file mode 100644 index 0000000000..33c142bbd2 --- /dev/null +++ b/lib/services/databox/lib/models/errorModel.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'; + +/** + * Top level error for the job. + * + */ +class ErrorModel { + /** + * Create a ErrorModel. + * @member {string} code Error code that can be used to programmatically + * identify the error. + * @member {string} [message] Describes the error in detail and provides + * debugging information. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorModel + * + * @returns {object} metadata of ErrorModel + * + */ + mapper() { + return { + required: false, + serializedName: 'Error', + type: { + name: 'Composite', + className: 'ErrorModel', + modelProperties: { + code: { + required: true, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorModel; diff --git a/lib/services/databox/lib/models/getCopyLogsUriOutput.js b/lib/services/databox/lib/models/getCopyLogsUriOutput.js new file mode 100644 index 0000000000..ccf6147421 --- /dev/null +++ b/lib/services/databox/lib/models/getCopyLogsUriOutput.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'); + +/** + * Output for the GetCopyLogsUri. + * + */ +class GetCopyLogsUriOutput { + /** + * Create a GetCopyLogsUriOutput. + * @member {string} [logType] Type/Level of the log. + * @member {array} [copyLogDetails] List of copy log details. + */ + constructor() { + } + + /** + * Defines the metadata of GetCopyLogsUriOutput + * + * @returns {object} metadata of GetCopyLogsUriOutput + * + */ + mapper() { + return { + required: false, + serializedName: 'GetCopyLogsUriOutput', + type: { + name: 'Composite', + className: 'GetCopyLogsUriOutput', + modelProperties: { + logType: { + required: false, + serializedName: 'logType', + type: { + name: 'String' + } + }, + copyLogDetails: { + required: false, + serializedName: 'copyLogDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CopyLogDetailsElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'CopyLogDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = GetCopyLogsUriOutput; diff --git a/lib/services/databox/lib/models/index.d.ts b/lib/services/databox/lib/models/index.d.ts new file mode 100644 index 0000000000..caec5b29de --- /dev/null +++ b/lib/services/databox/lib/models/index.d.ts @@ -0,0 +1,1031 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { BaseResource } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the CopyLogDetails class. + * @constructor + * Details for log generated during copy. + * + * @member {string} copyLogDetailsType Polymorphic Discriminator + */ +export interface CopyLogDetails { + copyLogDetailsType: string; +} + +/** + * @class + * Initializes a new instance of the AccountCopyLogDetails class. + * @constructor + * Copy log details for an storage account + * + * @member {string} accountName Destination account name. + * @member {string} copyLogLink Link for copy logs. + */ +export interface AccountCopyLogDetails extends CopyLogDetails { + accountName: string; + copyLogLink: string; +} + +/** + * @class + * Initializes a new instance of the ShareCredentialDetails class. + * @constructor + * Credential details of the shares in account. + * + * @member {string} [shareName] Name of the share. + * @member {string} [userName] User name for the share. + * @member {string} [password] Password for the share. + */ +export interface ShareCredentialDetails { + shareName?: string; + userName?: string; + password?: string; +} + +/** + * @class + * Initializes a new instance of the AccountCredentialDetails class. + * @constructor + * Credential details of the account. + * + * @member {string} [accountName] Name of the account. + * @member {array} shareCredentialDetails Per share level unencrypted access + * credentials. + */ +export interface AccountCredentialDetails { + accountName?: string; + shareCredentialDetails: ShareCredentialDetails[]; +} + +/** + * @class + * Initializes a new instance of the ShippingAddress class. + * @constructor + * Shipping address where customer wishes to receive the device. + * + * @member {string} streetAddress1 Street Address line 1. + * @member {string} [streetAddress2] Street Address line 2. + * @member {string} [streetAddress3] Street Address line 3. + * @member {string} [city] Name of the City. + * @member {string} [stateOrProvince] Name of the State or Province. + * @member {string} country Name of the Country. + * @member {string} postalCode Postal code. + * @member {string} [zipExtendedCode] Extended Zip Code. + * @member {string} [companyName] Name of the company. + * @member {string} [addressType] Type of address. Possible values include: + * 'None', 'Residential', 'Commercial' + */ +export interface ShippingAddress { + streetAddress1: string; + streetAddress2?: string; + streetAddress3?: string; + city?: string; + stateOrProvince?: string; + country: string; + postalCode: string; + zipExtendedCode?: string; + companyName?: string; + addressType?: string; +} + +/** + * @class + * Initializes a new instance of the AddressValidationOutput class. + * @constructor + * Output of the address validation api. + * + * @member {string} [validationStatus] The address validation status. Possible + * values include: 'Valid', 'Invalid', 'Ambiguous' + * @member {array} [alternateAddresses] List of alternate addresses. + */ +export interface AddressValidationOutput { + validationStatus?: string; + alternateAddresses?: ShippingAddress[]; +} + +/** + * @class + * Initializes a new instance of the ArmBaseObject class. + * @constructor + * Base class for all objects under resource. + * + * @member {string} [name] Name of the object. + * @member {string} [id] Id of the object. + * @member {string} [type] Type of the object. + */ +export interface ArmBaseObject { + readonly name?: string; + readonly id?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the AvailableSkuRequest class. + * @constructor + * The filters for showing the available skus. + * + * @member {string} country ISO country code. Country for hardware shipment. + * For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * @member {string} location Location for data transfer. For locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + */ +export interface AvailableSkuRequest { + country: string; + location: string; +} + +/** + * @class + * Initializes a new instance of the Sku class. + * @constructor + * The Sku. + * + * @member {string} name The sku name. + * @member {string} [displayName] The display name of the sku. + * @member {string} [family] The sku family. + */ +export interface Sku { + name: string; + displayName?: string; + family?: string; +} + +/** + * @class + * Initializes a new instance of the DestinationToServiceLocationMap class. + * @constructor + * Map of destination location to service location + * + * @member {string} [destinationLocation] Location of the destination. + * @member {string} [serviceLocation] Location of the service. + */ +export interface DestinationToServiceLocationMap { + destinationLocation?: string; + serviceLocation?: string; +} + +/** + * @class + * Initializes a new instance of the SkuCapacity class. + * @constructor + * Capacity of the sku. + * + * @member {string} usable Usable capacity in TB. + * @member {string} maximum Maximum capacity in TB. + */ +export interface SkuCapacity { + usable: string; + maximum: string; +} + +/** + * @class + * Initializes a new instance of the SkuCost class. + * @constructor + * Describes metadata for retrieving price info. + * + * @member {string} meterId Meter id of the Sku. + * @member {string} meterType The type of the meter. + */ +export interface SkuCost { + meterId: string; + meterType: string; +} + +/** + * @class + * Initializes a new instance of the SkuInformation class. + * @constructor + * Information of the sku. + * + * @member {object} sku The Sku. + * @member {string} [sku.name] The sku name. + * @member {string} [sku.displayName] The display name of the sku. + * @member {string} [sku.family] The sku family. + * @member {boolean} enabled The sku is enabled or not. + * @member {array} [destinationToServiceLocationMap] The map of destination + * location to service location. + * @member {object} capacity Capacity of the Sku. + * @member {string} [capacity.usable] Usable capacity in TB. + * @member {string} [capacity.maximum] Maximum capacity in TB. + * @member {array} costs Cost of the Sku. + * @member {array} apiVersions Api versions that support this Sku. + * @member {string} [disabledReason] Reason why the Sku is disabled. + */ +export interface SkuInformation { + sku: Sku; + enabled: boolean; + destinationToServiceLocationMap?: DestinationToServiceLocationMap[]; + capacity: SkuCapacity; + costs: SkuCost[]; + apiVersions: string[]; + disabledReason?: string; +} + +/** + * @class + * Initializes a new instance of the CabinetPodSecret class. + * @constructor + * The secrets related to a cabinet pod. + * + * @member {string} [deviceSerialNumber] Serial number of the assigned device. + * @member {string} [devicePassword] Password for out of the box experience on + * device. + * @member {array} [accountCredentialDetails] Per account level access + * credentials. + */ +export interface CabinetPodSecret { + deviceSerialNumber?: string; + devicePassword?: string; + accountCredentialDetails?: AccountCredentialDetails[]; +} + +/** + * @class + * Initializes a new instance of the JobSecrets class. + * @constructor + * The base class for the secrets + * + * @member {string} jobSecretsType Polymorphic Discriminator + */ +export interface JobSecrets { + jobSecretsType: string; +} + +/** + * @class + * Initializes a new instance of the CabinetJobSecrets class. + * @constructor + * The secrets related to a cabinet job. + * + * @member {array} [cabinetPodSecrets] Contains the list of secret objects for + * a cabinet job. + */ +export interface CabinetJobSecrets extends JobSecrets { + cabinetPodSecrets?: CabinetPodSecret[]; +} + +/** + * @class + * Initializes a new instance of the CancellationReason class. + * @constructor + * Reason for cancellation. + * + * @member {string} reason Reason for cancellation. + */ +export interface CancellationReason { + reason: string; +} + +/** + * @class + * Initializes a new instance of the NotificationPreference class. + * @constructor + * Notification preference for a job stage. + * + * @member {string} stageName Name of the stage. Possible values include: + * 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', + * 'DataCopy' + * @member {boolean} sendNotification Notification is required or not. + */ +export interface NotificationPreference { + stageName: string; + sendNotification: boolean; +} + +/** + * @class + * Initializes a new instance of the ContactDetails class. + * @constructor + * Contact Details. + * + * @member {string} [contactName] Contact name of the person. + * @member {string} phone Phone number of the contact person. + * @member {string} [phoneExtension] Phone extension number of the contact + * person. + * @member {string} [mobile] Mobile number of the contact person. + * @member {array} emailList List of Email-ids to be notified about job + * progress. + * @member {array} [notificationPreference] Notification preference for a job + * stage. + */ +export interface ContactDetails { + contactName?: string; + phone: string; + phoneExtension?: string; + mobile?: string; + emailList: string[]; + notificationPreference?: NotificationPreference[]; +} + +/** + * @class + * Initializes a new instance of the CopyProgress class. + * @constructor + * Copy progress. + * + * @member {string} [storageAccountName] Name of the storage account where the + * data needs to be uploaded. + * @member {number} [bytesSentToCloud] Amount of data uploaded by the job as of + * now. + * @member {number} [totalBytesToProcess] Total amount of data to be processed + * by the job. + */ +export interface CopyProgress { + storageAccountName?: string; + bytesSentToCloud?: number; + totalBytesToProcess?: number; +} + +/** + * @class + * Initializes a new instance of the DestinationAccountDetails class. + * @constructor + * Details for the destination account. + * + * @member {string} accountId Destination storage account id. + */ +export interface DestinationAccountDetails { + accountId: string; +} + +/** + * @class + * Initializes a new instance of the DiskCopyLogDetails class. + * @constructor + * Copy Log Details for a disk + * + * @member {string} diskSerialNumber Disk Serial Number. + * @member {string} errorLogLink Link for copy error logs. + * @member {string} verboseLogLink Link for copy verbose logs. + */ +export interface DiskCopyLogDetails extends CopyLogDetails { + diskSerialNumber: string; + errorLogLink: string; + verboseLogLink: string; +} + +/** + * @class + * Initializes a new instance of the DiskCopyProgress class. + * @constructor + * Disk Copy Progress + * + * @member {string} [serialNumber] The serial number of the disk + * @member {number} [percentComplete] Indicates the percentage completed for + * the copy of the disk. + * @member {string} [status] The Status of the copy. Possible values include: + * 'NotStarted', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed' + */ +export interface DiskCopyProgress { + serialNumber?: string; + percentComplete?: number; + status?: string; +} + +/** + * @class + * Initializes a new instance of the JobDetails class. + * @constructor + * Job details. + * + * @member {number} [expectedDataSizeInTeraBytes] The expected size of the + * data, which needs to be transfered in this job, in tera bytes. + * @member {array} [jobStages] List of stages that run in the job. + * @member {object} contactDetails Contact details for notification and + * shipping. + * @member {string} [contactDetails.contactName] Contact name of the person. + * @member {string} [contactDetails.phone] Phone number of the contact person. + * @member {string} [contactDetails.phoneExtension] Phone extension number of + * the contact person. + * @member {string} [contactDetails.mobile] Mobile number of the contact + * person. + * @member {array} [contactDetails.emailList] List of Email-ids to be notified + * about job progress. + * @member {array} [contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} shippingAddress Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * @member {array} [errorDetails] Error details for failure. This is optional. + * @member {string} jobDetailsType Polymorphic Discriminator + */ +export interface JobDetails { + expectedDataSizeInTeraBytes?: number; + jobStages?: JobStages[]; + contactDetails: ContactDetails; + shippingAddress: ShippingAddress; + errorDetails?: JobErrorDetails[]; + jobDetailsType: string; +} + +/** + * @class + * Initializes a new instance of the DiskJobDetails class. + * @constructor + * Disk Job Details. + * + * @member {object} [preferredDisks] User preference on what size disks are + * needed for the job. The map is from the disk size in TB to the count. Eg. + * {2,5} means 5 disks of 2 TB size. Key is string but will be checked against + * an int. + * @member {array} [copyProgress] Copy progress per disk. + * @member {object} [disksAndSizeDetails] Contains the map of disk serial + * number to the disk size being used for the job. Is returned only after the + * disks are shipped to the customer. + */ +export interface DiskJobDetails extends JobDetails { + preferredDisks?: { [propertyName: string]: number }; + copyProgress?: DiskCopyProgress[]; + disksAndSizeDetails?: { [propertyName: string]: number }; +} + +/** + * @class + * Initializes a new instance of the DiskSecret class. + * @constructor + * Contains all the secrets of a Disk. + * + * @member {string} [diskSerialNumber] Serial number of the assigned disk. + * @member {string} [bitLockerKey] Bit Locker key of the disk which can be used + * to unlock the disk to copy data. + */ +export interface DiskSecret { + diskSerialNumber?: string; + bitLockerKey?: string; +} + +/** + * @class + * Initializes a new instance of the DiskJobSecrets class. + * @constructor + * The secrets related to disk job. + * + * @member {array} [diskSecrets] Contains the list of secrets object for that + * device. + */ +export interface DiskJobSecrets extends JobSecrets { + diskSecrets?: DiskSecret[]; +} + +/** + * @class + * Initializes a new instance of the ErrorModel class. + * @constructor + * Top level error for the job. + * + * @member {string} code Error code that can be used to programmatically + * identify the error. + * @member {string} [message] Describes the error in detail and provides + * debugging information. + */ +export interface ErrorModel { + code: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the GetCopyLogsUriOutput class. + * @constructor + * Output for the GetCopyLogsUri. + * + * @member {string} [logType] Type/Level of the log. + * @member {array} [copyLogDetails] List of copy log details. + */ +export interface GetCopyLogsUriOutput { + logType?: string; + copyLogDetails?: CopyLogDetails[]; +} + +/** + * @class + * Initializes a new instance of the JobErrorDetails class. + * @constructor + * Job Error Details for providing the information and recommended action. + * + * @member {string} [errorMessage] Message for the error. + * @member {number} [errorCode] Code for the error. + * @member {string} [recommendedAction] Recommended action for the error. + * @member {string} [exceptionMessage] Contains the non localized exception + * message + */ +export interface JobErrorDetails { + errorMessage?: string; + errorCode?: number; + recommendedAction?: string; + exceptionMessage?: string; +} + +/** + * @class + * Initializes a new instance of the JobStages class. + * @constructor + * Job stages. + * + * @member {string} stageName Name of the job stage. Possible values include: + * 'DeviceOrdered', 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', + * 'AtAzureDC', 'DataCopy', 'Completed', 'CompletedWithErrors', 'Cancelled', + * 'Failed_IssueReportedAtCustomer', 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * @member {string} [displayName] Display name of the job stage. + * @member {string} stageStatus Status of the job stage. Possible values + * include: 'None', 'InProgress', 'Succeeded', 'Failed', 'Cancelled', + * 'Cancelling', 'SucceededWithErrors' + * @member {date} [stageTime] Time for the job stage in UTC ISO 8601 format. + * @member {object} [jobStageDetails] Job Stage Details + * @member {array} [errorDetails] Error details for the stage. + */ +export interface JobStages { + stageName: string; + displayName?: string; + stageStatus: string; + stageTime?: Date; + jobStageDetails?: any; + errorDetails?: JobErrorDetails[]; +} + +/** + * @class + * Initializes a new instance of the PackageShippingDetails class. + * @constructor + * Shipping details. + * + * @member {string} [carrierName] Name of the carrier. + * @member {string} [trackingId] Tracking Id of shipment. + * @member {string} [trackingUrl] Url where shipment can be tracked. + */ +export interface PackageShippingDetails { + carrierName?: string; + trackingId?: string; + trackingUrl?: string; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * Model of the Resource. + * + * @member {string} location The location of the resource. This will be one of + * the supported and registered Azure Regions (e.g. West US, East US, Southeast + * Asia, etc.). The region of a resource cannot be changed once it is created, + * but if an identical region is specified on update the request will succeed. + * @member {object} [tags] The list of key value pairs that describe the + * resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * @member {object} sku The sku type. + * @member {string} [sku.name] The sku name. + * @member {string} [sku.displayName] The display name of the sku. + * @member {string} [sku.family] The sku family. + */ +export interface Resource extends BaseResource { + location: string; + tags?: { [propertyName: string]: string }; + sku: Sku; +} + +/** + * @class + * Initializes a new instance of the JobResource class. + * @constructor + * Job Resource. + * + * @member {string} [deviceType] Type of the device to be used for the job. + * Possible values include: 'Pod', 'Disk', 'Cabinet' + * @member {boolean} [isCancellable] Describes whether the job is cancellable + * or not. + * @member {boolean} [isShippingAddressEditable] Describes whether the shipping + * address is editable or not. + * @member {string} [status] Name of the stage which is in progress. Possible + * values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * @member {date} [startTime] Time at which the job was started in UTC ISO 8601 + * format. + * @member {object} [error] Top level error for the job. + * @member {string} [error.code] Error code that can be used to + * programmatically identify the error. + * @member {string} [error.message] Describes the error in detail and provides + * debugging information. + * @member {object} [deliveryPackage] Delivery package shipping details. + * @member {string} [deliveryPackage.carrierName] Name of the carrier. + * @member {string} [deliveryPackage.trackingId] Tracking Id of shipment. + * @member {string} [deliveryPackage.trackingUrl] Url where shipment can be + * tracked. + * @member {object} [returnPackage] Return package shipping details. + * @member {string} [returnPackage.carrierName] Name of the carrier. + * @member {string} [returnPackage.trackingId] Tracking Id of shipment. + * @member {string} [returnPackage.trackingUrl] Url where shipment can be + * tracked. + * @member {array} destinationAccountDetails Destination account details. + * @member {object} [details] Details of a job run. This field will only be + * sent for expand details filter. + * @member {number} [details.expectedDataSizeInTeraBytes] The expected size of + * the data, which needs to be transfered in this job, in tera bytes. + * @member {array} [details.jobStages] List of stages that run in the job. + * @member {object} [details.contactDetails] Contact details for notification + * and shipping. + * @member {string} [details.contactDetails.contactName] Contact name of the + * person. + * @member {string} [details.contactDetails.phone] Phone number of the contact + * person. + * @member {string} [details.contactDetails.phoneExtension] Phone extension + * number of the contact person. + * @member {string} [details.contactDetails.mobile] Mobile number of the + * contact person. + * @member {array} [details.contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [details.contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} [details.shippingAddress] Shipping address of the customer. + * @member {string} [details.shippingAddress.streetAddress1] Street Address + * line 1. + * @member {string} [details.shippingAddress.streetAddress2] Street Address + * line 2. + * @member {string} [details.shippingAddress.streetAddress3] Street Address + * line 3. + * @member {string} [details.shippingAddress.city] Name of the City. + * @member {string} [details.shippingAddress.stateOrProvince] Name of the State + * or Province. + * @member {string} [details.shippingAddress.country] Name of the Country. + * @member {string} [details.shippingAddress.postalCode] Postal code. + * @member {string} [details.shippingAddress.zipExtendedCode] Extended Zip + * Code. + * @member {string} [details.shippingAddress.companyName] Name of the company. + * @member {string} [details.shippingAddress.addressType] Type of address. + * Possible values include: 'None', 'Residential', 'Commercial' + * @member {array} [details.errorDetails] Error details for failure. This is + * optional. + * @member {string} [details.jobDetailsType] Polymorphic Discriminator + * @member {string} [cancellationReason] Reason for cancellation. + * @member {string} [name] Name of the object. + * @member {string} [id] Id of the object. + * @member {string} [type] Type of the object. + */ +export interface JobResource extends Resource { + deviceType?: string; + isCancellable?: boolean; + isShippingAddressEditable?: boolean; + status?: string; + startTime?: Date; + error?: ErrorModel; + deliveryPackage?: PackageShippingDetails; + returnPackage?: PackageShippingDetails; + destinationAccountDetails: DestinationAccountDetails[]; + details?: JobDetails; + cancellationReason?: string; + readonly name?: string; + readonly id?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the UpdateJobDetails class. + * @constructor + * Job details for update. + * + * @member {object} [contactDetails] Contact details for notification and + * shipping. + * @member {string} [contactDetails.contactName] Contact name of the person. + * @member {string} [contactDetails.phone] Phone number of the contact person. + * @member {string} [contactDetails.phoneExtension] Phone extension number of + * the contact person. + * @member {string} [contactDetails.mobile] Mobile number of the contact + * person. + * @member {array} [contactDetails.emailList] List of Email-ids to be notified + * about job progress. + * @member {array} [contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} [shippingAddress] Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + */ +export interface UpdateJobDetails { + contactDetails?: ContactDetails; + shippingAddress?: ShippingAddress; +} + +/** + * @class + * Initializes a new instance of the JobResourceUpdateParameter class. + * @constructor + * The JobResourceUpdateParameter. + * + * @member {object} details Details of a job to be updated. + * @member {object} [details.contactDetails] Contact details for notification + * and shipping. + * @member {string} [details.contactDetails.contactName] Contact name of the + * person. + * @member {string} [details.contactDetails.phone] Phone number of the contact + * person. + * @member {string} [details.contactDetails.phoneExtension] Phone extension + * number of the contact person. + * @member {string} [details.contactDetails.mobile] Mobile number of the + * contact person. + * @member {array} [details.contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [details.contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} [details.shippingAddress] Shipping address of the customer. + * @member {string} [details.shippingAddress.streetAddress1] Street Address + * line 1. + * @member {string} [details.shippingAddress.streetAddress2] Street Address + * line 2. + * @member {string} [details.shippingAddress.streetAddress3] Street Address + * line 3. + * @member {string} [details.shippingAddress.city] Name of the City. + * @member {string} [details.shippingAddress.stateOrProvince] Name of the State + * or Province. + * @member {string} [details.shippingAddress.country] Name of the Country. + * @member {string} [details.shippingAddress.postalCode] Postal code. + * @member {string} [details.shippingAddress.zipExtendedCode] Extended Zip + * Code. + * @member {string} [details.shippingAddress.companyName] Name of the company. + * @member {string} [details.shippingAddress.addressType] Type of address. + * Possible values include: 'None', 'Residential', 'Commercial' + * @member {object} [tags] The list of key value pairs that describe the + * resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + */ +export interface JobResourceUpdateParameter { + details: UpdateJobDetails; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * Operation display + * + * @member {string} [provider] Provider name. + * @member {string} [resource] Resource name. + * @member {string} [operation] Localized name of the operation for display + * purpose. + * @member {string} [description] Localized description of the operation for + * display purpose. + */ +export interface OperationDisplay { + provider?: string; + resource?: string; + operation?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * Operation entity. + * + * @member {string} name Name of the operation. Format: + * {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} + * @member {object} display Operation display values. + * @member {string} [display.provider] Provider name. + * @member {string} [display.resource] Resource name. + * @member {string} [display.operation] Localized name of the operation for + * display purpose. + * @member {string} [display.description] Localized description of the + * operation for display purpose. + * @member {object} properties Operation properties. + * @member {string} origin Origin of the operation. Can be : + * user|system|user,system + */ +export interface Operation { + name: string; + display: OperationDisplay; + properties: any; + origin: string; +} + +/** + * @class + * Initializes a new instance of the PodJobDetails class. + * @constructor + * Pod Job Details + * + * @member {array} [copyProgress] Copy progress per account. + */ +export interface PodJobDetails extends JobDetails { + copyProgress?: CopyProgress[]; +} + +/** + * @class + * Initializes a new instance of the PodSecret class. + * @constructor + * The secrets related to a Pod. + * + * @member {string} [deviceSerialNumber] Serial number of the assigned device. + * @member {string} [devicePassword] Password for out of the box experience on + * device. + * @member {array} [accountCredentialDetails] Per account level access + * credentials. + */ +export interface PodSecret { + deviceSerialNumber?: string; + devicePassword?: string; + accountCredentialDetails?: AccountCredentialDetails[]; +} + +/** + * @class + * Initializes a new instance of the PodJobSecrets class. + * @constructor + * The secrets related to a pod job. + * + * @member {array} [podSecrets] Contains the list of secret objects for a job. + */ +export interface PodJobSecrets extends JobSecrets { + podSecrets?: PodSecret[]; +} + +/** + * @class + * Initializes a new instance of the ReportIssueDetails class. + * @constructor + * Details of the reported issue. + * + * @member {string} [issueType] Issue Type. Possible values include: + * 'DeviceMismatch', 'ValidationStringMismatch', 'CredentialNotWorking', + * 'DeviceFailure' + * @member {string} [deviceIssueType] Device Issue Type. Only used for Device + * failure issue. Possible values include: 'DeviceTampering', + * 'DeviceNotBootingUp', 'DeviceHealthCheckShowFailures', 'NICsAreNotWorking', + * 'Misc' + */ +export interface ReportIssueDetails { + issueType?: string; + deviceIssueType?: string; +} + +/** + * @class + * Initializes a new instance of the ShipmentPickUpRequest class. + * @constructor + * Shipment pick up request details. + * + * @member {date} [startTime] Minimum date after which the pick up should + * commence, this must be in local time of pick up area. + * @member {date} [endTime] Maximum date before which the pick up should + * commence, this must be in local time of pick up area. + * @member {string} [shipmentLocation] Shipment Location in the pickup place. + * Eg.front desk + */ +export interface ShipmentPickUpRequest { + startTime?: Date; + endTime?: Date; + shipmentLocation?: string; +} + +/** + * @class + * Initializes a new instance of the ShipmentPickUpResponse class. + * @constructor + * Shipment pick up response. + * + * @member {string} [confirmationNumber] Confirmation number for the pick up + * request. + * @member {date} [readyByTime] Time by which shipment should be ready for pick + * up, this is in local time of pick up area. + */ +export interface ShipmentPickUpResponse { + confirmationNumber?: string; + readyByTime?: Date; +} + +/** + * @class + * Initializes a new instance of the ShippingLabelDetails class. + * @constructor + * Details for the shipping label. + * + * @member {string} shippingLabelSasUri Sas uri for accessing the shipping + * label. + */ +export interface ShippingLabelDetails { + shippingLabelSasUri: string; +} + +/** + * @class + * Initializes a new instance of the UnencryptedSecrets class. + * @constructor + * Unencrypted secrets for accessing device. + * + * @member {string} jobName Name of the job. + * @member {string} [deviceType] The Device Type used in the job. Possible + * values include: 'Pod', 'Disk', 'Cabinet' + * @member {object} [jobSecrets] Secrets related to this job. + * @member {string} [jobSecrets.jobSecretsType] Polymorphic Discriminator + */ +export interface UnencryptedSecrets { + jobName: string; + deviceType?: string; + jobSecrets?: JobSecrets; +} + +/** + * @class + * Initializes a new instance of the ValidateAddress class. + * @constructor + * The requirements to validate customer address where the device needs to be + * shipped. + * + * @member {object} [shippingAddress] Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * @member {string} [deviceType] Device type to be used for the job. Possible + * values include: 'Pod', 'Disk', 'Cabinet' + */ +export interface ValidateAddress { + shippingAddress?: ShippingAddress; + deviceType?: string; +} + + +/** + * @class + * Initializes a new instance of the OperationList class. + * @constructor + * Operation Collection. + * + * @member {string} [nextLink] Link for the next set of operations. + */ +export interface OperationList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the JobResourceList class. + * @constructor + * Job Resource Collection + * + * @member {string} [nextLink] Link for the next set of job resources. + */ +export interface JobResourceList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the AvailableSkusResult class. + * @constructor + * The available skus operation response. + * + * @member {string} [nextLink] Link for the next set of skus. + */ +export interface AvailableSkusResult extends Array { + nextLink?: string; +} diff --git a/lib/services/databox/lib/models/index.js b/lib/services/databox/lib/models/index.js new file mode 100644 index 0000000000..352303a8e6 --- /dev/null +++ b/lib/services/databox/lib/models/index.js @@ -0,0 +1,82 @@ +/* + * 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.CopyLogDetails = require('./copyLogDetails'); +exports.AccountCopyLogDetails = require('./accountCopyLogDetails'); +exports.ShareCredentialDetails = require('./shareCredentialDetails'); +exports.AccountCredentialDetails = require('./accountCredentialDetails'); +exports.ShippingAddress = require('./shippingAddress'); +exports.AddressValidationOutput = require('./addressValidationOutput'); +exports.ArmBaseObject = require('./armBaseObject'); +exports.AvailableSkuRequest = require('./availableSkuRequest'); +exports.Sku = require('./sku'); +exports.DestinationToServiceLocationMap = require('./destinationToServiceLocationMap'); +exports.SkuCapacity = require('./skuCapacity'); +exports.SkuCost = require('./skuCost'); +exports.SkuInformation = require('./skuInformation'); +exports.CabinetPodSecret = require('./cabinetPodSecret'); +exports.JobSecrets = require('./jobSecrets'); +exports.CabinetJobSecrets = require('./cabinetJobSecrets'); +exports.CancellationReason = require('./cancellationReason'); +exports.NotificationPreference = require('./notificationPreference'); +exports.ContactDetails = require('./contactDetails'); +exports.CopyProgress = require('./copyProgress'); +exports.DestinationAccountDetails = require('./destinationAccountDetails'); +exports.DiskCopyLogDetails = require('./diskCopyLogDetails'); +exports.DiskCopyProgress = require('./diskCopyProgress'); +exports.JobDetails = require('./jobDetails'); +exports.DiskJobDetails = require('./diskJobDetails'); +exports.DiskSecret = require('./diskSecret'); +exports.DiskJobSecrets = require('./diskJobSecrets'); +exports.ErrorModel = require('./errorModel'); +exports.GetCopyLogsUriOutput = require('./getCopyLogsUriOutput'); +exports.JobErrorDetails = require('./jobErrorDetails'); +exports.JobStages = require('./jobStages'); +exports.PackageShippingDetails = require('./packageShippingDetails'); +exports.Resource = require('./resource'); +exports.JobResource = require('./jobResource'); +exports.UpdateJobDetails = require('./updateJobDetails'); +exports.JobResourceUpdateParameter = require('./jobResourceUpdateParameter'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Operation = require('./operation'); +exports.PodJobDetails = require('./podJobDetails'); +exports.PodSecret = require('./podSecret'); +exports.PodJobSecrets = require('./podJobSecrets'); +exports.ReportIssueDetails = require('./reportIssueDetails'); +exports.ShipmentPickUpRequest = require('./shipmentPickUpRequest'); +exports.ShipmentPickUpResponse = require('./shipmentPickUpResponse'); +exports.ShippingLabelDetails = require('./shippingLabelDetails'); +exports.UnencryptedSecrets = require('./unencryptedSecrets'); +exports.ValidateAddress = require('./validateAddress'); +exports.OperationList = require('./operationList'); +exports.JobResourceList = require('./jobResourceList'); +exports.AvailableSkusResult = require('./availableSkusResult'); +exports.discriminators = { + 'CopyLogDetails.Pod' : exports.AccountCopyLogDetails, + 'JobSecrets.Cabinet' : exports.CabinetJobSecrets, + 'CopyLogDetails' : exports.CopyLogDetails, + 'CopyLogDetails.Disk' : exports.DiskCopyLogDetails, + 'JobDetails.Disk' : exports.DiskJobDetails, + 'JobSecrets.Disk' : exports.DiskJobSecrets, + 'JobDetails' : exports.JobDetails, + 'JobSecrets' : exports.JobSecrets, + 'JobDetails.Pod' : exports.PodJobDetails, + 'JobSecrets.Pod' : exports.PodJobSecrets +}; diff --git a/lib/services/databox/lib/models/jobDetails.js b/lib/services/databox/lib/models/jobDetails.js new file mode 100644 index 0000000000..7a10967c26 --- /dev/null +++ b/lib/services/databox/lib/models/jobDetails.js @@ -0,0 +1,144 @@ +/* + * 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'); + +/** + * Job details. + * + */ +class JobDetails { + /** + * Create a JobDetails. + * @member {number} [expectedDataSizeInTeraBytes] The expected size of the + * data, which needs to be transfered in this job, in tera bytes. + * @member {array} [jobStages] List of stages that run in the job. + * @member {object} contactDetails Contact details for notification and + * shipping. + * @member {string} [contactDetails.contactName] Contact name of the person. + * @member {string} [contactDetails.phone] Phone number of the contact + * person. + * @member {string} [contactDetails.phoneExtension] Phone extension number of + * the contact person. + * @member {string} [contactDetails.mobile] Mobile number of the contact + * person. + * @member {array} [contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} shippingAddress Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * @member {array} [errorDetails] Error details for failure. This is + * optional. + * @member {string} jobDetailsType Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of JobDetails + * + * @returns {object} metadata of JobDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'JobDetails', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobDetailsType', + clientName: 'jobDetailsType' + }, + uberParent: 'JobDetails', + className: 'JobDetails', + modelProperties: { + expectedDataSizeInTeraBytes: { + required: false, + serializedName: 'expectedDataSizeInTeraBytes', + type: { + name: 'Number' + } + }, + jobStages: { + required: false, + serializedName: 'jobStages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobStagesElementType', + type: { + name: 'Composite', + className: 'JobStages' + } + } + } + }, + contactDetails: { + required: true, + serializedName: 'contactDetails', + type: { + name: 'Composite', + className: 'ContactDetails' + } + }, + shippingAddress: { + required: true, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + }, + errorDetails: { + required: false, + serializedName: 'errorDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobErrorDetailsElementType', + type: { + name: 'Composite', + className: 'JobErrorDetails' + } + } + } + }, + jobDetailsType: { + required: true, + serializedName: 'jobDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobDetails; diff --git a/lib/services/databox/lib/models/jobErrorDetails.js b/lib/services/databox/lib/models/jobErrorDetails.js new file mode 100644 index 0000000000..5d8dc52d1b --- /dev/null +++ b/lib/services/databox/lib/models/jobErrorDetails.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'; + +/** + * Job Error Details for providing the information and recommended action. + * + */ +class JobErrorDetails { + /** + * Create a JobErrorDetails. + * @member {string} [errorMessage] Message for the error. + * @member {number} [errorCode] Code for the error. + * @member {string} [recommendedAction] Recommended action for the error. + * @member {string} [exceptionMessage] Contains the non localized exception + * message + */ + constructor() { + } + + /** + * Defines the metadata of JobErrorDetails + * + * @returns {object} metadata of JobErrorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'JobErrorDetails', + type: { + name: 'Composite', + className: 'JobErrorDetails', + modelProperties: { + errorMessage: { + required: false, + serializedName: 'errorMessage', + type: { + name: 'String' + } + }, + errorCode: { + required: false, + serializedName: 'errorCode', + type: { + name: 'Number' + } + }, + recommendedAction: { + required: false, + serializedName: 'recommendedAction', + type: { + name: 'String' + } + }, + exceptionMessage: { + required: false, + serializedName: 'exceptionMessage', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobErrorDetails; diff --git a/lib/services/databox/lib/models/jobResource.js b/lib/services/databox/lib/models/jobResource.js new file mode 100644 index 0000000000..cfb1421f8c --- /dev/null +++ b/lib/services/databox/lib/models/jobResource.js @@ -0,0 +1,271 @@ +/* + * 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'); + +/** + * Job Resource. + * + * @extends models['Resource'] + */ +class JobResource extends models['Resource'] { + /** + * Create a JobResource. + * @member {string} [deviceType] Type of the device to be used for the job. + * Possible values include: 'Pod', 'Disk', 'Cabinet' + * @member {boolean} [isCancellable] Describes whether the job is cancellable + * or not. + * @member {boolean} [isShippingAddressEditable] Describes whether the + * shipping address is editable or not. + * @member {string} [status] Name of the stage which is in progress. Possible + * values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * @member {date} [startTime] Time at which the job was started in UTC ISO + * 8601 format. + * @member {object} [error] Top level error for the job. + * @member {string} [error.code] Error code that can be used to + * programmatically identify the error. + * @member {string} [error.message] Describes the error in detail and + * provides debugging information. + * @member {object} [deliveryPackage] Delivery package shipping details. + * @member {string} [deliveryPackage.carrierName] Name of the carrier. + * @member {string} [deliveryPackage.trackingId] Tracking Id of shipment. + * @member {string} [deliveryPackage.trackingUrl] Url where shipment can be + * tracked. + * @member {object} [returnPackage] Return package shipping details. + * @member {string} [returnPackage.carrierName] Name of the carrier. + * @member {string} [returnPackage.trackingId] Tracking Id of shipment. + * @member {string} [returnPackage.trackingUrl] Url where shipment can be + * tracked. + * @member {array} destinationAccountDetails Destination account details. + * @member {object} [details] Details of a job run. This field will only be + * sent for expand details filter. + * @member {number} [details.expectedDataSizeInTeraBytes] The expected size + * of the data, which needs to be transfered in this job, in tera bytes. + * @member {array} [details.jobStages] List of stages that run in the job. + * @member {object} [details.contactDetails] Contact details for notification + * and shipping. + * @member {string} [details.contactDetails.contactName] Contact name of the + * person. + * @member {string} [details.contactDetails.phone] Phone number of the + * contact person. + * @member {string} [details.contactDetails.phoneExtension] Phone extension + * number of the contact person. + * @member {string} [details.contactDetails.mobile] Mobile number of the + * contact person. + * @member {array} [details.contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * @member {object} [details.shippingAddress] Shipping address of the + * customer. + * @member {string} [details.shippingAddress.streetAddress1] Street Address + * line 1. + * @member {string} [details.shippingAddress.streetAddress2] Street Address + * line 2. + * @member {string} [details.shippingAddress.streetAddress3] Street Address + * line 3. + * @member {string} [details.shippingAddress.city] Name of the City. + * @member {string} [details.shippingAddress.stateOrProvince] Name of the + * State or Province. + * @member {string} [details.shippingAddress.country] Name of the Country. + * @member {string} [details.shippingAddress.postalCode] Postal code. + * @member {string} [details.shippingAddress.zipExtendedCode] Extended Zip + * Code. + * @member {string} [details.shippingAddress.companyName] Name of the + * company. + * @member {string} [details.shippingAddress.addressType] Type of address. + * Possible values include: 'None', 'Residential', 'Commercial' + * @member {array} [details.errorDetails] Error details for failure. This is + * optional. + * @member {string} [details.jobDetailsType] Polymorphic Discriminator + * @member {string} [cancellationReason] Reason for cancellation. + * @member {string} [name] Name of the object. + * @member {string} [id] Id of the object. + * @member {string} [type] Type of the object. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of JobResource + * + * @returns {object} metadata of JobResource + * + */ + mapper() { + return { + required: false, + serializedName: 'JobResource', + type: { + name: 'Composite', + className: 'JobResource', + modelProperties: { + 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: true, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + deviceType: { + required: false, + serializedName: 'properties.deviceType', + type: { + name: 'Enum', + allowedValues: [ 'Pod', 'Disk', 'Cabinet' ] + } + }, + isCancellable: { + required: false, + serializedName: 'properties.isCancellable', + type: { + name: 'Boolean' + } + }, + isShippingAddressEditable: { + required: false, + serializedName: 'properties.isShippingAddressEditable', + type: { + name: 'Boolean' + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'Enum', + allowedValues: [ 'DeviceOrdered', 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', 'Failed_IssueDetectedAtAzureDC', 'Aborted' ] + } + }, + startTime: { + required: false, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + error: { + required: false, + serializedName: 'properties.error', + type: { + name: 'Composite', + className: 'ErrorModel' + } + }, + deliveryPackage: { + required: false, + serializedName: 'properties.deliveryPackage', + type: { + name: 'Composite', + className: 'PackageShippingDetails' + } + }, + returnPackage: { + required: false, + serializedName: 'properties.returnPackage', + type: { + name: 'Composite', + className: 'PackageShippingDetails' + } + }, + destinationAccountDetails: { + required: true, + serializedName: 'properties.destinationAccountDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DestinationAccountDetailsElementType', + type: { + name: 'Composite', + className: 'DestinationAccountDetails' + } + } + } + }, + details: { + required: false, + serializedName: 'properties.details', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobDetailsType', + clientName: 'jobDetailsType' + }, + uberParent: 'JobDetails', + className: 'JobDetails' + } + }, + cancellationReason: { + required: false, + serializedName: 'properties.cancellationReason', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobResource; diff --git a/lib/services/databox/lib/models/jobResourceList.js b/lib/services/databox/lib/models/jobResourceList.js new file mode 100644 index 0000000000..bed4718392 --- /dev/null +++ b/lib/services/databox/lib/models/jobResourceList.js @@ -0,0 +1,67 @@ +/* + * 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'; + +/** + * Job Resource Collection + */ +class JobResourceList extends Array { + /** + * Create a JobResourceList. + * @member {string} [nextLink] Link for the next set of job resources. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of JobResourceList + * + * @returns {object} metadata of JobResourceList + * + */ + mapper() { + return { + required: false, + serializedName: 'JobResourceList', + type: { + name: 'Composite', + className: 'JobResourceList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobResourceElementType', + type: { + name: 'Composite', + className: 'JobResource' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobResourceList; diff --git a/lib/services/databox/lib/models/jobResourceUpdateParameter.js b/lib/services/databox/lib/models/jobResourceUpdateParameter.js new file mode 100644 index 0000000000..8faf5df59d --- /dev/null +++ b/lib/services/databox/lib/models/jobResourceUpdateParameter.js @@ -0,0 +1,105 @@ +/* + * 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 JobResourceUpdateParameter. + * + */ +class JobResourceUpdateParameter { + /** + * Create a JobResourceUpdateParameter. + * @member {object} details Details of a job to be updated. + * @member {object} [details.contactDetails] Contact details for notification + * and shipping. + * @member {string} [details.contactDetails.contactName] Contact name of the + * person. + * @member {string} [details.contactDetails.phone] Phone number of the + * contact person. + * @member {string} [details.contactDetails.phoneExtension] Phone extension + * number of the contact person. + * @member {string} [details.contactDetails.mobile] Mobile number of the + * contact person. + * @member {array} [details.contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * @member {object} [details.shippingAddress] Shipping address of the + * customer. + * @member {string} [details.shippingAddress.streetAddress1] Street Address + * line 1. + * @member {string} [details.shippingAddress.streetAddress2] Street Address + * line 2. + * @member {string} [details.shippingAddress.streetAddress3] Street Address + * line 3. + * @member {string} [details.shippingAddress.city] Name of the City. + * @member {string} [details.shippingAddress.stateOrProvince] Name of the + * State or Province. + * @member {string} [details.shippingAddress.country] Name of the Country. + * @member {string} [details.shippingAddress.postalCode] Postal code. + * @member {string} [details.shippingAddress.zipExtendedCode] Extended Zip + * Code. + * @member {string} [details.shippingAddress.companyName] Name of the + * company. + * @member {string} [details.shippingAddress.addressType] Type of address. + * Possible values include: 'None', 'Residential', 'Commercial' + * @member {object} [tags] The list of key value pairs that describe the + * resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + */ + constructor() { + } + + /** + * Defines the metadata of JobResourceUpdateParameter + * + * @returns {object} metadata of JobResourceUpdateParameter + * + */ + mapper() { + return { + required: false, + serializedName: 'JobResourceUpdateParameter', + type: { + name: 'Composite', + className: 'JobResourceUpdateParameter', + modelProperties: { + details: { + required: true, + serializedName: 'properties.details', + type: { + name: 'Composite', + className: 'UpdateJobDetails' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = JobResourceUpdateParameter; diff --git a/lib/services/databox/lib/models/jobSecrets.js b/lib/services/databox/lib/models/jobSecrets.js new file mode 100644 index 0000000000..9ef614fc2e --- /dev/null +++ b/lib/services/databox/lib/models/jobSecrets.js @@ -0,0 +1,58 @@ +/* + * 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 base class for the secrets + * + */ +class JobSecrets { + /** + * Create a JobSecrets. + * @member {string} jobSecretsType Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of JobSecrets + * + * @returns {object} metadata of JobSecrets + * + */ + mapper() { + return { + required: false, + serializedName: 'JobSecrets', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobSecretsType', + clientName: 'jobSecretsType' + }, + uberParent: 'JobSecrets', + className: 'JobSecrets', + modelProperties: { + jobSecretsType: { + required: true, + serializedName: 'jobSecretsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobSecrets; diff --git a/lib/services/databox/lib/models/jobStages.js b/lib/services/databox/lib/models/jobStages.js new file mode 100644 index 0000000000..158a9ba32a --- /dev/null +++ b/lib/services/databox/lib/models/jobStages.js @@ -0,0 +1,110 @@ +/* + * 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'); + +/** + * Job stages. + * + */ +class JobStages { + /** + * Create a JobStages. + * @member {string} stageName Name of the job stage. Possible values include: + * 'DeviceOrdered', 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', + * 'AtAzureDC', 'DataCopy', 'Completed', 'CompletedWithErrors', 'Cancelled', + * 'Failed_IssueReportedAtCustomer', 'Failed_IssueDetectedAtAzureDC', + * 'Aborted' + * @member {string} [displayName] Display name of the job stage. + * @member {string} stageStatus Status of the job stage. Possible values + * include: 'None', 'InProgress', 'Succeeded', 'Failed', 'Cancelled', + * 'Cancelling', 'SucceededWithErrors' + * @member {date} [stageTime] Time for the job stage in UTC ISO 8601 format. + * @member {object} [jobStageDetails] Job Stage Details + * @member {array} [errorDetails] Error details for the stage. + */ + constructor() { + } + + /** + * Defines the metadata of JobStages + * + * @returns {object} metadata of JobStages + * + */ + mapper() { + return { + required: false, + serializedName: 'JobStages', + type: { + name: 'Composite', + className: 'JobStages', + modelProperties: { + stageName: { + required: true, + serializedName: 'stageName', + type: { + name: 'Enum', + allowedValues: [ 'DeviceOrdered', 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', 'Failed_IssueDetectedAtAzureDC', 'Aborted' ] + } + }, + displayName: { + required: false, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + stageStatus: { + required: true, + serializedName: 'stageStatus', + type: { + name: 'Enum', + allowedValues: [ 'None', 'InProgress', 'Succeeded', 'Failed', 'Cancelled', 'Cancelling', 'SucceededWithErrors' ] + } + }, + stageTime: { + required: false, + serializedName: 'stageTime', + type: { + name: 'DateTime' + } + }, + jobStageDetails: { + required: false, + serializedName: 'jobStageDetails', + type: { + name: 'Object' + } + }, + errorDetails: { + required: false, + serializedName: 'errorDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobErrorDetailsElementType', + type: { + name: 'Composite', + className: 'JobErrorDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = JobStages; diff --git a/lib/services/databox/lib/models/notificationPreference.js b/lib/services/databox/lib/models/notificationPreference.js new file mode 100644 index 0000000000..b9dbc4de65 --- /dev/null +++ b/lib/services/databox/lib/models/notificationPreference.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'; + +/** + * Notification preference for a job stage. + * + */ +class NotificationPreference { + /** + * Create a NotificationPreference. + * @member {string} stageName Name of the stage. Possible values include: + * 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', + * 'DataCopy' + * @member {boolean} sendNotification Notification is required or not. + */ + constructor() { + } + + /** + * Defines the metadata of NotificationPreference + * + * @returns {object} metadata of NotificationPreference + * + */ + mapper() { + return { + required: false, + serializedName: 'NotificationPreference', + type: { + name: 'Composite', + className: 'NotificationPreference', + modelProperties: { + stageName: { + required: true, + serializedName: 'stageName', + type: { + name: 'Enum', + allowedValues: [ 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy' ] + } + }, + sendNotification: { + required: true, + serializedName: 'sendNotification', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = NotificationPreference; diff --git a/lib/services/databox/lib/models/operation.js b/lib/services/databox/lib/models/operation.js new file mode 100644 index 0000000000..1983f1ae05 --- /dev/null +++ b/lib/services/databox/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'; + +const models = require('./index'); + +/** + * Operation entity. + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} name Name of the operation. Format: + * {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} + * @member {object} display Operation display values. + * @member {string} [display.provider] Provider name. + * @member {string} [display.resource] Resource name. + * @member {string} [display.operation] Localized name of the operation for + * display purpose. + * @member {string} [display.description] Localized description of the + * operation for display purpose. + * @member {object} properties Operation properties. + * @member {string} origin Origin of the operation. Can be : + * user|system|user,system + */ + 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: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: true, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + }, + properties: { + required: true, + serializedName: 'properties', + type: { + name: 'Object' + } + }, + origin: { + required: true, + serializedName: 'origin', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/databox/lib/models/operationDisplay.js b/lib/services/databox/lib/models/operationDisplay.js new file mode 100644 index 0000000000..878daf0e9b --- /dev/null +++ b/lib/services/databox/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 + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @member {string} [provider] Provider name. + * @member {string} [resource] Resource name. + * @member {string} [operation] Localized name of the operation for display + * purpose. + * @member {string} [description] Localized description of the operation for + * display purpose. + */ + 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/databox/lib/models/operationList.js b/lib/services/databox/lib/models/operationList.js new file mode 100644 index 0000000000..31d2a1621d --- /dev/null +++ b/lib/services/databox/lib/models/operationList.js @@ -0,0 +1,67 @@ +/* + * 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 Collection. + */ +class OperationList extends Array { + /** + * Create a OperationList. + * @member {string} [nextLink] Link for the next set of operations. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OperationList + * + * @returns {object} metadata of OperationList + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationList', + type: { + name: 'Composite', + className: 'OperationList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationList; diff --git a/lib/services/databox/lib/models/packageShippingDetails.js b/lib/services/databox/lib/models/packageShippingDetails.js new file mode 100644 index 0000000000..471d4e457f --- /dev/null +++ b/lib/services/databox/lib/models/packageShippingDetails.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'; + +/** + * Shipping details. + * + */ +class PackageShippingDetails { + /** + * Create a PackageShippingDetails. + * @member {string} [carrierName] Name of the carrier. + * @member {string} [trackingId] Tracking Id of shipment. + * @member {string} [trackingUrl] Url where shipment can be tracked. + */ + constructor() { + } + + /** + * Defines the metadata of PackageShippingDetails + * + * @returns {object} metadata of PackageShippingDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'PackageShippingDetails', + type: { + name: 'Composite', + className: 'PackageShippingDetails', + modelProperties: { + 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 = PackageShippingDetails; diff --git a/lib/services/databox/lib/models/podJobDetails.js b/lib/services/databox/lib/models/podJobDetails.js new file mode 100644 index 0000000000..6199360298 --- /dev/null +++ b/lib/services/databox/lib/models/podJobDetails.js @@ -0,0 +1,130 @@ +/* + * 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'); + +/** + * Pod Job Details + * + * @extends models['JobDetails'] + */ +class PodJobDetails extends models['JobDetails'] { + /** + * Create a PodJobDetails. + * @member {array} [copyProgress] Copy progress per account. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PodJobDetails + * + * @returns {object} metadata of PodJobDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'Pod', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobDetailsType', + clientName: 'jobDetailsType' + }, + uberParent: 'JobDetails', + className: 'PodJobDetails', + modelProperties: { + expectedDataSizeInTeraBytes: { + required: false, + serializedName: 'expectedDataSizeInTeraBytes', + type: { + name: 'Number' + } + }, + jobStages: { + required: false, + serializedName: 'jobStages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobStagesElementType', + type: { + name: 'Composite', + className: 'JobStages' + } + } + } + }, + contactDetails: { + required: true, + serializedName: 'contactDetails', + type: { + name: 'Composite', + className: 'ContactDetails' + } + }, + shippingAddress: { + required: true, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + }, + errorDetails: { + required: false, + serializedName: 'errorDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobErrorDetailsElementType', + type: { + name: 'Composite', + className: 'JobErrorDetails' + } + } + } + }, + jobDetailsType: { + required: true, + serializedName: 'jobDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + copyProgress: { + required: false, + serializedName: 'copyProgress', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CopyProgressElementType', + type: { + name: 'Composite', + className: 'CopyProgress' + } + } + } + } + } + } + }; + } +} + +module.exports = PodJobDetails; diff --git a/lib/services/databox/lib/models/podJobSecrets.js b/lib/services/databox/lib/models/podJobSecrets.js new file mode 100644 index 0000000000..502a9a1bea --- /dev/null +++ b/lib/services/databox/lib/models/podJobSecrets.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'; + +const models = require('./index'); + +/** + * The secrets related to a pod job. + * + * @extends models['JobSecrets'] + */ +class PodJobSecrets extends models['JobSecrets'] { + /** + * Create a PodJobSecrets. + * @member {array} [podSecrets] Contains the list of secret objects for a + * job. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PodJobSecrets + * + * @returns {object} metadata of PodJobSecrets + * + */ + mapper() { + return { + required: false, + serializedName: 'Pod', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobSecretsType', + clientName: 'jobSecretsType' + }, + uberParent: 'JobSecrets', + className: 'PodJobSecrets', + modelProperties: { + jobSecretsType: { + required: true, + serializedName: 'jobSecretsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + podSecrets: { + required: false, + serializedName: 'podSecrets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PodSecretElementType', + type: { + name: 'Composite', + className: 'PodSecret' + } + } + } + } + } + } + }; + } +} + +module.exports = PodJobSecrets; diff --git a/lib/services/databox/lib/models/podSecret.js b/lib/services/databox/lib/models/podSecret.js new file mode 100644 index 0000000000..6d5dad55d2 --- /dev/null +++ b/lib/services/databox/lib/models/podSecret.js @@ -0,0 +1,81 @@ +/* + * 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 secrets related to a Pod. + * + */ +class PodSecret { + /** + * Create a PodSecret. + * @member {string} [deviceSerialNumber] Serial number of the assigned + * device. + * @member {string} [devicePassword] Password for out of the box experience + * on device. + * @member {array} [accountCredentialDetails] Per account level access + * credentials. + */ + constructor() { + } + + /** + * Defines the metadata of PodSecret + * + * @returns {object} metadata of PodSecret + * + */ + mapper() { + return { + required: false, + serializedName: 'PodSecret', + type: { + name: 'Composite', + className: 'PodSecret', + modelProperties: { + deviceSerialNumber: { + required: false, + serializedName: 'deviceSerialNumber', + type: { + name: 'String' + } + }, + devicePassword: { + required: false, + serializedName: 'devicePassword', + type: { + name: 'String' + } + }, + accountCredentialDetails: { + required: false, + serializedName: 'accountCredentialDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AccountCredentialDetailsElementType', + type: { + name: 'Composite', + className: 'AccountCredentialDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = PodSecret; diff --git a/lib/services/databox/lib/models/reportIssueDetails.js b/lib/services/databox/lib/models/reportIssueDetails.js new file mode 100644 index 0000000000..901c0b820e --- /dev/null +++ b/lib/services/databox/lib/models/reportIssueDetails.js @@ -0,0 +1,67 @@ +/* + * 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 of the reported issue. + * + */ +class ReportIssueDetails { + /** + * Create a ReportIssueDetails. + * @member {string} [issueType] Issue Type. Possible values include: + * 'DeviceMismatch', 'ValidationStringMismatch', 'CredentialNotWorking', + * 'DeviceFailure' + * @member {string} [deviceIssueType] Device Issue Type. Only used for Device + * failure issue. Possible values include: 'DeviceTampering', + * 'DeviceNotBootingUp', 'DeviceHealthCheckShowFailures', + * 'NICsAreNotWorking', 'Misc' + */ + constructor() { + } + + /** + * Defines the metadata of ReportIssueDetails + * + * @returns {object} metadata of ReportIssueDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ReportIssueDetails', + type: { + name: 'Composite', + className: 'ReportIssueDetails', + modelProperties: { + issueType: { + required: false, + serializedName: 'issueType', + type: { + name: 'Enum', + allowedValues: [ 'DeviceMismatch', 'ValidationStringMismatch', 'CredentialNotWorking', 'DeviceFailure' ] + } + }, + deviceIssueType: { + required: false, + serializedName: 'deviceIssueType', + type: { + name: 'Enum', + allowedValues: [ 'DeviceTampering', 'DeviceNotBootingUp', 'DeviceHealthCheckShowFailures', 'NICsAreNotWorking', 'Misc' ] + } + } + } + } + }; + } +} + +module.exports = ReportIssueDetails; diff --git a/lib/services/databox/lib/models/resource.js b/lib/services/databox/lib/models/resource.js new file mode 100644 index 0000000000..7b4f8e0d45 --- /dev/null +++ b/lib/services/databox/lib/models/resource.js @@ -0,0 +1,89 @@ +/* + * 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'); + +/** + * Model of the Resource. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} location The location of the resource. This will be one + * of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it + * is created, but if an identical region is specified on update the request + * will succeed. + * @member {object} [tags] The list of key value pairs that describe the + * resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * @member {object} sku The sku type. + * @member {string} [sku.name] The sku name. + * @member {string} [sku.displayName] The display name of the sku. + * @member {string} [sku.family] The sku family. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + 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: true, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/databox/lib/models/shareCredentialDetails.js b/lib/services/databox/lib/models/shareCredentialDetails.js new file mode 100644 index 0000000000..762649d305 --- /dev/null +++ b/lib/services/databox/lib/models/shareCredentialDetails.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'; + +/** + * Credential details of the shares in account. + * + */ +class ShareCredentialDetails { + /** + * Create a ShareCredentialDetails. + * @member {string} [shareName] Name of the share. + * @member {string} [userName] User name for the share. + * @member {string} [password] Password for the share. + */ + constructor() { + } + + /** + * Defines the metadata of ShareCredentialDetails + * + * @returns {object} metadata of ShareCredentialDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ShareCredentialDetails', + type: { + name: 'Composite', + className: 'ShareCredentialDetails', + modelProperties: { + shareName: { + required: false, + serializedName: 'shareName', + type: { + name: 'String' + } + }, + userName: { + required: false, + serializedName: 'userName', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'password', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ShareCredentialDetails; diff --git a/lib/services/databox/lib/models/shipmentPickUpRequest.js b/lib/services/databox/lib/models/shipmentPickUpRequest.js new file mode 100644 index 0000000000..30447b9a34 --- /dev/null +++ b/lib/services/databox/lib/models/shipmentPickUpRequest.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'; + +/** + * Shipment pick up request details. + * + */ +class ShipmentPickUpRequest { + /** + * Create a ShipmentPickUpRequest. + * @member {date} [startTime] Minimum date after which the pick up should + * commence, this must be in local time of pick up area. + * @member {date} [endTime] Maximum date before which the pick up should + * commence, this must be in local time of pick up area. + * @member {string} [shipmentLocation] Shipment Location in the pickup place. + * Eg.front desk + */ + constructor() { + } + + /** + * Defines the metadata of ShipmentPickUpRequest + * + * @returns {object} metadata of ShipmentPickUpRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'ShipmentPickUpRequest', + type: { + name: 'Composite', + className: 'ShipmentPickUpRequest', + modelProperties: { + startTime: { + required: false, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + }, + shipmentLocation: { + required: false, + serializedName: 'shipmentLocation', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ShipmentPickUpRequest; diff --git a/lib/services/databox/lib/models/shipmentPickUpResponse.js b/lib/services/databox/lib/models/shipmentPickUpResponse.js new file mode 100644 index 0000000000..58f2014b77 --- /dev/null +++ b/lib/services/databox/lib/models/shipmentPickUpResponse.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'; + +/** + * Shipment pick up response. + * + */ +class ShipmentPickUpResponse { + /** + * Create a ShipmentPickUpResponse. + * @member {string} [confirmationNumber] Confirmation number for the pick up + * request. + * @member {date} [readyByTime] Time by which shipment should be ready for + * pick up, this is in local time of pick up area. + */ + constructor() { + } + + /** + * Defines the metadata of ShipmentPickUpResponse + * + * @returns {object} metadata of ShipmentPickUpResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ShipmentPickUpResponse', + type: { + name: 'Composite', + className: 'ShipmentPickUpResponse', + modelProperties: { + confirmationNumber: { + required: false, + serializedName: 'confirmationNumber', + type: { + name: 'String' + } + }, + readyByTime: { + required: false, + serializedName: 'readyByTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = ShipmentPickUpResponse; diff --git a/lib/services/databox/lib/models/shippingAddress.js b/lib/services/databox/lib/models/shippingAddress.js new file mode 100644 index 0000000000..6c9265af63 --- /dev/null +++ b/lib/services/databox/lib/models/shippingAddress.js @@ -0,0 +1,126 @@ +/* + * 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'; + +/** + * Shipping address where customer wishes to receive the device. + * + */ +class ShippingAddress { + /** + * Create a ShippingAddress. + * @member {string} streetAddress1 Street Address line 1. + * @member {string} [streetAddress2] Street Address line 2. + * @member {string} [streetAddress3] Street Address line 3. + * @member {string} [city] Name of the City. + * @member {string} [stateOrProvince] Name of the State or Province. + * @member {string} country Name of the Country. + * @member {string} postalCode Postal code. + * @member {string} [zipExtendedCode] Extended Zip Code. + * @member {string} [companyName] Name of the company. + * @member {string} [addressType] Type of address. Possible values include: + * 'None', 'Residential', 'Commercial' + */ + constructor() { + } + + /** + * Defines the metadata of ShippingAddress + * + * @returns {object} metadata of ShippingAddress + * + */ + mapper() { + return { + required: false, + serializedName: 'ShippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress', + modelProperties: { + streetAddress1: { + required: true, + serializedName: 'streetAddress1', + type: { + name: 'String' + } + }, + streetAddress2: { + required: false, + serializedName: 'streetAddress2', + type: { + name: 'String' + } + }, + streetAddress3: { + required: false, + serializedName: 'streetAddress3', + type: { + name: 'String' + } + }, + city: { + required: false, + serializedName: 'city', + type: { + name: 'String' + } + }, + stateOrProvince: { + required: false, + serializedName: 'stateOrProvince', + type: { + name: 'String' + } + }, + country: { + required: true, + serializedName: 'country', + type: { + name: 'String' + } + }, + postalCode: { + required: true, + serializedName: 'postalCode', + type: { + name: 'String' + } + }, + zipExtendedCode: { + required: false, + serializedName: 'zipExtendedCode', + type: { + name: 'String' + } + }, + companyName: { + required: false, + serializedName: 'companyName', + type: { + name: 'String' + } + }, + addressType: { + required: false, + serializedName: 'addressType', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Residential', 'Commercial' ] + } + } + } + } + }; + } +} + +module.exports = ShippingAddress; diff --git a/lib/services/databox/lib/models/shippingLabelDetails.js b/lib/services/databox/lib/models/shippingLabelDetails.js new file mode 100644 index 0000000000..d97f469f2d --- /dev/null +++ b/lib/services/databox/lib/models/shippingLabelDetails.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Details for the shipping label. + * + */ +class ShippingLabelDetails { + /** + * Create a ShippingLabelDetails. + * @member {string} shippingLabelSasUri Sas uri for accessing the shipping + * label. + */ + constructor() { + } + + /** + * Defines the metadata of ShippingLabelDetails + * + * @returns {object} metadata of ShippingLabelDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ShippingLabelDetails', + type: { + name: 'Composite', + className: 'ShippingLabelDetails', + modelProperties: { + shippingLabelSasUri: { + required: true, + serializedName: 'shippingLabelSasUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ShippingLabelDetails; diff --git a/lib/services/databox/lib/models/sku.js b/lib/services/databox/lib/models/sku.js new file mode 100644 index 0000000000..dbe7a5e5f3 --- /dev/null +++ b/lib/services/databox/lib/models/sku.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'; + +/** + * The Sku. + * + */ +class Sku { + /** + * Create a Sku. + * @member {string} name The sku name. + * @member {string} [displayName] The display name of the sku. + * @member {string} [family] The sku family. + */ + 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: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + family: { + required: false, + serializedName: 'family', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Sku; diff --git a/lib/services/databox/lib/models/skuCapacity.js b/lib/services/databox/lib/models/skuCapacity.js new file mode 100644 index 0000000000..1b4e9af335 --- /dev/null +++ b/lib/services/databox/lib/models/skuCapacity.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'; + +/** + * Capacity of the sku. + * + */ +class SkuCapacity { + /** + * Create a SkuCapacity. + * @member {string} usable Usable capacity in TB. + * @member {string} maximum Maximum capacity in TB. + */ + constructor() { + } + + /** + * Defines the metadata of SkuCapacity + * + * @returns {object} metadata of SkuCapacity + * + */ + mapper() { + return { + required: false, + serializedName: 'SkuCapacity', + type: { + name: 'Composite', + className: 'SkuCapacity', + modelProperties: { + usable: { + required: true, + serializedName: 'usable', + type: { + name: 'String' + } + }, + maximum: { + required: true, + serializedName: 'maximum', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SkuCapacity; diff --git a/lib/services/databox/lib/models/skuCost.js b/lib/services/databox/lib/models/skuCost.js new file mode 100644 index 0000000000..5c34e9d1b9 --- /dev/null +++ b/lib/services/databox/lib/models/skuCost.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'; + +/** + * Describes metadata for retrieving price info. + * + */ +class SkuCost { + /** + * Create a SkuCost. + * @member {string} meterId Meter id of the Sku. + * @member {string} meterType The type of the meter. + */ + constructor() { + } + + /** + * Defines the metadata of SkuCost + * + * @returns {object} metadata of SkuCost + * + */ + mapper() { + return { + required: false, + serializedName: 'SkuCost', + type: { + name: 'Composite', + className: 'SkuCost', + modelProperties: { + meterId: { + required: true, + serializedName: 'meterId', + type: { + name: 'String' + } + }, + meterType: { + required: true, + serializedName: 'meterType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SkuCost; diff --git a/lib/services/databox/lib/models/skuInformation.js b/lib/services/databox/lib/models/skuInformation.js new file mode 100644 index 0000000000..b8b38f5808 --- /dev/null +++ b/lib/services/databox/lib/models/skuInformation.js @@ -0,0 +1,133 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Information of the sku. + * + */ +class SkuInformation { + /** + * Create a SkuInformation. + * @member {object} sku The Sku. + * @member {string} [sku.name] The sku name. + * @member {string} [sku.displayName] The display name of the sku. + * @member {string} [sku.family] The sku family. + * @member {boolean} enabled The sku is enabled or not. + * @member {array} [destinationToServiceLocationMap] The map of destination + * location to service location. + * @member {object} capacity Capacity of the Sku. + * @member {string} [capacity.usable] Usable capacity in TB. + * @member {string} [capacity.maximum] Maximum capacity in TB. + * @member {array} costs Cost of the Sku. + * @member {array} apiVersions Api versions that support this Sku. + * @member {string} [disabledReason] Reason why the Sku is disabled. + */ + constructor() { + } + + /** + * Defines the metadata of SkuInformation + * + * @returns {object} metadata of SkuInformation + * + */ + mapper() { + return { + required: false, + serializedName: 'SkuInformation', + type: { + name: 'Composite', + className: 'SkuInformation', + modelProperties: { + sku: { + required: true, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + enabled: { + required: true, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + destinationToServiceLocationMap: { + required: false, + serializedName: 'properties.destinationToServiceLocationMap', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DestinationToServiceLocationMapElementType', + type: { + name: 'Composite', + className: 'DestinationToServiceLocationMap' + } + } + } + }, + capacity: { + required: true, + serializedName: 'properties.capacity', + type: { + name: 'Composite', + className: 'SkuCapacity' + } + }, + costs: { + required: true, + serializedName: 'properties.costs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SkuCostElementType', + type: { + name: 'Composite', + className: 'SkuCost' + } + } + } + }, + apiVersions: { + required: true, + serializedName: 'properties.apiVersions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + disabledReason: { + required: false, + serializedName: 'properties.disabledReason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SkuInformation; diff --git a/lib/services/databox/lib/models/unencryptedSecrets.js b/lib/services/databox/lib/models/unencryptedSecrets.js new file mode 100644 index 0000000000..34c5fdd250 --- /dev/null +++ b/lib/services/databox/lib/models/unencryptedSecrets.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'; + +const models = require('./index'); + +/** + * Unencrypted secrets for accessing device. + * + */ +class UnencryptedSecrets { + /** + * Create a UnencryptedSecrets. + * @member {string} jobName Name of the job. + * @member {string} [deviceType] The Device Type used in the job. Possible + * values include: 'Pod', 'Disk', 'Cabinet' + * @member {object} [jobSecrets] Secrets related to this job. + * @member {string} [jobSecrets.jobSecretsType] Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of UnencryptedSecrets + * + * @returns {object} metadata of UnencryptedSecrets + * + */ + mapper() { + return { + required: false, + serializedName: 'UnencryptedSecrets', + type: { + name: 'Composite', + className: 'UnencryptedSecrets', + modelProperties: { + jobName: { + required: true, + serializedName: 'jobName', + type: { + name: 'String' + } + }, + deviceType: { + required: false, + serializedName: 'deviceType', + type: { + name: 'Enum', + allowedValues: [ 'Pod', 'Disk', 'Cabinet' ] + } + }, + jobSecrets: { + required: false, + serializedName: 'jobSecrets', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobSecretsType', + clientName: 'jobSecretsType' + }, + uberParent: 'JobSecrets', + className: 'JobSecrets' + } + } + } + } + }; + } +} + +module.exports = UnencryptedSecrets; diff --git a/lib/services/databox/lib/models/updateJobDetails.js b/lib/services/databox/lib/models/updateJobDetails.js new file mode 100644 index 0000000000..59ab402886 --- /dev/null +++ b/lib/services/databox/lib/models/updateJobDetails.js @@ -0,0 +1,88 @@ +/* + * 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'); + +/** + * Job details for update. + * + */ +class UpdateJobDetails { + /** + * Create a UpdateJobDetails. + * @member {object} [contactDetails] Contact details for notification and + * shipping. + * @member {string} [contactDetails.contactName] Contact name of the person. + * @member {string} [contactDetails.phone] Phone number of the contact + * person. + * @member {string} [contactDetails.phoneExtension] Phone extension number of + * the contact person. + * @member {string} [contactDetails.mobile] Mobile number of the contact + * person. + * @member {array} [contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} [shippingAddress] Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + */ + constructor() { + } + + /** + * Defines the metadata of UpdateJobDetails + * + * @returns {object} metadata of UpdateJobDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'UpdateJobDetails', + type: { + name: 'Composite', + className: 'UpdateJobDetails', + modelProperties: { + contactDetails: { + required: false, + serializedName: 'contactDetails', + type: { + name: 'Composite', + className: 'ContactDetails' + } + }, + shippingAddress: { + required: false, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + } + } + } + }; + } +} + +module.exports = UpdateJobDetails; diff --git a/lib/services/databox/lib/models/validateAddress.js b/lib/services/databox/lib/models/validateAddress.js new file mode 100644 index 0000000000..2ccf4508e0 --- /dev/null +++ b/lib/services/databox/lib/models/validateAddress.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'; + +const models = require('./index'); + +/** + * The requirements to validate customer address where the device needs to be + * shipped. + * + */ +class ValidateAddress { + /** + * Create a ValidateAddress. + * @member {object} [shippingAddress] Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * @member {string} [deviceType] Device type to be used for the job. Possible + * values include: 'Pod', 'Disk', 'Cabinet' + */ + constructor() { + } + + /** + * Defines the metadata of ValidateAddress + * + * @returns {object} metadata of ValidateAddress + * + */ + mapper() { + return { + required: false, + serializedName: 'ValidateAddress', + type: { + name: 'Composite', + className: 'ValidateAddress', + modelProperties: { + shippingAddress: { + required: false, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + }, + deviceType: { + required: false, + serializedName: 'deviceType', + type: { + name: 'Enum', + allowedValues: [ 'Pod', 'Disk', 'Cabinet' ] + } + } + } + } + }; + } +} + +module.exports = ValidateAddress; diff --git a/lib/services/databox/lib/operations/index.d.ts b/lib/services/databox/lib/operations/index.d.ts new file mode 100644 index 0000000000..9665379ef5 --- /dev/null +++ b/lib/services/databox/lib/operations/index.d.ts @@ -0,0 +1,2296 @@ +/* + * 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 DataBoxManagementClient. + */ +export interface Operations { + + + /** + * This method gets all the operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method gets all the operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationList} - 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. + * + * {OperationList} [result] - The deserialized result object if an error did not occur. + * See {@link OperationList} 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; + + + /** + * This method gets all the operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method gets all the operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationList} - 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. + * + * {OperationList} [result] - The deserialized result object if an error did not occur. + * See {@link OperationList} 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 + * Jobs + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxManagementClient. + */ +export interface Jobs { + + + /** + * Lists all the jobs available under the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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?: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the jobs available under the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 {JobResourceList} - 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. + * + * {JobResourceList} [result] - The deserialized result object if an error did not occur. + * See {@link JobResourceList} 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?: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the jobs available under the given resource group. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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?: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the jobs available under the given resource group. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 {JobResourceList} - 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. + * + * {JobResourceList} [result] - The deserialized result object if an error did not occur. + * See {@link JobResourceList} 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?: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about the specified job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] $expand is supported on details parameter + * for job, which provides details on the job stages. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, jobName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about the specified job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] $expand is supported on details parameter + * for job, which provides details on the job stages. + * + * @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 {JobResource} - 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. + * + * {JobResource} [result] - The deserialized result object if an error did not occur. + * See {@link JobResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, jobName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, jobName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, jobName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {string} [jobResource.deviceType] Type of the device to be used for + * the job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @param {boolean} [jobResource.isCancellable] Describes whether the job is + * cancellable or not. + * + * @param {boolean} [jobResource.isShippingAddressEditable] Describes whether + * the shipping address is editable or not. + * + * @param {string} [jobResource.status] Name of the stage which is in progress. + * Possible values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * + * @param {date} [jobResource.startTime] Time at which the job was started in + * UTC ISO 8601 format. + * + * @param {object} [jobResource.error] Top level error for the job. + * + * @param {string} jobResource.error.code Error code that can be used to + * programmatically identify the error. + * + * @param {string} [jobResource.error.message] Describes the error in detail + * and provides debugging information. + * + * @param {object} [jobResource.deliveryPackage] Delivery package shipping + * details. + * + * @param {object} [jobResource.returnPackage] Return package shipping details. + * + * @param {string} [jobResource.returnPackage.carrierName] Name of the carrier. + * + * @param {string} [jobResource.returnPackage.trackingId] Tracking Id of + * shipment. + * + * @param {string} [jobResource.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * + * @param {array} jobResource.destinationAccountDetails Destination account + * details. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {array} [jobResource.details.jobStages] List of stages that run in + * the job. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} [jobResource.details.contactDetails.contactName] Contact + * name of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResource.details.errorDetails] Error details for failure. + * This is optional. + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} [jobResource.cancellationReason] Reason for cancellation. + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {string} [jobResource.deviceType] Type of the device to be used for + * the job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @param {boolean} [jobResource.isCancellable] Describes whether the job is + * cancellable or not. + * + * @param {boolean} [jobResource.isShippingAddressEditable] Describes whether + * the shipping address is editable or not. + * + * @param {string} [jobResource.status] Name of the stage which is in progress. + * Possible values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * + * @param {date} [jobResource.startTime] Time at which the job was started in + * UTC ISO 8601 format. + * + * @param {object} [jobResource.error] Top level error for the job. + * + * @param {string} jobResource.error.code Error code that can be used to + * programmatically identify the error. + * + * @param {string} [jobResource.error.message] Describes the error in detail + * and provides debugging information. + * + * @param {object} [jobResource.deliveryPackage] Delivery package shipping + * details. + * + * @param {object} [jobResource.returnPackage] Return package shipping details. + * + * @param {string} [jobResource.returnPackage.carrierName] Name of the carrier. + * + * @param {string} [jobResource.returnPackage.trackingId] Tracking Id of + * shipment. + * + * @param {string} [jobResource.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * + * @param {array} jobResource.destinationAccountDetails Destination account + * details. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {array} [jobResource.details.jobStages] List of stages that run in + * the job. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} [jobResource.details.contactDetails.contactName] Contact + * name of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResource.details.errorDetails] Error details for failure. + * This is optional. + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} [jobResource.cancellationReason] Reason for cancellation. + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 {JobResource} - 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. + * + * {JobResource} [result] - The deserialized result object if an error did not occur. + * See {@link JobResource} 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. + */ + create(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, jobName: string, jobResource: models.JobResource, callback: ServiceCallback): void; + create(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, jobName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, jobName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} jobResourceUpdateParameter.details Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.contactName] Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} jobResourceUpdateParameter.details Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.contactName] Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 {JobResource} - 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. + * + * {JobResource} [result] - The deserialized result object if an error did not occur. + * See {@link JobResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, callback: ServiceCallback): void; + update(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Book shipment pick up. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} shipmentPickUpRequest Details of shipment pick up request. + * + * @param {date} [shipmentPickUpRequest.startTime] Minimum date after which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {date} [shipmentPickUpRequest.endTime] Maximum date before which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {string} [shipmentPickUpRequest.shipmentLocation] Shipment Location + * in the pickup place. Eg.front desk + * + * @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. + */ + bookShipmentPickUpWithHttpOperationResponse(resourceGroupName: string, jobName: string, shipmentPickUpRequest: models.ShipmentPickUpRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Book shipment pick up. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} shipmentPickUpRequest Details of shipment pick up request. + * + * @param {date} [shipmentPickUpRequest.startTime] Minimum date after which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {date} [shipmentPickUpRequest.endTime] Maximum date before which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {string} [shipmentPickUpRequest.shipmentLocation] Shipment Location + * in the pickup place. Eg.front desk + * + * @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 {ShipmentPickUpResponse} - 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. + * + * {ShipmentPickUpResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ShipmentPickUpResponse} 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. + */ + bookShipmentPickUp(resourceGroupName: string, jobName: string, shipmentPickUpRequest: models.ShipmentPickUpRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + bookShipmentPickUp(resourceGroupName: string, jobName: string, shipmentPickUpRequest: models.ShipmentPickUpRequest, callback: ServiceCallback): void; + bookShipmentPickUp(resourceGroupName: string, jobName: string, shipmentPickUpRequest: models.ShipmentPickUpRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * CancelJob. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} cancellationReason Reason for cancellation. + * + * @param {string} cancellationReason.reason Reason for cancellation. + * + * @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. + */ + cancelWithHttpOperationResponse(resourceGroupName: string, jobName: string, cancellationReason: models.CancellationReason, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * CancelJob. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} cancellationReason Reason for cancellation. + * + * @param {string} cancellationReason.reason Reason for cancellation. + * + * @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. + */ + cancel(resourceGroupName: string, jobName: string, cancellationReason: models.CancellationReason, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + cancel(resourceGroupName: string, jobName: string, cancellationReason: models.CancellationReason, callback: ServiceCallback): void; + cancel(resourceGroupName: string, jobName: string, cancellationReason: models.CancellationReason, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Provides list of copy logs uri. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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. + */ + getCopyLogsUriWithHttpOperationResponse(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Provides list of copy logs uri. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 {GetCopyLogsUriOutput} - 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. + * + * {GetCopyLogsUriOutput} [result] - The deserialized result object if an error did not occur. + * See {@link GetCopyLogsUriOutput} 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. + */ + getCopyLogsUri(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getCopyLogsUri(resourceGroupName: string, jobName: string, callback: ServiceCallback): void; + getCopyLogsUri(resourceGroupName: string, jobName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get shipping label sas uri. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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. + */ + downloadShippingLabelUriWithHttpOperationResponse(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get shipping label sas uri. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 {ShippingLabelDetails} - 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. + * + * {ShippingLabelDetails} [result] - The deserialized result object if an error did not occur. + * See {@link ShippingLabelDetails} 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. + */ + downloadShippingLabelUri(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + downloadShippingLabelUri(resourceGroupName: string, jobName: string, callback: ServiceCallback): void; + downloadShippingLabelUri(resourceGroupName: string, jobName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * This method gets the unencrypted secrets related to the job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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. + */ + listSecretsWithHttpOperationResponse(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method gets the unencrypted secrets related to the job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 {UnencryptedSecrets} - 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. + * + * {UnencryptedSecrets} [result] - The deserialized result object if an error did not occur. + * See {@link UnencryptedSecrets} 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. + */ + listSecrets(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listSecrets(resourceGroupName: string, jobName: string, callback: ServiceCallback): void; + listSecrets(resourceGroupName: string, jobName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Reports an issue. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} reportIssueDetails Details of reported issue. + * + * @param {string} [reportIssueDetails.issueType] Issue Type. Possible values + * include: 'DeviceMismatch', 'ValidationStringMismatch', + * 'CredentialNotWorking', 'DeviceFailure' + * + * @param {string} [reportIssueDetails.deviceIssueType] Device Issue Type. Only + * used for Device failure issue. Possible values include: 'DeviceTampering', + * 'DeviceNotBootingUp', 'DeviceHealthCheckShowFailures', 'NICsAreNotWorking', + * 'Misc' + * + * @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. + */ + reportIssueWithHttpOperationResponse(resourceGroupName: string, jobName: string, reportIssueDetails: models.ReportIssueDetails, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Reports an issue. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} reportIssueDetails Details of reported issue. + * + * @param {string} [reportIssueDetails.issueType] Issue Type. Possible values + * include: 'DeviceMismatch', 'ValidationStringMismatch', + * 'CredentialNotWorking', 'DeviceFailure' + * + * @param {string} [reportIssueDetails.deviceIssueType] Device Issue Type. Only + * used for Device failure issue. Possible values include: 'DeviceTampering', + * 'DeviceNotBootingUp', 'DeviceHealthCheckShowFailures', 'NICsAreNotWorking', + * 'Misc' + * + * @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. + */ + reportIssue(resourceGroupName: string, jobName: string, reportIssueDetails: models.ReportIssueDetails, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + reportIssue(resourceGroupName: string, jobName: string, reportIssueDetails: models.ReportIssueDetails, callback: ServiceCallback): void; + reportIssue(resourceGroupName: string, jobName: string, reportIssueDetails: models.ReportIssueDetails, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {string} [jobResource.deviceType] Type of the device to be used for + * the job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @param {boolean} [jobResource.isCancellable] Describes whether the job is + * cancellable or not. + * + * @param {boolean} [jobResource.isShippingAddressEditable] Describes whether + * the shipping address is editable or not. + * + * @param {string} [jobResource.status] Name of the stage which is in progress. + * Possible values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * + * @param {date} [jobResource.startTime] Time at which the job was started in + * UTC ISO 8601 format. + * + * @param {object} [jobResource.error] Top level error for the job. + * + * @param {string} jobResource.error.code Error code that can be used to + * programmatically identify the error. + * + * @param {string} [jobResource.error.message] Describes the error in detail + * and provides debugging information. + * + * @param {object} [jobResource.deliveryPackage] Delivery package shipping + * details. + * + * @param {object} [jobResource.returnPackage] Return package shipping details. + * + * @param {string} [jobResource.returnPackage.carrierName] Name of the carrier. + * + * @param {string} [jobResource.returnPackage.trackingId] Tracking Id of + * shipment. + * + * @param {string} [jobResource.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * + * @param {array} jobResource.destinationAccountDetails Destination account + * details. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {array} [jobResource.details.jobStages] List of stages that run in + * the job. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} [jobResource.details.contactDetails.contactName] Contact + * name of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResource.details.errorDetails] Error details for failure. + * This is optional. + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} [jobResource.cancellationReason] Reason for cancellation. + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {string} [jobResource.deviceType] Type of the device to be used for + * the job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @param {boolean} [jobResource.isCancellable] Describes whether the job is + * cancellable or not. + * + * @param {boolean} [jobResource.isShippingAddressEditable] Describes whether + * the shipping address is editable or not. + * + * @param {string} [jobResource.status] Name of the stage which is in progress. + * Possible values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * + * @param {date} [jobResource.startTime] Time at which the job was started in + * UTC ISO 8601 format. + * + * @param {object} [jobResource.error] Top level error for the job. + * + * @param {string} jobResource.error.code Error code that can be used to + * programmatically identify the error. + * + * @param {string} [jobResource.error.message] Describes the error in detail + * and provides debugging information. + * + * @param {object} [jobResource.deliveryPackage] Delivery package shipping + * details. + * + * @param {object} [jobResource.returnPackage] Return package shipping details. + * + * @param {string} [jobResource.returnPackage.carrierName] Name of the carrier. + * + * @param {string} [jobResource.returnPackage.trackingId] Tracking Id of + * shipment. + * + * @param {string} [jobResource.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * + * @param {array} jobResource.destinationAccountDetails Destination account + * details. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {array} [jobResource.details.jobStages] List of stages that run in + * the job. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} [jobResource.details.contactDetails.contactName] Contact + * name of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResource.details.errorDetails] Error details for failure. + * This is optional. + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} [jobResource.cancellationReason] Reason for cancellation. + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 {JobResource} - 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. + * + * {JobResource} [result] - The deserialized result object if an error did not occur. + * See {@link JobResource} 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. + */ + beginCreate(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, jobName: string, jobResource: models.JobResource, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} jobResourceUpdateParameter.details Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.contactName] Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} jobResourceUpdateParameter.details Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.contactName] Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 {JobResource} - 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. + * + * {JobResource} [result] - The deserialized result object if an error did not occur. + * See {@link JobResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the jobs available under the subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the jobs available under the 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 {JobResourceList} - 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. + * + * {JobResourceList} [result] - The deserialized result object if an error did not occur. + * See {@link JobResourceList} 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; + + + /** + * Lists all the jobs available under the given 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>; + + /** + * Lists all the jobs available under the given 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 {JobResourceList} - 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. + * + * {JobResourceList} [result] - The deserialized result object if an error did not occur. + * See {@link JobResourceList} 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 + * Service + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxManagementClient. + */ +export interface Service { + + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @param {string} location The location of the resource + * + * @param {object} availableSkuRequest Filters for showing the available skus. + * + * @param {string} availableSkuRequest.country ISO country code. Country for + * hardware shipment. For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * + * @param {string} availableSkuRequest.location Location for data transfer. For + * locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * + * @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. + */ + listAvailableSkusWithHttpOperationResponse(location: string, availableSkuRequest: models.AvailableSkuRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @param {string} location The location of the resource + * + * @param {object} availableSkuRequest Filters for showing the available skus. + * + * @param {string} availableSkuRequest.country ISO country code. Country for + * hardware shipment. For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * + * @param {string} availableSkuRequest.location Location for data transfer. For + * locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * + * @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 {AvailableSkusResult} - 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. + * + * {AvailableSkusResult} [result] - The deserialized result object if an error did not occur. + * See {@link AvailableSkusResult} 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. + */ + listAvailableSkus(location: string, availableSkuRequest: models.AvailableSkuRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAvailableSkus(location: string, availableSkuRequest: models.AvailableSkuRequest, callback: ServiceCallback): void; + listAvailableSkus(location: string, availableSkuRequest: models.AvailableSkuRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * This method validates the customer shipping address and provide alternate + * addresses if any. + * + * @param {string} location The location of the resource + * + * @param {object} validateAddress Shipping address of the customer. + * + * @param {object} [validateAddress.shippingAddress] Shipping address of the + * customer. + * + * @param {string} validateAddress.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [validateAddress.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [validateAddress.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [validateAddress.shippingAddress.city] Name of the City. + * + * @param {string} [validateAddress.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} validateAddress.shippingAddress.country Name of the Country. + * + * @param {string} validateAddress.shippingAddress.postalCode Postal code. + * + * @param {string} [validateAddress.shippingAddress.zipExtendedCode] Extended + * Zip Code. + * + * @param {string} [validateAddress.shippingAddress.companyName] Name of the + * company. + * + * @param {string} [validateAddress.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {string} [validateAddress.deviceType] Device type to be used for the + * job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @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. + */ + validateAddressMethodWithHttpOperationResponse(location: string, validateAddress: models.ValidateAddress, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method validates the customer shipping address and provide alternate + * addresses if any. + * + * @param {string} location The location of the resource + * + * @param {object} validateAddress Shipping address of the customer. + * + * @param {object} [validateAddress.shippingAddress] Shipping address of the + * customer. + * + * @param {string} validateAddress.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [validateAddress.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [validateAddress.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [validateAddress.shippingAddress.city] Name of the City. + * + * @param {string} [validateAddress.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} validateAddress.shippingAddress.country Name of the Country. + * + * @param {string} validateAddress.shippingAddress.postalCode Postal code. + * + * @param {string} [validateAddress.shippingAddress.zipExtendedCode] Extended + * Zip Code. + * + * @param {string} [validateAddress.shippingAddress.companyName] Name of the + * company. + * + * @param {string} [validateAddress.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {string} [validateAddress.deviceType] Device type to be used for the + * job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @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 {AddressValidationOutput} - 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. + * + * {AddressValidationOutput} [result] - The deserialized result object if an error did not occur. + * See {@link AddressValidationOutput} 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. + */ + validateAddressMethod(location: string, validateAddress: models.ValidateAddress, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + validateAddressMethod(location: string, validateAddress: models.ValidateAddress, callback: ServiceCallback): void; + validateAddressMethod(location: string, validateAddress: models.ValidateAddress, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @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. + */ + listAvailableSkusNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @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 {AvailableSkusResult} - 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. + * + * {AvailableSkusResult} [result] - The deserialized result object if an error did not occur. + * See {@link AvailableSkusResult} 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. + */ + listAvailableSkusNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAvailableSkusNext(nextPageLink: string, callback: ServiceCallback): void; + listAvailableSkusNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/databox/lib/operations/index.js b/lib/services/databox/lib/operations/index.js new file mode 100644 index 0000000000..9ece56c7e9 --- /dev/null +++ b/lib/services/databox/lib/operations/index.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.Operations = require('./operations'); +exports.Jobs = require('./jobs'); +exports.Service = require('./service'); diff --git a/lib/services/databox/lib/operations/jobs.js b/lib/services/databox/lib/operations/jobs.js new file mode 100644 index 0000000000..ec67d62513 --- /dev/null +++ b/lib/services/databox/lib/operations/jobs.js @@ -0,0 +1,5172 @@ +/* + * 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 jobs available under the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 JobResourceList} 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.'); + } + let skipToken = (options && options.skipToken !== undefined) ? options.skipToken : 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 (skipToken !== null && skipToken !== undefined && typeof skipToken.valueOf() !== 'string') { + throw new Error('skipToken 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.DataBox/jobs'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (skipToken !== null && skipToken !== undefined) { + queryParameters.push('$skipToken=' + encodeURIComponent(skipToken)); + } + 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['JobResourceList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the jobs available under the given resource group. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 JobResourceList} 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 skipToken = (options && options.skipToken !== undefined) ? options.skipToken : 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 (skipToken !== null && skipToken !== undefined && typeof skipToken.valueOf() !== 'string') { + throw new Error('skipToken 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.DataBox/jobs'; + 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 (skipToken !== null && skipToken !== undefined) { + queryParameters.push('$skipToken=' + encodeURIComponent(skipToken)); + } + 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['JobResourceList']().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 information about the specified job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] $expand is supported on details parameter + * for job, which provides details on the job stages. + * + * @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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, jobName, 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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.DataBox/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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['JobResource']().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 a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {string} [jobResource.deviceType] Type of the device to be used for + * the job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @param {boolean} [jobResource.isCancellable] Describes whether the job is + * cancellable or not. + * + * @param {boolean} [jobResource.isShippingAddressEditable] Describes whether + * the shipping address is editable or not. + * + * @param {string} [jobResource.status] Name of the stage which is in progress. + * Possible values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * + * @param {date} [jobResource.startTime] Time at which the job was started in + * UTC ISO 8601 format. + * + * @param {object} [jobResource.error] Top level error for the job. + * + * @param {string} jobResource.error.code Error code that can be used to + * programmatically identify the error. + * + * @param {string} [jobResource.error.message] Describes the error in detail + * and provides debugging information. + * + * @param {object} [jobResource.deliveryPackage] Delivery package shipping + * details. + * + * @param {object} [jobResource.returnPackage] Return package shipping details. + * + * @param {string} [jobResource.returnPackage.carrierName] Name of the carrier. + * + * @param {string} [jobResource.returnPackage.trackingId] Tracking Id of + * shipment. + * + * @param {string} [jobResource.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * + * @param {array} jobResource.destinationAccountDetails Destination account + * details. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {array} [jobResource.details.jobStages] List of stages that run in + * the job. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} [jobResource.details.contactDetails.contactName] Contact + * name of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResource.details.errorDetails] Error details for failure. + * This is optional. + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} [jobResource.cancellationReason] Reason for cancellation. + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 JobResource} 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 _create(resourceGroupName, jobName, jobResource, 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.beginCreate(resourceGroupName, jobName, jobResource, 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['JobResource']().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 a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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(resourceGroupName, jobName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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.DataBox/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 !== 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); + }); +} + + +/** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} jobResourceUpdateParameter.details Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.contactName] Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, jobName, jobResourceUpdateParameter, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, 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['JobResource']().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); + }); + }); +} + +/** + * Book shipment pick up. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} shipmentPickUpRequest Details of shipment pick up request. + * + * @param {date} [shipmentPickUpRequest.startTime] Minimum date after which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {date} [shipmentPickUpRequest.endTime] Maximum date before which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {string} [shipmentPickUpRequest.shipmentLocation] Shipment Location + * in the pickup place. Eg.front desk + * + * @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 ShipmentPickUpResponse} 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 _bookShipmentPickUp(resourceGroupName, jobName, shipmentPickUpRequest, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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 (shipmentPickUpRequest === null || shipmentPickUpRequest === undefined) { + throw new Error('shipmentPickUpRequest cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 (shipmentPickUpRequest !== null && shipmentPickUpRequest !== undefined) { + let requestModelMapper = new client.models['ShipmentPickUpRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, shipmentPickUpRequest, 'shipmentPickUpRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(shipmentPickUpRequest, 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['ShipmentPickUpResponse']().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); + }); +} + +/** + * CancelJob. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} cancellationReason Reason for cancellation. + * + * @param {string} cancellationReason.reason Reason for cancellation. + * + * @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 _cancel(resourceGroupName, jobName, cancellationReason, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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 (cancellationReason === null || cancellationReason === undefined) { + throw new Error('cancellationReason cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 (cancellationReason !== null && cancellationReason !== undefined) { + let requestModelMapper = new client.models['CancellationReason']().mapper(); + requestModel = client.serialize(requestModelMapper, cancellationReason, 'cancellationReason'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(cancellationReason, 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 !== 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); + }); +} + +/** + * Provides list of copy logs uri. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 GetCopyLogsUriOutput} 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 _getCopyLogsUri(resourceGroupName, jobName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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.DataBox/jobs/{jobName}/copyLogsUri'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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['GetCopyLogsUriOutput']().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 shipping label sas uri. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 ShippingLabelDetails} 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 _downloadShippingLabelUri(resourceGroupName, jobName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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.DataBox/jobs/{jobName}/downloadShippingLabel'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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['ShippingLabelDetails']().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); + }); +} + +/** + * This method gets the unencrypted secrets related to the job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 UnencryptedSecrets} 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 _listSecrets(resourceGroupName, jobName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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.DataBox/jobs/{jobName}/listSecrets'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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['UnencryptedSecrets']().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); + }); +} + +/** + * Reports an issue. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} reportIssueDetails Details of reported issue. + * + * @param {string} [reportIssueDetails.issueType] Issue Type. Possible values + * include: 'DeviceMismatch', 'ValidationStringMismatch', + * 'CredentialNotWorking', 'DeviceFailure' + * + * @param {string} [reportIssueDetails.deviceIssueType] Device Issue Type. Only + * used for Device failure issue. Possible values include: 'DeviceTampering', + * 'DeviceNotBootingUp', 'DeviceHealthCheckShowFailures', 'NICsAreNotWorking', + * 'Misc' + * + * @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 _reportIssue(resourceGroupName, jobName, reportIssueDetails, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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 (reportIssueDetails === null || reportIssueDetails === undefined) { + throw new Error('reportIssueDetails cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/reportIssue'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 (reportIssueDetails !== null && reportIssueDetails !== undefined) { + let requestModelMapper = new client.models['ReportIssueDetails']().mapper(); + requestModel = client.serialize(requestModelMapper, reportIssueDetails, 'reportIssueDetails'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(reportIssueDetails, 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 !== 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); + }); +} + +/** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {string} [jobResource.deviceType] Type of the device to be used for + * the job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @param {boolean} [jobResource.isCancellable] Describes whether the job is + * cancellable or not. + * + * @param {boolean} [jobResource.isShippingAddressEditable] Describes whether + * the shipping address is editable or not. + * + * @param {string} [jobResource.status] Name of the stage which is in progress. + * Possible values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * + * @param {date} [jobResource.startTime] Time at which the job was started in + * UTC ISO 8601 format. + * + * @param {object} [jobResource.error] Top level error for the job. + * + * @param {string} jobResource.error.code Error code that can be used to + * programmatically identify the error. + * + * @param {string} [jobResource.error.message] Describes the error in detail + * and provides debugging information. + * + * @param {object} [jobResource.deliveryPackage] Delivery package shipping + * details. + * + * @param {object} [jobResource.returnPackage] Return package shipping details. + * + * @param {string} [jobResource.returnPackage.carrierName] Name of the carrier. + * + * @param {string} [jobResource.returnPackage.trackingId] Tracking Id of + * shipment. + * + * @param {string} [jobResource.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * + * @param {array} jobResource.destinationAccountDetails Destination account + * details. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {array} [jobResource.details.jobStages] List of stages that run in + * the job. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} [jobResource.details.contactDetails.contactName] Contact + * name of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResource.details.errorDetails] Error details for failure. + * This is optional. + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} [jobResource.cancellationReason] Reason for cancellation. + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 JobResource} 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 _beginCreate(resourceGroupName, jobName, jobResource, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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 (jobResource === null || jobResource === undefined) { + throw new Error('jobResource cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 (jobResource !== null && jobResource !== undefined) { + let requestModelMapper = new client.models['JobResource']().mapper(); + requestModel = client.serialize(requestModelMapper, jobResource, 'jobResource'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(jobResource, 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['JobResource']().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); + }); +} + +/** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} jobResourceUpdateParameter.details Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.contactName] Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, 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 ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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 (ifMatch !== null && ifMatch !== undefined && typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch must be of type string.'); + } + if (jobResourceUpdateParameter === null || jobResourceUpdateParameter === undefined) { + throw new Error('jobResourceUpdateParameter cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 (ifMatch !== undefined && ifMatch !== null) { + httpRequest.headers['If-Match'] = ifMatch; + } + 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 (jobResourceUpdateParameter !== null && jobResourceUpdateParameter !== undefined) { + let requestModelMapper = new client.models['JobResourceUpdateParameter']().mapper(); + requestModel = client.serialize(requestModelMapper, jobResourceUpdateParameter, 'jobResourceUpdateParameter'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(jobResourceUpdateParameter, 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['JobResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the jobs available under the 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 JobResourceList} 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['JobResourceList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the jobs available under the given 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 JobResourceList} 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['JobResourceList']().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 Jobs. */ +class Jobs { + /** + * Create a Jobs. + * @param {DataBoxManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._create = _create; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._bookShipmentPickUp = _bookShipmentPickUp; + this._cancel = _cancel; + this._getCopyLogsUri = _getCopyLogsUri; + this._downloadShippingLabelUri = _downloadShippingLabelUri; + this._listSecrets = _listSecrets; + this._reportIssue = _reportIssue; + this._beginCreate = _beginCreate; + this._beginUpdate = _beginUpdate; + this._listNext = _listNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Lists all the jobs available under the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the jobs available under the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 {JobResourceList} - 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 JobResourceList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all the jobs available under the given resource group. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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; + }); + }); + } + + /** + * Lists all the jobs available under the given resource group. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 {JobResourceList} - 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 JobResourceList} 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); + } + } + + /** + * Gets information about the specified job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] $expand is supported on details parameter + * for job, which provides details on the job stages. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about the specified job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] $expand is supported on details parameter + * for job, which provides details on the job stages. + * + * @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 {JobResource} - 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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, jobName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, jobName, options, optionalCallback); + } + } + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {string} [jobResource.deviceType] Type of the device to be used for + * the job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @param {boolean} [jobResource.isCancellable] Describes whether the job is + * cancellable or not. + * + * @param {boolean} [jobResource.isShippingAddressEditable] Describes whether + * the shipping address is editable or not. + * + * @param {string} [jobResource.status] Name of the stage which is in progress. + * Possible values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * + * @param {date} [jobResource.startTime] Time at which the job was started in + * UTC ISO 8601 format. + * + * @param {object} [jobResource.error] Top level error for the job. + * + * @param {string} jobResource.error.code Error code that can be used to + * programmatically identify the error. + * + * @param {string} [jobResource.error.message] Describes the error in detail + * and provides debugging information. + * + * @param {object} [jobResource.deliveryPackage] Delivery package shipping + * details. + * + * @param {object} [jobResource.returnPackage] Return package shipping details. + * + * @param {string} [jobResource.returnPackage.carrierName] Name of the carrier. + * + * @param {string} [jobResource.returnPackage.trackingId] Tracking Id of + * shipment. + * + * @param {string} [jobResource.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * + * @param {array} jobResource.destinationAccountDetails Destination account + * details. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {array} [jobResource.details.jobStages] List of stages that run in + * the job. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} [jobResource.details.contactDetails.contactName] Contact + * name of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResource.details.errorDetails] Error details for failure. + * This is optional. + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} [jobResource.cancellationReason] Reason for cancellation. + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName, jobName, jobResource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, jobName, jobResource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {string} [jobResource.deviceType] Type of the device to be used for + * the job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @param {boolean} [jobResource.isCancellable] Describes whether the job is + * cancellable or not. + * + * @param {boolean} [jobResource.isShippingAddressEditable] Describes whether + * the shipping address is editable or not. + * + * @param {string} [jobResource.status] Name of the stage which is in progress. + * Possible values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * + * @param {date} [jobResource.startTime] Time at which the job was started in + * UTC ISO 8601 format. + * + * @param {object} [jobResource.error] Top level error for the job. + * + * @param {string} jobResource.error.code Error code that can be used to + * programmatically identify the error. + * + * @param {string} [jobResource.error.message] Describes the error in detail + * and provides debugging information. + * + * @param {object} [jobResource.deliveryPackage] Delivery package shipping + * details. + * + * @param {object} [jobResource.returnPackage] Return package shipping details. + * + * @param {string} [jobResource.returnPackage.carrierName] Name of the carrier. + * + * @param {string} [jobResource.returnPackage.trackingId] Tracking Id of + * shipment. + * + * @param {string} [jobResource.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * + * @param {array} jobResource.destinationAccountDetails Destination account + * details. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {array} [jobResource.details.jobStages] List of stages that run in + * the job. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} [jobResource.details.contactDetails.contactName] Contact + * name of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResource.details.errorDetails] Error details for failure. + * This is optional. + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} [jobResource.cancellationReason] Reason for cancellation. + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 {JobResource} - 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 JobResource} 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. + */ + create(resourceGroupName, jobName, jobResource, 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._create(resourceGroupName, jobName, jobResource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, jobName, jobResource, options, optionalCallback); + } + } + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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(resourceGroupName, jobName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, jobName, options, optionalCallback); + } + } + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} jobResourceUpdateParameter.details Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.contactName] Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, jobName, jobResourceUpdateParameter, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, jobName, jobResourceUpdateParameter, 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 properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} jobResourceUpdateParameter.details Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.contactName] Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 {JobResource} - 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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, jobName, jobResourceUpdateParameter, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, jobName, jobResourceUpdateParameter, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, jobName, jobResourceUpdateParameter, options, optionalCallback); + } + } + + /** + * Book shipment pick up. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} shipmentPickUpRequest Details of shipment pick up request. + * + * @param {date} [shipmentPickUpRequest.startTime] Minimum date after which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {date} [shipmentPickUpRequest.endTime] Maximum date before which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {string} [shipmentPickUpRequest.shipmentLocation] Shipment Location + * in the pickup place. Eg.front desk + * + * @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. + */ + bookShipmentPickUpWithHttpOperationResponse(resourceGroupName, jobName, shipmentPickUpRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._bookShipmentPickUp(resourceGroupName, jobName, shipmentPickUpRequest, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Book shipment pick up. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} shipmentPickUpRequest Details of shipment pick up request. + * + * @param {date} [shipmentPickUpRequest.startTime] Minimum date after which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {date} [shipmentPickUpRequest.endTime] Maximum date before which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {string} [shipmentPickUpRequest.shipmentLocation] Shipment Location + * in the pickup place. Eg.front desk + * + * @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 {ShipmentPickUpResponse} - 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 ShipmentPickUpResponse} 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. + */ + bookShipmentPickUp(resourceGroupName, jobName, shipmentPickUpRequest, 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._bookShipmentPickUp(resourceGroupName, jobName, shipmentPickUpRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._bookShipmentPickUp(resourceGroupName, jobName, shipmentPickUpRequest, options, optionalCallback); + } + } + + /** + * CancelJob. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} cancellationReason Reason for cancellation. + * + * @param {string} cancellationReason.reason Reason for cancellation. + * + * @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. + */ + cancelWithHttpOperationResponse(resourceGroupName, jobName, cancellationReason, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._cancel(resourceGroupName, jobName, cancellationReason, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * CancelJob. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} cancellationReason Reason for cancellation. + * + * @param {string} cancellationReason.reason Reason for cancellation. + * + * @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. + */ + cancel(resourceGroupName, jobName, cancellationReason, 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._cancel(resourceGroupName, jobName, cancellationReason, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._cancel(resourceGroupName, jobName, cancellationReason, options, optionalCallback); + } + } + + /** + * Provides list of copy logs uri. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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. + */ + getCopyLogsUriWithHttpOperationResponse(resourceGroupName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getCopyLogsUri(resourceGroupName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Provides list of copy logs uri. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 {GetCopyLogsUriOutput} - 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 GetCopyLogsUriOutput} 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. + */ + getCopyLogsUri(resourceGroupName, jobName, 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._getCopyLogsUri(resourceGroupName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCopyLogsUri(resourceGroupName, jobName, options, optionalCallback); + } + } + + /** + * Get shipping label sas uri. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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. + */ + downloadShippingLabelUriWithHttpOperationResponse(resourceGroupName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._downloadShippingLabelUri(resourceGroupName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get shipping label sas uri. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 {ShippingLabelDetails} - 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 ShippingLabelDetails} 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. + */ + downloadShippingLabelUri(resourceGroupName, jobName, 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._downloadShippingLabelUri(resourceGroupName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._downloadShippingLabelUri(resourceGroupName, jobName, options, optionalCallback); + } + } + + /** + * This method gets the unencrypted secrets related to the job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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. + */ + listSecretsWithHttpOperationResponse(resourceGroupName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listSecrets(resourceGroupName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method gets the unencrypted secrets related to the job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 {UnencryptedSecrets} - 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 UnencryptedSecrets} 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. + */ + listSecrets(resourceGroupName, jobName, 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._listSecrets(resourceGroupName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listSecrets(resourceGroupName, jobName, options, optionalCallback); + } + } + + /** + * Reports an issue. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} reportIssueDetails Details of reported issue. + * + * @param {string} [reportIssueDetails.issueType] Issue Type. Possible values + * include: 'DeviceMismatch', 'ValidationStringMismatch', + * 'CredentialNotWorking', 'DeviceFailure' + * + * @param {string} [reportIssueDetails.deviceIssueType] Device Issue Type. Only + * used for Device failure issue. Possible values include: 'DeviceTampering', + * 'DeviceNotBootingUp', 'DeviceHealthCheckShowFailures', 'NICsAreNotWorking', + * 'Misc' + * + * @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. + */ + reportIssueWithHttpOperationResponse(resourceGroupName, jobName, reportIssueDetails, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._reportIssue(resourceGroupName, jobName, reportIssueDetails, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Reports an issue. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} reportIssueDetails Details of reported issue. + * + * @param {string} [reportIssueDetails.issueType] Issue Type. Possible values + * include: 'DeviceMismatch', 'ValidationStringMismatch', + * 'CredentialNotWorking', 'DeviceFailure' + * + * @param {string} [reportIssueDetails.deviceIssueType] Device Issue Type. Only + * used for Device failure issue. Possible values include: 'DeviceTampering', + * 'DeviceNotBootingUp', 'DeviceHealthCheckShowFailures', 'NICsAreNotWorking', + * 'Misc' + * + * @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. + */ + reportIssue(resourceGroupName, jobName, reportIssueDetails, 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._reportIssue(resourceGroupName, jobName, reportIssueDetails, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._reportIssue(resourceGroupName, jobName, reportIssueDetails, options, optionalCallback); + } + } + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {string} [jobResource.deviceType] Type of the device to be used for + * the job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @param {boolean} [jobResource.isCancellable] Describes whether the job is + * cancellable or not. + * + * @param {boolean} [jobResource.isShippingAddressEditable] Describes whether + * the shipping address is editable or not. + * + * @param {string} [jobResource.status] Name of the stage which is in progress. + * Possible values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * + * @param {date} [jobResource.startTime] Time at which the job was started in + * UTC ISO 8601 format. + * + * @param {object} [jobResource.error] Top level error for the job. + * + * @param {string} jobResource.error.code Error code that can be used to + * programmatically identify the error. + * + * @param {string} [jobResource.error.message] Describes the error in detail + * and provides debugging information. + * + * @param {object} [jobResource.deliveryPackage] Delivery package shipping + * details. + * + * @param {object} [jobResource.returnPackage] Return package shipping details. + * + * @param {string} [jobResource.returnPackage.carrierName] Name of the carrier. + * + * @param {string} [jobResource.returnPackage.trackingId] Tracking Id of + * shipment. + * + * @param {string} [jobResource.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * + * @param {array} jobResource.destinationAccountDetails Destination account + * details. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {array} [jobResource.details.jobStages] List of stages that run in + * the job. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} [jobResource.details.contactDetails.contactName] Contact + * name of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResource.details.errorDetails] Error details for failure. + * This is optional. + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} [jobResource.cancellationReason] Reason for cancellation. + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, jobName, jobResource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, jobName, jobResource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {string} [jobResource.deviceType] Type of the device to be used for + * the job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @param {boolean} [jobResource.isCancellable] Describes whether the job is + * cancellable or not. + * + * @param {boolean} [jobResource.isShippingAddressEditable] Describes whether + * the shipping address is editable or not. + * + * @param {string} [jobResource.status] Name of the stage which is in progress. + * Possible values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * + * @param {date} [jobResource.startTime] Time at which the job was started in + * UTC ISO 8601 format. + * + * @param {object} [jobResource.error] Top level error for the job. + * + * @param {string} jobResource.error.code Error code that can be used to + * programmatically identify the error. + * + * @param {string} [jobResource.error.message] Describes the error in detail + * and provides debugging information. + * + * @param {object} [jobResource.deliveryPackage] Delivery package shipping + * details. + * + * @param {object} [jobResource.returnPackage] Return package shipping details. + * + * @param {string} [jobResource.returnPackage.carrierName] Name of the carrier. + * + * @param {string} [jobResource.returnPackage.trackingId] Tracking Id of + * shipment. + * + * @param {string} [jobResource.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * + * @param {array} jobResource.destinationAccountDetails Destination account + * details. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {array} [jobResource.details.jobStages] List of stages that run in + * the job. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} [jobResource.details.contactDetails.contactName] Contact + * name of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResource.details.errorDetails] Error details for failure. + * This is optional. + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} [jobResource.cancellationReason] Reason for cancellation. + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 {JobResource} - 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 JobResource} 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. + */ + beginCreate(resourceGroupName, jobName, jobResource, 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._beginCreate(resourceGroupName, jobName, jobResource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, jobName, jobResource, options, optionalCallback); + } + } + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} jobResourceUpdateParameter.details Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.contactName] Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, jobName, jobResourceUpdateParameter, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, 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 properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} jobResourceUpdateParameter.details Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.contactName] Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 {JobResource} - 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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, options, optionalCallback); + } + } + + /** + * Lists all the jobs available under the subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the jobs available under the 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 {JobResourceList} - 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 JobResourceList} 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); + } + } + + /** + * Lists all the jobs available under the given 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; + }); + }); + } + + /** + * Lists all the jobs available under the given 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 {JobResourceList} - 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 JobResourceList} 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 = Jobs; diff --git a/lib/services/databox/lib/operations/operations.js b/lib/services/databox/lib/operations/operations.js new file mode 100644 index 0000000000..a9780b8d99 --- /dev/null +++ b/lib/services/databox/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; + +/** + * This method gets all the operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationList} 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.DataBox/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['OperationList']().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); + }); +} + +/** + * This method gets all the operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationList} 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['OperationList']().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 {DataBoxManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * This method gets all the operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method gets all the operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationList} - 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 OperationList} 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); + } + } + + /** + * This method gets all the operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method gets all the operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationList} - 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 OperationList} 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/databox/lib/operations/service.js b/lib/services/databox/lib/operations/service.js new file mode 100644 index 0000000000..c833ed4327 --- /dev/null +++ b/lib/services/databox/lib/operations/service.js @@ -0,0 +1,869 @@ +/* + * 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; + +/** + * This method provides the list of available skus for the given subscription + * and location. + * + * @param {string} location The location of the resource + * + * @param {object} availableSkuRequest Filters for showing the available skus. + * + * @param {string} availableSkuRequest.country ISO country code. Country for + * hardware shipment. For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * + * @param {string} availableSkuRequest.location Location for data transfer. For + * locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * + * @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 AvailableSkusResult} 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 _listAvailableSkus(location, availableSkuRequest, 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.'); + } + if (availableSkuRequest === null || availableSkuRequest === undefined) + { + availableSkuRequest = {}; + } + // 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 (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location 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 (availableSkuRequest === null || availableSkuRequest === undefined) { + throw new Error('availableSkuRequest cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/availableSkus'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + 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 (availableSkuRequest !== null && availableSkuRequest !== undefined) { + let requestModelMapper = new client.models['AvailableSkuRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, availableSkuRequest, 'availableSkuRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(availableSkuRequest, 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['AvailableSkusResult']().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); + }); +} + +/** + * This method validates the customer shipping address and provide alternate + * addresses if any. + * + * @param {string} location The location of the resource + * + * @param {object} validateAddress Shipping address of the customer. + * + * @param {object} [validateAddress.shippingAddress] Shipping address of the + * customer. + * + * @param {string} validateAddress.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [validateAddress.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [validateAddress.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [validateAddress.shippingAddress.city] Name of the City. + * + * @param {string} [validateAddress.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} validateAddress.shippingAddress.country Name of the Country. + * + * @param {string} validateAddress.shippingAddress.postalCode Postal code. + * + * @param {string} [validateAddress.shippingAddress.zipExtendedCode] Extended + * Zip Code. + * + * @param {string} [validateAddress.shippingAddress.companyName] Name of the + * company. + * + * @param {string} [validateAddress.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {string} [validateAddress.deviceType] Device type to be used for the + * job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @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 AddressValidationOutput} 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 _validateAddressMethod(location, validateAddress, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location 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 (validateAddress === null || validateAddress === undefined) { + throw new Error('validateAddress cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + 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 (validateAddress !== null && validateAddress !== undefined) { + let requestModelMapper = new client.models['ValidateAddress']().mapper(); + requestModel = client.serialize(requestModelMapper, validateAddress, 'validateAddress'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(validateAddress, 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['AddressValidationOutput']().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); + }); +} + +/** + * This method provides the list of available skus for the given subscription + * and location. + * + * @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 AvailableSkusResult} 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 _listAvailableSkusNext(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 = '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['AvailableSkusResult']().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 Service. */ +class Service { + /** + * Create a Service. + * @param {DataBoxManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listAvailableSkus = _listAvailableSkus; + this._validateAddressMethod = _validateAddressMethod; + this._listAvailableSkusNext = _listAvailableSkusNext; + } + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @param {string} location The location of the resource + * + * @param {object} availableSkuRequest Filters for showing the available skus. + * + * @param {string} availableSkuRequest.country ISO country code. Country for + * hardware shipment. For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * + * @param {string} availableSkuRequest.location Location for data transfer. For + * locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * + * @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. + */ + listAvailableSkusWithHttpOperationResponse(location, availableSkuRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAvailableSkus(location, availableSkuRequest, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @param {string} location The location of the resource + * + * @param {object} availableSkuRequest Filters for showing the available skus. + * + * @param {string} availableSkuRequest.country ISO country code. Country for + * hardware shipment. For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * + * @param {string} availableSkuRequest.location Location for data transfer. For + * locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * + * @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 {AvailableSkusResult} - 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 AvailableSkusResult} 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. + */ + listAvailableSkus(location, availableSkuRequest, 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._listAvailableSkus(location, availableSkuRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAvailableSkus(location, availableSkuRequest, options, optionalCallback); + } + } + + /** + * This method validates the customer shipping address and provide alternate + * addresses if any. + * + * @param {string} location The location of the resource + * + * @param {object} validateAddress Shipping address of the customer. + * + * @param {object} [validateAddress.shippingAddress] Shipping address of the + * customer. + * + * @param {string} validateAddress.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [validateAddress.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [validateAddress.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [validateAddress.shippingAddress.city] Name of the City. + * + * @param {string} [validateAddress.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} validateAddress.shippingAddress.country Name of the Country. + * + * @param {string} validateAddress.shippingAddress.postalCode Postal code. + * + * @param {string} [validateAddress.shippingAddress.zipExtendedCode] Extended + * Zip Code. + * + * @param {string} [validateAddress.shippingAddress.companyName] Name of the + * company. + * + * @param {string} [validateAddress.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {string} [validateAddress.deviceType] Device type to be used for the + * job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @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. + */ + validateAddressMethodWithHttpOperationResponse(location, validateAddress, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._validateAddressMethod(location, validateAddress, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method validates the customer shipping address and provide alternate + * addresses if any. + * + * @param {string} location The location of the resource + * + * @param {object} validateAddress Shipping address of the customer. + * + * @param {object} [validateAddress.shippingAddress] Shipping address of the + * customer. + * + * @param {string} validateAddress.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [validateAddress.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [validateAddress.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [validateAddress.shippingAddress.city] Name of the City. + * + * @param {string} [validateAddress.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} validateAddress.shippingAddress.country Name of the Country. + * + * @param {string} validateAddress.shippingAddress.postalCode Postal code. + * + * @param {string} [validateAddress.shippingAddress.zipExtendedCode] Extended + * Zip Code. + * + * @param {string} [validateAddress.shippingAddress.companyName] Name of the + * company. + * + * @param {string} [validateAddress.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {string} [validateAddress.deviceType] Device type to be used for the + * job. Possible values include: 'Pod', 'Disk', 'Cabinet' + * + * @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 {AddressValidationOutput} - 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 AddressValidationOutput} 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. + */ + validateAddressMethod(location, validateAddress, 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._validateAddressMethod(location, validateAddress, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._validateAddressMethod(location, validateAddress, options, optionalCallback); + } + } + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @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. + */ + listAvailableSkusNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAvailableSkusNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @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 {AvailableSkusResult} - 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 AvailableSkusResult} 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. + */ + listAvailableSkusNext(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._listAvailableSkusNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAvailableSkusNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Service; diff --git a/lib/services/databox/package.json b/lib/services/databox/package.json new file mode 100644 index 0000000000..83a0d19993 --- /dev/null +++ b/lib/services/databox/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-databox", + "author": "Microsoft Corporation", + "description": "DataBoxManagementClient Library with typescript type definitions for node", + "version": "1.0.0-preview", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ + "node", + "azure" + ], + "license": "MIT", + "main": "./lib/dataBoxManagementClient.js", + "types": "./lib/dataBoxManagementClient.d.ts", + "homepage": "https://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-node/issues" + } +} diff --git a/lib/services/databoxManagement/LICENSE.txt b/lib/services/databoxManagement/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/databoxManagement/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 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/databoxManagement/lib/dataBoxManagementClient.d.ts b/lib/services/databoxManagement/lib/dataBoxManagementClient.d.ts new file mode 100644 index 0000000000..be7c0f4b6c --- /dev/null +++ b/lib/services/databoxManagement/lib/dataBoxManagementClient.d.ts @@ -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. + */ + +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 DataBoxManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the DataBoxManagementClient 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; + jobs: operations.Jobs; + service: operations.Service; +} + +export { DataBoxManagementClient, models as DataBoxManagementModels }; diff --git a/lib/services/databoxManagement/lib/dataBoxManagementClient.js b/lib/services/databoxManagement/lib/dataBoxManagementClient.js new file mode 100644 index 0000000000..0ecbe860ab --- /dev/null +++ b/lib/services/databoxManagement/lib/dataBoxManagementClient.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. + */ + +/* 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 DataBoxManagementClient. */ +class DataBoxManagementClient extends ServiceClient { + /** + * Create a DataBoxManagementClient. + * @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-01-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.jobs = new operations.Jobs(this); + this.service = new operations.Service(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = DataBoxManagementClient; +module.exports['default'] = DataBoxManagementClient; +module.exports.DataBoxManagementClient = DataBoxManagementClient; +module.exports.DataBoxManagementModels = models; diff --git a/lib/services/databoxManagement/lib/models/accountCredentialDetails.js b/lib/services/databoxManagement/lib/models/accountCredentialDetails.js new file mode 100644 index 0000000000..2f4ef9fc31 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/accountCredentialDetails.js @@ -0,0 +1,81 @@ +/* + * 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'; + +/** + * Credential details of the account. + * + */ +class AccountCredentialDetails { + /** + * Create a AccountCredentialDetails. + * @member {string} [accountName] Name of the account. + * @member {string} [accountConnectionString] Connection string of the + * account endpoint to use the account as a storage endpoint on the device. + * @member {array} [shareCredentialDetails] Per share level unencrypted + * access credentials. + */ + constructor() { + } + + /** + * Defines the metadata of AccountCredentialDetails + * + * @returns {object} metadata of AccountCredentialDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'AccountCredentialDetails', + type: { + name: 'Composite', + className: 'AccountCredentialDetails', + modelProperties: { + accountName: { + required: false, + readOnly: true, + serializedName: 'accountName', + type: { + name: 'String' + } + }, + accountConnectionString: { + required: false, + readOnly: true, + serializedName: 'accountConnectionString', + type: { + name: 'String' + } + }, + shareCredentialDetails: { + required: false, + readOnly: true, + serializedName: 'shareCredentialDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ShareCredentialDetailsElementType', + type: { + name: 'Composite', + className: 'ShareCredentialDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = AccountCredentialDetails; diff --git a/lib/services/databoxManagement/lib/models/addressValidationOutput.js b/lib/services/databoxManagement/lib/models/addressValidationOutput.js new file mode 100644 index 0000000000..0c85263f23 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/addressValidationOutput.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'; + +/** + * Output of the address validation api. + * + */ +class AddressValidationOutput { + /** + * Create a AddressValidationOutput. + * @member {string} [validationStatus] The address validation status. + * Possible values include: 'Valid', 'Invalid', 'Ambiguous' + * @member {array} [alternateAddresses] List of alternate addresses. + */ + constructor() { + } + + /** + * Defines the metadata of AddressValidationOutput + * + * @returns {object} metadata of AddressValidationOutput + * + */ + mapper() { + return { + required: false, + serializedName: 'AddressValidationOutput', + type: { + name: 'Composite', + className: 'AddressValidationOutput', + modelProperties: { + validationStatus: { + required: false, + readOnly: true, + serializedName: 'properties.validationStatus', + type: { + name: 'Enum', + allowedValues: [ 'Valid', 'Invalid', 'Ambiguous' ] + } + }, + alternateAddresses: { + required: false, + readOnly: true, + serializedName: 'properties.alternateAddresses', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ShippingAddressElementType', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + } + } + } + } + } + }; + } +} + +module.exports = AddressValidationOutput; diff --git a/lib/services/databoxManagement/lib/models/applianceNetworkConfiguration.js b/lib/services/databoxManagement/lib/models/applianceNetworkConfiguration.js new file mode 100644 index 0000000000..30f31f6f7e --- /dev/null +++ b/lib/services/databoxManagement/lib/models/applianceNetworkConfiguration.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 Network Adapter configuration of a DataBox. + * + */ +class ApplianceNetworkConfiguration { + /** + * Create a ApplianceNetworkConfiguration. + * @member {string} [name] Name of the network. + * @member {string} [macAddress] Mac Address. + */ + constructor() { + } + + /** + * Defines the metadata of ApplianceNetworkConfiguration + * + * @returns {object} metadata of ApplianceNetworkConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplianceNetworkConfiguration', + type: { + name: 'Composite', + className: 'ApplianceNetworkConfiguration', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + macAddress: { + required: false, + readOnly: true, + serializedName: 'macAddress', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplianceNetworkConfiguration; diff --git a/lib/services/databoxManagement/lib/models/armBaseObject.js b/lib/services/databoxManagement/lib/models/armBaseObject.js new file mode 100644 index 0000000000..a20f3e73cf --- /dev/null +++ b/lib/services/databoxManagement/lib/models/armBaseObject.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'; + +/** + * Base class for all objects under resource. + * + */ +class ArmBaseObject { + /** + * Create a ArmBaseObject. + * @member {string} [name] Name of the object. + * @member {string} [id] Id of the object. + * @member {string} [type] Type of the object. + */ + constructor() { + } + + /** + * Defines the metadata of ArmBaseObject + * + * @returns {object} metadata of ArmBaseObject + * + */ + mapper() { + return { + required: false, + serializedName: 'ArmBaseObject', + type: { + name: 'Composite', + className: 'ArmBaseObject', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ArmBaseObject; diff --git a/lib/services/databoxManagement/lib/models/availableSkuRequest.js b/lib/services/databoxManagement/lib/models/availableSkuRequest.js new file mode 100644 index 0000000000..ec7cab0b40 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/availableSkuRequest.js @@ -0,0 +1,88 @@ +/* + * 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 filters for showing the available skus. + * + */ +class AvailableSkuRequest { + /** + * Create a AvailableSkuRequest. + * @member {string} country ISO country code. Country for hardware shipment. + * For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * @member {string} location Location for data transfer. For locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * @member {array} [skuNames] Sku Names to filter for available skus + */ + constructor() { + } + + /** + * Defines the metadata of AvailableSkuRequest + * + * @returns {object} metadata of AvailableSkuRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'AvailableSkuRequest', + type: { + name: 'Composite', + className: 'AvailableSkuRequest', + modelProperties: { + transferType: { + required: true, + isConstant: true, + serializedName: 'transferType', + defaultValue: 'ImportToAzure', + type: { + name: 'String' + } + }, + country: { + required: true, + serializedName: 'country', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + skuNames: { + required: false, + serializedName: 'skuNames', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SkuNameElementType', + type: { + name: 'Enum', + allowedValues: [ 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' ] + } + } + } + } + } + } + }; + } +} + +module.exports = AvailableSkuRequest; diff --git a/lib/services/databoxManagement/lib/models/availableSkusResult.js b/lib/services/databoxManagement/lib/models/availableSkusResult.js new file mode 100644 index 0000000000..47905503e7 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/availableSkusResult.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'; + +/** + * The available skus operation response. + */ +class AvailableSkusResult extends Array { + /** + * Create a AvailableSkusResult. + * @member {string} [nextLink] Link for the next set of skus. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AvailableSkusResult + * + * @returns {object} metadata of AvailableSkusResult + * + */ + mapper() { + return { + required: false, + serializedName: 'AvailableSkusResult', + type: { + name: 'Composite', + className: 'AvailableSkusResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SkuInformationElementType', + type: { + name: 'Composite', + className: 'SkuInformation' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AvailableSkusResult; diff --git a/lib/services/databoxManagement/lib/models/cancellationReason.js b/lib/services/databoxManagement/lib/models/cancellationReason.js new file mode 100644 index 0000000000..ad05bc05e3 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/cancellationReason.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'; + +/** + * Reason for cancellation. + * + */ +class CancellationReason { + /** + * Create a CancellationReason. + * @member {string} reason Reason for cancellation. + */ + constructor() { + } + + /** + * Defines the metadata of CancellationReason + * + * @returns {object} metadata of CancellationReason + * + */ + mapper() { + return { + required: false, + serializedName: 'CancellationReason', + type: { + name: 'Composite', + className: 'CancellationReason', + modelProperties: { + reason: { + required: true, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CancellationReason; diff --git a/lib/services/databoxManagement/lib/models/contactDetails.js b/lib/services/databoxManagement/lib/models/contactDetails.js new file mode 100644 index 0000000000..f1a1a28e31 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/contactDetails.js @@ -0,0 +1,110 @@ +/* + * 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'; + +/** + * Contact Details. + * + */ +class ContactDetails { + /** + * Create a ContactDetails. + * @member {string} contactName Contact name of the person. + * @member {string} phone Phone number of the contact person. + * @member {string} [phoneExtension] Phone extension number of the contact + * person. + * @member {string} [mobile] Mobile number of the contact person. + * @member {array} emailList List of Email-ids to be notified about job + * progress. + * @member {array} [notificationPreference] Notification preference for a job + * stage. + */ + constructor() { + } + + /** + * Defines the metadata of ContactDetails + * + * @returns {object} metadata of ContactDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ContactDetails', + type: { + name: 'Composite', + className: 'ContactDetails', + modelProperties: { + contactName: { + required: true, + serializedName: 'contactName', + type: { + name: 'String' + } + }, + phone: { + required: true, + serializedName: 'phone', + type: { + name: 'String' + } + }, + phoneExtension: { + required: false, + serializedName: 'phoneExtension', + type: { + name: 'String' + } + }, + mobile: { + required: false, + serializedName: 'mobile', + type: { + name: 'String' + } + }, + emailList: { + required: true, + serializedName: 'emailList', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + notificationPreference: { + required: false, + serializedName: 'notificationPreference', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NotificationPreferenceElementType', + type: { + name: 'Composite', + className: 'NotificationPreference' + } + } + } + } + } + } + }; + } +} + +module.exports = ContactDetails; diff --git a/lib/services/databoxManagement/lib/models/copyLogDetails.js b/lib/services/databoxManagement/lib/models/copyLogDetails.js new file mode 100644 index 0000000000..0e75a970ff --- /dev/null +++ b/lib/services/databoxManagement/lib/models/copyLogDetails.js @@ -0,0 +1,58 @@ +/* + * 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 for log generated during copy. + * + */ +class CopyLogDetails { + /** + * Create a CopyLogDetails. + * @member {string} copyLogDetailsType Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of CopyLogDetails + * + * @returns {object} metadata of CopyLogDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'CopyLogDetails', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'CopyLogDetails', + modelProperties: { + copyLogDetailsType: { + required: true, + serializedName: 'copyLogDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CopyLogDetails; diff --git a/lib/services/databoxManagement/lib/models/copyProgress.js b/lib/services/databoxManagement/lib/models/copyProgress.js new file mode 100644 index 0000000000..4a7f340fec --- /dev/null +++ b/lib/services/databoxManagement/lib/models/copyProgress.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'; + +/** + * Copy progress. + * + */ +class CopyProgress { + /** + * Create a CopyProgress. + * @member {string} [storageAccountName] Name of the storage account where + * the data needs to be uploaded. + * @member {string} [accountId] Id of the account where the data needs to be + * uploaded. + * @member {number} [bytesSentToCloud] Amount of data uploaded by the job as + * of now. + * @member {number} [totalBytesToProcess] Total amount of data to be + * processed by the job. + */ + constructor() { + } + + /** + * Defines the metadata of CopyProgress + * + * @returns {object} metadata of CopyProgress + * + */ + mapper() { + return { + required: false, + serializedName: 'CopyProgress', + type: { + name: 'Composite', + className: 'CopyProgress', + modelProperties: { + storageAccountName: { + required: false, + readOnly: true, + serializedName: 'storageAccountName', + type: { + name: 'String' + } + }, + accountId: { + required: false, + readOnly: true, + serializedName: 'accountId', + type: { + name: 'String' + } + }, + bytesSentToCloud: { + required: false, + readOnly: true, + serializedName: 'bytesSentToCloud', + type: { + name: 'Number' + } + }, + totalBytesToProcess: { + required: false, + readOnly: true, + serializedName: 'totalBytesToProcess', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = CopyProgress; diff --git a/lib/services/databoxManagement/lib/models/dataBoxAccountCopyLogDetails.js b/lib/services/databoxManagement/lib/models/dataBoxAccountCopyLogDetails.js new file mode 100644 index 0000000000..90f9b9360a --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxAccountCopyLogDetails.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'; + +const models = require('./index'); + +/** + * Copy log details for a storage account of a DataBox job + * + * @extends models['CopyLogDetails'] + */ +class DataBoxAccountCopyLogDetails extends models['CopyLogDetails'] { + /** + * Create a DataBoxAccountCopyLogDetails. + * @member {string} [accountName] Destination account name. + * @member {string} [copyLogLink] Link for copy logs. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxAccountCopyLogDetails + * + * @returns {object} metadata of DataBoxAccountCopyLogDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBox', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'DataBoxAccountCopyLogDetails', + modelProperties: { + copyLogDetailsType: { + required: true, + serializedName: 'copyLogDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + accountName: { + required: false, + readOnly: true, + serializedName: 'accountName', + type: { + name: 'String' + } + }, + copyLogLink: { + required: false, + readOnly: true, + serializedName: 'copyLogLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DataBoxAccountCopyLogDetails; diff --git a/lib/services/databoxManagement/lib/models/dataBoxDiskCopyLogDetails.js b/lib/services/databoxManagement/lib/models/dataBoxDiskCopyLogDetails.js new file mode 100644 index 0000000000..b5b8c926aa --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxDiskCopyLogDetails.js @@ -0,0 +1,88 @@ +/* + * 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'); + +/** + * Copy Log Details for a disk + * + * @extends models['CopyLogDetails'] + */ +class DataBoxDiskCopyLogDetails extends models['CopyLogDetails'] { + /** + * Create a DataBoxDiskCopyLogDetails. + * @member {string} [diskSerialNumber] Disk Serial Number. + * @member {string} [errorLogLink] Link for copy error logs. + * @member {string} [verboseLogLink] Link for copy verbose logs. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxDiskCopyLogDetails + * + * @returns {object} metadata of DataBoxDiskCopyLogDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxDisk', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'DataBoxDiskCopyLogDetails', + modelProperties: { + copyLogDetailsType: { + required: true, + serializedName: 'copyLogDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + diskSerialNumber: { + required: false, + readOnly: true, + serializedName: 'diskSerialNumber', + type: { + name: 'String' + } + }, + errorLogLink: { + required: false, + readOnly: true, + serializedName: 'errorLogLink', + type: { + name: 'String' + } + }, + verboseLogLink: { + required: false, + readOnly: true, + serializedName: 'verboseLogLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DataBoxDiskCopyLogDetails; diff --git a/lib/services/databoxManagement/lib/models/dataBoxDiskCopyProgress.js b/lib/services/databoxManagement/lib/models/dataBoxDiskCopyProgress.js new file mode 100644 index 0000000000..5699bf139f --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxDiskCopyProgress.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'; + +/** + * DataBox Disk Copy Progress + * + */ +class DataBoxDiskCopyProgress { + /** + * Create a DataBoxDiskCopyProgress. + * @member {string} [serialNumber] The serial number of the disk + * @member {number} [bytesCopied] Bytes copied during the copy of disk. + * @member {number} [percentComplete] Indicates the percentage completed for + * the copy of the disk. + * @member {string} [status] The Status of the copy. Possible values include: + * 'NotStarted', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', + * 'NotReturned' + */ + constructor() { + } + + /** + * Defines the metadata of DataBoxDiskCopyProgress + * + * @returns {object} metadata of DataBoxDiskCopyProgress + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxDiskCopyProgress', + type: { + name: 'Composite', + className: 'DataBoxDiskCopyProgress', + modelProperties: { + serialNumber: { + required: false, + readOnly: true, + serializedName: 'serialNumber', + type: { + name: 'String' + } + }, + bytesCopied: { + required: false, + readOnly: true, + serializedName: 'bytesCopied', + type: { + name: 'Number' + } + }, + percentComplete: { + required: false, + readOnly: true, + serializedName: 'percentComplete', + type: { + name: 'Number' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'NotStarted', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', 'NotReturned' ] + } + } + } + } + }; + } +} + +module.exports = DataBoxDiskCopyProgress; diff --git a/lib/services/databoxManagement/lib/models/dataBoxDiskJobDetails.js b/lib/services/databoxManagement/lib/models/dataBoxDiskJobDetails.js new file mode 100644 index 0000000000..4db3d114e8 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxDiskJobDetails.js @@ -0,0 +1,255 @@ +/* + * 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'); + +/** + * DataBox Disk Job Details. + * + * @extends models['JobDetails'] + */ +class DataBoxDiskJobDetails extends models['JobDetails'] { + /** + * Create a DataBoxDiskJobDetails. + * @member {object} [preferredDisks] User preference on what size disks are + * needed for the job. The map is from the disk size in TB to the count. Eg. + * {2,5} means 5 disks of 2 TB size. Key is string but will be checked + * against an int. + * @member {array} [copyProgress] Copy progress per disk. + * @member {object} [disksAndSizeDetails] Contains the map of disk serial + * number to the disk size being used for the job. Is returned only after the + * disks are shipped to the customer. + * @member {string} [passkey] User entered passkey for DataBox Disk job. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxDiskJobDetails + * + * @returns {object} metadata of DataBoxDiskJobDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxDisk', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobDetailsType', + clientName: 'jobDetailsType' + }, + uberParent: 'JobDetails', + className: 'DataBoxDiskJobDetails', + modelProperties: { + expectedDataSizeInTeraBytes: { + required: false, + serializedName: 'expectedDataSizeInTeraBytes', + type: { + name: 'Number' + } + }, + jobStages: { + required: false, + readOnly: true, + serializedName: 'jobStages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobStagesElementType', + type: { + name: 'Composite', + className: 'JobStages' + } + } + } + }, + contactDetails: { + required: true, + serializedName: 'contactDetails', + type: { + name: 'Composite', + className: 'ContactDetails' + } + }, + shippingAddress: { + required: true, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + }, + deliveryPackage: { + required: false, + readOnly: true, + serializedName: 'deliveryPackage', + type: { + name: 'Composite', + className: 'PackageShippingDetails' + } + }, + returnPackage: { + required: false, + readOnly: true, + serializedName: 'returnPackage', + type: { + name: 'Composite', + className: 'PackageShippingDetails' + } + }, + destinationAccountDetails: { + required: true, + serializedName: 'destinationAccountDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DestinationAccountDetailsElementType', + type: { + name: 'Composite', + className: 'DestinationAccountDetails' + } + } + } + }, + errorDetails: { + required: false, + readOnly: true, + serializedName: 'errorDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobErrorDetailsElementType', + type: { + name: 'Composite', + className: 'JobErrorDetails' + } + } + } + }, + preferences: { + required: false, + serializedName: 'preferences', + type: { + name: 'Composite', + className: 'Preferences' + } + }, + copyLogDetails: { + required: false, + readOnly: true, + serializedName: 'copyLogDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CopyLogDetailsElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'CopyLogDetails' + } + } + } + }, + reverseShipmentLabelSasKey: { + required: false, + readOnly: true, + serializedName: 'reverseShipmentLabelSasKey', + type: { + name: 'String' + } + }, + chainOfCustodySasKey: { + required: false, + readOnly: true, + serializedName: 'chainOfCustodySasKey', + type: { + name: 'String' + } + }, + jobDetailsType: { + required: true, + serializedName: 'jobDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + preferredDisks: { + required: false, + serializedName: 'preferredDisks', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + copyProgress: { + required: false, + readOnly: true, + serializedName: 'copyProgress', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DataBoxDiskCopyProgressElementType', + type: { + name: 'Composite', + className: 'DataBoxDiskCopyProgress' + } + } + } + }, + disksAndSizeDetails: { + required: false, + readOnly: true, + serializedName: 'disksAndSizeDetails', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + passkey: { + required: false, + serializedName: 'passkey', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DataBoxDiskJobDetails; diff --git a/lib/services/databoxManagement/lib/models/dataBoxDiskJobSecrets.js b/lib/services/databoxManagement/lib/models/dataBoxDiskJobSecrets.js new file mode 100644 index 0000000000..06b013fafb --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxDiskJobSecrets.js @@ -0,0 +1,98 @@ +/* + * 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 secrets related to disk job. + * + * @extends models['JobSecrets'] + */ +class DataBoxDiskJobSecrets extends models['JobSecrets'] { + /** + * Create a DataBoxDiskJobSecrets. + * @member {array} [diskSecrets] Contains the list of secrets object for that + * device. + * @member {string} [passKey] PassKey for the disk Job. + * @member {boolean} [isPasskeyUserDefined] Whether passkey was provided by + * user. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxDiskJobSecrets + * + * @returns {object} metadata of DataBoxDiskJobSecrets + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxDisk', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobSecretsType', + clientName: 'jobSecretsType' + }, + uberParent: 'JobSecrets', + className: 'DataBoxDiskJobSecrets', + modelProperties: { + jobSecretsType: { + required: true, + serializedName: 'jobSecretsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + diskSecrets: { + required: false, + readOnly: true, + serializedName: 'diskSecrets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DiskSecretElementType', + type: { + name: 'Composite', + className: 'DiskSecret' + } + } + } + }, + passKey: { + required: false, + readOnly: true, + serializedName: 'passKey', + type: { + name: 'String' + } + }, + isPasskeyUserDefined: { + required: false, + readOnly: true, + serializedName: 'isPasskeyUserDefined', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = DataBoxDiskJobSecrets; diff --git a/lib/services/databoxManagement/lib/models/dataBoxHeavyAccountCopyLogDetails.js b/lib/services/databoxManagement/lib/models/dataBoxHeavyAccountCopyLogDetails.js new file mode 100644 index 0000000000..3ef2c7939a --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxHeavyAccountCopyLogDetails.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'); + +/** + * Copy log details for a storage account for Databox heavy + * + * @extends models['CopyLogDetails'] + */ +class DataBoxHeavyAccountCopyLogDetails extends models['CopyLogDetails'] { + /** + * Create a DataBoxHeavyAccountCopyLogDetails. + * @member {string} [accountName] Destination account name. + * @member {array} [copyLogLink] Link for copy logs. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxHeavyAccountCopyLogDetails + * + * @returns {object} metadata of DataBoxHeavyAccountCopyLogDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxHeavy', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'DataBoxHeavyAccountCopyLogDetails', + modelProperties: { + copyLogDetailsType: { + required: true, + serializedName: 'copyLogDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + accountName: { + required: false, + readOnly: true, + serializedName: 'accountName', + type: { + name: 'String' + } + }, + copyLogLink: { + required: false, + readOnly: true, + serializedName: 'copyLogLink', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DataBoxHeavyAccountCopyLogDetails; diff --git a/lib/services/databoxManagement/lib/models/dataBoxHeavyJobDetails.js b/lib/services/databoxManagement/lib/models/dataBoxHeavyJobDetails.js new file mode 100644 index 0000000000..a8b80f2dc7 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxHeavyJobDetails.js @@ -0,0 +1,211 @@ +/* + * 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'); + +/** + * Databox Heavy Device Job Details + * + * @extends models['JobDetails'] + */ +class DataBoxHeavyJobDetails extends models['JobDetails'] { + /** + * Create a DataBoxHeavyJobDetails. + * @member {array} [copyProgress] Copy progress per account. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxHeavyJobDetails + * + * @returns {object} metadata of DataBoxHeavyJobDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxHeavy', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobDetailsType', + clientName: 'jobDetailsType' + }, + uberParent: 'JobDetails', + className: 'DataBoxHeavyJobDetails', + modelProperties: { + expectedDataSizeInTeraBytes: { + required: false, + serializedName: 'expectedDataSizeInTeraBytes', + type: { + name: 'Number' + } + }, + jobStages: { + required: false, + readOnly: true, + serializedName: 'jobStages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobStagesElementType', + type: { + name: 'Composite', + className: 'JobStages' + } + } + } + }, + contactDetails: { + required: true, + serializedName: 'contactDetails', + type: { + name: 'Composite', + className: 'ContactDetails' + } + }, + shippingAddress: { + required: true, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + }, + deliveryPackage: { + required: false, + readOnly: true, + serializedName: 'deliveryPackage', + type: { + name: 'Composite', + className: 'PackageShippingDetails' + } + }, + returnPackage: { + required: false, + readOnly: true, + serializedName: 'returnPackage', + type: { + name: 'Composite', + className: 'PackageShippingDetails' + } + }, + destinationAccountDetails: { + required: true, + serializedName: 'destinationAccountDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DestinationAccountDetailsElementType', + type: { + name: 'Composite', + className: 'DestinationAccountDetails' + } + } + } + }, + errorDetails: { + required: false, + readOnly: true, + serializedName: 'errorDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobErrorDetailsElementType', + type: { + name: 'Composite', + className: 'JobErrorDetails' + } + } + } + }, + preferences: { + required: false, + serializedName: 'preferences', + type: { + name: 'Composite', + className: 'Preferences' + } + }, + copyLogDetails: { + required: false, + readOnly: true, + serializedName: 'copyLogDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CopyLogDetailsElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'CopyLogDetails' + } + } + } + }, + reverseShipmentLabelSasKey: { + required: false, + readOnly: true, + serializedName: 'reverseShipmentLabelSasKey', + type: { + name: 'String' + } + }, + chainOfCustodySasKey: { + required: false, + readOnly: true, + serializedName: 'chainOfCustodySasKey', + type: { + name: 'String' + } + }, + jobDetailsType: { + required: true, + serializedName: 'jobDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + copyProgress: { + required: false, + readOnly: true, + serializedName: 'copyProgress', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CopyProgressElementType', + type: { + name: 'Composite', + className: 'CopyProgress' + } + } + } + } + } + } + }; + } +} + +module.exports = DataBoxHeavyJobDetails; diff --git a/lib/services/databoxManagement/lib/models/dataBoxHeavyJobSecrets.js b/lib/services/databoxManagement/lib/models/dataBoxHeavyJobSecrets.js new file mode 100644 index 0000000000..c91acbcf35 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxHeavyJobSecrets.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'; + +const models = require('./index'); + +/** + * The secrets related to a databox heavy job. + * + * @extends models['JobSecrets'] + */ +class DataBoxHeavyJobSecrets extends models['JobSecrets'] { + /** + * Create a DataBoxHeavyJobSecrets. + * @member {array} [cabinetPodSecrets] Contains the list of secret objects + * for a databox heavy job. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxHeavyJobSecrets + * + * @returns {object} metadata of DataBoxHeavyJobSecrets + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxHeavy', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobSecretsType', + clientName: 'jobSecretsType' + }, + uberParent: 'JobSecrets', + className: 'DataBoxHeavyJobSecrets', + modelProperties: { + jobSecretsType: { + required: true, + serializedName: 'jobSecretsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + cabinetPodSecrets: { + required: false, + readOnly: true, + serializedName: 'cabinetPodSecrets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DataBoxHeavySecretElementType', + type: { + name: 'Composite', + className: 'DataBoxHeavySecret' + } + } + } + } + } + } + }; + } +} + +module.exports = DataBoxHeavyJobSecrets; diff --git a/lib/services/databoxManagement/lib/models/dataBoxHeavySecret.js b/lib/services/databoxManagement/lib/models/dataBoxHeavySecret.js new file mode 100644 index 0000000000..8b3e78c591 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxHeavySecret.js @@ -0,0 +1,110 @@ +/* + * 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 secrets related to a databox heavy. + * + */ +class DataBoxHeavySecret { + /** + * Create a DataBoxHeavySecret. + * @member {string} [deviceSerialNumber] Serial number of the assigned + * device. + * @member {string} [devicePassword] Password for out of the box experience + * on device. + * @member {array} [networkConfigurations] Network configuration of the + * appliance. + * @member {string} [encodedValidationCertPubKey] The base 64 encoded public + * key to authenticate with the device + * @member {array} [accountCredentialDetails] Per account level access + * credentials. + */ + constructor() { + } + + /** + * Defines the metadata of DataBoxHeavySecret + * + * @returns {object} metadata of DataBoxHeavySecret + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxHeavySecret', + type: { + name: 'Composite', + className: 'DataBoxHeavySecret', + modelProperties: { + deviceSerialNumber: { + required: false, + readOnly: true, + serializedName: 'deviceSerialNumber', + type: { + name: 'String' + } + }, + devicePassword: { + required: false, + readOnly: true, + serializedName: 'devicePassword', + type: { + name: 'String' + } + }, + networkConfigurations: { + required: false, + readOnly: true, + serializedName: 'networkConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplianceNetworkConfigurationElementType', + type: { + name: 'Composite', + className: 'ApplianceNetworkConfiguration' + } + } + } + }, + encodedValidationCertPubKey: { + required: false, + readOnly: true, + serializedName: 'encodedValidationCertPubKey', + type: { + name: 'String' + } + }, + accountCredentialDetails: { + required: false, + readOnly: true, + serializedName: 'accountCredentialDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AccountCredentialDetailsElementType', + type: { + name: 'Composite', + className: 'AccountCredentialDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = DataBoxHeavySecret; diff --git a/lib/services/databoxManagement/lib/models/dataBoxJobDetails.js b/lib/services/databoxManagement/lib/models/dataBoxJobDetails.js new file mode 100644 index 0000000000..e19501f82c --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxJobDetails.js @@ -0,0 +1,211 @@ +/* + * 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'); + +/** + * Databox Job Details + * + * @extends models['JobDetails'] + */ +class DataBoxJobDetails extends models['JobDetails'] { + /** + * Create a DataBoxJobDetails. + * @member {array} [copyProgress] Copy progress per storage account. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataBoxJobDetails + * + * @returns {object} metadata of DataBoxJobDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBox', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobDetailsType', + clientName: 'jobDetailsType' + }, + uberParent: 'JobDetails', + className: 'DataBoxJobDetails', + modelProperties: { + expectedDataSizeInTeraBytes: { + required: false, + serializedName: 'expectedDataSizeInTeraBytes', + type: { + name: 'Number' + } + }, + jobStages: { + required: false, + readOnly: true, + serializedName: 'jobStages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobStagesElementType', + type: { + name: 'Composite', + className: 'JobStages' + } + } + } + }, + contactDetails: { + required: true, + serializedName: 'contactDetails', + type: { + name: 'Composite', + className: 'ContactDetails' + } + }, + shippingAddress: { + required: true, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + }, + deliveryPackage: { + required: false, + readOnly: true, + serializedName: 'deliveryPackage', + type: { + name: 'Composite', + className: 'PackageShippingDetails' + } + }, + returnPackage: { + required: false, + readOnly: true, + serializedName: 'returnPackage', + type: { + name: 'Composite', + className: 'PackageShippingDetails' + } + }, + destinationAccountDetails: { + required: true, + serializedName: 'destinationAccountDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DestinationAccountDetailsElementType', + type: { + name: 'Composite', + className: 'DestinationAccountDetails' + } + } + } + }, + errorDetails: { + required: false, + readOnly: true, + serializedName: 'errorDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobErrorDetailsElementType', + type: { + name: 'Composite', + className: 'JobErrorDetails' + } + } + } + }, + preferences: { + required: false, + serializedName: 'preferences', + type: { + name: 'Composite', + className: 'Preferences' + } + }, + copyLogDetails: { + required: false, + readOnly: true, + serializedName: 'copyLogDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CopyLogDetailsElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'CopyLogDetails' + } + } + } + }, + reverseShipmentLabelSasKey: { + required: false, + readOnly: true, + serializedName: 'reverseShipmentLabelSasKey', + type: { + name: 'String' + } + }, + chainOfCustodySasKey: { + required: false, + readOnly: true, + serializedName: 'chainOfCustodySasKey', + type: { + name: 'String' + } + }, + jobDetailsType: { + required: true, + serializedName: 'jobDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + copyProgress: { + required: false, + readOnly: true, + serializedName: 'copyProgress', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CopyProgressElementType', + type: { + name: 'Composite', + className: 'CopyProgress' + } + } + } + } + } + } + }; + } +} + +module.exports = DataBoxJobDetails; diff --git a/lib/services/databoxManagement/lib/models/dataBoxSecret.js b/lib/services/databoxManagement/lib/models/dataBoxSecret.js new file mode 100644 index 0000000000..d21d2c3a1d --- /dev/null +++ b/lib/services/databoxManagement/lib/models/dataBoxSecret.js @@ -0,0 +1,110 @@ +/* + * 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 secrets related to a DataBox. + * + */ +class DataBoxSecret { + /** + * Create a DataBoxSecret. + * @member {string} [deviceSerialNumber] Serial number of the assigned + * device. + * @member {string} [devicePassword] Password for out of the box experience + * on device. + * @member {array} [networkConfigurations] Network configuration of the + * appliance. + * @member {string} [encodedValidationCertPubKey] The base 64 encoded public + * key to authenticate with the device + * @member {array} [accountCredentialDetails] Per account level access + * credentials. + */ + constructor() { + } + + /** + * Defines the metadata of DataBoxSecret + * + * @returns {object} metadata of DataBoxSecret + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBoxSecret', + type: { + name: 'Composite', + className: 'DataBoxSecret', + modelProperties: { + deviceSerialNumber: { + required: false, + readOnly: true, + serializedName: 'deviceSerialNumber', + type: { + name: 'String' + } + }, + devicePassword: { + required: false, + readOnly: true, + serializedName: 'devicePassword', + type: { + name: 'String' + } + }, + networkConfigurations: { + required: false, + readOnly: true, + serializedName: 'networkConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplianceNetworkConfigurationElementType', + type: { + name: 'Composite', + className: 'ApplianceNetworkConfiguration' + } + } + } + }, + encodedValidationCertPubKey: { + required: false, + readOnly: true, + serializedName: 'encodedValidationCertPubKey', + type: { + name: 'String' + } + }, + accountCredentialDetails: { + required: false, + readOnly: true, + serializedName: 'accountCredentialDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AccountCredentialDetailsElementType', + type: { + name: 'Composite', + className: 'AccountCredentialDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = DataBoxSecret; diff --git a/lib/services/databoxManagement/lib/models/databoxJobSecrets.js b/lib/services/databoxManagement/lib/models/databoxJobSecrets.js new file mode 100644 index 0000000000..7abd8401c6 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/databoxJobSecrets.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'; + +const models = require('./index'); + +/** + * The secrets related to a databox job. + * + * @extends models['JobSecrets'] + */ +class DataboxJobSecrets extends models['JobSecrets'] { + /** + * Create a DataboxJobSecrets. + * @member {array} [podSecrets] Contains the list of secret objects for a + * job. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DataboxJobSecrets + * + * @returns {object} metadata of DataboxJobSecrets + * + */ + mapper() { + return { + required: false, + serializedName: 'DataBox', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobSecretsType', + clientName: 'jobSecretsType' + }, + uberParent: 'JobSecrets', + className: 'DataboxJobSecrets', + modelProperties: { + jobSecretsType: { + required: true, + serializedName: 'jobSecretsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + podSecrets: { + required: false, + serializedName: 'podSecrets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DataBoxSecretElementType', + type: { + name: 'Composite', + className: 'DataBoxSecret' + } + } + } + } + } + } + }; + } +} + +module.exports = DataboxJobSecrets; diff --git a/lib/services/databoxManagement/lib/models/destinationAccountDetails.js b/lib/services/databoxManagement/lib/models/destinationAccountDetails.js new file mode 100644 index 0000000000..c1a7a7c680 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/destinationAccountDetails.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'; + +/** + * Details for the destination account. + * + */ +class DestinationAccountDetails { + /** + * Create a DestinationAccountDetails. + * @member {string} accountId Destination storage account id. + */ + constructor() { + } + + /** + * Defines the metadata of DestinationAccountDetails + * + * @returns {object} metadata of DestinationAccountDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'DestinationAccountDetails', + type: { + name: 'Composite', + className: 'DestinationAccountDetails', + modelProperties: { + accountId: { + required: true, + serializedName: 'accountId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DestinationAccountDetails; diff --git a/lib/services/databoxManagement/lib/models/destinationToServiceLocationMap.js b/lib/services/databoxManagement/lib/models/destinationToServiceLocationMap.js new file mode 100644 index 0000000000..22d264ea2b --- /dev/null +++ b/lib/services/databoxManagement/lib/models/destinationToServiceLocationMap.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'; + +/** + * Map of destination location to service location + * + */ +class DestinationToServiceLocationMap { + /** + * Create a DestinationToServiceLocationMap. + * @member {string} [destinationLocation] Location of the destination. + * @member {string} [serviceLocation] Location of the service. + */ + constructor() { + } + + /** + * Defines the metadata of DestinationToServiceLocationMap + * + * @returns {object} metadata of DestinationToServiceLocationMap + * + */ + mapper() { + return { + required: false, + serializedName: 'DestinationToServiceLocationMap', + type: { + name: 'Composite', + className: 'DestinationToServiceLocationMap', + modelProperties: { + destinationLocation: { + required: false, + readOnly: true, + serializedName: 'destinationLocation', + type: { + name: 'String' + } + }, + serviceLocation: { + required: false, + readOnly: true, + serializedName: 'serviceLocation', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DestinationToServiceLocationMap; diff --git a/lib/services/databoxManagement/lib/models/diskSecret.js b/lib/services/databoxManagement/lib/models/diskSecret.js new file mode 100644 index 0000000000..deaef7f5d4 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/diskSecret.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'; + +/** + * Contains all the secrets of a Disk. + * + */ +class DiskSecret { + /** + * Create a DiskSecret. + * @member {string} [diskSerialNumber] Serial number of the assigned disk. + * @member {string} [bitLockerKey] Bit Locker key of the disk which can be + * used to unlock the disk to copy data. + */ + constructor() { + } + + /** + * Defines the metadata of DiskSecret + * + * @returns {object} metadata of DiskSecret + * + */ + mapper() { + return { + required: false, + serializedName: 'DiskSecret', + type: { + name: 'Composite', + className: 'DiskSecret', + modelProperties: { + diskSerialNumber: { + required: false, + readOnly: true, + serializedName: 'diskSerialNumber', + type: { + name: 'String' + } + }, + bitLockerKey: { + required: false, + readOnly: true, + serializedName: 'bitLockerKey', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DiskSecret; diff --git a/lib/services/databoxManagement/lib/models/errorModel.js b/lib/services/databoxManagement/lib/models/errorModel.js new file mode 100644 index 0000000000..8e415baa3b --- /dev/null +++ b/lib/services/databoxManagement/lib/models/errorModel.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'; + +/** + * Top level error for the job. + * + */ +class ErrorModel { + /** + * Create a ErrorModel. + * @member {string} [code] Error code that can be used to programmatically + * identify the error. + * @member {string} [message] Describes the error in detail and provides + * debugging information. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorModel + * + * @returns {object} metadata of ErrorModel + * + */ + mapper() { + return { + required: false, + serializedName: 'Error', + type: { + name: 'Composite', + className: 'ErrorModel', + modelProperties: { + code: { + required: false, + readOnly: true, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorModel; diff --git a/lib/services/databoxManagement/lib/models/index.d.ts b/lib/services/databoxManagement/lib/models/index.d.ts new file mode 100644 index 0000000000..fee82c5576 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/index.d.ts @@ -0,0 +1,1126 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { BaseResource } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the ShareCredentialDetails class. + * @constructor + * Credential details of the shares in account. + * + * @member {string} [shareName] Name of the share. + * @member {string} [shareType] Type of the share. Possible values include: + * 'UnknownType', 'HCS', 'BlockBlob', 'PageBlob', 'AzureFile' + * @member {string} [userName] User name for the share. + * @member {string} [password] Password for the share. + * @member {array} [supportedAccessProtocols] Access protocols supported on the + * device. + */ +export interface ShareCredentialDetails { + readonly shareName?: string; + readonly shareType?: string; + readonly userName?: string; + readonly password?: string; + readonly supportedAccessProtocols?: string[]; +} + +/** + * @class + * Initializes a new instance of the AccountCredentialDetails class. + * @constructor + * Credential details of the account. + * + * @member {string} [accountName] Name of the account. + * @member {string} [accountConnectionString] Connection string of the account + * endpoint to use the account as a storage endpoint on the device. + * @member {array} [shareCredentialDetails] Per share level unencrypted access + * credentials. + */ +export interface AccountCredentialDetails { + readonly accountName?: string; + readonly accountConnectionString?: string; + readonly shareCredentialDetails?: ShareCredentialDetails[]; +} + +/** + * @class + * Initializes a new instance of the ShippingAddress class. + * @constructor + * Shipping address where customer wishes to receive the device. + * + * @member {string} streetAddress1 Street Address line 1. + * @member {string} [streetAddress2] Street Address line 2. + * @member {string} [streetAddress3] Street Address line 3. + * @member {string} [city] Name of the City. + * @member {string} [stateOrProvince] Name of the State or Province. + * @member {string} country Name of the Country. + * @member {string} postalCode Postal code. + * @member {string} [zipExtendedCode] Extended Zip Code. + * @member {string} [companyName] Name of the company. + * @member {string} [addressType] Type of address. Possible values include: + * 'None', 'Residential', 'Commercial' + */ +export interface ShippingAddress { + streetAddress1: string; + streetAddress2?: string; + streetAddress3?: string; + city?: string; + stateOrProvince?: string; + country: string; + postalCode: string; + zipExtendedCode?: string; + companyName?: string; + addressType?: string; +} + +/** + * @class + * Initializes a new instance of the AddressValidationOutput class. + * @constructor + * Output of the address validation api. + * + * @member {string} [validationStatus] The address validation status. Possible + * values include: 'Valid', 'Invalid', 'Ambiguous' + * @member {array} [alternateAddresses] List of alternate addresses. + */ +export interface AddressValidationOutput { + readonly validationStatus?: string; + readonly alternateAddresses?: ShippingAddress[]; +} + +/** + * @class + * Initializes a new instance of the ApplianceNetworkConfiguration class. + * @constructor + * The Network Adapter configuration of a DataBox. + * + * @member {string} [name] Name of the network. + * @member {string} [macAddress] Mac Address. + */ +export interface ApplianceNetworkConfiguration { + readonly name?: string; + readonly macAddress?: string; +} + +/** + * @class + * Initializes a new instance of the ArmBaseObject class. + * @constructor + * Base class for all objects under resource. + * + * @member {string} [name] Name of the object. + * @member {string} [id] Id of the object. + * @member {string} [type] Type of the object. + */ +export interface ArmBaseObject { + readonly name?: string; + readonly id?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the AvailableSkuRequest class. + * @constructor + * The filters for showing the available skus. + * + * @member {string} country ISO country code. Country for hardware shipment. + * For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * @member {string} location Location for data transfer. For locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * @member {array} [skuNames] Sku Names to filter for available skus + */ +export interface AvailableSkuRequest { + country: string; + location: string; + skuNames?: string[]; +} + +/** + * @class + * Initializes a new instance of the Sku class. + * @constructor + * The Sku. + * + * @member {string} name The sku name. Possible values include: 'DataBox', + * 'DataBoxDisk', 'DataBoxHeavy' + * @member {string} [displayName] The display name of the sku. + * @member {string} [family] The sku family. + */ +export interface Sku { + name: string; + displayName?: string; + family?: string; +} + +/** + * @class + * Initializes a new instance of the DestinationToServiceLocationMap class. + * @constructor + * Map of destination location to service location + * + * @member {string} [destinationLocation] Location of the destination. + * @member {string} [serviceLocation] Location of the service. + */ +export interface DestinationToServiceLocationMap { + readonly destinationLocation?: string; + readonly serviceLocation?: string; +} + +/** + * @class + * Initializes a new instance of the SkuCapacity class. + * @constructor + * Capacity of the sku. + * + * @member {string} [usable] Usable capacity in TB. + * @member {string} [maximum] Maximum capacity in TB. + */ +export interface SkuCapacity { + readonly usable?: string; + readonly maximum?: string; +} + +/** + * @class + * Initializes a new instance of the SkuCost class. + * @constructor + * Describes metadata for retrieving price info. + * + * @member {string} [meterId] Meter id of the Sku. + * @member {string} [meterType] The type of the meter. + */ +export interface SkuCost { + readonly meterId?: string; + readonly meterType?: string; +} + +/** + * @class + * Initializes a new instance of the SkuInformation class. + * @constructor + * Information of the sku. + * + * @member {object} [sku] The Sku. + * @member {string} [sku.name] The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * @member {string} [sku.displayName] The display name of the sku. + * @member {string} [sku.family] The sku family. + * @member {boolean} [enabled] The sku is enabled or not. + * @member {array} [destinationToServiceLocationMap] The map of destination + * location to service location. + * @member {object} [capacity] Capacity of the Sku. + * @member {string} [capacity.usable] Usable capacity in TB. + * @member {string} [capacity.maximum] Maximum capacity in TB. + * @member {array} [costs] Cost of the Sku. + * @member {array} [apiVersions] Api versions that support this Sku. + * @member {string} [disabledReason] Reason why the Sku is disabled. Possible + * values include: 'None', 'Country', 'Region', 'Feature', 'OfferType' + * @member {string} [disabledReasonMessage] Message for why the Sku is + * disabled. + * @member {string} [requiredFeature] Required feature to access the sku. + */ +export interface SkuInformation { + readonly sku?: Sku; + readonly enabled?: boolean; + readonly destinationToServiceLocationMap?: DestinationToServiceLocationMap[]; + readonly capacity?: SkuCapacity; + readonly costs?: SkuCost[]; + readonly apiVersions?: string[]; + readonly disabledReason?: string; + readonly disabledReasonMessage?: string; + readonly requiredFeature?: string; +} + +/** + * @class + * Initializes a new instance of the CancellationReason class. + * @constructor + * Reason for cancellation. + * + * @member {string} reason Reason for cancellation. + */ +export interface CancellationReason { + reason: string; +} + +/** + * @class + * Initializes a new instance of the NotificationPreference class. + * @constructor + * Notification preference for a job stage. + * + * @member {string} stageName Name of the stage. Possible values include: + * 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', + * 'DataCopy' + * @member {boolean} sendNotification Notification is required or not. + */ +export interface NotificationPreference { + stageName: string; + sendNotification: boolean; +} + +/** + * @class + * Initializes a new instance of the ContactDetails class. + * @constructor + * Contact Details. + * + * @member {string} contactName Contact name of the person. + * @member {string} phone Phone number of the contact person. + * @member {string} [phoneExtension] Phone extension number of the contact + * person. + * @member {string} [mobile] Mobile number of the contact person. + * @member {array} emailList List of Email-ids to be notified about job + * progress. + * @member {array} [notificationPreference] Notification preference for a job + * stage. + */ +export interface ContactDetails { + contactName: string; + phone: string; + phoneExtension?: string; + mobile?: string; + emailList: string[]; + notificationPreference?: NotificationPreference[]; +} + +/** + * @class + * Initializes a new instance of the CopyLogDetails class. + * @constructor + * Details for log generated during copy. + * + * @member {string} copyLogDetailsType Polymorphic Discriminator + */ +export interface CopyLogDetails { + copyLogDetailsType: string; +} + +/** + * @class + * Initializes a new instance of the CopyProgress class. + * @constructor + * Copy progress. + * + * @member {string} [storageAccountName] Name of the storage account where the + * data needs to be uploaded. + * @member {string} [accountId] Id of the account where the data needs to be + * uploaded. + * @member {number} [bytesSentToCloud] Amount of data uploaded by the job as of + * now. + * @member {number} [totalBytesToProcess] Total amount of data to be processed + * by the job. + */ +export interface CopyProgress { + readonly storageAccountName?: string; + readonly accountId?: string; + readonly bytesSentToCloud?: number; + readonly totalBytesToProcess?: number; +} + +/** + * @class + * Initializes a new instance of the DataBoxAccountCopyLogDetails class. + * @constructor + * Copy log details for a storage account of a DataBox job + * + * @member {string} [accountName] Destination account name. + * @member {string} [copyLogLink] Link for copy logs. + */ +export interface DataBoxAccountCopyLogDetails extends CopyLogDetails { + readonly accountName?: string; + readonly copyLogLink?: string; +} + +/** + * @class + * Initializes a new instance of the DataBoxDiskCopyLogDetails class. + * @constructor + * Copy Log Details for a disk + * + * @member {string} [diskSerialNumber] Disk Serial Number. + * @member {string} [errorLogLink] Link for copy error logs. + * @member {string} [verboseLogLink] Link for copy verbose logs. + */ +export interface DataBoxDiskCopyLogDetails extends CopyLogDetails { + readonly diskSerialNumber?: string; + readonly errorLogLink?: string; + readonly verboseLogLink?: string; +} + +/** + * @class + * Initializes a new instance of the DataBoxDiskCopyProgress class. + * @constructor + * DataBox Disk Copy Progress + * + * @member {string} [serialNumber] The serial number of the disk + * @member {number} [bytesCopied] Bytes copied during the copy of disk. + * @member {number} [percentComplete] Indicates the percentage completed for + * the copy of the disk. + * @member {string} [status] The Status of the copy. Possible values include: + * 'NotStarted', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', + * 'NotReturned' + */ +export interface DataBoxDiskCopyProgress { + readonly serialNumber?: string; + readonly bytesCopied?: number; + readonly percentComplete?: number; + readonly status?: string; +} + +/** + * @class + * Initializes a new instance of the JobDetails class. + * @constructor + * Job details. + * + * @member {number} [expectedDataSizeInTeraBytes] The expected size of the + * data, which needs to be transfered in this job, in tera bytes. + * @member {array} [jobStages] List of stages that run in the job. + * @member {object} contactDetails Contact details for notification and + * shipping. + * @member {string} [contactDetails.contactName] Contact name of the person. + * @member {string} [contactDetails.phone] Phone number of the contact person. + * @member {string} [contactDetails.phoneExtension] Phone extension number of + * the contact person. + * @member {string} [contactDetails.mobile] Mobile number of the contact + * person. + * @member {array} [contactDetails.emailList] List of Email-ids to be notified + * about job progress. + * @member {array} [contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} shippingAddress Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * @member {object} [deliveryPackage] Delivery package shipping details. + * @member {string} [deliveryPackage.carrierName] Name of the carrier. + * @member {string} [deliveryPackage.trackingId] Tracking Id of shipment. + * @member {string} [deliveryPackage.trackingUrl] Url where shipment can be + * tracked. + * @member {object} [returnPackage] Return package shipping details. + * @member {string} [returnPackage.carrierName] Name of the carrier. + * @member {string} [returnPackage.trackingId] Tracking Id of shipment. + * @member {string} [returnPackage.trackingUrl] Url where shipment can be + * tracked. + * @member {array} destinationAccountDetails Destination account details. + * @member {array} [errorDetails] Error details for failure. This is optional. + * @member {object} [preferences] Preferences for the order. + * @member {array} [preferences.preferredDataCenterRegion] + * @member {array} [copyLogDetails] List of copy log details. + * @member {string} [reverseShipmentLabelSasKey] Shared access key to download + * the return shipment label + * @member {string} [chainOfCustodySasKey] Shared access key to download the + * chain of custody logs + * @member {string} jobDetailsType Polymorphic Discriminator + */ +export interface JobDetails { + expectedDataSizeInTeraBytes?: number; + readonly jobStages?: JobStages[]; + contactDetails: ContactDetails; + shippingAddress: ShippingAddress; + readonly deliveryPackage?: PackageShippingDetails; + readonly returnPackage?: PackageShippingDetails; + destinationAccountDetails: DestinationAccountDetails[]; + readonly errorDetails?: JobErrorDetails[]; + preferences?: Preferences; + readonly copyLogDetails?: CopyLogDetails[]; + readonly reverseShipmentLabelSasKey?: string; + readonly chainOfCustodySasKey?: string; + jobDetailsType: string; +} + +/** + * @class + * Initializes a new instance of the DataBoxDiskJobDetails class. + * @constructor + * DataBox Disk Job Details. + * + * @member {object} [preferredDisks] User preference on what size disks are + * needed for the job. The map is from the disk size in TB to the count. Eg. + * {2,5} means 5 disks of 2 TB size. Key is string but will be checked against + * an int. + * @member {array} [copyProgress] Copy progress per disk. + * @member {object} [disksAndSizeDetails] Contains the map of disk serial + * number to the disk size being used for the job. Is returned only after the + * disks are shipped to the customer. + * @member {string} [passkey] User entered passkey for DataBox Disk job. + */ +export interface DataBoxDiskJobDetails extends JobDetails { + preferredDisks?: { [propertyName: string]: number }; + readonly copyProgress?: DataBoxDiskCopyProgress[]; + readonly disksAndSizeDetails?: { [propertyName: string]: number }; + passkey?: string; +} + +/** + * @class + * Initializes a new instance of the DiskSecret class. + * @constructor + * Contains all the secrets of a Disk. + * + * @member {string} [diskSerialNumber] Serial number of the assigned disk. + * @member {string} [bitLockerKey] Bit Locker key of the disk which can be used + * to unlock the disk to copy data. + */ +export interface DiskSecret { + readonly diskSerialNumber?: string; + readonly bitLockerKey?: string; +} + +/** + * @class + * Initializes a new instance of the JobSecrets class. + * @constructor + * The base class for the secrets + * + * @member {string} jobSecretsType Polymorphic Discriminator + */ +export interface JobSecrets { + jobSecretsType: string; +} + +/** + * @class + * Initializes a new instance of the DataBoxDiskJobSecrets class. + * @constructor + * The secrets related to disk job. + * + * @member {array} [diskSecrets] Contains the list of secrets object for that + * device. + * @member {string} [passKey] PassKey for the disk Job. + * @member {boolean} [isPasskeyUserDefined] Whether passkey was provided by + * user. + */ +export interface DataBoxDiskJobSecrets extends JobSecrets { + readonly diskSecrets?: DiskSecret[]; + readonly passKey?: string; + readonly isPasskeyUserDefined?: boolean; +} + +/** + * @class + * Initializes a new instance of the DataBoxHeavyAccountCopyLogDetails class. + * @constructor + * Copy log details for a storage account for Databox heavy + * + * @member {string} [accountName] Destination account name. + * @member {array} [copyLogLink] Link for copy logs. + */ +export interface DataBoxHeavyAccountCopyLogDetails extends CopyLogDetails { + readonly accountName?: string; + readonly copyLogLink?: string[]; +} + +/** + * @class + * Initializes a new instance of the DataBoxHeavyJobDetails class. + * @constructor + * Databox Heavy Device Job Details + * + * @member {array} [copyProgress] Copy progress per account. + */ +export interface DataBoxHeavyJobDetails extends JobDetails { + readonly copyProgress?: CopyProgress[]; +} + +/** + * @class + * Initializes a new instance of the DataBoxHeavySecret class. + * @constructor + * The secrets related to a databox heavy. + * + * @member {string} [deviceSerialNumber] Serial number of the assigned device. + * @member {string} [devicePassword] Password for out of the box experience on + * device. + * @member {array} [networkConfigurations] Network configuration of the + * appliance. + * @member {string} [encodedValidationCertPubKey] The base 64 encoded public + * key to authenticate with the device + * @member {array} [accountCredentialDetails] Per account level access + * credentials. + */ +export interface DataBoxHeavySecret { + readonly deviceSerialNumber?: string; + readonly devicePassword?: string; + readonly networkConfigurations?: ApplianceNetworkConfiguration[]; + readonly encodedValidationCertPubKey?: string; + readonly accountCredentialDetails?: AccountCredentialDetails[]; +} + +/** + * @class + * Initializes a new instance of the DataBoxHeavyJobSecrets class. + * @constructor + * The secrets related to a databox heavy job. + * + * @member {array} [cabinetPodSecrets] Contains the list of secret objects for + * a databox heavy job. + */ +export interface DataBoxHeavyJobSecrets extends JobSecrets { + readonly cabinetPodSecrets?: DataBoxHeavySecret[]; +} + +/** + * @class + * Initializes a new instance of the DataBoxJobDetails class. + * @constructor + * Databox Job Details + * + * @member {array} [copyProgress] Copy progress per storage account. + */ +export interface DataBoxJobDetails extends JobDetails { + readonly copyProgress?: CopyProgress[]; +} + +/** + * @class + * Initializes a new instance of the DataBoxSecret class. + * @constructor + * The secrets related to a DataBox. + * + * @member {string} [deviceSerialNumber] Serial number of the assigned device. + * @member {string} [devicePassword] Password for out of the box experience on + * device. + * @member {array} [networkConfigurations] Network configuration of the + * appliance. + * @member {string} [encodedValidationCertPubKey] The base 64 encoded public + * key to authenticate with the device + * @member {array} [accountCredentialDetails] Per account level access + * credentials. + */ +export interface DataBoxSecret { + readonly deviceSerialNumber?: string; + readonly devicePassword?: string; + readonly networkConfigurations?: ApplianceNetworkConfiguration[]; + readonly encodedValidationCertPubKey?: string; + readonly accountCredentialDetails?: AccountCredentialDetails[]; +} + +/** + * @class + * Initializes a new instance of the DataboxJobSecrets class. + * @constructor + * The secrets related to a databox job. + * + * @member {array} [podSecrets] Contains the list of secret objects for a job. + */ +export interface DataboxJobSecrets extends JobSecrets { + podSecrets?: DataBoxSecret[]; +} + +/** + * @class + * Initializes a new instance of the DestinationAccountDetails class. + * @constructor + * Details for the destination account. + * + * @member {string} accountId Destination storage account id. + */ +export interface DestinationAccountDetails { + accountId: string; +} + +/** + * @class + * Initializes a new instance of the ErrorModel class. + * @constructor + * Top level error for the job. + * + * @member {string} [code] Error code that can be used to programmatically + * identify the error. + * @member {string} [message] Describes the error in detail and provides + * debugging information. + */ +export interface ErrorModel { + readonly code?: string; + readonly message?: string; +} + +/** + * @class + * Initializes a new instance of the JobErrorDetails class. + * @constructor + * Job Error Details for providing the information and recommended action. + * + * @member {string} [errorMessage] Message for the error. + * @member {number} [errorCode] Code for the error. + * @member {string} [recommendedAction] Recommended action for the error. + * @member {string} [exceptionMessage] Contains the non localized exception + * message + */ +export interface JobErrorDetails { + readonly errorMessage?: string; + readonly errorCode?: number; + readonly recommendedAction?: string; + readonly exceptionMessage?: string; +} + +/** + * @class + * Initializes a new instance of the JobStages class. + * @constructor + * Job stages. + * + * @member {string} [stageName] Name of the job stage. Possible values include: + * 'DeviceOrdered', 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', + * 'AtAzureDC', 'DataCopy', 'Completed', 'CompletedWithErrors', 'Cancelled', + * 'Failed_IssueReportedAtCustomer', 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * @member {string} [displayName] Display name of the job stage. + * @member {string} [stageStatus] Status of the job stage. Possible values + * include: 'None', 'InProgress', 'Succeeded', 'Failed', 'Cancelled', + * 'Cancelling', 'SucceededWithErrors' + * @member {date} [stageTime] Time for the job stage in UTC ISO 8601 format. + * @member {object} [jobStageDetails] Job Stage Details + * @member {array} [errorDetails] Error details for the stage. + */ +export interface JobStages { + readonly stageName?: string; + readonly displayName?: string; + readonly stageStatus?: string; + readonly stageTime?: Date; + readonly jobStageDetails?: any; + readonly errorDetails?: JobErrorDetails[]; +} + +/** + * @class + * Initializes a new instance of the PackageShippingDetails class. + * @constructor + * Shipping details. + * + * @member {string} [carrierName] Name of the carrier. + * @member {string} [trackingId] Tracking Id of shipment. + * @member {string} [trackingUrl] Url where shipment can be tracked. + */ +export interface PackageShippingDetails { + readonly carrierName?: string; + readonly trackingId?: string; + readonly trackingUrl?: string; +} + +/** + * @class + * Initializes a new instance of the Preferences class. + * @constructor + * Preferences related to the order + * + * @member {array} [preferredDataCenterRegion] + */ +export interface Preferences { + preferredDataCenterRegion?: string[]; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * Model of the Resource. + * + * @member {string} location The location of the resource. This will be one of + * the supported and registered Azure Regions (e.g. West US, East US, Southeast + * Asia, etc.). The region of a resource cannot be changed once it is created, + * but if an identical region is specified on update the request will succeed. + * @member {object} [tags] The list of key value pairs that describe the + * resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * @member {object} sku The sku type. + * @member {string} [sku.name] The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * @member {string} [sku.displayName] The display name of the sku. + * @member {string} [sku.family] The sku family. + */ +export interface Resource extends BaseResource { + location: string; + tags?: { [propertyName: string]: string }; + sku: Sku; +} + +/** + * @class + * Initializes a new instance of the JobResource class. + * @constructor + * Job Resource. + * + * @member {boolean} [isCancellable] Describes whether the job is cancellable + * or not. + * @member {boolean} [isDeletable] Describes whether the job is deletable or + * not. + * @member {boolean} [isShippingAddressEditable] Describes whether the shipping + * address is editable or not. + * @member {string} [status] Name of the stage which is in progress. Possible + * values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * @member {date} [startTime] Time at which the job was started in UTC ISO 8601 + * format. + * @member {object} [error] Top level error for the job. + * @member {string} [error.code] Error code that can be used to + * programmatically identify the error. + * @member {string} [error.message] Describes the error in detail and provides + * debugging information. + * @member {object} [details] Details of a job run. This field will only be + * sent for expand details filter. + * @member {number} [details.expectedDataSizeInTeraBytes] The expected size of + * the data, which needs to be transfered in this job, in tera bytes. + * @member {array} [details.jobStages] List of stages that run in the job. + * @member {object} [details.contactDetails] Contact details for notification + * and shipping. + * @member {string} [details.contactDetails.contactName] Contact name of the + * person. + * @member {string} [details.contactDetails.phone] Phone number of the contact + * person. + * @member {string} [details.contactDetails.phoneExtension] Phone extension + * number of the contact person. + * @member {string} [details.contactDetails.mobile] Mobile number of the + * contact person. + * @member {array} [details.contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [details.contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} [details.shippingAddress] Shipping address of the customer. + * @member {string} [details.shippingAddress.streetAddress1] Street Address + * line 1. + * @member {string} [details.shippingAddress.streetAddress2] Street Address + * line 2. + * @member {string} [details.shippingAddress.streetAddress3] Street Address + * line 3. + * @member {string} [details.shippingAddress.city] Name of the City. + * @member {string} [details.shippingAddress.stateOrProvince] Name of the State + * or Province. + * @member {string} [details.shippingAddress.country] Name of the Country. + * @member {string} [details.shippingAddress.postalCode] Postal code. + * @member {string} [details.shippingAddress.zipExtendedCode] Extended Zip + * Code. + * @member {string} [details.shippingAddress.companyName] Name of the company. + * @member {string} [details.shippingAddress.addressType] Type of address. + * Possible values include: 'None', 'Residential', 'Commercial' + * @member {object} [details.deliveryPackage] Delivery package shipping + * details. + * @member {string} [details.deliveryPackage.carrierName] Name of the carrier. + * @member {string} [details.deliveryPackage.trackingId] Tracking Id of + * shipment. + * @member {string} [details.deliveryPackage.trackingUrl] Url where shipment + * can be tracked. + * @member {object} [details.returnPackage] Return package shipping details. + * @member {string} [details.returnPackage.carrierName] Name of the carrier. + * @member {string} [details.returnPackage.trackingId] Tracking Id of shipment. + * @member {string} [details.returnPackage.trackingUrl] Url where shipment can + * be tracked. + * @member {array} [details.destinationAccountDetails] Destination account + * details. + * @member {array} [details.errorDetails] Error details for failure. This is + * optional. + * @member {object} [details.preferences] Preferences for the order. + * @member {array} [details.preferences.preferredDataCenterRegion] + * @member {array} [details.copyLogDetails] List of copy log details. + * @member {string} [details.reverseShipmentLabelSasKey] Shared access key to + * download the return shipment label + * @member {string} [details.chainOfCustodySasKey] Shared access key to + * download the chain of custody logs + * @member {string} [details.jobDetailsType] Polymorphic Discriminator + * @member {string} [cancellationReason] Reason for cancellation. + * @member {string} [name] Name of the object. + * @member {string} [id] Id of the object. + * @member {string} [type] Type of the object. + */ +export interface JobResource extends Resource { + readonly isCancellable?: boolean; + readonly isDeletable?: boolean; + readonly isShippingAddressEditable?: boolean; + readonly status?: string; + readonly startTime?: Date; + readonly error?: ErrorModel; + details?: JobDetails; + readonly cancellationReason?: string; + readonly name?: string; + readonly id?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the UpdateJobDetails class. + * @constructor + * Job details for update. + * + * @member {object} [contactDetails] Contact details for notification and + * shipping. + * @member {string} [contactDetails.contactName] Contact name of the person. + * @member {string} [contactDetails.phone] Phone number of the contact person. + * @member {string} [contactDetails.phoneExtension] Phone extension number of + * the contact person. + * @member {string} [contactDetails.mobile] Mobile number of the contact + * person. + * @member {array} [contactDetails.emailList] List of Email-ids to be notified + * about job progress. + * @member {array} [contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} [shippingAddress] Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + */ +export interface UpdateJobDetails { + contactDetails?: ContactDetails; + shippingAddress?: ShippingAddress; +} + +/** + * @class + * Initializes a new instance of the JobResourceUpdateParameter class. + * @constructor + * The JobResourceUpdateParameter. + * + * @member {object} [details] Details of a job to be updated. + * @member {object} [details.contactDetails] Contact details for notification + * and shipping. + * @member {string} [details.contactDetails.contactName] Contact name of the + * person. + * @member {string} [details.contactDetails.phone] Phone number of the contact + * person. + * @member {string} [details.contactDetails.phoneExtension] Phone extension + * number of the contact person. + * @member {string} [details.contactDetails.mobile] Mobile number of the + * contact person. + * @member {array} [details.contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [details.contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} [details.shippingAddress] Shipping address of the customer. + * @member {string} [details.shippingAddress.streetAddress1] Street Address + * line 1. + * @member {string} [details.shippingAddress.streetAddress2] Street Address + * line 2. + * @member {string} [details.shippingAddress.streetAddress3] Street Address + * line 3. + * @member {string} [details.shippingAddress.city] Name of the City. + * @member {string} [details.shippingAddress.stateOrProvince] Name of the State + * or Province. + * @member {string} [details.shippingAddress.country] Name of the Country. + * @member {string} [details.shippingAddress.postalCode] Postal code. + * @member {string} [details.shippingAddress.zipExtendedCode] Extended Zip + * Code. + * @member {string} [details.shippingAddress.companyName] Name of the company. + * @member {string} [details.shippingAddress.addressType] Type of address. + * Possible values include: 'None', 'Residential', 'Commercial' + * @member {array} [destinationAccountDetails] Destination account details. + * @member {object} [tags] The list of key value pairs that describe the + * resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + */ +export interface JobResourceUpdateParameter { + details?: UpdateJobDetails; + destinationAccountDetails?: DestinationAccountDetails[]; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * Operation display + * + * @member {string} [provider] Provider name. + * @member {string} [resource] Resource name. + * @member {string} [operation] Localized name of the operation for display + * purpose. + * @member {string} [description] Localized description of the operation for + * display purpose. + */ +export interface OperationDisplay { + provider?: string; + resource?: string; + operation?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * Operation entity. + * + * @member {string} [name] Name of the operation. Format: + * {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} + * @member {object} [display] Operation display values. + * @member {string} [display.provider] Provider name. + * @member {string} [display.resource] Resource name. + * @member {string} [display.operation] Localized name of the operation for + * display purpose. + * @member {string} [display.description] Localized description of the + * operation for display purpose. + * @member {object} [properties] Operation properties. + * @member {string} [origin] Origin of the operation. Can be : + * user|system|user,system + */ +export interface Operation { + readonly name?: string; + readonly display?: OperationDisplay; + readonly properties?: any; + readonly origin?: string; +} + +/** + * @class + * Initializes a new instance of the ShipmentPickUpRequest class. + * @constructor + * Shipment pick up request details. + * + * @member {date} startTime Minimum date after which the pick up should + * commence, this must be in local time of pick up area. + * @member {date} endTime Maximum date before which the pick up should + * commence, this must be in local time of pick up area. + * @member {string} shipmentLocation Shipment Location in the pickup place. + * Eg.front desk + */ +export interface ShipmentPickUpRequest { + startTime: Date; + endTime: Date; + shipmentLocation: string; +} + +/** + * @class + * Initializes a new instance of the ShipmentPickUpResponse class. + * @constructor + * Shipment pick up response. + * + * @member {string} [confirmationNumber] Confirmation number for the pick up + * request. + * @member {date} [readyByTime] Time by which shipment should be ready for pick + * up, this is in local time of pick up area. + */ +export interface ShipmentPickUpResponse { + readonly confirmationNumber?: string; + readonly readyByTime?: Date; +} + +/** + * @class + * Initializes a new instance of the UnencryptedCredentials class. + * @constructor + * Unencrypted credentials for accessing device. + * + * @member {string} [jobName] Name of the job. + * @member {object} [jobSecrets] Secrets related to this job. + * @member {string} [jobSecrets.jobSecretsType] Polymorphic Discriminator + */ +export interface UnencryptedCredentials { + readonly jobName?: string; + readonly jobSecrets?: JobSecrets; +} + +/** + * @class + * Initializes a new instance of the ValidateAddress class. + * @constructor + * The requirements to validate customer address where the device needs to be + * shipped. + * + * @member {object} shippingAddress Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * @member {string} deviceType Device type to be used for the job. Possible + * values include: 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + */ +export interface ValidateAddress { + shippingAddress: ShippingAddress; + deviceType: string; +} + + +/** + * @class + * Initializes a new instance of the OperationList class. + * @constructor + * Operation Collection. + * + * @member {string} [nextLink] Link for the next set of operations. + */ +export interface OperationList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the JobResourceList class. + * @constructor + * Job Resource Collection + * + * @member {string} [nextLink] Link for the next set of job resources. + */ +export interface JobResourceList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the UnencryptedCredentialsList class. + * @constructor + * List of unencrypted credentials for accessing device. + * + * @member {string} [nextLink] Link for the next set of unencrypted + * credentials. + */ +export interface UnencryptedCredentialsList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the AvailableSkusResult class. + * @constructor + * The available skus operation response. + * + * @member {string} [nextLink] Link for the next set of skus. + */ +export interface AvailableSkusResult extends Array { + nextLink?: string; +} diff --git a/lib/services/databoxManagement/lib/models/index.js b/lib/services/databoxManagement/lib/models/index.js new file mode 100644 index 0000000000..726f31c4a6 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/index.js @@ -0,0 +1,86 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.ShareCredentialDetails = require('./shareCredentialDetails'); +exports.AccountCredentialDetails = require('./accountCredentialDetails'); +exports.ShippingAddress = require('./shippingAddress'); +exports.AddressValidationOutput = require('./addressValidationOutput'); +exports.ApplianceNetworkConfiguration = require('./applianceNetworkConfiguration'); +exports.ArmBaseObject = require('./armBaseObject'); +exports.AvailableSkuRequest = require('./availableSkuRequest'); +exports.Sku = require('./sku'); +exports.DestinationToServiceLocationMap = require('./destinationToServiceLocationMap'); +exports.SkuCapacity = require('./skuCapacity'); +exports.SkuCost = require('./skuCost'); +exports.SkuInformation = require('./skuInformation'); +exports.CancellationReason = require('./cancellationReason'); +exports.NotificationPreference = require('./notificationPreference'); +exports.ContactDetails = require('./contactDetails'); +exports.CopyLogDetails = require('./copyLogDetails'); +exports.CopyProgress = require('./copyProgress'); +exports.DataBoxAccountCopyLogDetails = require('./dataBoxAccountCopyLogDetails'); +exports.DataBoxDiskCopyLogDetails = require('./dataBoxDiskCopyLogDetails'); +exports.DataBoxDiskCopyProgress = require('./dataBoxDiskCopyProgress'); +exports.JobDetails = require('./jobDetails'); +exports.DataBoxDiskJobDetails = require('./dataBoxDiskJobDetails'); +exports.DiskSecret = require('./diskSecret'); +exports.JobSecrets = require('./jobSecrets'); +exports.DataBoxDiskJobSecrets = require('./dataBoxDiskJobSecrets'); +exports.DataBoxHeavyAccountCopyLogDetails = require('./dataBoxHeavyAccountCopyLogDetails'); +exports.DataBoxHeavyJobDetails = require('./dataBoxHeavyJobDetails'); +exports.DataBoxHeavySecret = require('./dataBoxHeavySecret'); +exports.DataBoxHeavyJobSecrets = require('./dataBoxHeavyJobSecrets'); +exports.DataBoxJobDetails = require('./dataBoxJobDetails'); +exports.DataBoxSecret = require('./dataBoxSecret'); +exports.DataboxJobSecrets = require('./databoxJobSecrets'); +exports.DestinationAccountDetails = require('./destinationAccountDetails'); +exports.ErrorModel = require('./errorModel'); +exports.JobErrorDetails = require('./jobErrorDetails'); +exports.JobStages = require('./jobStages'); +exports.PackageShippingDetails = require('./packageShippingDetails'); +exports.Preferences = require('./preferences'); +exports.Resource = require('./resource'); +exports.JobResource = require('./jobResource'); +exports.UpdateJobDetails = require('./updateJobDetails'); +exports.JobResourceUpdateParameter = require('./jobResourceUpdateParameter'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Operation = require('./operation'); +exports.ShipmentPickUpRequest = require('./shipmentPickUpRequest'); +exports.ShipmentPickUpResponse = require('./shipmentPickUpResponse'); +exports.UnencryptedCredentials = require('./unencryptedCredentials'); +exports.ValidateAddress = require('./validateAddress'); +exports.OperationList = require('./operationList'); +exports.JobResourceList = require('./jobResourceList'); +exports.UnencryptedCredentialsList = require('./unencryptedCredentialsList'); +exports.AvailableSkusResult = require('./availableSkusResult'); +exports.discriminators = { + 'CopyLogDetails' : exports.CopyLogDetails, + 'CopyLogDetails.DataBox' : exports.DataBoxAccountCopyLogDetails, + 'CopyLogDetails.DataBoxDisk' : exports.DataBoxDiskCopyLogDetails, + 'JobDetails.DataBoxDisk' : exports.DataBoxDiskJobDetails, + 'JobSecrets.DataBoxDisk' : exports.DataBoxDiskJobSecrets, + 'CopyLogDetails.DataBoxHeavy' : exports.DataBoxHeavyAccountCopyLogDetails, + 'JobDetails.DataBoxHeavy' : exports.DataBoxHeavyJobDetails, + 'JobSecrets.DataBoxHeavy' : exports.DataBoxHeavyJobSecrets, + 'JobDetails.DataBox' : exports.DataBoxJobDetails, + 'JobSecrets.DataBox' : exports.DataboxJobSecrets, + 'JobDetails' : exports.JobDetails, + 'JobSecrets' : exports.JobSecrets +}; diff --git a/lib/services/databoxManagement/lib/models/jobDetails.js b/lib/services/databoxManagement/lib/models/jobDetails.js new file mode 100644 index 0000000000..c9a50e2889 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/jobDetails.js @@ -0,0 +1,240 @@ +/* + * 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'; + +/** + * Job details. + * + */ +class JobDetails { + /** + * Create a JobDetails. + * @member {number} [expectedDataSizeInTeraBytes] The expected size of the + * data, which needs to be transfered in this job, in tera bytes. + * @member {array} [jobStages] List of stages that run in the job. + * @member {object} contactDetails Contact details for notification and + * shipping. + * @member {string} [contactDetails.contactName] Contact name of the person. + * @member {string} [contactDetails.phone] Phone number of the contact + * person. + * @member {string} [contactDetails.phoneExtension] Phone extension number of + * the contact person. + * @member {string} [contactDetails.mobile] Mobile number of the contact + * person. + * @member {array} [contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} shippingAddress Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * @member {object} [deliveryPackage] Delivery package shipping details. + * @member {string} [deliveryPackage.carrierName] Name of the carrier. + * @member {string} [deliveryPackage.trackingId] Tracking Id of shipment. + * @member {string} [deliveryPackage.trackingUrl] Url where shipment can be + * tracked. + * @member {object} [returnPackage] Return package shipping details. + * @member {string} [returnPackage.carrierName] Name of the carrier. + * @member {string} [returnPackage.trackingId] Tracking Id of shipment. + * @member {string} [returnPackage.trackingUrl] Url where shipment can be + * tracked. + * @member {array} destinationAccountDetails Destination account details. + * @member {array} [errorDetails] Error details for failure. This is + * optional. + * @member {object} [preferences] Preferences for the order. + * @member {array} [preferences.preferredDataCenterRegion] + * @member {array} [copyLogDetails] List of copy log details. + * @member {string} [reverseShipmentLabelSasKey] Shared access key to + * download the return shipment label + * @member {string} [chainOfCustodySasKey] Shared access key to download the + * chain of custody logs + * @member {string} jobDetailsType Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of JobDetails + * + * @returns {object} metadata of JobDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'JobDetails', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobDetailsType', + clientName: 'jobDetailsType' + }, + uberParent: 'JobDetails', + className: 'JobDetails', + modelProperties: { + expectedDataSizeInTeraBytes: { + required: false, + serializedName: 'expectedDataSizeInTeraBytes', + type: { + name: 'Number' + } + }, + jobStages: { + required: false, + readOnly: true, + serializedName: 'jobStages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobStagesElementType', + type: { + name: 'Composite', + className: 'JobStages' + } + } + } + }, + contactDetails: { + required: true, + serializedName: 'contactDetails', + type: { + name: 'Composite', + className: 'ContactDetails' + } + }, + shippingAddress: { + required: true, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + }, + deliveryPackage: { + required: false, + readOnly: true, + serializedName: 'deliveryPackage', + type: { + name: 'Composite', + className: 'PackageShippingDetails' + } + }, + returnPackage: { + required: false, + readOnly: true, + serializedName: 'returnPackage', + type: { + name: 'Composite', + className: 'PackageShippingDetails' + } + }, + destinationAccountDetails: { + required: true, + serializedName: 'destinationAccountDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DestinationAccountDetailsElementType', + type: { + name: 'Composite', + className: 'DestinationAccountDetails' + } + } + } + }, + errorDetails: { + required: false, + readOnly: true, + serializedName: 'errorDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobErrorDetailsElementType', + type: { + name: 'Composite', + className: 'JobErrorDetails' + } + } + } + }, + preferences: { + required: false, + serializedName: 'preferences', + type: { + name: 'Composite', + className: 'Preferences' + } + }, + copyLogDetails: { + required: false, + readOnly: true, + serializedName: 'copyLogDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CopyLogDetailsElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'copyLogDetailsType', + clientName: 'copyLogDetailsType' + }, + uberParent: 'CopyLogDetails', + className: 'CopyLogDetails' + } + } + } + }, + reverseShipmentLabelSasKey: { + required: false, + readOnly: true, + serializedName: 'reverseShipmentLabelSasKey', + type: { + name: 'String' + } + }, + chainOfCustodySasKey: { + required: false, + readOnly: true, + serializedName: 'chainOfCustodySasKey', + type: { + name: 'String' + } + }, + jobDetailsType: { + required: true, + serializedName: 'jobDetailsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobDetails; diff --git a/lib/services/databoxManagement/lib/models/jobErrorDetails.js b/lib/services/databoxManagement/lib/models/jobErrorDetails.js new file mode 100644 index 0000000000..88693f272a --- /dev/null +++ b/lib/services/databoxManagement/lib/models/jobErrorDetails.js @@ -0,0 +1,81 @@ +/* + * 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'; + +/** + * Job Error Details for providing the information and recommended action. + * + */ +class JobErrorDetails { + /** + * Create a JobErrorDetails. + * @member {string} [errorMessage] Message for the error. + * @member {number} [errorCode] Code for the error. + * @member {string} [recommendedAction] Recommended action for the error. + * @member {string} [exceptionMessage] Contains the non localized exception + * message + */ + constructor() { + } + + /** + * Defines the metadata of JobErrorDetails + * + * @returns {object} metadata of JobErrorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'JobErrorDetails', + type: { + name: 'Composite', + className: 'JobErrorDetails', + modelProperties: { + errorMessage: { + required: false, + readOnly: true, + serializedName: 'errorMessage', + type: { + name: 'String' + } + }, + errorCode: { + required: false, + readOnly: true, + serializedName: 'errorCode', + type: { + name: 'Number' + } + }, + recommendedAction: { + required: false, + readOnly: true, + serializedName: 'recommendedAction', + type: { + name: 'String' + } + }, + exceptionMessage: { + required: false, + readOnly: true, + serializedName: 'exceptionMessage', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobErrorDetails; diff --git a/lib/services/databoxManagement/lib/models/jobResource.js b/lib/services/databoxManagement/lib/models/jobResource.js new file mode 100644 index 0000000000..adcad744a6 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/jobResource.js @@ -0,0 +1,258 @@ +/* + * 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'); + +/** + * Job Resource. + * + * @extends models['Resource'] + */ +class JobResource extends models['Resource'] { + /** + * Create a JobResource. + * @member {boolean} [isCancellable] Describes whether the job is cancellable + * or not. + * @member {boolean} [isDeletable] Describes whether the job is deletable or + * not. + * @member {boolean} [isShippingAddressEditable] Describes whether the + * shipping address is editable or not. + * @member {string} [status] Name of the stage which is in progress. Possible + * values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', + * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', + * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * @member {date} [startTime] Time at which the job was started in UTC ISO + * 8601 format. + * @member {object} [error] Top level error for the job. + * @member {string} [error.code] Error code that can be used to + * programmatically identify the error. + * @member {string} [error.message] Describes the error in detail and + * provides debugging information. + * @member {object} [details] Details of a job run. This field will only be + * sent for expand details filter. + * @member {number} [details.expectedDataSizeInTeraBytes] The expected size + * of the data, which needs to be transfered in this job, in tera bytes. + * @member {array} [details.jobStages] List of stages that run in the job. + * @member {object} [details.contactDetails] Contact details for notification + * and shipping. + * @member {string} [details.contactDetails.contactName] Contact name of the + * person. + * @member {string} [details.contactDetails.phone] Phone number of the + * contact person. + * @member {string} [details.contactDetails.phoneExtension] Phone extension + * number of the contact person. + * @member {string} [details.contactDetails.mobile] Mobile number of the + * contact person. + * @member {array} [details.contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * @member {object} [details.shippingAddress] Shipping address of the + * customer. + * @member {string} [details.shippingAddress.streetAddress1] Street Address + * line 1. + * @member {string} [details.shippingAddress.streetAddress2] Street Address + * line 2. + * @member {string} [details.shippingAddress.streetAddress3] Street Address + * line 3. + * @member {string} [details.shippingAddress.city] Name of the City. + * @member {string} [details.shippingAddress.stateOrProvince] Name of the + * State or Province. + * @member {string} [details.shippingAddress.country] Name of the Country. + * @member {string} [details.shippingAddress.postalCode] Postal code. + * @member {string} [details.shippingAddress.zipExtendedCode] Extended Zip + * Code. + * @member {string} [details.shippingAddress.companyName] Name of the + * company. + * @member {string} [details.shippingAddress.addressType] Type of address. + * Possible values include: 'None', 'Residential', 'Commercial' + * @member {object} [details.deliveryPackage] Delivery package shipping + * details. + * @member {string} [details.deliveryPackage.carrierName] Name of the + * carrier. + * @member {string} [details.deliveryPackage.trackingId] Tracking Id of + * shipment. + * @member {string} [details.deliveryPackage.trackingUrl] Url where shipment + * can be tracked. + * @member {object} [details.returnPackage] Return package shipping details. + * @member {string} [details.returnPackage.carrierName] Name of the carrier. + * @member {string} [details.returnPackage.trackingId] Tracking Id of + * shipment. + * @member {string} [details.returnPackage.trackingUrl] Url where shipment + * can be tracked. + * @member {array} [details.destinationAccountDetails] Destination account + * details. + * @member {array} [details.errorDetails] Error details for failure. This is + * optional. + * @member {object} [details.preferences] Preferences for the order. + * @member {array} [details.preferences.preferredDataCenterRegion] + * @member {array} [details.copyLogDetails] List of copy log details. + * @member {string} [details.reverseShipmentLabelSasKey] Shared access key to + * download the return shipment label + * @member {string} [details.chainOfCustodySasKey] Shared access key to + * download the chain of custody logs + * @member {string} [details.jobDetailsType] Polymorphic Discriminator + * @member {string} [cancellationReason] Reason for cancellation. + * @member {string} [name] Name of the object. + * @member {string} [id] Id of the object. + * @member {string} [type] Type of the object. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of JobResource + * + * @returns {object} metadata of JobResource + * + */ + mapper() { + return { + required: false, + serializedName: 'JobResource', + type: { + name: 'Composite', + className: 'JobResource', + modelProperties: { + 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: true, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + isCancellable: { + required: false, + readOnly: true, + serializedName: 'properties.isCancellable', + type: { + name: 'Boolean' + } + }, + isDeletable: { + required: false, + readOnly: true, + serializedName: 'properties.isDeletable', + type: { + name: 'Boolean' + } + }, + isShippingAddressEditable: { + required: false, + readOnly: true, + serializedName: 'properties.isShippingAddressEditable', + type: { + name: 'Boolean' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'Enum', + allowedValues: [ 'DeviceOrdered', 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', 'Failed_IssueDetectedAtAzureDC', 'Aborted' ] + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + error: { + required: false, + readOnly: true, + serializedName: 'properties.error', + type: { + name: 'Composite', + className: 'ErrorModel' + } + }, + details: { + required: false, + serializedName: 'properties.details', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobDetailsType', + clientName: 'jobDetailsType' + }, + uberParent: 'JobDetails', + className: 'JobDetails' + } + }, + cancellationReason: { + required: false, + readOnly: true, + serializedName: 'properties.cancellationReason', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobResource; diff --git a/lib/services/databoxManagement/lib/models/jobResourceList.js b/lib/services/databoxManagement/lib/models/jobResourceList.js new file mode 100644 index 0000000000..bed4718392 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/jobResourceList.js @@ -0,0 +1,67 @@ +/* + * 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'; + +/** + * Job Resource Collection + */ +class JobResourceList extends Array { + /** + * Create a JobResourceList. + * @member {string} [nextLink] Link for the next set of job resources. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of JobResourceList + * + * @returns {object} metadata of JobResourceList + * + */ + mapper() { + return { + required: false, + serializedName: 'JobResourceList', + type: { + name: 'Composite', + className: 'JobResourceList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobResourceElementType', + type: { + name: 'Composite', + className: 'JobResource' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobResourceList; diff --git a/lib/services/databoxManagement/lib/models/jobResourceUpdateParameter.js b/lib/services/databoxManagement/lib/models/jobResourceUpdateParameter.js new file mode 100644 index 0000000000..d4d85a55b0 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/jobResourceUpdateParameter.js @@ -0,0 +1,119 @@ +/* + * 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 JobResourceUpdateParameter. + * + */ +class JobResourceUpdateParameter { + /** + * Create a JobResourceUpdateParameter. + * @member {object} [details] Details of a job to be updated. + * @member {object} [details.contactDetails] Contact details for notification + * and shipping. + * @member {string} [details.contactDetails.contactName] Contact name of the + * person. + * @member {string} [details.contactDetails.phone] Phone number of the + * contact person. + * @member {string} [details.contactDetails.phoneExtension] Phone extension + * number of the contact person. + * @member {string} [details.contactDetails.mobile] Mobile number of the + * contact person. + * @member {array} [details.contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * @member {object} [details.shippingAddress] Shipping address of the + * customer. + * @member {string} [details.shippingAddress.streetAddress1] Street Address + * line 1. + * @member {string} [details.shippingAddress.streetAddress2] Street Address + * line 2. + * @member {string} [details.shippingAddress.streetAddress3] Street Address + * line 3. + * @member {string} [details.shippingAddress.city] Name of the City. + * @member {string} [details.shippingAddress.stateOrProvince] Name of the + * State or Province. + * @member {string} [details.shippingAddress.country] Name of the Country. + * @member {string} [details.shippingAddress.postalCode] Postal code. + * @member {string} [details.shippingAddress.zipExtendedCode] Extended Zip + * Code. + * @member {string} [details.shippingAddress.companyName] Name of the + * company. + * @member {string} [details.shippingAddress.addressType] Type of address. + * Possible values include: 'None', 'Residential', 'Commercial' + * @member {array} [destinationAccountDetails] Destination account details. + * @member {object} [tags] The list of key value pairs that describe the + * resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + */ + constructor() { + } + + /** + * Defines the metadata of JobResourceUpdateParameter + * + * @returns {object} metadata of JobResourceUpdateParameter + * + */ + mapper() { + return { + required: false, + serializedName: 'JobResourceUpdateParameter', + type: { + name: 'Composite', + className: 'JobResourceUpdateParameter', + modelProperties: { + details: { + required: false, + serializedName: 'properties.details', + type: { + name: 'Composite', + className: 'UpdateJobDetails' + } + }, + destinationAccountDetails: { + required: false, + serializedName: 'properties.destinationAccountDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DestinationAccountDetailsElementType', + type: { + name: 'Composite', + className: 'DestinationAccountDetails' + } + } + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = JobResourceUpdateParameter; diff --git a/lib/services/databoxManagement/lib/models/jobSecrets.js b/lib/services/databoxManagement/lib/models/jobSecrets.js new file mode 100644 index 0000000000..9ef614fc2e --- /dev/null +++ b/lib/services/databoxManagement/lib/models/jobSecrets.js @@ -0,0 +1,58 @@ +/* + * 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 base class for the secrets + * + */ +class JobSecrets { + /** + * Create a JobSecrets. + * @member {string} jobSecretsType Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of JobSecrets + * + * @returns {object} metadata of JobSecrets + * + */ + mapper() { + return { + required: false, + serializedName: 'JobSecrets', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobSecretsType', + clientName: 'jobSecretsType' + }, + uberParent: 'JobSecrets', + className: 'JobSecrets', + modelProperties: { + jobSecretsType: { + required: true, + serializedName: 'jobSecretsType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobSecrets; diff --git a/lib/services/databoxManagement/lib/models/jobStages.js b/lib/services/databoxManagement/lib/models/jobStages.js new file mode 100644 index 0000000000..939fb5caa7 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/jobStages.js @@ -0,0 +1,114 @@ +/* + * 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'; + +/** + * Job stages. + * + */ +class JobStages { + /** + * Create a JobStages. + * @member {string} [stageName] Name of the job stage. Possible values + * include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched', 'Delivered', + * 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', 'CompletedWithErrors', + * 'Cancelled', 'Failed_IssueReportedAtCustomer', + * 'Failed_IssueDetectedAtAzureDC', 'Aborted' + * @member {string} [displayName] Display name of the job stage. + * @member {string} [stageStatus] Status of the job stage. Possible values + * include: 'None', 'InProgress', 'Succeeded', 'Failed', 'Cancelled', + * 'Cancelling', 'SucceededWithErrors' + * @member {date} [stageTime] Time for the job stage in UTC ISO 8601 format. + * @member {object} [jobStageDetails] Job Stage Details + * @member {array} [errorDetails] Error details for the stage. + */ + constructor() { + } + + /** + * Defines the metadata of JobStages + * + * @returns {object} metadata of JobStages + * + */ + mapper() { + return { + required: false, + serializedName: 'JobStages', + type: { + name: 'Composite', + className: 'JobStages', + modelProperties: { + stageName: { + required: false, + readOnly: true, + serializedName: 'stageName', + type: { + name: 'Enum', + allowedValues: [ 'DeviceOrdered', 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', 'Failed_IssueDetectedAtAzureDC', 'Aborted' ] + } + }, + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + stageStatus: { + required: false, + readOnly: true, + serializedName: 'stageStatus', + type: { + name: 'Enum', + allowedValues: [ 'None', 'InProgress', 'Succeeded', 'Failed', 'Cancelled', 'Cancelling', 'SucceededWithErrors' ] + } + }, + stageTime: { + required: false, + readOnly: true, + serializedName: 'stageTime', + type: { + name: 'DateTime' + } + }, + jobStageDetails: { + required: false, + readOnly: true, + serializedName: 'jobStageDetails', + type: { + name: 'Object' + } + }, + errorDetails: { + required: false, + readOnly: true, + serializedName: 'errorDetails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobErrorDetailsElementType', + type: { + name: 'Composite', + className: 'JobErrorDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = JobStages; diff --git a/lib/services/databoxManagement/lib/models/notificationPreference.js b/lib/services/databoxManagement/lib/models/notificationPreference.js new file mode 100644 index 0000000000..b9dbc4de65 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/notificationPreference.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'; + +/** + * Notification preference for a job stage. + * + */ +class NotificationPreference { + /** + * Create a NotificationPreference. + * @member {string} stageName Name of the stage. Possible values include: + * 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', + * 'DataCopy' + * @member {boolean} sendNotification Notification is required or not. + */ + constructor() { + } + + /** + * Defines the metadata of NotificationPreference + * + * @returns {object} metadata of NotificationPreference + * + */ + mapper() { + return { + required: false, + serializedName: 'NotificationPreference', + type: { + name: 'Composite', + className: 'NotificationPreference', + modelProperties: { + stageName: { + required: true, + serializedName: 'stageName', + type: { + name: 'Enum', + allowedValues: [ 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy' ] + } + }, + sendNotification: { + required: true, + serializedName: 'sendNotification', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = NotificationPreference; diff --git a/lib/services/databoxManagement/lib/models/operation.js b/lib/services/databoxManagement/lib/models/operation.js new file mode 100644 index 0000000000..ba7df8da23 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/operation.js @@ -0,0 +1,89 @@ +/* + * 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 entity. + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} [name] Name of the operation. Format: + * {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} + * @member {object} [display] Operation display values. + * @member {string} [display.provider] Provider name. + * @member {string} [display.resource] Resource name. + * @member {string} [display.operation] Localized name of the operation for + * display purpose. + * @member {string} [display.description] Localized description of the + * operation for display purpose. + * @member {object} [properties] Operation properties. + * @member {string} [origin] Origin of the operation. Can be : + * user|system|user,system + */ + constructor() { + } + + /** + * Defines the metadata of Operation + * + * @returns {object} metadata of Operation + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation', + type: { + name: 'Composite', + className: 'Operation', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + readOnly: true, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + }, + properties: { + required: false, + readOnly: true, + serializedName: 'properties', + type: { + name: 'Object' + } + }, + origin: { + required: false, + readOnly: true, + serializedName: 'origin', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/databoxManagement/lib/models/operationDisplay.js b/lib/services/databoxManagement/lib/models/operationDisplay.js new file mode 100644 index 0000000000..878daf0e9b --- /dev/null +++ b/lib/services/databoxManagement/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 + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @member {string} [provider] Provider name. + * @member {string} [resource] Resource name. + * @member {string} [operation] Localized name of the operation for display + * purpose. + * @member {string} [description] Localized description of the operation for + * display purpose. + */ + 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/databoxManagement/lib/models/operationList.js b/lib/services/databoxManagement/lib/models/operationList.js new file mode 100644 index 0000000000..1a3e057a27 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/operationList.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'; + +/** + * Operation Collection. + */ +class OperationList extends Array { + /** + * Create a OperationList. + * @member {string} [nextLink] Link for the next set of operations. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OperationList + * + * @returns {object} metadata of OperationList + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationList', + type: { + name: 'Composite', + className: 'OperationList', + modelProperties: { + value: { + required: false, + readOnly: 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 = OperationList; diff --git a/lib/services/databoxManagement/lib/models/packageShippingDetails.js b/lib/services/databoxManagement/lib/models/packageShippingDetails.js new file mode 100644 index 0000000000..e4a3ecf10d --- /dev/null +++ b/lib/services/databoxManagement/lib/models/packageShippingDetails.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'; + +/** + * Shipping details. + * + */ +class PackageShippingDetails { + /** + * Create a PackageShippingDetails. + * @member {string} [carrierName] Name of the carrier. + * @member {string} [trackingId] Tracking Id of shipment. + * @member {string} [trackingUrl] Url where shipment can be tracked. + */ + constructor() { + } + + /** + * Defines the metadata of PackageShippingDetails + * + * @returns {object} metadata of PackageShippingDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'PackageShippingDetails', + type: { + name: 'Composite', + className: 'PackageShippingDetails', + modelProperties: { + carrierName: { + required: false, + readOnly: true, + serializedName: 'carrierName', + type: { + name: 'String' + } + }, + trackingId: { + required: false, + readOnly: true, + serializedName: 'trackingId', + type: { + name: 'String' + } + }, + trackingUrl: { + required: false, + readOnly: true, + serializedName: 'trackingUrl', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PackageShippingDetails; diff --git a/lib/services/databoxManagement/lib/models/preferences.js b/lib/services/databoxManagement/lib/models/preferences.js new file mode 100644 index 0000000000..ba452eef71 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/preferences.js @@ -0,0 +1,59 @@ +/* + * 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'; + +/** + * Preferences related to the order + * + */ +class Preferences { + /** + * Create a Preferences. + * @member {array} [preferredDataCenterRegion] + */ + constructor() { + } + + /** + * Defines the metadata of Preferences + * + * @returns {object} metadata of Preferences + * + */ + mapper() { + return { + required: false, + serializedName: 'Preferences', + type: { + name: 'Composite', + className: 'Preferences', + modelProperties: { + preferredDataCenterRegion: { + required: false, + serializedName: 'preferredDataCenterRegion', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Preferences; diff --git a/lib/services/databoxManagement/lib/models/resource.js b/lib/services/databoxManagement/lib/models/resource.js new file mode 100644 index 0000000000..88c250a7a3 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/resource.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'); + +/** + * Model of the Resource. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} location The location of the resource. This will be one + * of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it + * is created, but if an identical region is specified on update the request + * will succeed. + * @member {object} [tags] The list of key value pairs that describe the + * resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * @member {object} sku The sku type. + * @member {string} [sku.name] The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * @member {string} [sku.displayName] The display name of the sku. + * @member {string} [sku.family] The sku family. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + 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: true, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/databoxManagement/lib/models/shareCredentialDetails.js b/lib/services/databoxManagement/lib/models/shareCredentialDetails.js new file mode 100644 index 0000000000..1987c2df08 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/shareCredentialDetails.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'; + +/** + * Credential details of the shares in account. + * + */ +class ShareCredentialDetails { + /** + * Create a ShareCredentialDetails. + * @member {string} [shareName] Name of the share. + * @member {string} [shareType] Type of the share. Possible values include: + * 'UnknownType', 'HCS', 'BlockBlob', 'PageBlob', 'AzureFile' + * @member {string} [userName] User name for the share. + * @member {string} [password] Password for the share. + * @member {array} [supportedAccessProtocols] Access protocols supported on + * the device. + */ + constructor() { + } + + /** + * Defines the metadata of ShareCredentialDetails + * + * @returns {object} metadata of ShareCredentialDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ShareCredentialDetails', + type: { + name: 'Composite', + className: 'ShareCredentialDetails', + modelProperties: { + shareName: { + required: false, + readOnly: true, + serializedName: 'shareName', + type: { + name: 'String' + } + }, + shareType: { + required: false, + readOnly: true, + serializedName: 'shareType', + type: { + name: 'Enum', + allowedValues: [ 'UnknownType', 'HCS', 'BlockBlob', 'PageBlob', 'AzureFile' ] + } + }, + userName: { + required: false, + readOnly: true, + serializedName: 'userName', + type: { + name: 'String' + } + }, + password: { + required: false, + readOnly: true, + serializedName: 'password', + type: { + name: 'String' + } + }, + supportedAccessProtocols: { + required: false, + readOnly: true, + serializedName: 'supportedAccessProtocols', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AccessProtocolElementType', + type: { + name: 'Enum', + allowedValues: [ 'SMB', 'NFS' ] + } + } + } + } + } + } + }; + } +} + +module.exports = ShareCredentialDetails; diff --git a/lib/services/databoxManagement/lib/models/shipmentPickUpRequest.js b/lib/services/databoxManagement/lib/models/shipmentPickUpRequest.js new file mode 100644 index 0000000000..63c7edecf1 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/shipmentPickUpRequest.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'; + +/** + * Shipment pick up request details. + * + */ +class ShipmentPickUpRequest { + /** + * Create a ShipmentPickUpRequest. + * @member {date} startTime Minimum date after which the pick up should + * commence, this must be in local time of pick up area. + * @member {date} endTime Maximum date before which the pick up should + * commence, this must be in local time of pick up area. + * @member {string} shipmentLocation Shipment Location in the pickup place. + * Eg.front desk + */ + constructor() { + } + + /** + * Defines the metadata of ShipmentPickUpRequest + * + * @returns {object} metadata of ShipmentPickUpRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'ShipmentPickUpRequest', + type: { + name: 'Composite', + className: 'ShipmentPickUpRequest', + modelProperties: { + startTime: { + required: true, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: true, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + }, + shipmentLocation: { + required: true, + serializedName: 'shipmentLocation', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ShipmentPickUpRequest; diff --git a/lib/services/databoxManagement/lib/models/shipmentPickUpResponse.js b/lib/services/databoxManagement/lib/models/shipmentPickUpResponse.js new file mode 100644 index 0000000000..4e46ef66df --- /dev/null +++ b/lib/services/databoxManagement/lib/models/shipmentPickUpResponse.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'; + +/** + * Shipment pick up response. + * + */ +class ShipmentPickUpResponse { + /** + * Create a ShipmentPickUpResponse. + * @member {string} [confirmationNumber] Confirmation number for the pick up + * request. + * @member {date} [readyByTime] Time by which shipment should be ready for + * pick up, this is in local time of pick up area. + */ + constructor() { + } + + /** + * Defines the metadata of ShipmentPickUpResponse + * + * @returns {object} metadata of ShipmentPickUpResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ShipmentPickUpResponse', + type: { + name: 'Composite', + className: 'ShipmentPickUpResponse', + modelProperties: { + confirmationNumber: { + required: false, + readOnly: true, + serializedName: 'confirmationNumber', + type: { + name: 'String' + } + }, + readyByTime: { + required: false, + readOnly: true, + serializedName: 'readyByTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = ShipmentPickUpResponse; diff --git a/lib/services/databoxManagement/lib/models/shippingAddress.js b/lib/services/databoxManagement/lib/models/shippingAddress.js new file mode 100644 index 0000000000..6c9265af63 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/shippingAddress.js @@ -0,0 +1,126 @@ +/* + * 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'; + +/** + * Shipping address where customer wishes to receive the device. + * + */ +class ShippingAddress { + /** + * Create a ShippingAddress. + * @member {string} streetAddress1 Street Address line 1. + * @member {string} [streetAddress2] Street Address line 2. + * @member {string} [streetAddress3] Street Address line 3. + * @member {string} [city] Name of the City. + * @member {string} [stateOrProvince] Name of the State or Province. + * @member {string} country Name of the Country. + * @member {string} postalCode Postal code. + * @member {string} [zipExtendedCode] Extended Zip Code. + * @member {string} [companyName] Name of the company. + * @member {string} [addressType] Type of address. Possible values include: + * 'None', 'Residential', 'Commercial' + */ + constructor() { + } + + /** + * Defines the metadata of ShippingAddress + * + * @returns {object} metadata of ShippingAddress + * + */ + mapper() { + return { + required: false, + serializedName: 'ShippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress', + modelProperties: { + streetAddress1: { + required: true, + serializedName: 'streetAddress1', + type: { + name: 'String' + } + }, + streetAddress2: { + required: false, + serializedName: 'streetAddress2', + type: { + name: 'String' + } + }, + streetAddress3: { + required: false, + serializedName: 'streetAddress3', + type: { + name: 'String' + } + }, + city: { + required: false, + serializedName: 'city', + type: { + name: 'String' + } + }, + stateOrProvince: { + required: false, + serializedName: 'stateOrProvince', + type: { + name: 'String' + } + }, + country: { + required: true, + serializedName: 'country', + type: { + name: 'String' + } + }, + postalCode: { + required: true, + serializedName: 'postalCode', + type: { + name: 'String' + } + }, + zipExtendedCode: { + required: false, + serializedName: 'zipExtendedCode', + type: { + name: 'String' + } + }, + companyName: { + required: false, + serializedName: 'companyName', + type: { + name: 'String' + } + }, + addressType: { + required: false, + serializedName: 'addressType', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Residential', 'Commercial' ] + } + } + } + } + }; + } +} + +module.exports = ShippingAddress; diff --git a/lib/services/databoxManagement/lib/models/sku.js b/lib/services/databoxManagement/lib/models/sku.js new file mode 100644 index 0000000000..ea07b1ef49 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/sku.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'; + +/** + * The Sku. + * + */ +class Sku { + /** + * Create a Sku. + * @member {string} name The sku name. Possible values include: 'DataBox', + * 'DataBoxDisk', 'DataBoxHeavy' + * @member {string} [displayName] The display name of the sku. + * @member {string} [family] The sku family. + */ + 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: true, + serializedName: 'name', + type: { + name: 'Enum', + allowedValues: [ 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' ] + } + }, + displayName: { + required: false, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + family: { + required: false, + serializedName: 'family', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Sku; diff --git a/lib/services/databoxManagement/lib/models/skuCapacity.js b/lib/services/databoxManagement/lib/models/skuCapacity.js new file mode 100644 index 0000000000..d870c9baad --- /dev/null +++ b/lib/services/databoxManagement/lib/models/skuCapacity.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'; + +/** + * Capacity of the sku. + * + */ +class SkuCapacity { + /** + * Create a SkuCapacity. + * @member {string} [usable] Usable capacity in TB. + * @member {string} [maximum] Maximum capacity in TB. + */ + constructor() { + } + + /** + * Defines the metadata of SkuCapacity + * + * @returns {object} metadata of SkuCapacity + * + */ + mapper() { + return { + required: false, + serializedName: 'SkuCapacity', + type: { + name: 'Composite', + className: 'SkuCapacity', + modelProperties: { + usable: { + required: false, + readOnly: true, + serializedName: 'usable', + type: { + name: 'String' + } + }, + maximum: { + required: false, + readOnly: true, + serializedName: 'maximum', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SkuCapacity; diff --git a/lib/services/databoxManagement/lib/models/skuCost.js b/lib/services/databoxManagement/lib/models/skuCost.js new file mode 100644 index 0000000000..2c3912a07a --- /dev/null +++ b/lib/services/databoxManagement/lib/models/skuCost.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'; + +/** + * Describes metadata for retrieving price info. + * + */ +class SkuCost { + /** + * Create a SkuCost. + * @member {string} [meterId] Meter id of the Sku. + * @member {string} [meterType] The type of the meter. + */ + constructor() { + } + + /** + * Defines the metadata of SkuCost + * + * @returns {object} metadata of SkuCost + * + */ + mapper() { + return { + required: false, + serializedName: 'SkuCost', + type: { + name: 'Composite', + className: 'SkuCost', + modelProperties: { + meterId: { + required: false, + readOnly: true, + serializedName: 'meterId', + type: { + name: 'String' + } + }, + meterType: { + required: false, + readOnly: true, + serializedName: 'meterType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SkuCost; diff --git a/lib/services/databoxManagement/lib/models/skuInformation.js b/lib/services/databoxManagement/lib/models/skuInformation.js new file mode 100644 index 0000000000..4f3e072e54 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/skuInformation.js @@ -0,0 +1,160 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Information of the sku. + * + */ +class SkuInformation { + /** + * Create a SkuInformation. + * @member {object} [sku] The Sku. + * @member {string} [sku.name] The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * @member {string} [sku.displayName] The display name of the sku. + * @member {string} [sku.family] The sku family. + * @member {boolean} [enabled] The sku is enabled or not. + * @member {array} [destinationToServiceLocationMap] The map of destination + * location to service location. + * @member {object} [capacity] Capacity of the Sku. + * @member {string} [capacity.usable] Usable capacity in TB. + * @member {string} [capacity.maximum] Maximum capacity in TB. + * @member {array} [costs] Cost of the Sku. + * @member {array} [apiVersions] Api versions that support this Sku. + * @member {string} [disabledReason] Reason why the Sku is disabled. Possible + * values include: 'None', 'Country', 'Region', 'Feature', 'OfferType' + * @member {string} [disabledReasonMessage] Message for why the Sku is + * disabled. + * @member {string} [requiredFeature] Required feature to access the sku. + */ + constructor() { + } + + /** + * Defines the metadata of SkuInformation + * + * @returns {object} metadata of SkuInformation + * + */ + mapper() { + return { + required: false, + serializedName: 'SkuInformation', + type: { + name: 'Composite', + className: 'SkuInformation', + modelProperties: { + sku: { + required: false, + readOnly: true, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + enabled: { + required: false, + readOnly: true, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + destinationToServiceLocationMap: { + required: false, + readOnly: true, + serializedName: 'properties.destinationToServiceLocationMap', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DestinationToServiceLocationMapElementType', + type: { + name: 'Composite', + className: 'DestinationToServiceLocationMap' + } + } + } + }, + capacity: { + required: false, + readOnly: true, + serializedName: 'properties.capacity', + type: { + name: 'Composite', + className: 'SkuCapacity' + } + }, + costs: { + required: false, + readOnly: true, + serializedName: 'properties.costs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SkuCostElementType', + type: { + name: 'Composite', + className: 'SkuCost' + } + } + } + }, + apiVersions: { + required: false, + readOnly: true, + serializedName: 'properties.apiVersions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + disabledReason: { + required: false, + readOnly: true, + serializedName: 'properties.disabledReason', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Country', 'Region', 'Feature', 'OfferType' ] + } + }, + disabledReasonMessage: { + required: false, + readOnly: true, + serializedName: 'properties.disabledReasonMessage', + type: { + name: 'String' + } + }, + requiredFeature: { + required: false, + readOnly: true, + serializedName: 'properties.requiredFeature', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SkuInformation; diff --git a/lib/services/databoxManagement/lib/models/unencryptedCredentials.js b/lib/services/databoxManagement/lib/models/unencryptedCredentials.js new file mode 100644 index 0000000000..bf2a70d33c --- /dev/null +++ b/lib/services/databoxManagement/lib/models/unencryptedCredentials.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'; + +/** + * Unencrypted credentials for accessing device. + * + */ +class UnencryptedCredentials { + /** + * Create a UnencryptedCredentials. + * @member {string} [jobName] Name of the job. + * @member {object} [jobSecrets] Secrets related to this job. + * @member {string} [jobSecrets.jobSecretsType] Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of UnencryptedCredentials + * + * @returns {object} metadata of UnencryptedCredentials + * + */ + mapper() { + return { + required: false, + serializedName: 'UnencryptedCredentials', + type: { + name: 'Composite', + className: 'UnencryptedCredentials', + modelProperties: { + jobName: { + required: false, + readOnly: true, + serializedName: 'jobName', + type: { + name: 'String' + } + }, + jobSecrets: { + required: false, + readOnly: true, + serializedName: 'jobSecrets', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'jobSecretsType', + clientName: 'jobSecretsType' + }, + uberParent: 'JobSecrets', + className: 'JobSecrets' + } + } + } + } + }; + } +} + +module.exports = UnencryptedCredentials; diff --git a/lib/services/databoxManagement/lib/models/unencryptedCredentialsList.js b/lib/services/databoxManagement/lib/models/unencryptedCredentialsList.js new file mode 100644 index 0000000000..19e7c6d3f0 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/unencryptedCredentialsList.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'; + +/** + * List of unencrypted credentials for accessing device. + */ +class UnencryptedCredentialsList extends Array { + /** + * Create a UnencryptedCredentialsList. + * @member {string} [nextLink] Link for the next set of unencrypted + * credentials. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of UnencryptedCredentialsList + * + * @returns {object} metadata of UnencryptedCredentialsList + * + */ + mapper() { + return { + required: false, + serializedName: 'UnencryptedCredentialsList', + type: { + name: 'Composite', + className: 'UnencryptedCredentialsList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'UnencryptedCredentialsElementType', + type: { + name: 'Composite', + className: 'UnencryptedCredentials' + } + } + } + } + } + } + }; + } +} + +module.exports = UnencryptedCredentialsList; diff --git a/lib/services/databoxManagement/lib/models/updateJobDetails.js b/lib/services/databoxManagement/lib/models/updateJobDetails.js new file mode 100644 index 0000000000..459db7f456 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/updateJobDetails.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'; + +/** + * Job details for update. + * + */ +class UpdateJobDetails { + /** + * Create a UpdateJobDetails. + * @member {object} [contactDetails] Contact details for notification and + * shipping. + * @member {string} [contactDetails.contactName] Contact name of the person. + * @member {string} [contactDetails.phone] Phone number of the contact + * person. + * @member {string} [contactDetails.phoneExtension] Phone extension number of + * the contact person. + * @member {string} [contactDetails.mobile] Mobile number of the contact + * person. + * @member {array} [contactDetails.emailList] List of Email-ids to be + * notified about job progress. + * @member {array} [contactDetails.notificationPreference] Notification + * preference for a job stage. + * @member {object} [shippingAddress] Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + */ + constructor() { + } + + /** + * Defines the metadata of UpdateJobDetails + * + * @returns {object} metadata of UpdateJobDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'UpdateJobDetails', + type: { + name: 'Composite', + className: 'UpdateJobDetails', + modelProperties: { + contactDetails: { + required: false, + serializedName: 'contactDetails', + type: { + name: 'Composite', + className: 'ContactDetails' + } + }, + shippingAddress: { + required: false, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + } + } + } + }; + } +} + +module.exports = UpdateJobDetails; diff --git a/lib/services/databoxManagement/lib/models/validateAddress.js b/lib/services/databoxManagement/lib/models/validateAddress.js new file mode 100644 index 0000000000..d712f95a61 --- /dev/null +++ b/lib/services/databoxManagement/lib/models/validateAddress.js @@ -0,0 +1,76 @@ +/* + * 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 requirements to validate customer address where the device needs to be + * shipped. + * + */ +class ValidateAddress { + /** + * Create a ValidateAddress. + * @member {object} shippingAddress Shipping address of the customer. + * @member {string} [shippingAddress.streetAddress1] Street Address line 1. + * @member {string} [shippingAddress.streetAddress2] Street Address line 2. + * @member {string} [shippingAddress.streetAddress3] Street Address line 3. + * @member {string} [shippingAddress.city] Name of the City. + * @member {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * @member {string} [shippingAddress.country] Name of the Country. + * @member {string} [shippingAddress.postalCode] Postal code. + * @member {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * @member {string} [shippingAddress.companyName] Name of the company. + * @member {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * @member {string} deviceType Device type to be used for the job. Possible + * values include: 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + */ + constructor() { + } + + /** + * Defines the metadata of ValidateAddress + * + * @returns {object} metadata of ValidateAddress + * + */ + mapper() { + return { + required: false, + serializedName: 'ValidateAddress', + type: { + name: 'Composite', + className: 'ValidateAddress', + modelProperties: { + shippingAddress: { + required: true, + serializedName: 'shippingAddress', + type: { + name: 'Composite', + className: 'ShippingAddress' + } + }, + deviceType: { + required: true, + serializedName: 'deviceType', + type: { + name: 'Enum', + allowedValues: [ 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' ] + } + } + } + } + }; + } +} + +module.exports = ValidateAddress; diff --git a/lib/services/databoxManagement/lib/operations/index.d.ts b/lib/services/databoxManagement/lib/operations/index.d.ts new file mode 100644 index 0000000000..0b42beddd0 --- /dev/null +++ b/lib/services/databoxManagement/lib/operations/index.d.ts @@ -0,0 +1,1979 @@ +/* + * 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 DataBoxManagementClient. + */ +export interface Operations { + + + /** + * This method gets all the operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method gets all the operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationList} - 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. + * + * {OperationList} [result] - The deserialized result object if an error did not occur. + * See {@link OperationList} 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; + + + /** + * This method gets all the operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method gets all the operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationList} - 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. + * + * {OperationList} [result] - The deserialized result object if an error did not occur. + * See {@link OperationList} 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 + * Jobs + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxManagementClient. + */ +export interface Jobs { + + + /** + * Lists all the jobs available under the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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?: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the jobs available under the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 {JobResourceList} - 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. + * + * {JobResourceList} [result] - The deserialized result object if an error did not occur. + * See {@link JobResourceList} 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?: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the jobs available under the given resource group. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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?: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the jobs available under the given resource group. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 {JobResourceList} - 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. + * + * {JobResourceList} [result] - The deserialized result object if an error did not occur. + * See {@link JobResourceList} 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?: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { skipToken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about the specified job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] $expand is supported on details parameter + * for job, which provides details on the job stages. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, jobName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about the specified job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] $expand is supported on details parameter + * for job, which provides details on the job stages. + * + * @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 {JobResource} - 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. + * + * {JobResource} [result] - The deserialized result object if an error did not occur. + * See {@link JobResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, jobName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, jobName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, jobName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} jobResource.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} jobResource.details.destinationAccountDetails Destination + * account details. + * + * @param {object} [jobResource.details.preferences] Preferences for the order. + * + * @param {array} [jobResource.details.preferences.preferredDataCenterRegion] + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} jobResource.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} jobResource.details.destinationAccountDetails Destination + * account details. + * + * @param {object} [jobResource.details.preferences] Preferences for the order. + * + * @param {array} [jobResource.details.preferences.preferredDataCenterRegion] + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 {JobResource} - 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. + * + * {JobResource} [result] - The deserialized result object if an error did not occur. + * See {@link JobResource} 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. + */ + create(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, jobName: string, jobResource: models.JobResource, callback: ServiceCallback): void; + create(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, jobName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, jobName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} [jobResourceUpdateParameter.details] Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * jobResourceUpdateParameter.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResourceUpdateParameter.destinationAccountDetails] + * Destination account details. + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} [jobResourceUpdateParameter.details] Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * jobResourceUpdateParameter.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResourceUpdateParameter.destinationAccountDetails] + * Destination account details. + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 {JobResource} - 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. + * + * {JobResource} [result] - The deserialized result object if an error did not occur. + * See {@link JobResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, callback: ServiceCallback): void; + update(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Book shipment pick up. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} shipmentPickUpRequest Details of shipment pick up request. + * + * @param {date} shipmentPickUpRequest.startTime Minimum date after which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {date} shipmentPickUpRequest.endTime Maximum date before which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {string} shipmentPickUpRequest.shipmentLocation Shipment Location in + * the pickup place. Eg.front desk + * + * @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. + */ + bookShipmentPickUpWithHttpOperationResponse(resourceGroupName: string, jobName: string, shipmentPickUpRequest: models.ShipmentPickUpRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Book shipment pick up. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} shipmentPickUpRequest Details of shipment pick up request. + * + * @param {date} shipmentPickUpRequest.startTime Minimum date after which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {date} shipmentPickUpRequest.endTime Maximum date before which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {string} shipmentPickUpRequest.shipmentLocation Shipment Location in + * the pickup place. Eg.front desk + * + * @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 {ShipmentPickUpResponse} - 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. + * + * {ShipmentPickUpResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ShipmentPickUpResponse} 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. + */ + bookShipmentPickUp(resourceGroupName: string, jobName: string, shipmentPickUpRequest: models.ShipmentPickUpRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + bookShipmentPickUp(resourceGroupName: string, jobName: string, shipmentPickUpRequest: models.ShipmentPickUpRequest, callback: ServiceCallback): void; + bookShipmentPickUp(resourceGroupName: string, jobName: string, shipmentPickUpRequest: models.ShipmentPickUpRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * CancelJob. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {string} reason Reason for cancellation. + * + * @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. + */ + cancelWithHttpOperationResponse(resourceGroupName: string, jobName: string, reason: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * CancelJob. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {string} reason Reason for cancellation. + * + * @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. + */ + cancel(resourceGroupName: string, jobName: string, reason: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + cancel(resourceGroupName: string, jobName: string, reason: string, callback: ServiceCallback): void; + cancel(resourceGroupName: string, jobName: string, reason: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * This method gets the unencrypted secrets related to the job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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. + */ + listCredentialsWithHttpOperationResponse(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method gets the unencrypted secrets related to the job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 {UnencryptedCredentialsList} - 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. + * + * {UnencryptedCredentialsList} [result] - The deserialized result object if an error did not occur. + * See {@link UnencryptedCredentialsList} 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. + */ + listCredentials(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listCredentials(resourceGroupName: string, jobName: string, callback: ServiceCallback): void; + listCredentials(resourceGroupName: string, jobName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} jobResource.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} jobResource.details.destinationAccountDetails Destination + * account details. + * + * @param {object} [jobResource.details.preferences] Preferences for the order. + * + * @param {array} [jobResource.details.preferences.preferredDataCenterRegion] + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} jobResource.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} jobResource.details.destinationAccountDetails Destination + * account details. + * + * @param {object} [jobResource.details.preferences] Preferences for the order. + * + * @param {array} [jobResource.details.preferences.preferredDataCenterRegion] + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 {JobResource} - 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. + * + * {JobResource} [result] - The deserialized result object if an error did not occur. + * See {@link JobResource} 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. + */ + beginCreate(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, jobName: string, jobResource: models.JobResource, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, jobName: string, jobResource: models.JobResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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(resourceGroupName: string, jobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, jobName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, jobName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} [jobResourceUpdateParameter.details] Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * jobResourceUpdateParameter.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResourceUpdateParameter.destinationAccountDetails] + * Destination account details. + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} [jobResourceUpdateParameter.details] Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * jobResourceUpdateParameter.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResourceUpdateParameter.destinationAccountDetails] + * Destination account details. + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 {JobResource} - 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. + * + * {JobResource} [result] - The deserialized result object if an error did not occur. + * See {@link JobResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, jobName: string, jobResourceUpdateParameter: models.JobResourceUpdateParameter, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the jobs available under the subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the jobs available under the 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 {JobResourceList} - 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. + * + * {JobResourceList} [result] - The deserialized result object if an error did not occur. + * See {@link JobResourceList} 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; + + + /** + * Lists all the jobs available under the given 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>; + + /** + * Lists all the jobs available under the given 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 {JobResourceList} - 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. + * + * {JobResourceList} [result] - The deserialized result object if an error did not occur. + * See {@link JobResourceList} 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 + * Service + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataBoxManagementClient. + */ +export interface Service { + + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @param {string} location The location of the resource + * + * @param {object} availableSkuRequest Filters for showing the available skus. + * + * @param {string} availableSkuRequest.country ISO country code. Country for + * hardware shipment. For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * + * @param {string} availableSkuRequest.location Location for data transfer. For + * locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * + * @param {array} [availableSkuRequest.skuNames] Sku Names to filter for + * available skus + * + * @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. + */ + listAvailableSkusWithHttpOperationResponse(location: string, availableSkuRequest: models.AvailableSkuRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @param {string} location The location of the resource + * + * @param {object} availableSkuRequest Filters for showing the available skus. + * + * @param {string} availableSkuRequest.country ISO country code. Country for + * hardware shipment. For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * + * @param {string} availableSkuRequest.location Location for data transfer. For + * locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * + * @param {array} [availableSkuRequest.skuNames] Sku Names to filter for + * available skus + * + * @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 {AvailableSkusResult} - 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. + * + * {AvailableSkusResult} [result] - The deserialized result object if an error did not occur. + * See {@link AvailableSkusResult} 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. + */ + listAvailableSkus(location: string, availableSkuRequest: models.AvailableSkuRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAvailableSkus(location: string, availableSkuRequest: models.AvailableSkuRequest, callback: ServiceCallback): void; + listAvailableSkus(location: string, availableSkuRequest: models.AvailableSkuRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * This method validates the customer shipping address and provide alternate + * addresses if any. + * + * @param {string} location The location of the resource + * + * @param {object} shippingAddress Shipping address of the customer. + * + * @param {string} shippingAddress.streetAddress1 Street Address line 1. + * + * @param {string} [shippingAddress.streetAddress2] Street Address line 2. + * + * @param {string} [shippingAddress.streetAddress3] Street Address line 3. + * + * @param {string} [shippingAddress.city] Name of the City. + * + * @param {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * + * @param {string} shippingAddress.country Name of the Country. + * + * @param {string} shippingAddress.postalCode Postal code. + * + * @param {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * + * @param {string} [shippingAddress.companyName] Name of the company. + * + * @param {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * + * @param {string} deviceType Device type to be used for the job. Possible + * values include: 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @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. + */ + validateAddressMethodWithHttpOperationResponse(location: string, shippingAddress: models.ShippingAddress, deviceType: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method validates the customer shipping address and provide alternate + * addresses if any. + * + * @param {string} location The location of the resource + * + * @param {object} shippingAddress Shipping address of the customer. + * + * @param {string} shippingAddress.streetAddress1 Street Address line 1. + * + * @param {string} [shippingAddress.streetAddress2] Street Address line 2. + * + * @param {string} [shippingAddress.streetAddress3] Street Address line 3. + * + * @param {string} [shippingAddress.city] Name of the City. + * + * @param {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * + * @param {string} shippingAddress.country Name of the Country. + * + * @param {string} shippingAddress.postalCode Postal code. + * + * @param {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * + * @param {string} [shippingAddress.companyName] Name of the company. + * + * @param {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * + * @param {string} deviceType Device type to be used for the job. Possible + * values include: 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @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 {AddressValidationOutput} - 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. + * + * {AddressValidationOutput} [result] - The deserialized result object if an error did not occur. + * See {@link AddressValidationOutput} 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. + */ + validateAddressMethod(location: string, shippingAddress: models.ShippingAddress, deviceType: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + validateAddressMethod(location: string, shippingAddress: models.ShippingAddress, deviceType: string, callback: ServiceCallback): void; + validateAddressMethod(location: string, shippingAddress: models.ShippingAddress, deviceType: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @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. + */ + listAvailableSkusNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @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 {AvailableSkusResult} - 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. + * + * {AvailableSkusResult} [result] - The deserialized result object if an error did not occur. + * See {@link AvailableSkusResult} 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. + */ + listAvailableSkusNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAvailableSkusNext(nextPageLink: string, callback: ServiceCallback): void; + listAvailableSkusNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/databoxManagement/lib/operations/index.js b/lib/services/databoxManagement/lib/operations/index.js new file mode 100644 index 0000000000..9ece56c7e9 --- /dev/null +++ b/lib/services/databoxManagement/lib/operations/index.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.Operations = require('./operations'); +exports.Jobs = require('./jobs'); +exports.Service = require('./service'); diff --git a/lib/services/databoxManagement/lib/operations/jobs.js b/lib/services/databoxManagement/lib/operations/jobs.js new file mode 100644 index 0000000000..cd6408a4fa --- /dev/null +++ b/lib/services/databoxManagement/lib/operations/jobs.js @@ -0,0 +1,4307 @@ +/* + * 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 jobs available under the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 JobResourceList} 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.'); + } + let skipToken = (options && options.skipToken !== undefined) ? options.skipToken : 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 (skipToken !== null && skipToken !== undefined && typeof skipToken.valueOf() !== 'string') { + throw new Error('skipToken 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.DataBox/jobs'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (skipToken !== null && skipToken !== undefined) { + queryParameters.push('$skipToken=' + encodeURIComponent(skipToken)); + } + 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['JobResourceList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the jobs available under the given resource group. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 JobResourceList} 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 skipToken = (options && options.skipToken !== undefined) ? options.skipToken : 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 (skipToken !== null && skipToken !== undefined && typeof skipToken.valueOf() !== 'string') { + throw new Error('skipToken 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.DataBox/jobs'; + 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 (skipToken !== null && skipToken !== undefined) { + queryParameters.push('$skipToken=' + encodeURIComponent(skipToken)); + } + 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['JobResourceList']().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 information about the specified job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] $expand is supported on details parameter + * for job, which provides details on the job stages. + * + * @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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, jobName, 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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.DataBox/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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['JobResource']().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 a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} jobResource.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} jobResource.details.destinationAccountDetails Destination + * account details. + * + * @param {object} [jobResource.details.preferences] Preferences for the order. + * + * @param {array} [jobResource.details.preferences.preferredDataCenterRegion] + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 JobResource} 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 _create(resourceGroupName, jobName, jobResource, 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.beginCreate(resourceGroupName, jobName, jobResource, 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['JobResource']().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 a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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(resourceGroupName, jobName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, jobName, 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 properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} [jobResourceUpdateParameter.details] Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * jobResourceUpdateParameter.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResourceUpdateParameter.destinationAccountDetails] + * Destination account details. + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, jobName, jobResourceUpdateParameter, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, 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['JobResource']().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); + }); + }); +} + +/** + * Book shipment pick up. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} shipmentPickUpRequest Details of shipment pick up request. + * + * @param {date} shipmentPickUpRequest.startTime Minimum date after which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {date} shipmentPickUpRequest.endTime Maximum date before which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {string} shipmentPickUpRequest.shipmentLocation Shipment Location in + * the pickup place. Eg.front desk + * + * @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 ShipmentPickUpResponse} 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 _bookShipmentPickUp(resourceGroupName, jobName, shipmentPickUpRequest, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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 (shipmentPickUpRequest === null || shipmentPickUpRequest === undefined) { + throw new Error('shipmentPickUpRequest cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 (shipmentPickUpRequest !== null && shipmentPickUpRequest !== undefined) { + let requestModelMapper = new client.models['ShipmentPickUpRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, shipmentPickUpRequest, 'shipmentPickUpRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(shipmentPickUpRequest, 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['ShipmentPickUpResponse']().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); + }); +} + +/** + * CancelJob. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {string} reason Reason for cancellation. + * + * @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 _cancel(resourceGroupName, jobName, reason, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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 (reason === null || reason === undefined || typeof reason.valueOf() !== 'string') { + throw new Error('reason 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 cancellationReason; + if (reason !== null && reason !== undefined) { + cancellationReason = new client.models['CancellationReason'](); + cancellationReason.reason = reason; + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 (cancellationReason !== null && cancellationReason !== undefined) { + let requestModelMapper = new client.models['CancellationReason']().mapper(); + requestModel = client.serialize(requestModelMapper, cancellationReason, 'cancellationReason'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(cancellationReason, 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 !== 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); + }); +} + +/** + * This method gets the unencrypted secrets related to the job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 UnencryptedCredentialsList} 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 _listCredentials(resourceGroupName, jobName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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.DataBox/jobs/{jobName}/listCredentials'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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['UnencryptedCredentialsList']().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 a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} jobResource.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} jobResource.details.destinationAccountDetails Destination + * account details. + * + * @param {object} [jobResource.details.preferences] Preferences for the order. + * + * @param {array} [jobResource.details.preferences.preferredDataCenterRegion] + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 JobResource} 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 _beginCreate(resourceGroupName, jobName, jobResource, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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 (jobResource === null || jobResource === undefined) { + throw new Error('jobResource cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 (jobResource !== null && jobResource !== undefined) { + let requestModelMapper = new client.models['JobResource']().mapper(); + requestModel = client.serialize(requestModelMapper, jobResource, 'jobResource'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(jobResource, 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['JobResource']().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 a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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(resourceGroupName, jobName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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.DataBox/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 !== 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); + }); +} + +/** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} [jobResourceUpdateParameter.details] Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * jobResourceUpdateParameter.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResourceUpdateParameter.destinationAccountDetails] + * Destination account details. + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, 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 ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobName !== null && jobName !== undefined) { + if (jobName.length > 24) + { + throw new Error('"jobName" should satisfy the constraint - "MaxLength": 24'); + } + if (jobName.length < 3) + { + throw new Error('"jobName" should satisfy the constraint - "MinLength": 3'); + } + if (jobName.match(/^[-\w\.]+$/) === null) + { + throw new Error('"jobName" should satisfy the constraint - "Pattern": /^[-\w\.]+$/'); + } + } + 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 (ifMatch !== null && ifMatch !== undefined && typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch must be of type string.'); + } + if (jobResourceUpdateParameter === null || jobResourceUpdateParameter === undefined) { + throw new Error('jobResourceUpdateParameter cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + 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 (ifMatch !== undefined && ifMatch !== null) { + httpRequest.headers['If-Match'] = ifMatch; + } + 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 (jobResourceUpdateParameter !== null && jobResourceUpdateParameter !== undefined) { + let requestModelMapper = new client.models['JobResourceUpdateParameter']().mapper(); + requestModel = client.serialize(requestModelMapper, jobResourceUpdateParameter, 'jobResourceUpdateParameter'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(jobResourceUpdateParameter, 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['JobResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the jobs available under the 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 JobResourceList} 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['JobResourceList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all the jobs available under the given 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 JobResourceList} 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['JobResourceList']().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 Jobs. */ +class Jobs { + /** + * Create a Jobs. + * @param {DataBoxManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._create = _create; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._bookShipmentPickUp = _bookShipmentPickUp; + this._cancel = _cancel; + this._listCredentials = _listCredentials; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdate = _beginUpdate; + this._listNext = _listNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Lists all the jobs available under the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the jobs available under the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 {JobResourceList} - 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 JobResourceList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all the jobs available under the given resource group. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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; + }); + }); + } + + /** + * Lists all the jobs available under the given resource group. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skipToken] $skipToken is supported on Get list of + * jobs, which provides the next page in the list of jobs. + * + * @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 {JobResourceList} - 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 JobResourceList} 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); + } + } + + /** + * Gets information about the specified job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] $expand is supported on details parameter + * for job, which provides details on the job stages. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about the specified job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] $expand is supported on details parameter + * for job, which provides details on the job stages. + * + * @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 {JobResource} - 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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, jobName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, jobName, options, optionalCallback); + } + } + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} jobResource.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} jobResource.details.destinationAccountDetails Destination + * account details. + * + * @param {object} [jobResource.details.preferences] Preferences for the order. + * + * @param {array} [jobResource.details.preferences.preferredDataCenterRegion] + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName, jobName, jobResource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, jobName, jobResource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} jobResource.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} jobResource.details.destinationAccountDetails Destination + * account details. + * + * @param {object} [jobResource.details.preferences] Preferences for the order. + * + * @param {array} [jobResource.details.preferences.preferredDataCenterRegion] + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 {JobResource} - 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 JobResource} 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. + */ + create(resourceGroupName, jobName, jobResource, 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._create(resourceGroupName, jobName, jobResource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, jobName, jobResource, options, optionalCallback); + } + } + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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(resourceGroupName, jobName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, jobName, options, optionalCallback); + } + } + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} [jobResourceUpdateParameter.details] Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * jobResourceUpdateParameter.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResourceUpdateParameter.destinationAccountDetails] + * Destination account details. + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, jobName, jobResourceUpdateParameter, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, jobName, jobResourceUpdateParameter, 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 properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} [jobResourceUpdateParameter.details] Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * jobResourceUpdateParameter.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResourceUpdateParameter.destinationAccountDetails] + * Destination account details. + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 {JobResource} - 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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, jobName, jobResourceUpdateParameter, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, jobName, jobResourceUpdateParameter, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, jobName, jobResourceUpdateParameter, options, optionalCallback); + } + } + + /** + * Book shipment pick up. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} shipmentPickUpRequest Details of shipment pick up request. + * + * @param {date} shipmentPickUpRequest.startTime Minimum date after which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {date} shipmentPickUpRequest.endTime Maximum date before which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {string} shipmentPickUpRequest.shipmentLocation Shipment Location in + * the pickup place. Eg.front desk + * + * @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. + */ + bookShipmentPickUpWithHttpOperationResponse(resourceGroupName, jobName, shipmentPickUpRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._bookShipmentPickUp(resourceGroupName, jobName, shipmentPickUpRequest, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Book shipment pick up. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} shipmentPickUpRequest Details of shipment pick up request. + * + * @param {date} shipmentPickUpRequest.startTime Minimum date after which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {date} shipmentPickUpRequest.endTime Maximum date before which the + * pick up should commence, this must be in local time of pick up area. + * + * @param {string} shipmentPickUpRequest.shipmentLocation Shipment Location in + * the pickup place. Eg.front desk + * + * @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 {ShipmentPickUpResponse} - 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 ShipmentPickUpResponse} 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. + */ + bookShipmentPickUp(resourceGroupName, jobName, shipmentPickUpRequest, 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._bookShipmentPickUp(resourceGroupName, jobName, shipmentPickUpRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._bookShipmentPickUp(resourceGroupName, jobName, shipmentPickUpRequest, options, optionalCallback); + } + } + + /** + * CancelJob. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {string} reason Reason for cancellation. + * + * @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. + */ + cancelWithHttpOperationResponse(resourceGroupName, jobName, reason, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._cancel(resourceGroupName, jobName, reason, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * CancelJob. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {string} reason Reason for cancellation. + * + * @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. + */ + cancel(resourceGroupName, jobName, reason, 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._cancel(resourceGroupName, jobName, reason, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._cancel(resourceGroupName, jobName, reason, options, optionalCallback); + } + } + + /** + * This method gets the unencrypted secrets related to the job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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. + */ + listCredentialsWithHttpOperationResponse(resourceGroupName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listCredentials(resourceGroupName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method gets the unencrypted secrets related to the job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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 {UnencryptedCredentialsList} - 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 UnencryptedCredentialsList} 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. + */ + listCredentials(resourceGroupName, jobName, 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._listCredentials(resourceGroupName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listCredentials(resourceGroupName, jobName, options, optionalCallback); + } + } + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} jobResource.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} jobResource.details.destinationAccountDetails Destination + * account details. + * + * @param {object} [jobResource.details.preferences] Preferences for the order. + * + * @param {array} [jobResource.details.preferences.preferredDataCenterRegion] + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, jobName, jobResource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, jobName, jobResource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new job with the specified parameters. Existing job cannot be + * updated with this API and should instead be updated with the Update job API. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResource Job details from request body. + * + * @param {object} [jobResource.details] Details of a job run. This field will + * only be sent for expand details filter. + * + * @param {number} [jobResource.details.expectedDataSizeInTeraBytes] The + * expected size of the data, which needs to be transfered in this job, in tera + * bytes. + * + * @param {object} jobResource.details.contactDetails Contact details for + * notification and shipping. + * + * @param {string} jobResource.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResource.details.contactDetails.phone Phone number of the + * contact person. + * + * @param {string} [jobResource.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResource.details.contactDetails.mobile] Mobile number of + * the contact person. + * + * @param {array} jobResource.details.contactDetails.emailList List of + * Email-ids to be notified about job progress. + * + * @param {array} [jobResource.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} jobResource.details.shippingAddress Shipping address of the + * customer. + * + * @param {string} jobResource.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} [jobResource.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResource.details.shippingAddress.city] Name of the City. + * + * @param {string} [jobResource.details.shippingAddress.stateOrProvince] Name + * of the State or Province. + * + * @param {string} jobResource.details.shippingAddress.country Name of the + * Country. + * + * @param {string} jobResource.details.shippingAddress.postalCode Postal code. + * + * @param {string} [jobResource.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} [jobResource.details.shippingAddress.companyName] Name of + * the company. + * + * @param {string} [jobResource.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} jobResource.details.destinationAccountDetails Destination + * account details. + * + * @param {object} [jobResource.details.preferences] Preferences for the order. + * + * @param {array} [jobResource.details.preferences.preferredDataCenterRegion] + * + * @param {string} jobResource.details.jobDetailsType Polymorphic Discriminator + * + * @param {string} jobResource.location The location of the resource. This will + * be one of the supported and registered Azure Regions (e.g. West US, East US, + * Southeast Asia, etc.). The region of a resource cannot be changed once it is + * created, but if an identical region is specified on update the request will + * succeed. + * + * @param {object} [jobResource.tags] The list of key value pairs that describe + * the resource. These tags can be used in viewing and grouping this resource + * (across resource groups). + * + * @param {object} jobResource.sku The sku type. + * + * @param {string} jobResource.sku.name The sku name. Possible values include: + * 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @param {string} [jobResource.sku.displayName] The display name of the sku. + * + * @param {string} [jobResource.sku.family] The sku family. + * + * @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 {JobResource} - 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 JobResource} 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. + */ + beginCreate(resourceGroupName, jobName, jobResource, 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._beginCreate(resourceGroupName, jobName, jobResource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, jobName, jobResource, options, optionalCallback); + } + } + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @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(resourceGroupName, jobName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, jobName, options, optionalCallback); + } + } + + /** + * Updates the properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} [jobResourceUpdateParameter.details] Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * jobResourceUpdateParameter.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResourceUpdateParameter.destinationAccountDetails] + * Destination account details. + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, jobName, jobResourceUpdateParameter, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, 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 properties of an existing job. + * + * @param {string} resourceGroupName The Resource Group Name + * + * @param {string} jobName The name of the job Resource within the specified + * resource group. job names must be between 3 and 24 characters in length and + * use any alphanumeric and underscore only + * + * @param {object} jobResourceUpdateParameter Job update parameters from + * request body. + * + * @param {object} [jobResourceUpdateParameter.details] Details of a job to be + * updated. + * + * @param {object} [jobResourceUpdateParameter.details.contactDetails] Contact + * details for notification and shipping. + * + * @param {string} + * jobResourceUpdateParameter.details.contactDetails.contactName Contact name + * of the person. + * + * @param {string} jobResourceUpdateParameter.details.contactDetails.phone + * Phone number of the contact person. + * + * @param {string} + * [jobResourceUpdateParameter.details.contactDetails.phoneExtension] Phone + * extension number of the contact person. + * + * @param {string} [jobResourceUpdateParameter.details.contactDetails.mobile] + * Mobile number of the contact person. + * + * @param {array} jobResourceUpdateParameter.details.contactDetails.emailList + * List of Email-ids to be notified about job progress. + * + * @param {array} + * [jobResourceUpdateParameter.details.contactDetails.notificationPreference] + * Notification preference for a job stage. + * + * @param {object} [jobResourceUpdateParameter.details.shippingAddress] + * Shipping address of the customer. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.streetAddress1 Street + * Address line 1. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress2] Street + * Address line 2. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.streetAddress3] Street + * Address line 3. + * + * @param {string} [jobResourceUpdateParameter.details.shippingAddress.city] + * Name of the City. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.stateOrProvince] Name of + * the State or Province. + * + * @param {string} jobResourceUpdateParameter.details.shippingAddress.country + * Name of the Country. + * + * @param {string} + * jobResourceUpdateParameter.details.shippingAddress.postalCode Postal code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.zipExtendedCode] + * Extended Zip Code. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.companyName] Name of the + * company. + * + * @param {string} + * [jobResourceUpdateParameter.details.shippingAddress.addressType] Type of + * address. Possible values include: 'None', 'Residential', 'Commercial' + * + * @param {array} [jobResourceUpdateParameter.destinationAccountDetails] + * Destination account details. + * + * @param {object} [jobResourceUpdateParameter.tags] The list of key value + * pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] Defines the If-Match condition. The patch + * will be performed only if the ETag of the job on the server matches this + * value. + * + * @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 {JobResource} - 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 JobResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, jobName, jobResourceUpdateParameter, options, optionalCallback); + } + } + + /** + * Lists all the jobs available under the subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the jobs available under the 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 {JobResourceList} - 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 JobResourceList} 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); + } + } + + /** + * Lists all the jobs available under the given 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; + }); + }); + } + + /** + * Lists all the jobs available under the given 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 {JobResourceList} - 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 JobResourceList} 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 = Jobs; diff --git a/lib/services/databoxManagement/lib/operations/operations.js b/lib/services/databoxManagement/lib/operations/operations.js new file mode 100644 index 0000000000..a9780b8d99 --- /dev/null +++ b/lib/services/databoxManagement/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; + +/** + * This method gets all the operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationList} 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.DataBox/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['OperationList']().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); + }); +} + +/** + * This method gets all the operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationList} 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['OperationList']().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 {DataBoxManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * This method gets all the operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method gets all the operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationList} - 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 OperationList} 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); + } + } + + /** + * This method gets all the operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method gets all the operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationList} - 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 OperationList} 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/databoxManagement/lib/operations/service.js b/lib/services/databoxManagement/lib/operations/service.js new file mode 100644 index 0000000000..79f9724513 --- /dev/null +++ b/lib/services/databoxManagement/lib/operations/service.js @@ -0,0 +1,868 @@ +/* + * 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; + +/** + * This method provides the list of available skus for the given subscription + * and location. + * + * @param {string} location The location of the resource + * + * @param {object} availableSkuRequest Filters for showing the available skus. + * + * @param {string} availableSkuRequest.country ISO country code. Country for + * hardware shipment. For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * + * @param {string} availableSkuRequest.location Location for data transfer. For + * locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * + * @param {array} [availableSkuRequest.skuNames] Sku Names to filter for + * available skus + * + * @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 AvailableSkusResult} 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 _listAvailableSkus(location, availableSkuRequest, 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.'); + } + if (availableSkuRequest === null || availableSkuRequest === undefined) + { + availableSkuRequest = {}; + } + // 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 (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location 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 (availableSkuRequest === null || availableSkuRequest === undefined) { + throw new Error('availableSkuRequest cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/availableSkus'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + 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 (availableSkuRequest !== null && availableSkuRequest !== undefined) { + let requestModelMapper = new client.models['AvailableSkuRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, availableSkuRequest, 'availableSkuRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(availableSkuRequest, 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['AvailableSkusResult']().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); + }); +} + +/** + * This method validates the customer shipping address and provide alternate + * addresses if any. + * + * @param {string} location The location of the resource + * + * @param {object} shippingAddress Shipping address of the customer. + * + * @param {string} shippingAddress.streetAddress1 Street Address line 1. + * + * @param {string} [shippingAddress.streetAddress2] Street Address line 2. + * + * @param {string} [shippingAddress.streetAddress3] Street Address line 3. + * + * @param {string} [shippingAddress.city] Name of the City. + * + * @param {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * + * @param {string} shippingAddress.country Name of the Country. + * + * @param {string} shippingAddress.postalCode Postal code. + * + * @param {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * + * @param {string} [shippingAddress.companyName] Name of the company. + * + * @param {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * + * @param {string} deviceType Device type to be used for the job. Possible + * values include: 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @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 AddressValidationOutput} 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 _validateAddressMethod(location, shippingAddress, deviceType, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location 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 (shippingAddress === null || shippingAddress === undefined) { + throw new Error('shippingAddress cannot be null or undefined.'); + } + if (deviceType) { + let allowedValues = [ 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' ]; + if (!allowedValues.some( function(item) { return item === deviceType; })) { + throw new Error(deviceType + ' is not a valid value. The valid values are: ' + allowedValues); + } + } else { + throw new Error('deviceType 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 validateAddress; + if ((shippingAddress !== null && shippingAddress !== undefined) || (deviceType !== null && deviceType !== undefined)) { + validateAddress = new client.models['ValidateAddress'](); + validateAddress.shippingAddress = shippingAddress; + validateAddress.deviceType = deviceType; + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + 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 (validateAddress !== null && validateAddress !== undefined) { + let requestModelMapper = new client.models['ValidateAddress']().mapper(); + requestModel = client.serialize(requestModelMapper, validateAddress, 'validateAddress'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(validateAddress, 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['AddressValidationOutput']().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); + }); +} + +/** + * This method provides the list of available skus for the given subscription + * and location. + * + * @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 AvailableSkusResult} 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 _listAvailableSkusNext(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 = '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['AvailableSkusResult']().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 Service. */ +class Service { + /** + * Create a Service. + * @param {DataBoxManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listAvailableSkus = _listAvailableSkus; + this._validateAddressMethod = _validateAddressMethod; + this._listAvailableSkusNext = _listAvailableSkusNext; + } + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @param {string} location The location of the resource + * + * @param {object} availableSkuRequest Filters for showing the available skus. + * + * @param {string} availableSkuRequest.country ISO country code. Country for + * hardware shipment. For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * + * @param {string} availableSkuRequest.location Location for data transfer. For + * locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * + * @param {array} [availableSkuRequest.skuNames] Sku Names to filter for + * available skus + * + * @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. + */ + listAvailableSkusWithHttpOperationResponse(location, availableSkuRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAvailableSkus(location, availableSkuRequest, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @param {string} location The location of the resource + * + * @param {object} availableSkuRequest Filters for showing the available skus. + * + * @param {string} availableSkuRequest.country ISO country code. Country for + * hardware shipment. For codes check: + * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * + * @param {string} availableSkuRequest.location Location for data transfer. For + * locations check: + * https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + * + * @param {array} [availableSkuRequest.skuNames] Sku Names to filter for + * available skus + * + * @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 {AvailableSkusResult} - 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 AvailableSkusResult} 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. + */ + listAvailableSkus(location, availableSkuRequest, 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._listAvailableSkus(location, availableSkuRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAvailableSkus(location, availableSkuRequest, options, optionalCallback); + } + } + + /** + * This method validates the customer shipping address and provide alternate + * addresses if any. + * + * @param {string} location The location of the resource + * + * @param {object} shippingAddress Shipping address of the customer. + * + * @param {string} shippingAddress.streetAddress1 Street Address line 1. + * + * @param {string} [shippingAddress.streetAddress2] Street Address line 2. + * + * @param {string} [shippingAddress.streetAddress3] Street Address line 3. + * + * @param {string} [shippingAddress.city] Name of the City. + * + * @param {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * + * @param {string} shippingAddress.country Name of the Country. + * + * @param {string} shippingAddress.postalCode Postal code. + * + * @param {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * + * @param {string} [shippingAddress.companyName] Name of the company. + * + * @param {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * + * @param {string} deviceType Device type to be used for the job. Possible + * values include: 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @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. + */ + validateAddressMethodWithHttpOperationResponse(location, shippingAddress, deviceType, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._validateAddressMethod(location, shippingAddress, deviceType, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method validates the customer shipping address and provide alternate + * addresses if any. + * + * @param {string} location The location of the resource + * + * @param {object} shippingAddress Shipping address of the customer. + * + * @param {string} shippingAddress.streetAddress1 Street Address line 1. + * + * @param {string} [shippingAddress.streetAddress2] Street Address line 2. + * + * @param {string} [shippingAddress.streetAddress3] Street Address line 3. + * + * @param {string} [shippingAddress.city] Name of the City. + * + * @param {string} [shippingAddress.stateOrProvince] Name of the State or + * Province. + * + * @param {string} shippingAddress.country Name of the Country. + * + * @param {string} shippingAddress.postalCode Postal code. + * + * @param {string} [shippingAddress.zipExtendedCode] Extended Zip Code. + * + * @param {string} [shippingAddress.companyName] Name of the company. + * + * @param {string} [shippingAddress.addressType] Type of address. Possible + * values include: 'None', 'Residential', 'Commercial' + * + * @param {string} deviceType Device type to be used for the job. Possible + * values include: 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' + * + * @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 {AddressValidationOutput} - 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 AddressValidationOutput} 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. + */ + validateAddressMethod(location, shippingAddress, deviceType, 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._validateAddressMethod(location, shippingAddress, deviceType, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._validateAddressMethod(location, shippingAddress, deviceType, options, optionalCallback); + } + } + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @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. + */ + listAvailableSkusNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAvailableSkusNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This method provides the list of available skus for the given subscription + * and location. + * + * @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 {AvailableSkusResult} - 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 AvailableSkusResult} 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. + */ + listAvailableSkusNext(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._listAvailableSkusNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAvailableSkusNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Service; diff --git a/lib/services/databoxManagement/package.json b/lib/services/databoxManagement/package.json new file mode 100644 index 0000000000..2bf4392204 --- /dev/null +++ b/lib/services/databoxManagement/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-databox", + "author": "Microsoft Corporation", + "description": "DataBoxManagementClient Library with typescript type definitions for node", + "version": "0.0.1", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ + "node", + "azure" + ], + "license": "MIT", + "main": "./lib/dataBoxManagementClient.js", + "types": "./lib/dataBoxManagementClient.d.ts", + "homepage": "https://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-node/issues" + } +}