diff --git a/packages/@azure/arm-databox/LICENSE.txt b/packages/@azure/arm-databox/LICENSE.txt index a70e8cf66038..5431ba98b936 100644 --- a/packages/@azure/arm-databox/LICENSE.txt +++ b/packages/@azure/arm-databox/LICENSE.txt @@ -1,21 +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. +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/packages/@azure/arm-databox/README.md b/packages/@azure/arm-databox/README.md index 0b61f969c717..2d4cf5339c9c 100644 --- a/packages/@azure/arm-databox/README.md +++ b/packages/@azure/arm-databox/README.md @@ -1,77 +1,77 @@ -# Azure DataBoxManagementClient SDK for JavaScript -This package contains an isomorphic SDK for DataBoxManagementClient. - -## Currently supported environments -- Node.js version 6.x.x or higher -- Browser JavaScript - -## How to Install -``` -npm install @azure/arm-databox -``` - - -## How to use - -### nodejs - Authentication, client creation and list operations as an example written in TypeScript. - -```ts -import * as msRest from "ms-rest-js"; -import * as msRestAzure from "ms-rest-azure-js"; -import * as msRestNodeAuth from "ms-rest-nodeauth"; -import { DataBoxManagementClient, DataBoxManagementModels, DataBoxManagementMappers } from "@azure/arm-databox"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new DataBoxManagementClient(creds, subscriptionId); - client.operations.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); -``` - -### browser - Authentication, client creation and list operations as an example written in JavaScript. -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/arm-databox sample - - - - - - - - - -``` - -# Related projects - - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +# Azure DataBoxManagementClient SDK for JavaScript +This package contains an isomorphic SDK for DataBoxManagementClient. + +## Currently supported environments +- Node.js version 6.x.x or higher +- Browser JavaScript + +## How to Install +``` +npm install @azure/arm-databox +``` + + +## How to use + +### nodejs - Authentication, client creation and list operations as an example written in TypeScript. + +```ts +import * as msRest from "ms-rest-js"; +import * as msRestAzure from "ms-rest-azure-js"; +import * as msRestNodeAuth from "ms-rest-nodeauth"; +import { DataBoxManagementClient, DataBoxManagementModels, DataBoxManagementMappers } from "@azure/arm-databox"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new DataBoxManagementClient(creds, subscriptionId); + client.operations.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +### browser - Authentication, client creation and list operations as an example written in JavaScript. +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/arm-databox sample + + + + + + + + + +``` + +# Related projects + - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/packages/@azure/arm-databox/lib/dataBoxManagementClientContext.ts b/packages/@azure/arm-databox/lib/dataBoxManagementClientContext.ts index 06a3f3875332..89b3b7cae56f 100644 --- a/packages/@azure/arm-databox/lib/dataBoxManagementClientContext.ts +++ b/packages/@azure/arm-databox/lib/dataBoxManagementClientContext.ts @@ -16,17 +16,10 @@ const packageName = "@azure/arm-databox"; const packageVersion = "0.0.1"; export class DataBoxManagementClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - - apiVersion: string; - + apiVersion?: string; subscriptionId: string; - acceptLanguage: string; - - longRunningOperationRetryTimeout: number; - /** * Initializes a new instance of the DataBoxManagementClient class. * @param credentials Credentials needed for the client to connect to Azure. diff --git a/packages/@azure/arm-databox/lib/models/index.ts b/packages/@azure/arm-databox/lib/models/index.ts index 13d22fcbc1b5..d1211c31c08d 100644 --- a/packages/@azure/arm-databox/lib/models/index.ts +++ b/packages/@azure/arm-databox/lib/models/index.ts @@ -30,7 +30,7 @@ export interface ShareCredentialDetails { /** * @member {ShareDestinationFormatType} [shareType] Type of the share. * Possible values include: 'UnknownType', 'HCS', 'BlockBlob', 'PageBlob', - * 'AzureFile' + * 'AzureFile', 'ManagedDisk' * **NOTE: This property will not be serialized. It can only be populated by * the server.** */ @@ -364,7 +364,7 @@ export interface SkuInformation { /** * @member {SkuDisabledReason} [disabledReason] Reason why the Sku is * disabled. Possible values include: 'None', 'Country', 'Region', 'Feature', - * 'OfferType' + * 'OfferType', 'NoSubscriptionInfo' * **NOTE: This property will not be serialized. It can only be populated by * the server.** */ @@ -505,6 +505,20 @@ export interface CopyProgress { * the server.** */ readonly totalBytesToProcess?: number; + /** + * @member {number} [filesProcessed] Number of files processed by the job as + * of now. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly filesProcessed?: number; + /** + * @member {number} [totalFilesToProcess] Total number of files to be + * processed by the job. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly totalFilesToProcess?: number; } /** @@ -617,7 +631,7 @@ export interface JobDetails { jobDetailsType: "JobDetails"; /** * @member {number} [expectedDataSizeInTeraBytes] The expected size of the - * data, which needs to be transfered in this job, in tera bytes. + * data, which needs to be transferred in this job, in terabytes. */ expectedDataSizeInTeraBytes?: number; /** @@ -651,10 +665,10 @@ export interface JobDetails { */ readonly returnPackage?: PackageShippingDetails; /** - * @member {DestinationAccountDetails[]} destinationAccountDetails + * @member {DestinationAccountDetailsUnion[]} destinationAccountDetails * Destination account details. */ - destinationAccountDetails: DestinationAccountDetails[]; + destinationAccountDetails: DestinationAccountDetailsUnion[]; /** * @member {JobErrorDetails[]} [errorDetails] Error details for failure. This * is optional. @@ -701,7 +715,7 @@ export interface DataBoxDiskJobDetails { jobDetailsType: "DataBoxDisk"; /** * @member {number} [expectedDataSizeInTeraBytes] The expected size of the - * data, which needs to be transfered in this job, in tera bytes. + * data, which needs to be transferred in this job, in terabytes. */ expectedDataSizeInTeraBytes?: number; /** @@ -735,10 +749,10 @@ export interface DataBoxDiskJobDetails { */ readonly returnPackage?: PackageShippingDetails; /** - * @member {DestinationAccountDetails[]} destinationAccountDetails + * @member {DestinationAccountDetailsUnion[]} destinationAccountDetails * Destination account details. */ - destinationAccountDetails: DestinationAccountDetails[]; + destinationAccountDetails: DestinationAccountDetailsUnion[]; /** * @member {JobErrorDetails[]} [errorDetails] Error details for failure. This * is optional. @@ -873,7 +887,7 @@ export interface DataBoxDiskJobSecrets { /** * @interface * An interface representing DataBoxHeavyAccountCopyLogDetails. - * Copy log details for a storage account for Databox heavy + * Copy log details for a storage account for DataBoxHeavy * */ export interface DataBoxHeavyAccountCopyLogDetails { @@ -898,7 +912,7 @@ export interface DataBoxHeavyAccountCopyLogDetails { /** * @interface * An interface representing DataBoxHeavyJobDetails. - * Databox Heavy Device Job Details + * DataBoxHeavy Device Job Details * */ export interface DataBoxHeavyJobDetails { @@ -908,7 +922,7 @@ export interface DataBoxHeavyJobDetails { jobDetailsType: "DataBoxHeavy"; /** * @member {number} [expectedDataSizeInTeraBytes] The expected size of the - * data, which needs to be transfered in this job, in tera bytes. + * data, which needs to be transferred in this job, in terabytes. */ expectedDataSizeInTeraBytes?: number; /** @@ -942,10 +956,10 @@ export interface DataBoxHeavyJobDetails { */ readonly returnPackage?: PackageShippingDetails; /** - * @member {DestinationAccountDetails[]} destinationAccountDetails + * @member {DestinationAccountDetailsUnion[]} destinationAccountDetails * Destination account details. */ - destinationAccountDetails: DestinationAccountDetails[]; + destinationAccountDetails: DestinationAccountDetailsUnion[]; /** * @member {JobErrorDetails[]} [errorDetails] Error details for failure. This * is optional. @@ -988,7 +1002,7 @@ export interface DataBoxHeavyJobDetails { /** * @interface * An interface representing DataBoxHeavySecret. - * The secrets related to a databox heavy. + * The secrets related to a DataBoxHeavy. * */ export interface DataBoxHeavySecret { @@ -1032,7 +1046,7 @@ export interface DataBoxHeavySecret { /** * @interface * An interface representing DataBoxHeavyJobSecrets. - * The secrets related to a databox heavy job. + * The secrets related to a DataBoxHeavy job. * */ export interface DataBoxHeavyJobSecrets { @@ -1042,7 +1056,7 @@ export interface DataBoxHeavyJobSecrets { jobSecretsType: "DataBoxHeavy"; /** * @member {DataBoxHeavySecret[]} [cabinetPodSecrets] Contains the list of - * secret objects for a databox heavy job. + * secret objects for a DataBoxHeavy job. * **NOTE: This property will not be serialized. It can only be populated by * the server.** */ @@ -1052,7 +1066,7 @@ export interface DataBoxHeavyJobSecrets { /** * @interface * An interface representing DataBoxJobDetails. - * Databox Job Details + * DataBox Job Details * */ export interface DataBoxJobDetails { @@ -1062,7 +1076,7 @@ export interface DataBoxJobDetails { jobDetailsType: "DataBox"; /** * @member {number} [expectedDataSizeInTeraBytes] The expected size of the - * data, which needs to be transfered in this job, in tera bytes. + * data, which needs to be transferred in this job, in terabytes. */ expectedDataSizeInTeraBytes?: number; /** @@ -1096,10 +1110,10 @@ export interface DataBoxJobDetails { */ readonly returnPackage?: PackageShippingDetails; /** - * @member {DestinationAccountDetails[]} destinationAccountDetails + * @member {DestinationAccountDetailsUnion[]} destinationAccountDetails * Destination account details. */ - destinationAccountDetails: DestinationAccountDetails[]; + destinationAccountDetails: DestinationAccountDetailsUnion[]; /** * @member {JobErrorDetails[]} [errorDetails] Error details for failure. This * is optional. @@ -1186,7 +1200,7 @@ export interface DataBoxSecret { /** * @interface * An interface representing DataboxJobSecrets. - * The secrets related to a databox job. + * The secrets related to a DataBox job. * */ export interface DataboxJobSecrets { @@ -1201,17 +1215,77 @@ export interface DataboxJobSecrets { podSecrets?: DataBoxSecret[]; } +/** + * Contains the possible cases for DestinationAccountDetails. + */ +export type DestinationAccountDetailsUnion = DestinationAccountDetails | DestinationManagedDiskDetails | DestinationStorageAccountDetails; + /** * @interface * An interface representing DestinationAccountDetails. - * Details for the destination account. + * Details of the destination of the data * */ export interface DestinationAccountDetails { /** - * @member {string} accountId Destination storage account id. + * @member {string} dataDestinationType Polymorphic Discriminator + */ + dataDestinationType: "DestinationAccountDetails"; + /** + * @member {string} [accountId] Arm Id of the destination where the data has + * to be moved. */ - accountId: string; + accountId?: string; +} + +/** + * @interface + * An interface representing DestinationManagedDiskDetails. + * Details for the destination compute disks. + * + */ +export interface DestinationManagedDiskDetails { + /** + * @member {string} dataDestinationType Polymorphic Discriminator + */ + dataDestinationType: "ManagedDisk"; + /** + * @member {string} [accountId] Arm Id of the destination where the data has + * to be moved. + */ + accountId?: string; + /** + * @member {string} resourceGroupId Destination Resource Group Id where the + * Compute disks should be created. + */ + resourceGroupId: string; + /** + * @member {string} stagingStorageAccountId Arm Id of the storage account + * that can be used to copy the vhd for staging. + */ + stagingStorageAccountId: string; +} + +/** + * @interface + * An interface representing DestinationStorageAccountDetails. + * Details for the destination storage account. + * + */ +export interface DestinationStorageAccountDetails { + /** + * @member {string} dataDestinationType Polymorphic Discriminator + */ + dataDestinationType: "StorageAccount"; + /** + * @member {string} [accountId] Arm Id of the destination where the data has + * to be moved. + */ + accountId?: string; + /** + * @member {string} storageAccountId Destination Storage Account Arm Id. + */ + storageAccountId: string; } /** @@ -1504,10 +1578,10 @@ export interface JobResourceUpdateParameter { */ details?: UpdateJobDetails; /** - * @member {DestinationAccountDetails[]} [destinationAccountDetails] + * @member {DestinationAccountDetailsUnion[]} [destinationAccountDetails] * Destination account details. */ - destinationAccountDetails?: DestinationAccountDetails[]; + destinationAccountDetails?: DestinationAccountDetailsUnion[]; /** * @member {{ [propertyName: string]: string }} [tags] The list of key value * pairs that describe the resource. These tags can be used in viewing and @@ -1814,7 +1888,7 @@ export interface AvailableSkusResult extends Array { /** * Defines values for ShareDestinationFormatType. * Possible values include: 'UnknownType', 'HCS', 'BlockBlob', 'PageBlob', - * 'AzureFile' + * 'AzureFile', 'ManagedDisk' * @readonly * @enum {string} */ @@ -1824,7 +1898,7 @@ export enum ShareDestinationFormatType { */ UnknownType = 'UnknownType', /** - * Storsimple data format. + * StorSimple data format. */ HCS = 'HCS', /** @@ -1839,6 +1913,10 @@ export enum ShareDestinationFormatType { * Azure storage file format. */ AzureFile = 'AzureFile', + /** + * Azure Compute Disk. + */ + ManagedDisk = 'ManagedDisk', } /** @@ -1909,22 +1987,23 @@ export enum AddressType { */ export enum SkuName { /** - * Databox. + * DataBox. */ DataBox = 'DataBox', /** - * DataboxDisk. + * DataBoxDisk. */ DataBoxDisk = 'DataBoxDisk', /** - * DataboxHeavy. + * DataBoxHeavy. */ DataBoxHeavy = 'DataBoxHeavy', } /** * Defines values for SkuDisabledReason. - * Possible values include: 'None', 'Country', 'Region', 'Feature', 'OfferType' + * Possible values include: 'None', 'Country', 'Region', 'Feature', + * 'OfferType', 'NoSubscriptionInfo' * @readonly * @enum {string} */ @@ -1938,7 +2017,7 @@ export enum SkuDisabledReason { */ Country = 'Country', /** - * SKU is not available to push data to the requested storage account region. + * SKU is not available to push data to the requested Azure region. */ Region = 'Region', /** @@ -1949,6 +2028,11 @@ export enum SkuDisabledReason { * Subscription does not have required offer types for the SKU. */ OfferType = 'OfferType', + /** + * Subscription has not registered to Microsoft.DataBox and Service does not + * have the subscription notification. + */ + NoSubscriptionInfo = 'NoSubscriptionInfo', } /** @@ -1994,7 +2078,7 @@ export enum NotificationStageName { */ export enum CopyStatus { /** - * Data copy hasnt started yet. + * Data copy hasn't started yet. */ NotStarted = 'NotStarted', /** diff --git a/packages/@azure/arm-databox/lib/models/jobsMappers.ts b/packages/@azure/arm-databox/lib/models/jobsMappers.ts index c5eaab52abae..a266cd5dfb7e 100644 --- a/packages/@azure/arm-databox/lib/models/jobsMappers.ts +++ b/packages/@azure/arm-databox/lib/models/jobsMappers.ts @@ -51,6 +51,8 @@ export { ShareCredentialDetails, DataBoxJobDetails, DataboxJobSecrets, - DataBoxSecret + DataBoxSecret, + DestinationManagedDiskDetails, + DestinationStorageAccountDetails } from "../models/mappers"; diff --git a/packages/@azure/arm-databox/lib/models/mappers.ts b/packages/@azure/arm-databox/lib/models/mappers.ts index 5db8f8377757..3e2c05dd2be2 100644 --- a/packages/@azure/arm-databox/lib/models/mappers.ts +++ b/packages/@azure/arm-databox/lib/models/mappers.ts @@ -37,7 +37,8 @@ export const ShareCredentialDetails: msRest.CompositeMapper = { "HCS", "BlockBlob", "PageBlob", - "AzureFile" + "AzureFile", + "ManagedDisk" ] } }, @@ -512,7 +513,8 @@ export const SkuInformation: msRest.CompositeMapper = { "Country", "Region", "Feature", - "OfferType" + "OfferType", + "NoSubscriptionInfo" ] } }, @@ -698,6 +700,20 @@ export const CopyProgress: msRest.CompositeMapper = { type: { name: "Number" } + }, + filesProcessed: { + readOnly: true, + serializedName: "filesProcessed", + type: { + name: "Number" + } + }, + totalFilesToProcess: { + readOnly: true, + serializedName: "totalFilesToProcess", + type: { + name: "Number" + } } } } @@ -880,6 +896,11 @@ export const JobDetails: msRest.CompositeMapper = { element: { type: { name: "Composite", + polymorphicDiscriminator: { + serializedName: "dataDestinationType", + clientName: "dataDestinationType" + }, + uberParent: "DestinationAccountDetails", className: "DestinationAccountDetails" } } @@ -1342,14 +1363,72 @@ export const DestinationAccountDetails: msRest.CompositeMapper = { serializedName: "DestinationAccountDetails", type: { name: "Composite", + polymorphicDiscriminator: { + serializedName: "dataDestinationType", + clientName: "dataDestinationType" + }, + uberParent: "DestinationAccountDetails", className: "DestinationAccountDetails", modelProperties: { accountId: { - required: true, serializedName: "accountId", type: { name: "String" } + }, + dataDestinationType: { + required: true, + serializedName: "dataDestinationType", + type: { + name: "String" + } + } + } + } +}; + +export const DestinationManagedDiskDetails: msRest.CompositeMapper = { + serializedName: "ManagedDisk", + type: { + name: "Composite", + polymorphicDiscriminator: DestinationAccountDetails.type.polymorphicDiscriminator, + uberParent: "DestinationAccountDetails", + className: "DestinationManagedDiskDetails", + modelProperties: { + ...DestinationAccountDetails.type.modelProperties, + resourceGroupId: { + required: true, + serializedName: "resourceGroupId", + type: { + name: "String" + } + }, + stagingStorageAccountId: { + required: true, + serializedName: "stagingStorageAccountId", + type: { + name: "String" + } + } + } + } +}; + +export const DestinationStorageAccountDetails: msRest.CompositeMapper = { + serializedName: "StorageAccount", + type: { + name: "Composite", + polymorphicDiscriminator: DestinationAccountDetails.type.polymorphicDiscriminator, + uberParent: "DestinationAccountDetails", + className: "DestinationStorageAccountDetails", + modelProperties: { + ...DestinationAccountDetails.type.modelProperties, + storageAccountId: { + required: true, + serializedName: "storageAccountId", + type: { + name: "String" + } } } } @@ -1740,6 +1819,11 @@ export const JobResourceUpdateParameter: msRest.CompositeMapper = { element: { type: { name: "Composite", + polymorphicDiscriminator: { + serializedName: "dataDestinationType", + clientName: "dataDestinationType" + }, + uberParent: "DestinationAccountDetails", className: "DestinationAccountDetails" } } @@ -2067,6 +2151,9 @@ export const discriminators = { 'JobSecrets.DataBoxHeavy' : DataBoxHeavyJobSecrets, 'JobDetails.DataBox' : DataBoxJobDetails, 'JobSecrets.DataBox' : DataboxJobSecrets, + 'DestinationAccountDetails' : DestinationAccountDetails, + 'DestinationAccountDetails.ManagedDisk' : DestinationManagedDiskDetails, + 'DestinationAccountDetails.StorageAccount' : DestinationStorageAccountDetails, 'JobDetails' : JobDetails, 'JobSecrets' : JobSecrets }; diff --git a/packages/@azure/arm-databox/package.json b/packages/@azure/arm-databox/package.json index 848bf016e0cd..de4253e2166f 100644 --- a/packages/@azure/arm-databox/package.json +++ b/packages/@azure/arm-databox/package.json @@ -33,10 +33,23 @@ "bugs": { "url": "https://github.com/azure/azure-sdk-for-js/issues" }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "lib/**/*.ts", + "rollup.config.js", + "tsconfig.json" + ], "scripts": { "build": "tsc && rollup -c rollup.config.js && npm run minify", "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-databox.js.map'\" -o ./dist/arm-databox.min.js ./dist/arm-databox.js", - "prepare": "npm run build" + "prepack": "npm install && npm run build" }, "sideEffects": false }