diff --git a/lib/services/azurestackManagement/LICENSE.txt b/lib/services/azurestackManagement/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/azurestackManagement/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/azurestackManagement/README.md b/lib/services/azurestackManagement/README.md index c37d7e5b6b..ed24abc7b8 100644 --- a/lib/services/azurestackManagement/README.md +++ b/lib/services/azurestackManagement/README.md @@ -1,42 +1,41 @@ -# Microsoft Azure SDK for Node.js - AzureStackManagement - -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-azurestack -``` - -## How to Use - -### Authentication, client creation and listing automation accounts as an example - -```javascript -const msRestAzure = require('ms-rest-azure'); -const AzureStackManagement = require("azure-arm-azurestack"); - -// Interactive Login -// It provides a url and code that needs to be copied and pasted in a browser and authenticated over there. If successful, -// the user will get a DeviceTokenCredentials object. -msRestAzure.interactiveLogin() - .then((credentials) => { - let client = new AzureStackManagement(credentials, 'your-subscription-id'); - client.products.listByResourceGroup('test-rg') - .then((products) => { - console.log('List of Products:'); - console.dir(products, {depth: null, colors: true}); - }); - }).catch((err) => { - console.log('An error ocurred'); - console.dir(err, {depth: null, colors: true}); - }); -``` - -## Related projects - -- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) \ No newline at end of file +--- +uid: azure-arm-azurestack +summary: *content + +--- +**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.** +## Microsoft Azure SDK for Node.js - AzureStackManagementClient +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-azurestack +``` + +### How to use + +#### Authentication, client creation and list operations as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const AzureStackManagementClient = require("azure-arm-azurestack"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new AzureStackManagementClient(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/azurestackManagement/lib/azureStackManagementClient.d.ts b/lib/services/azurestackManagement/lib/azureStackManagementClient.d.ts index 5f3c5c6652..06fd618fdf 100644 --- a/lib/services/azurestackManagement/lib/azureStackManagementClient.d.ts +++ b/lib/services/azurestackManagement/lib/azureStackManagementClient.d.ts @@ -34,11 +34,11 @@ export default class AzureStackManagementClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @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); diff --git a/lib/services/azurestackManagement/lib/azureStackManagementClient.js b/lib/services/azurestackManagement/lib/azureStackManagementClient.js index b1c25a1d98..02c3a1c077 100644 --- a/lib/services/azurestackManagement/lib/azureStackManagementClient.js +++ b/lib/services/azurestackManagement/lib/azureStackManagementClient.js @@ -34,9 +34,9 @@ class AzureStackManagementClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @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) { diff --git a/lib/services/azurestackManagement/lib/models/activationKeyResult.js b/lib/services/azurestackManagement/lib/models/activationKeyResult.js index 2d787ed7b3..9021d347fa 100644 --- a/lib/services/azurestackManagement/lib/models/activationKeyResult.js +++ b/lib/services/azurestackManagement/lib/models/activationKeyResult.js @@ -17,7 +17,7 @@ class ActivationKeyResult { /** * Create a ActivationKeyResult. - * @member {string} [activationKey] Azure Stack activation key. + * @property {string} [activationKey] Azure Stack activation key. */ constructor() { } diff --git a/lib/services/azurestackManagement/lib/models/customerSubscription.js b/lib/services/azurestackManagement/lib/models/customerSubscription.js index 167e18a79a..5b055f79d0 100644 --- a/lib/services/azurestackManagement/lib/models/customerSubscription.js +++ b/lib/services/azurestackManagement/lib/models/customerSubscription.js @@ -13,14 +13,14 @@ const models = require('./index'); /** - * Customer subcription. + * Customer subscription. * * @extends models['Resource'] */ class CustomerSubscription extends models['Resource'] { /** * Create a CustomerSubscription. - * @member {string} [tenantId] Tenant Id. + * @property {string} [tenantId] Tenant Id. */ constructor() { super(); @@ -64,29 +64,6 @@ class CustomerSubscription extends models['Resource'] { name: 'String' } }, - location: { - required: true, - isConstant: true, - serializedName: 'location', - defaultValue: 'global', - type: { - name: 'String' - } - }, - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, etag: { required: false, serializedName: 'etag', diff --git a/lib/services/azurestackManagement/lib/models/customerSubscriptionList.js b/lib/services/azurestackManagement/lib/models/customerSubscriptionList.js index 4bd0774c57..062918d83d 100644 --- a/lib/services/azurestackManagement/lib/models/customerSubscriptionList.js +++ b/lib/services/azurestackManagement/lib/models/customerSubscriptionList.js @@ -16,7 +16,7 @@ class CustomerSubscriptionList extends Array { /** * Create a CustomerSubscriptionList. - * @member {string} [nextLink] URI to the next page. + * @property {string} [nextLink] URI to the next page. */ constructor() { super(); diff --git a/lib/services/azurestackManagement/lib/models/dataDiskImage.js b/lib/services/azurestackManagement/lib/models/dataDiskImage.js index d01e165155..4679884c18 100644 --- a/lib/services/azurestackManagement/lib/models/dataDiskImage.js +++ b/lib/services/azurestackManagement/lib/models/dataDiskImage.js @@ -17,8 +17,8 @@ class DataDiskImage { /** * Create a DataDiskImage. - * @member {number} [lun] The LUN. - * @member {string} [sourceBlobSasUri] SAS key for source blob. + * @property {number} [lun] The LUN. + * @property {string} [sourceBlobSasUri] SAS key for source blob. */ constructor() { } diff --git a/lib/services/azurestackManagement/lib/models/display.js b/lib/services/azurestackManagement/lib/models/display.js index d14b31a47f..3f3f7ab908 100644 --- a/lib/services/azurestackManagement/lib/models/display.js +++ b/lib/services/azurestackManagement/lib/models/display.js @@ -18,15 +18,15 @@ class Display { /** * Create a Display. - * @member {string} [provider] The localized, friendly version of the + * @property {string} [provider] The localized, friendly version of the * resource provider name. - * @member {string} [resource] The localized, friendly version of the + * @property {string} [resource] The localized, friendly version of the * resource type related to this action or operation; the resource type * should match the public documentation for the resource provider. - * @member {string} [operation] The localized, friendly name for the + * @property {string} [operation] The localized, friendly name for the * operation. Use the name as it will displayed to the user. - * @member {string} [description] The localized, friendly description for the - * operation. The description will be displayed to the user. It should be + * @property {string} [description] The localized, friendly description for + * the operation. The description will be displayed to the user. It should be * thorough and concise for used in both tooltips and detailed views. */ constructor() { diff --git a/lib/services/azurestackManagement/lib/models/errorDetails.js b/lib/services/azurestackManagement/lib/models/errorDetails.js new file mode 100644 index 0000000000..cbaec9ce69 --- /dev/null +++ b/lib/services/azurestackManagement/lib/models/errorDetails.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 details of the error. + * + */ +class ErrorDetails { + /** + * Create a ErrorDetails. + * @property {string} [code] Error code. + * @property {string} [message] Error message indicating why the operation + * failed. + * @property {string} [target] The target of the particular error. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorDetails + * + * @returns {object} metadata of ErrorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorDetails', + type: { + name: 'Composite', + className: 'ErrorDetails', + modelProperties: { + code: { + required: false, + readOnly: true, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + target: { + required: false, + readOnly: true, + serializedName: 'target', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorDetails; diff --git a/lib/services/azurestackManagement/lib/models/errorResponse.js b/lib/services/azurestackManagement/lib/models/errorResponse.js new file mode 100644 index 0000000000..dbbd68693f --- /dev/null +++ b/lib/services/azurestackManagement/lib/models/errorResponse.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'; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + * + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @property {object} [error] The details of the error. + * @property {string} [error.code] Error code. + * @property {string} [error.message] Error message indicating why the + * operation failed. + * @property {string} [error.target] The target of the particular error. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + error: { + required: false, + serializedName: 'error', + type: { + name: 'Composite', + className: 'ErrorDetails' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/azurestackManagement/lib/models/extendedProduct.js b/lib/services/azurestackManagement/lib/models/extendedProduct.js index efccfd01d5..3f9748432b 100644 --- a/lib/services/azurestackManagement/lib/models/extendedProduct.js +++ b/lib/services/azurestackManagement/lib/models/extendedProduct.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Extended description about the product required for installing it into Azure * Stack. @@ -20,27 +18,27 @@ const models = require('./index'); class ExtendedProduct { /** * Create a ExtendedProduct. - * @member {string} [galleryPackageBlobSasUri] The URI to the .azpkg file + * @property {string} [galleryPackageBlobSasUri] The URI to the .azpkg file * that provides information required for showing product in the gallery. - * @member {string} [productKind] Specifies the kind of the product + * @property {string} [productKind] Specifies the kind of the product * (virtualMachine or virtualMachineExtension). - * @member {string} [computeRole] Specifies kind of compute role inclided in - * the package. Possible values include: 'None', 'IaaS', 'PaaS' - * @member {boolean} [isSystemExtension] Specifies if product is a Virtual + * @property {string} [computeRole] Specifies kind of compute role included + * in the package. Possible values include: 'None', 'IaaS', 'PaaS' + * @property {boolean} [isSystemExtension] Specifies if product is a Virtual * Machine Extension. - * @member {string} [uri] The URI. - * @member {boolean} [supportMultipleExtensions] Indicates if specified + * @property {string} [uri] The URI. + * @property {boolean} [supportMultipleExtensions] Indicates if specified * product supports multiple extensions. - * @member {string} [version] Specifies product version. - * @member {string} [vmOsType] Specifies operating system used by the + * @property {string} [version] Specifies product version. + * @property {string} [vmOsType] Specifies operating system used by the * product. Possible values include: 'None', 'Windows', 'Linux' - * @member {boolean} [vmScaleSetEnabled] Indicates if virtual machine Scale + * @property {boolean} [vmScaleSetEnabled] Indicates if virtual machine Scale * Set is enabled in the specified product. - * @member {object} [osDiskImage] OS disk image used by product. - * @member {string} [osDiskImage.operatingSystem] OS operating system type. + * @property {object} [osDiskImage] OS disk image used by product. + * @property {string} [osDiskImage.operatingSystem] OS operating system type. * Possible values include: 'None', 'Windows', 'Linux' - * @member {string} [osDiskImage.sourceBlobSasUri] SAS key for source blob. - * @member {array} [dataDiskImages] List of attached data disks. + * @property {string} [osDiskImage.sourceBlobSasUri] SAS key for source blob. + * @property {array} [dataDiskImages] List of attached data disks. */ constructor() { } diff --git a/lib/services/azurestackManagement/lib/models/iconUris.js b/lib/services/azurestackManagement/lib/models/iconUris.js index 7cceff6494..fcfa261e96 100644 --- a/lib/services/azurestackManagement/lib/models/iconUris.js +++ b/lib/services/azurestackManagement/lib/models/iconUris.js @@ -17,11 +17,11 @@ class IconUris { /** * Create a IconUris. - * @member {string} [large] URI to large icon. - * @member {string} [wide] URI to wide icon. - * @member {string} [medium] URI to medium icon. - * @member {string} [small] URI to small icon. - * @member {string} [hero] URI to hero icon. + * @property {string} [large] URI to large icon. + * @property {string} [wide] URI to wide icon. + * @property {string} [medium] URI to medium icon. + * @property {string} [small] URI to small icon. + * @property {string} [hero] URI to hero icon. */ constructor() { } diff --git a/lib/services/azurestackManagement/lib/models/index.d.ts b/lib/services/azurestackManagement/lib/models/index.d.ts index 8b3056f640..9a302eb477 100644 --- a/lib/services/azurestackManagement/lib/models/index.d.ts +++ b/lib/services/azurestackManagement/lib/models/index.d.ts @@ -1,416 +1,486 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * 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'; +import { BaseResource, CloudError } from "ms-rest-azure"; +import * as moment from "moment"; -export { BaseResource } from 'ms-rest-azure'; -export { CloudError } from 'ms-rest-azure'; +export { + BaseResource, + CloudError +}; /** - * @class - * Initializes a new instance of the Resource class. - * @constructor * Base resource object. - * - * @member {string} [id] ID of the resource. - * @member {string} [name] Name of the resource. - * @member {string} [type] Type of Resource. - * @member {object} [tags] Custom tags for the resource. - * @member {string} [etag] The entity tag used for optimistic concurency when - * modifying the resource. */ export interface Resource extends BaseResource { + /** + * ID of the resource. + */ + readonly id?: string; + /** + * Name of the resource. + */ + readonly name?: string; + /** + * Type of Resource. + */ + readonly type?: string; + /** + * The entity tag used for optimistic concurrency when modifying the resource. + */ + etag?: string; +} + +/** + * Base resource object. + */ +export interface TrackedResource extends BaseResource { + /** + * ID of the resource. + */ readonly id?: string; + /** + * Name of the resource. + */ readonly name?: string; + /** + * Type of Resource. + */ readonly type?: string; + /** + * Custom tags for the resource. + */ tags?: { [propertyName: string]: string }; + /** + * The entity tag used for optimistic concurrency when modifying the resource. + */ etag?: string; } /** - * @class - * Initializes a new instance of the Display class. - * @constructor - * Contains the localized display information for this particular operation or - * action. - * - * @member {string} [provider] The localized, friendly version of the resource - * provider name. - * @member {string} [resource] The localized, friendly version of the resource - * type related to this action or operation; the resource type should match the - * public documentation for the resource provider. - * @member {string} [operation] The localized, friendly name for the operation. - * Use the name as it will displayed to the user. - * @member {string} [description] The localized, friendly description for the - * operation. The description will be displayed to the user. It should be - * thorough and concise for used in both tooltips and detailed views. + * Contains the localized display information for this particular operation or action. */ export interface Display { + /** + * The localized, friendly version of the resource provider name. + */ provider?: string; + /** + * The localized, friendly version of the resource type related to this action or operation; the + * resource type should match the public documentation for the resource provider. + */ resource?: string; + /** + * The localized, friendly name for the operation. Use the name as it will displayed to the user. + */ operation?: string; + /** + * The localized, friendly description for the operation. The description will be displayed to + * the user. It should be thorough and concise for used in both tooltips and detailed views. + */ description?: string; } /** - * @class - * Initializes a new instance of the Operation class. - * @constructor * Describes the supported REST operation. - * - * @member {string} [name] The name of the operation being performed on this - * particular object. - * @member {object} [display] Contains the localized display information for - * this particular operation or action. - * @member {string} [display.provider] The localized, friendly version of the - * resource provider name. - * @member {string} [display.resource] The localized, friendly version of the - * resource type related to this action or operation; the resource type should - * match the public documentation for the resource provider. - * @member {string} [display.operation] The localized, friendly name for the - * operation. Use the name as it will displayed to the user. - * @member {string} [display.description] The localized, friendly description - * for the operation. The description will be displayed to the user. It should - * be thorough and concise for used in both tooltips and detailed views. - * @member {string} [origin] The intended executor of the operation. */ export interface Operation { + /** + * The name of the operation being performed on this particular object. + */ name?: string; + /** + * Contains the localized display information for this particular operation or action. + */ display?: Display; + /** + * The intended executor of the operation. + */ origin?: string; } /** - * @class - * Initializes a new instance of the OsDiskImage class. - * @constructor + * The details of the error. + */ +export interface ErrorDetails { + /** + * Error code. + */ + readonly code?: string; + /** + * Error message indicating why the operation failed. + */ + readonly message?: string; + /** + * The target of the particular error. + */ + readonly target?: string; +} + +/** + * Error response indicates that the service is not able to process the incoming request. The + * reason is provided in the error message. + */ +export interface ErrorResponse { + /** + * The details of the error. + */ + error?: ErrorDetails; +} + +/** * OS disk image. - * - * @member {string} [operatingSystem] OS operating system type. Possible values - * include: 'None', 'Windows', 'Linux' - * @member {string} [sourceBlobSasUri] SAS key for source blob. */ export interface OsDiskImage { + /** + * OS operating system type. Possible values include: 'None', 'Windows', 'Linux' + */ readonly operatingSystem?: string; + /** + * SAS key for source blob. + */ readonly sourceBlobSasUri?: string; } /** - * @class - * Initializes a new instance of the DataDiskImage class. - * @constructor * Data disk image. - * - * @member {number} [lun] The LUN. - * @member {string} [sourceBlobSasUri] SAS key for source blob. */ export interface DataDiskImage { + /** + * The LUN. + */ readonly lun?: number; + /** + * SAS key for source blob. + */ readonly sourceBlobSasUri?: string; } /** - * @class - * Initializes a new instance of the ExtendedProduct class. - * @constructor - * Extended description about the product required for installing it into Azure - * Stack. - * - * @member {string} [galleryPackageBlobSasUri] The URI to the .azpkg file that - * provides information required for showing product in the gallery. - * @member {string} [productKind] Specifies the kind of the product - * (virtualMachine or virtualMachineExtension). - * @member {string} [computeRole] Specifies kind of compute role inclided in - * the package. Possible values include: 'None', 'IaaS', 'PaaS' - * @member {boolean} [isSystemExtension] Specifies if product is a Virtual - * Machine Extension. - * @member {string} [uri] The URI. - * @member {boolean} [supportMultipleExtensions] Indicates if specified product - * supports multiple extensions. - * @member {string} [version] Specifies product version. - * @member {string} [vmOsType] Specifies operating system used by the product. - * Possible values include: 'None', 'Windows', 'Linux' - * @member {boolean} [vmScaleSetEnabled] Indicates if virtual machine Scale Set - * is enabled in the specified product. - * @member {object} [osDiskImage] OS disk image used by product. - * @member {string} [osDiskImage.operatingSystem] OS operating system type. - * Possible values include: 'None', 'Windows', 'Linux' - * @member {string} [osDiskImage.sourceBlobSasUri] SAS key for source blob. - * @member {array} [dataDiskImages] List of attached data disks. + * Extended description about the product required for installing it into Azure Stack. */ export interface ExtendedProduct { + /** + * The URI to the .azpkg file that provides information required for showing product in the + * gallery. + */ readonly galleryPackageBlobSasUri?: string; + /** + * Specifies the kind of the product (virtualMachine or virtualMachineExtension). + */ readonly productKind?: string; + /** + * Specifies kind of compute role included in the package. Possible values include: 'None', + * 'IaaS', 'PaaS' + */ readonly computeRole?: string; + /** + * Specifies if product is a Virtual Machine Extension. + */ readonly isSystemExtension?: boolean; + /** + * The URI. + */ readonly uri?: string; + /** + * Indicates if specified product supports multiple extensions. + */ readonly supportMultipleExtensions?: boolean; + /** + * Specifies product version. + */ readonly version?: string; + /** + * Specifies operating system used by the product. Possible values include: 'None', 'Windows', + * 'Linux' + */ readonly vmOsType?: string; + /** + * Indicates if virtual machine Scale Set is enabled in the specified product. + */ readonly vmScaleSetEnabled?: boolean; + /** + * OS disk image used by product. + */ readonly osDiskImage?: OsDiskImage; + /** + * List of attached data disks. + */ readonly dataDiskImages?: DataDiskImage[]; } /** - * @class - * Initializes a new instance of the VirtualMachineExtensionProductProperties class. - * @constructor * Product information. - * - * @member {string} [computeRole] Specifies kind of compute role inclided in - * the package. Possible values include: 'None', 'IaaS', 'PaaS' - * @member {boolean} [isSystemExtension] Specifies if product is a Virtual - * Machine Extension. - * @member {string} [uri] The URI. - * @member {boolean} [supportMultipleExtensions] Indicates if specified product - * supports multiple extensions. - * @member {string} [version] Specifies product version. - * @member {string} [vmOsType] Specifies operating system used by the product. - * Possible values include: 'None', 'Windows', 'Linux' - * @member {boolean} [vmScaleSetEnabled] Indicates if virtual machine Scale Set - * is enabled in the specified product. */ export interface VirtualMachineExtensionProductProperties { + /** + * Specifies kind of compute role included in the package. Possible values include: 'None', + * 'IaaS', 'PaaS' + */ readonly computeRole?: string; + /** + * Specifies if product is a Virtual Machine Extension. + */ readonly isSystemExtension?: boolean; + /** + * The URI. + */ readonly uri?: string; + /** + * Indicates if specified product supports multiple extensions. + */ readonly supportMultipleExtensions?: boolean; + /** + * Specifies product version. + */ readonly version?: string; + /** + * Specifies operating system used by the product. Possible values include: 'None', 'Windows', + * 'Linux' + */ readonly vmOsType?: string; + /** + * Indicates if virtual machine Scale Set is enabled in the specified product. + */ readonly vmScaleSetEnabled?: boolean; } /** - * @class - * Initializes a new instance of the VirtualMachineProductProperties class. - * @constructor * Product information. - * - * @member {string} [version] Specifies product version. - * @member {object} [osDiskImage] OS disk image used by product. - * @member {string} [osDiskImage.operatingSystem] OS operating system type. - * Possible values include: 'None', 'Windows', 'Linux' - * @member {string} [osDiskImage.sourceBlobSasUri] SAS key for source blob. - * @member {array} [dataDiskImages] List of attached data disks. */ export interface VirtualMachineProductProperties { + /** + * Specifies product version. + */ readonly version?: string; + /** + * OS disk image used by product. + */ readonly osDiskImage?: OsDiskImage; + /** + * List of attached data disks. + */ readonly dataDiskImages?: DataDiskImage[]; } /** - * @class - * Initializes a new instance of the IconUris class. - * @constructor * Links to product icons. - * - * @member {string} [large] URI to large icon. - * @member {string} [wide] URI to wide icon. - * @member {string} [medium] URI to medium icon. - * @member {string} [small] URI to small icon. - * @member {string} [hero] URI to hero icon. */ export interface IconUris { + /** + * URI to large icon. + */ large?: string; + /** + * URI to wide icon. + */ wide?: string; + /** + * URI to medium icon. + */ medium?: string; + /** + * URI to small icon. + */ small?: string; + /** + * URI to hero icon. + */ hero?: string; } /** - * @class - * Initializes a new instance of the ProductLink class. - * @constructor * Link with additional information about a product. - * - * @member {string} [displayName] The description of the link. - * @member {string} [uri] The URI corresponding to the link. */ export interface ProductLink { + /** + * The description of the link. + */ displayName?: string; + /** + * The URI corresponding to the link. + */ uri?: string; } /** - * @class - * Initializes a new instance of the ProductProperties class. - * @constructor * Additional properties of the product - * - * @member {string} [version] The version. */ export interface ProductProperties { + /** + * The version. + */ version?: string; } /** - * @class - * Initializes a new instance of the Product class. - * @constructor * Product information. - * - * @member {string} [displayName] The display name of the product. - * @member {string} [description] The description of the product. - * @member {string} [publisherDisplayName] The user-friendly name of the - * product publisher. - * @member {string} [publisherIdentifier] Publisher identifier. - * @member {string} [offer] The offer representing the product. - * @member {string} [offerVersion] The version of the product offer. - * @member {string} [sku] The product SKU. - * @member {string} [billingPartNumber] The part number used for billing - * purposes. - * @member {string} [vmExtensionType] The type of the Virtual Machine - * Extension. - * @member {string} [galleryItemIdentity] The identifier of the gallery item - * corresponding to the product. - * @member {object} [iconUris] Additional links available for this product. - * @member {string} [iconUris.large] URI to large icon. - * @member {string} [iconUris.wide] URI to wide icon. - * @member {string} [iconUris.medium] URI to medium icon. - * @member {string} [iconUris.small] URI to small icon. - * @member {string} [iconUris.hero] URI to hero icon. - * @member {array} [links] Additional links available for this product. - * @member {string} [legalTerms] The legal terms. - * @member {string} [privacyPolicy] The privacy policy. - * @member {number} [payloadLength] The length of product content. - * @member {string} [productKind] The kind of the product (virtualMachine or - * virtualMachineExtension) - * @member {object} [productProperties] Additional properties for the product. - * @member {string} [productProperties.version] The version. */ export interface Product extends Resource { + /** + * The display name of the product. + */ displayName?: string; + /** + * The description of the product. + */ description?: string; + /** + * The user-friendly name of the product publisher. + */ publisherDisplayName?: string; + /** + * Publisher identifier. + */ publisherIdentifier?: string; + /** + * The offer representing the product. + */ offer?: string; + /** + * The version of the product offer. + */ offerVersion?: string; + /** + * The product SKU. + */ sku?: string; + /** + * The part number used for billing purposes. + */ billingPartNumber?: string; + /** + * The type of the Virtual Machine Extension. + */ vmExtensionType?: string; + /** + * The identifier of the gallery item corresponding to the product. + */ galleryItemIdentity?: string; + /** + * Additional links available for this product. + */ iconUris?: IconUris; + /** + * Additional links available for this product. + */ links?: ProductLink[]; + /** + * The legal terms. + */ legalTerms?: string; + /** + * The privacy policy. + */ privacyPolicy?: string; + /** + * The length of product content. + */ payloadLength?: number; + /** + * The kind of the product (virtualMachine or virtualMachineExtension) + */ productKind?: string; + /** + * Additional properties for the product. + */ productProperties?: ProductProperties; } /** - * @class - * Initializes a new instance of the Registration class. - * @constructor * Registration information. - * - * @member {string} [objectId] The object identifier associated with the Azure - * Stack connecting to Azure. - * @member {string} [cloudId] The identifier of the registered Azure Stack. - * @member {string} [billingModel] Specifies the billing mode for the Azure - * Stack registration. */ -export interface Registration extends Resource { +export interface Registration extends TrackedResource { + /** + * The object identifier associated with the Azure Stack connecting to Azure. + */ objectId?: string; + /** + * The identifier of the registered Azure Stack. + */ cloudId?: string; + /** + * Specifies the billing mode for the Azure Stack registration. + */ billingModel?: string; } /** - * @class - * Initializes a new instance of the ActivationKeyResult class. - * @constructor * The resource containing the Azure Stack activation key. - * - * @member {string} [activationKey] Azure Stack activation key. */ export interface ActivationKeyResult { + /** + * Azure Stack activation key. + */ activationKey?: string; } /** - * @class - * Initializes a new instance of the RegistrationParameter class. - * @constructor * Registration resource - * - * @member {string} registrationToken The token identifying registered Azure - * Stack */ -export interface RegistrationParameter extends Resource { +export interface RegistrationParameter { + /** + * The token identifying registered Azure Stack + */ registrationToken: string; + /** + * Location of the resource. Possible values include: 'global' + */ + location?: string; } /** - * @class - * Initializes a new instance of the CustomerSubscription class. - * @constructor - * Customer subcription. - * - * @member {string} [tenantId] Tenant Id. + * Customer subscription. */ export interface CustomerSubscription extends Resource { + /** + * Tenant Id. + */ tenantId?: string; } - /** - * @class - * Initializes a new instance of the OperationList class. - * @constructor * List of Operations - * - * @member {string} [nextLink] URI to the next page of operations. */ export interface OperationList extends Array { + /** + * URI to the next page of operations. + */ nextLink?: string; } /** - * @class - * Initializes a new instance of the ProductList class. - * @constructor * Pageable list of products. - * - * @member {string} [nextLink] URI to the next page. */ export interface ProductList extends Array { + /** + * URI to the next page. + */ nextLink?: string; } /** - * @class - * Initializes a new instance of the RegistrationList class. - * @constructor * Pageable list of registrations. - * - * @member {string} [nextLink] URI to the next page. */ export interface RegistrationList extends Array { + /** + * URI to the next page. + */ nextLink?: string; } /** - * @class - * Initializes a new instance of the CustomerSubscriptionList class. - * @constructor * Pageable list of customer subscriptions. - * - * @member {string} [nextLink] URI to the next page. */ export interface CustomerSubscriptionList extends Array { + /** + * URI to the next page. + */ nextLink?: string; } diff --git a/lib/services/azurestackManagement/lib/models/index.js b/lib/services/azurestackManagement/lib/models/index.js index a8f5c8e4b5..0a18f2f7d1 100644 --- a/lib/services/azurestackManagement/lib/models/index.js +++ b/lib/services/azurestackManagement/lib/models/index.js @@ -19,8 +19,11 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; exports.Resource = require('./resource'); +exports.TrackedResource = require('./trackedResource'); exports.Display = require('./display'); exports.Operation = require('./operation'); +exports.ErrorDetails = require('./errorDetails'); +exports.ErrorResponse = require('./errorResponse'); exports.OsDiskImage = require('./osDiskImage'); exports.DataDiskImage = require('./dataDiskImage'); exports.ExtendedProduct = require('./extendedProduct'); diff --git a/lib/services/azurestackManagement/lib/models/operation.js b/lib/services/azurestackManagement/lib/models/operation.js index 6cf7998034..a407fcb422 100644 --- a/lib/services/azurestackManagement/lib/models/operation.js +++ b/lib/services/azurestackManagement/lib/models/operation.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Describes the supported REST operation. * @@ -19,22 +17,22 @@ const models = require('./index'); class Operation { /** * Create a Operation. - * @member {string} [name] The name of the operation being performed on this - * particular object. - * @member {object} [display] Contains the localized display information for - * this particular operation or action. - * @member {string} [display.provider] The localized, friendly version of the - * resource provider name. - * @member {string} [display.resource] The localized, friendly version of the - * resource type related to this action or operation; the resource type + * @property {string} [name] The name of the operation being performed on + * this particular object. + * @property {object} [display] Contains the localized display information + * for this particular operation or action. + * @property {string} [display.provider] The localized, friendly version of + * the resource provider name. + * @property {string} [display.resource] The localized, friendly version of + * the resource type related to this action or operation; the resource type * should match the public documentation for the resource provider. - * @member {string} [display.operation] The localized, friendly name for the - * operation. Use the name as it will displayed to the user. - * @member {string} [display.description] The localized, friendly description - * for the operation. The description will be displayed to the user. It - * should be thorough and concise for used in both tooltips and detailed - * views. - * @member {string} [origin] The intended executor of the operation. + * @property {string} [display.operation] The localized, friendly name for + * the operation. Use the name as it will displayed to the user. + * @property {string} [display.description] The localized, friendly + * description for the operation. The description will be displayed to the + * user. It should be thorough and concise for used in both tooltips and + * detailed views. + * @property {string} [origin] The intended executor of the operation. */ constructor() { } diff --git a/lib/services/azurestackManagement/lib/models/operationList.js b/lib/services/azurestackManagement/lib/models/operationList.js index 937dc3f4de..7a1de97b30 100644 --- a/lib/services/azurestackManagement/lib/models/operationList.js +++ b/lib/services/azurestackManagement/lib/models/operationList.js @@ -16,7 +16,7 @@ class OperationList extends Array { /** * Create a OperationList. - * @member {string} [nextLink] URI to the next page of operations. + * @property {string} [nextLink] URI to the next page of operations. */ constructor() { super(); diff --git a/lib/services/azurestackManagement/lib/models/osDiskImage.js b/lib/services/azurestackManagement/lib/models/osDiskImage.js index b2c22b2962..a1ce128a7b 100644 --- a/lib/services/azurestackManagement/lib/models/osDiskImage.js +++ b/lib/services/azurestackManagement/lib/models/osDiskImage.js @@ -17,9 +17,9 @@ class OsDiskImage { /** * Create a OsDiskImage. - * @member {string} [operatingSystem] OS operating system type. Possible + * @property {string} [operatingSystem] OS operating system type. Possible * values include: 'None', 'Windows', 'Linux' - * @member {string} [sourceBlobSasUri] SAS key for source blob. + * @property {string} [sourceBlobSasUri] SAS key for source blob. */ constructor() { } diff --git a/lib/services/azurestackManagement/lib/models/product.js b/lib/services/azurestackManagement/lib/models/product.js index 6c6f9e30b8..6af83de06e 100644 --- a/lib/services/azurestackManagement/lib/models/product.js +++ b/lib/services/azurestackManagement/lib/models/product.js @@ -20,35 +20,35 @@ const models = require('./index'); class Product extends models['Resource'] { /** * Create a Product. - * @member {string} [displayName] The display name of the product. - * @member {string} [description] The description of the product. - * @member {string} [publisherDisplayName] The user-friendly name of the + * @property {string} [displayName] The display name of the product. + * @property {string} [description] The description of the product. + * @property {string} [publisherDisplayName] The user-friendly name of the * product publisher. - * @member {string} [publisherIdentifier] Publisher identifier. - * @member {string} [offer] The offer representing the product. - * @member {string} [offerVersion] The version of the product offer. - * @member {string} [sku] The product SKU. - * @member {string} [billingPartNumber] The part number used for billing + * @property {string} [publisherIdentifier] Publisher identifier. + * @property {string} [offer] The offer representing the product. + * @property {string} [offerVersion] The version of the product offer. + * @property {string} [sku] The product SKU. + * @property {string} [billingPartNumber] The part number used for billing * purposes. - * @member {string} [vmExtensionType] The type of the Virtual Machine + * @property {string} [vmExtensionType] The type of the Virtual Machine * Extension. - * @member {string} [galleryItemIdentity] The identifier of the gallery item - * corresponding to the product. - * @member {object} [iconUris] Additional links available for this product. - * @member {string} [iconUris.large] URI to large icon. - * @member {string} [iconUris.wide] URI to wide icon. - * @member {string} [iconUris.medium] URI to medium icon. - * @member {string} [iconUris.small] URI to small icon. - * @member {string} [iconUris.hero] URI to hero icon. - * @member {array} [links] Additional links available for this product. - * @member {string} [legalTerms] The legal terms. - * @member {string} [privacyPolicy] The privacy policy. - * @member {number} [payloadLength] The length of product content. - * @member {string} [productKind] The kind of the product (virtualMachine or - * virtualMachineExtension) - * @member {object} [productProperties] Additional properties for the + * @property {string} [galleryItemIdentity] The identifier of the gallery + * item corresponding to the product. + * @property {object} [iconUris] Additional links available for this product. + * @property {string} [iconUris.large] URI to large icon. + * @property {string} [iconUris.wide] URI to wide icon. + * @property {string} [iconUris.medium] URI to medium icon. + * @property {string} [iconUris.small] URI to small icon. + * @property {string} [iconUris.hero] URI to hero icon. + * @property {array} [links] Additional links available for this product. + * @property {string} [legalTerms] The legal terms. + * @property {string} [privacyPolicy] The privacy policy. + * @property {number} [payloadLength] The length of product content. + * @property {string} [productKind] The kind of the product (virtualMachine + * or virtualMachineExtension) + * @property {object} [productProperties] Additional properties for the * product. - * @member {string} [productProperties.version] The version. + * @property {string} [productProperties.version] The version. */ constructor() { super(); @@ -92,29 +92,6 @@ class Product extends models['Resource'] { name: 'String' } }, - location: { - required: true, - isConstant: true, - serializedName: 'location', - defaultValue: 'global', - type: { - name: 'String' - } - }, - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, etag: { required: false, serializedName: 'etag', diff --git a/lib/services/azurestackManagement/lib/models/productLink.js b/lib/services/azurestackManagement/lib/models/productLink.js index 08ded046b0..3e0b8b8e99 100644 --- a/lib/services/azurestackManagement/lib/models/productLink.js +++ b/lib/services/azurestackManagement/lib/models/productLink.js @@ -17,8 +17,8 @@ class ProductLink { /** * Create a ProductLink. - * @member {string} [displayName] The description of the link. - * @member {string} [uri] The URI corresponding to the link. + * @property {string} [displayName] The description of the link. + * @property {string} [uri] The URI corresponding to the link. */ constructor() { } diff --git a/lib/services/azurestackManagement/lib/models/productList.js b/lib/services/azurestackManagement/lib/models/productList.js index 5857ba3970..ad0afb98e9 100644 --- a/lib/services/azurestackManagement/lib/models/productList.js +++ b/lib/services/azurestackManagement/lib/models/productList.js @@ -16,7 +16,7 @@ class ProductList extends Array { /** * Create a ProductList. - * @member {string} [nextLink] URI to the next page. + * @property {string} [nextLink] URI to the next page. */ constructor() { super(); diff --git a/lib/services/azurestackManagement/lib/models/productProperties.js b/lib/services/azurestackManagement/lib/models/productProperties.js index dce2b9e71e..4d10f2cf7a 100644 --- a/lib/services/azurestackManagement/lib/models/productProperties.js +++ b/lib/services/azurestackManagement/lib/models/productProperties.js @@ -17,7 +17,7 @@ class ProductProperties { /** * Create a ProductProperties. - * @member {string} [version] The version. + * @property {string} [version] The version. */ constructor() { } diff --git a/lib/services/azurestackManagement/lib/models/registration.js b/lib/services/azurestackManagement/lib/models/registration.js index 57d449361b..c003f56099 100644 --- a/lib/services/azurestackManagement/lib/models/registration.js +++ b/lib/services/azurestackManagement/lib/models/registration.js @@ -15,15 +15,15 @@ const models = require('./index'); /** * Registration information. * - * @extends models['Resource'] + * @extends models['TrackedResource'] */ -class Registration extends models['Resource'] { +class Registration extends models['TrackedResource'] { /** * Create a Registration. - * @member {string} [objectId] The object identifier associated with the + * @property {string} [objectId] The object identifier associated with the * Azure Stack connecting to Azure. - * @member {string} [cloudId] The identifier of the registered Azure Stack. - * @member {string} [billingModel] Specifies the billing mode for the Azure + * @property {string} [cloudId] The identifier of the registered Azure Stack. + * @property {string} [billingModel] Specifies the billing mode for the Azure * Stack registration. */ constructor() { diff --git a/lib/services/azurestackManagement/lib/models/registrationList.js b/lib/services/azurestackManagement/lib/models/registrationList.js index 62c02234a5..2da176dad3 100644 --- a/lib/services/azurestackManagement/lib/models/registrationList.js +++ b/lib/services/azurestackManagement/lib/models/registrationList.js @@ -16,7 +16,7 @@ class RegistrationList extends Array { /** * Create a RegistrationList. - * @member {string} [nextLink] URI to the next page. + * @property {string} [nextLink] URI to the next page. */ constructor() { super(); diff --git a/lib/services/azurestackManagement/lib/models/registrationParameter.js b/lib/services/azurestackManagement/lib/models/registrationParameter.js index 207300dfdf..b1515afb42 100644 --- a/lib/services/azurestackManagement/lib/models/registrationParameter.js +++ b/lib/services/azurestackManagement/lib/models/registrationParameter.js @@ -10,21 +10,19 @@ 'use strict'; -const models = require('./index'); - /** * Registration resource * - * @extends models['Resource'] */ -class RegistrationParameter extends models['Resource'] { +class RegistrationParameter { /** * Create a RegistrationParameter. - * @member {string} registrationToken The token identifying registered Azure - * Stack + * @property {string} registrationToken The token identifying registered + * Azure Stack + * @property {string} [location] Location of the resource. Possible values + * include: 'global' */ constructor() { - super(); } /** @@ -41,63 +39,16 @@ class RegistrationParameter extends models['Resource'] { name: 'Composite', className: 'RegistrationParameter', modelProperties: { - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - type: { - required: false, - readOnly: true, - serializedName: 'type', - type: { - name: 'String' - } - }, - location: { + registrationToken: { required: true, - isConstant: true, - serializedName: 'location', - defaultValue: 'global', + serializedName: 'properties.registrationToken', type: { name: 'String' } }, - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - etag: { + location: { required: false, - serializedName: 'etag', - type: { - name: 'String' - } - }, - registrationToken: { - required: true, - serializedName: 'properties.registrationToken', + serializedName: 'location', type: { name: 'String' } diff --git a/lib/services/azurestackManagement/lib/models/resource.js b/lib/services/azurestackManagement/lib/models/resource.js index dd1cc93fe1..de09ef98cf 100644 --- a/lib/services/azurestackManagement/lib/models/resource.js +++ b/lib/services/azurestackManagement/lib/models/resource.js @@ -20,12 +20,11 @@ const models = require('./index'); class Resource extends models['BaseResource'] { /** * Create a Resource. - * @member {string} [id] ID of the resource. - * @member {string} [name] Name of the resource. - * @member {string} [type] Type of Resource. - * @member {object} [tags] Custom tags for the resource. - * @member {string} [etag] The entity tag used for optimistic concurency when - * modifying the resource. + * @property {string} [id] ID of the resource. + * @property {string} [name] Name of the resource. + * @property {string} [type] Type of Resource. + * @property {string} [etag] The entity tag used for optimistic concurrency + * when modifying the resource. */ constructor() { super(); @@ -69,29 +68,6 @@ class Resource extends models['BaseResource'] { name: 'String' } }, - location: { - required: true, - isConstant: true, - serializedName: 'location', - defaultValue: 'global', - type: { - name: 'String' - } - }, - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, etag: { required: false, serializedName: 'etag', diff --git a/lib/services/azurestackManagement/lib/models/trackedResource.js b/lib/services/azurestackManagement/lib/models/trackedResource.js new file mode 100644 index 0000000000..b42612853d --- /dev/null +++ b/lib/services/azurestackManagement/lib/models/trackedResource.js @@ -0,0 +1,108 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Base resource object. + * + * @extends models['BaseResource'] + */ +class TrackedResource extends models['BaseResource'] { + /** + * Create a TrackedResource. + * @property {string} [id] ID of the resource. + * @property {string} [name] Name of the resource. + * @property {string} [type] Type of Resource. + * @property {object} [tags] Custom tags for the resource. + * @property {string} [etag] The entity tag used for optimistic concurrency + * when modifying the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of TrackedResource + * + * @returns {object} metadata of TrackedResource + * + */ + mapper() { + return { + required: false, + serializedName: 'TrackedResource', + type: { + name: 'Composite', + className: 'TrackedResource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: true, + isConstant: true, + serializedName: 'location', + defaultValue: 'global', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TrackedResource; diff --git a/lib/services/azurestackManagement/lib/models/virtualMachineExtensionProductProperties.js b/lib/services/azurestackManagement/lib/models/virtualMachineExtensionProductProperties.js index a6f810cdbd..ddd782ab35 100644 --- a/lib/services/azurestackManagement/lib/models/virtualMachineExtensionProductProperties.js +++ b/lib/services/azurestackManagement/lib/models/virtualMachineExtensionProductProperties.js @@ -17,17 +17,17 @@ class VirtualMachineExtensionProductProperties { /** * Create a VirtualMachineExtensionProductProperties. - * @member {string} [computeRole] Specifies kind of compute role inclided in - * the package. Possible values include: 'None', 'IaaS', 'PaaS' - * @member {boolean} [isSystemExtension] Specifies if product is a Virtual + * @property {string} [computeRole] Specifies kind of compute role included + * in the package. Possible values include: 'None', 'IaaS', 'PaaS' + * @property {boolean} [isSystemExtension] Specifies if product is a Virtual * Machine Extension. - * @member {string} [uri] The URI. - * @member {boolean} [supportMultipleExtensions] Indicates if specified + * @property {string} [uri] The URI. + * @property {boolean} [supportMultipleExtensions] Indicates if specified * product supports multiple extensions. - * @member {string} [version] Specifies product version. - * @member {string} [vmOsType] Specifies operating system used by the + * @property {string} [version] Specifies product version. + * @property {string} [vmOsType] Specifies operating system used by the * product. Possible values include: 'None', 'Windows', 'Linux' - * @member {boolean} [vmScaleSetEnabled] Indicates if virtual machine Scale + * @property {boolean} [vmScaleSetEnabled] Indicates if virtual machine Scale * Set is enabled in the specified product. */ constructor() { diff --git a/lib/services/azurestackManagement/lib/models/virtualMachineProductProperties.js b/lib/services/azurestackManagement/lib/models/virtualMachineProductProperties.js index d3664648fb..7eff8e0acc 100644 --- a/lib/services/azurestackManagement/lib/models/virtualMachineProductProperties.js +++ b/lib/services/azurestackManagement/lib/models/virtualMachineProductProperties.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Product information. * @@ -19,12 +17,12 @@ const models = require('./index'); class VirtualMachineProductProperties { /** * Create a VirtualMachineProductProperties. - * @member {string} [version] Specifies product version. - * @member {object} [osDiskImage] OS disk image used by product. - * @member {string} [osDiskImage.operatingSystem] OS operating system type. + * @property {string} [version] Specifies product version. + * @property {object} [osDiskImage] OS disk image used by product. + * @property {string} [osDiskImage.operatingSystem] OS operating system type. * Possible values include: 'None', 'Windows', 'Linux' - * @member {string} [osDiskImage.sourceBlobSasUri] SAS key for source blob. - * @member {array} [dataDiskImages] List of attached data disks. + * @property {string} [osDiskImage.sourceBlobSasUri] SAS key for source blob. + * @property {array} [dataDiskImages] List of attached data disks. */ constructor() { } diff --git a/lib/services/azurestackManagement/lib/operations/customerSubscriptions.js b/lib/services/azurestackManagement/lib/operations/customerSubscriptions.js index 8f4b9762d5..9f9bd981ea 100644 --- a/lib/services/azurestackManagement/lib/operations/customerSubscriptions.js +++ b/lib/services/azurestackManagement/lib/operations/customerSubscriptions.js @@ -110,7 +110,7 @@ function _list(resourceGroup, registrationName, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 404) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -120,12 +120,13 @@ function _list(resourceGroup, registrationName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -261,7 +262,7 @@ function _get(resourceGroup, registrationName, customerSubscriptionName, options return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 404) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -271,12 +272,13 @@ function _get(resourceGroup, registrationName, customerSubscriptionName, options 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -458,11 +460,8 @@ function _deleteMethod(resourceGroup, registrationName, customerSubscriptionName * * @param {string} [customerCreationParameters.tenantId] Tenant Id. * - * @param {object} [customerCreationParameters.tags] Custom tags for the - * resource. - * * @param {string} [customerCreationParameters.etag] The entity tag used for - * optimistic concurency when modifying the resource. + * optimistic concurrency when modifying the resource. * * @param {object} [options] Optional Parameters. * @@ -701,7 +700,7 @@ function _listNext(nextPageLink, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 404) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -711,12 +710,13 @@ function _listNext(nextPageLink, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1046,11 +1046,8 @@ class CustomerSubscriptions { * * @param {string} [customerCreationParameters.tenantId] Tenant Id. * - * @param {object} [customerCreationParameters.tags] Custom tags for the - * resource. - * * @param {string} [customerCreationParameters.etag] The entity tag used for - * optimistic concurency when modifying the resource. + * optimistic concurrency when modifying the resource. * * @param {object} [options] Optional Parameters. * @@ -1091,11 +1088,8 @@ class CustomerSubscriptions { * * @param {string} [customerCreationParameters.tenantId] Tenant Id. * - * @param {object} [customerCreationParameters.tags] Custom tags for the - * resource. - * * @param {string} [customerCreationParameters.etag] The entity tag used for - * optimistic concurency when modifying the resource. + * optimistic concurrency when modifying the resource. * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/azurestackManagement/lib/operations/index.d.ts b/lib/services/azurestackManagement/lib/operations/index.d.ts index acc1323ba9..f9431431f7 100644 --- a/lib/services/azurestackManagement/lib/operations/index.d.ts +++ b/lib/services/azurestackManagement/lib/operations/index.d.ts @@ -573,10 +573,8 @@ export interface Registrations { * @param {string} token.registrationToken The token identifying registered * Azure Stack * - * @param {object} [token.tags] Custom tags for the resource. - * - * @param {string} [token.etag] The entity tag used for optimistic concurency - * when modifying the resource. + * @param {string} [token.location] Location of the resource. Possible values + * include: 'global' * * @param {object} [options] Optional Parameters. * @@ -603,10 +601,8 @@ export interface Registrations { * @param {string} token.registrationToken The token identifying registered * Azure Stack * - * @param {object} [token.tags] Custom tags for the resource. - * - * @param {string} [token.etag] The entity tag used for optimistic concurency - * when modifying the resource. + * @param {string} [token.location] Location of the resource. Possible values + * include: 'global' * * @param {object} [options] Optional Parameters. * @@ -640,6 +636,81 @@ export interface Registrations { createOrUpdate(resourceGroup: string, registrationName: string, token: models.RegistrationParameter, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Patch an Azure Stack registration. + * + * @param {string} resourceGroup Name of the resource group. + * + * @param {string} registrationName Name of the Azure Stack registration. + * + * @param {object} token Registration token + * + * @param {string} token.registrationToken The token identifying registered + * Azure Stack + * + * @param {string} [token.location] Location of the resource. Possible values + * include: 'global' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroup: string, registrationName: string, token: models.RegistrationParameter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Patch an Azure Stack registration. + * + * @param {string} resourceGroup Name of the resource group. + * + * @param {string} registrationName Name of the Azure Stack registration. + * + * @param {object} token Registration token + * + * @param {string} token.registrationToken The token identifying registered + * Azure Stack + * + * @param {string} [token.location] Location of the resource. Possible values + * include: 'global' + * + * @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 {Registration} - 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. + * + * {Registration} [result] - The deserialized result object if an error did not occur. + * See {@link Registration} 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(resourceGroup: string, registrationName: string, token: models.RegistrationParameter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroup: string, registrationName: string, token: models.RegistrationParameter, callback: ServiceCallback): void; + update(resourceGroup: string, registrationName: string, token: models.RegistrationParameter, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Returns Azure Stack Activation Key. * @@ -964,11 +1035,8 @@ export interface CustomerSubscriptions { * * @param {string} [customerCreationParameters.tenantId] Tenant Id. * - * @param {object} [customerCreationParameters.tags] Custom tags for the - * resource. - * * @param {string} [customerCreationParameters.etag] The entity tag used for - * optimistic concurency when modifying the resource. + * optimistic concurrency when modifying the resource. * * @param {object} [options] Optional Parameters. * @@ -997,11 +1065,8 @@ export interface CustomerSubscriptions { * * @param {string} [customerCreationParameters.tenantId] Tenant Id. * - * @param {object} [customerCreationParameters.tags] Custom tags for the - * resource. - * * @param {string} [customerCreationParameters.etag] The entity tag used for - * optimistic concurency when modifying the resource. + * optimistic concurrency when modifying the resource. * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/azurestackManagement/lib/operations/products.js b/lib/services/azurestackManagement/lib/operations/products.js index 6a76e680b5..50ba88bda9 100644 --- a/lib/services/azurestackManagement/lib/operations/products.js +++ b/lib/services/azurestackManagement/lib/operations/products.js @@ -109,7 +109,7 @@ function _list(resourceGroup, registrationName, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 404) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -119,12 +119,13 @@ function _list(resourceGroup, registrationName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -260,7 +261,7 @@ function _get(resourceGroup, registrationName, productName, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 404) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -270,12 +271,13 @@ function _get(resourceGroup, registrationName, productName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -538,7 +540,7 @@ function _listNext(nextPageLink, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 404) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -548,12 +550,13 @@ function _listNext(nextPageLink, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { diff --git a/lib/services/azurestackManagement/lib/operations/registrations.js b/lib/services/azurestackManagement/lib/operations/registrations.js index 4b517e7af8..87192e7efb 100644 --- a/lib/services/azurestackManagement/lib/operations/registrations.js +++ b/lib/services/azurestackManagement/lib/operations/registrations.js @@ -103,7 +103,7 @@ function _list(resourceGroup, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 404) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -113,12 +113,13 @@ function _list(resourceGroup, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -248,7 +249,7 @@ function _get(resourceGroup, registrationName, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 404) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -258,12 +259,13 @@ function _get(resourceGroup, registrationName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -392,7 +394,7 @@ function _deleteMethod(resourceGroup, registrationName, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 204 && statusCode !== 404) { + if (statusCode !== 200 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -402,12 +404,13 @@ function _deleteMethod(resourceGroup, registrationName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -437,10 +440,8 @@ function _deleteMethod(resourceGroup, registrationName, options, callback) { * @param {string} token.registrationToken The token identifying registered * Azure Stack * - * @param {object} [token.tags] Custom tags for the resource. - * - * @param {string} [token.etag] The entity tag used for optimistic concurency - * when modifying the resource. + * @param {string} [token.location] Location of the resource. Possible values + * include: 'global' * * @param {object} [options] Optional Parameters. * @@ -614,6 +615,177 @@ function _createOrUpdate(resourceGroup, registrationName, token, options, callba }); } +/** + * Patch an Azure Stack registration. + * + * @param {string} resourceGroup Name of the resource group. + * + * @param {string} registrationName Name of the Azure Stack registration. + * + * @param {object} token Registration token + * + * @param {string} token.registrationToken The token identifying registered + * Azure Stack + * + * @param {string} [token.location] Location of the resource. Possible values + * include: 'global' + * + * @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 Registration} 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(resourceGroup, registrationName, token, 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 (resourceGroup === null || resourceGroup === undefined || typeof resourceGroup.valueOf() !== 'string') { + throw new Error('resourceGroup cannot be null or undefined and it must be of type string.'); + } + if (registrationName === null || registrationName === undefined || typeof registrationName.valueOf() !== 'string') { + throw new Error('registrationName 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 (token === null || token === undefined) { + throw new Error('token 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/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroup}', encodeURIComponent(resourceGroup)); + requestUrl = requestUrl.replace('{registrationName}', encodeURIComponent(registrationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (token !== null && token !== undefined) { + let requestModelMapper = new client.models['RegistrationParameter']().mapper(); + requestModel = client.serialize(requestModelMapper, token, 'token'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(token, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().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['Registration']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** * Returns Azure Stack Activation Key. * @@ -836,7 +1008,7 @@ function _listNext(nextPageLink, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 404) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -846,12 +1018,13 @@ function _listNext(nextPageLink, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -898,6 +1071,7 @@ class Registrations { this._get = _get; this._deleteMethod = _deleteMethod; this._createOrUpdate = _createOrUpdate; + this._update = _update; this._getActivationKey = _getActivationKey; this._listNext = _listNext; } @@ -1167,10 +1341,8 @@ class Registrations { * @param {string} token.registrationToken The token identifying registered * Azure Stack * - * @param {object} [token.tags] Custom tags for the resource. - * - * @param {string} [token.etag] The entity tag used for optimistic concurency - * when modifying the resource. + * @param {string} [token.location] Location of the resource. Possible values + * include: 'global' * * @param {object} [options] Optional Parameters. * @@ -1209,10 +1381,8 @@ class Registrations { * @param {string} token.registrationToken The token identifying registered * Azure Stack * - * @param {object} [token.tags] Custom tags for the resource. - * - * @param {string} [token.etag] The entity tag used for optimistic concurency - * when modifying the resource. + * @param {string} [token.location] Location of the resource. Possible values + * include: 'global' * * @param {object} [options] Optional Parameters. * @@ -1261,6 +1431,108 @@ class Registrations { } } + /** + * Patch an Azure Stack registration. + * + * @param {string} resourceGroup Name of the resource group. + * + * @param {string} registrationName Name of the Azure Stack registration. + * + * @param {object} token Registration token + * + * @param {string} token.registrationToken The token identifying registered + * Azure Stack + * + * @param {string} [token.location] Location of the resource. Possible values + * include: 'global' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroup, registrationName, token, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroup, registrationName, token, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Patch an Azure Stack registration. + * + * @param {string} resourceGroup Name of the resource group. + * + * @param {string} registrationName Name of the Azure Stack registration. + * + * @param {object} token Registration token + * + * @param {string} token.registrationToken The token identifying registered + * Azure Stack + * + * @param {string} [token.location] Location of the resource. Possible values + * include: 'global' + * + * @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 {Registration} - 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 Registration} 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(resourceGroup, registrationName, token, 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(resourceGroup, registrationName, token, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroup, registrationName, token, options, optionalCallback); + } + } + /** * Returns Azure Stack Activation Key. * diff --git a/lib/services/azurestackManagement/package.json b/lib/services/azurestackManagement/package.json index 91bdb3cf3a..592f23c65c 100644 --- a/lib/services/azurestackManagement/package.json +++ b/lib/services/azurestackManagement/package.json @@ -1,34 +1,25 @@ { "name": "azure-arm-azurestack", "author": "Microsoft Corporation", - "contributors": [ - "Gibson, Rikki ", - "Schulte, Dan ", - "Zavery, Amar " - ], + "description": "AzureStackManagementClient Library with typescript type definitions for node", "version": "1.1.0-preview", - "description": "Microsoft Azure Stack Management Client Library for node", - "tags": [ - "azure", - "sdk" - ], + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, "keywords": [ "node", "azure" ], + "license": "MIT", "main": "./lib/azureStackManagementClient.js", "types": "./lib/azureStackManagementClient.d.ts", - "license": "MIT", - "dependencies": { - "ms-rest-azure": "^2.5.5", - "ms-rest": "^2.3.2" - }, - "homepage": "http://github.com/Azure/azure-sdk-for-node", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/azurestackManagement", "repository": { "type": "git", - "url": "git@github.com:Azure/azure-sdk-for-node.git" + "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" + "url": "https://github.com/azure/azure-sdk-for-node/issues" } -} \ No newline at end of file +}