diff --git a/lib/services/deploymentmanagerManagement/LICENSE.txt b/lib/services/deploymentmanagerManagement/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/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/deploymentmanagerManagement/README.md b/lib/services/deploymentmanagerManagement/README.md new file mode 100644 index 0000000000..da08be589e --- /dev/null +++ b/lib/services/deploymentmanagerManagement/README.md @@ -0,0 +1,42 @@ +--- +uid: azure-arm-deploymentmanager +summary: *content + +--- +# Microsoft Azure SDK for Node.js - AzureDeploymentManager +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-deploymentmanager +``` + +## How to use + +### Authentication, client creation and get serviceTopologies as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const AzureDeploymentManager = require("azure-arm-deploymentmanager"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new AzureDeploymentManager(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + const serviceTopologyName = "testserviceTopologyName"; + return client.serviceTopologies.get(resourceGroupName, serviceTopologyName).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/deploymentmanagerManagement/lib/azureDeploymentManager.d.ts b/lib/services/deploymentmanagerManagement/lib/azureDeploymentManager.d.ts new file mode 100644 index 0000000000..941a310aae --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/azureDeploymentManager.d.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class AzureDeploymentManager extends AzureServiceClient { + /** + * Initializes a new instance of the AzureDeploymentManager class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + apiVersion: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + serviceTopologies: operations.ServiceTopologies; + services: operations.Services; + serviceUnits: operations.ServiceUnits; + steps: operations.Steps; + rollouts: operations.Rollouts; + artifactSources: operations.ArtifactSources; + operations: operations.Operations; +} + +export { AzureDeploymentManager, models as AzureDeploymentManagerModels }; diff --git a/lib/services/deploymentmanagerManagement/lib/azureDeploymentManager.js b/lib/services/deploymentmanagerManagement/lib/azureDeploymentManager.js new file mode 100644 index 0000000000..ffaac85483 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/azureDeploymentManager.js @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a AzureDeploymentManager. */ +class AzureDeploymentManager extends ServiceClient { + /** + * Create a AzureDeploymentManager. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2018-09-01-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.serviceTopologies = new operations.ServiceTopologies(this); + this.services = new operations.Services(this); + this.serviceUnits = new operations.ServiceUnits(this); + this.steps = new operations.Steps(this); + this.rollouts = new operations.Rollouts(this); + this.artifactSources = new operations.ArtifactSources(this); + this.operations = new operations.Operations(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = AzureDeploymentManager; +module.exports['default'] = AzureDeploymentManager; +module.exports.AzureDeploymentManager = AzureDeploymentManager; +module.exports.AzureDeploymentManagerModels = models; diff --git a/lib/services/deploymentmanagerManagement/lib/models/artifactSource.js b/lib/services/deploymentmanagerManagement/lib/models/artifactSource.js new file mode 100644 index 0000000000..2b9ebaadd5 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/artifactSource.js @@ -0,0 +1,127 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource that define the source location where the artifacts are + * located. + * + * @extends models['TrackedResource'] + */ +class ArtifactSource extends models['TrackedResource'] { + /** + * Create a ArtifactSource. + * @member {string} sourceType The type of artifact source used. + * @member {string} [artifactRoot] The root folder under which all artifacts + * for all environments are expected to be organized. + * @member {object} authentication The authentication method to use to access + * the artifact source. + * @member {string} [authentication.type] Polymorphic Discriminator + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ArtifactSource + * + * @returns {object} metadata of ArtifactSource + * + */ + mapper() { + return { + required: false, + serializedName: 'ArtifactSource', + type: { + name: 'Composite', + className: 'ArtifactSource', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + sourceType: { + required: true, + serializedName: 'properties.sourceType', + type: { + name: 'String' + } + }, + artifactRoot: { + required: false, + serializedName: 'properties.artifactRoot', + type: { + name: 'String' + } + }, + authentication: { + required: true, + serializedName: 'properties.authentication', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'Authentication', + className: 'Authentication' + } + } + } + } + }; + } +} + +module.exports = ArtifactSource; diff --git a/lib/services/deploymentmanagerManagement/lib/models/artifactSourcePropertiesModel.js b/lib/services/deploymentmanagerManagement/lib/models/artifactSourcePropertiesModel.js new file mode 100644 index 0000000000..3b2adb696b --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/artifactSourcePropertiesModel.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The properties that define the source location where the artifacts are + * located. + * + */ +class ArtifactSourcePropertiesModel { + /** + * Create a ArtifactSourcePropertiesModel. + * @member {string} sourceType The type of artifact source used. + * @member {string} [artifactRoot] The root folder under which all artifacts + * for all environments are expected to be organized. + * @member {object} authentication The authentication method to use to access + * the artifact source. + * @member {string} [authentication.type] Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of ArtifactSourcePropertiesModel + * + * @returns {object} metadata of ArtifactSourcePropertiesModel + * + */ + mapper() { + return { + required: false, + serializedName: 'ArtifactSourceProperties', + type: { + name: 'Composite', + className: 'ArtifactSourcePropertiesModel', + modelProperties: { + sourceType: { + required: true, + serializedName: 'sourceType', + type: { + name: 'String' + } + }, + artifactRoot: { + required: false, + serializedName: 'artifactRoot', + type: { + name: 'String' + } + }, + authentication: { + required: true, + serializedName: 'authentication', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'Authentication', + className: 'Authentication' + } + } + } + } + }; + } +} + +module.exports = ArtifactSourcePropertiesModel; diff --git a/lib/services/deploymentmanagerManagement/lib/models/authentication.js b/lib/services/deploymentmanagerManagement/lib/models/authentication.js new file mode 100644 index 0000000000..95cb44b987 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/authentication.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'; + +/** + * Defines the authentication method and properties to access the artifacts. + * + */ +class Authentication { + /** + * Create a Authentication. + * @member {string} type Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of Authentication + * + * @returns {object} metadata of Authentication + * + */ + mapper() { + return { + required: false, + serializedName: 'Authentication', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'Authentication', + className: 'Authentication', + modelProperties: { + type: { + required: true, + serializedName: 'type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Authentication; diff --git a/lib/services/deploymentmanagerManagement/lib/models/azureEntityResource.js b/lib/services/deploymentmanagerManagement/lib/models/azureEntityResource.js new file mode 100644 index 0000000000..a87a9fe033 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/azureEntityResource.js @@ -0,0 +1,82 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource model definition for a Azure Resource Manager resource with an + * etag. + * + * @extends models['Resource'] + */ +class AzureEntityResource extends models['Resource'] { + /** + * Create a AzureEntityResource. + * @member {string} [etag] Resource Etag. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AzureEntityResource + * + * @returns {object} metadata of AzureEntityResource + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureEntityResource', + type: { + name: 'Composite', + className: 'AzureEntityResource', + 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' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AzureEntityResource; diff --git a/lib/services/deploymentmanagerManagement/lib/models/cloudErrorBody.js b/lib/services/deploymentmanagerManagement/lib/models/cloudErrorBody.js new file mode 100644 index 0000000000..2c58f5ba56 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/cloudErrorBody.js @@ -0,0 +1,86 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Detailed error information of any failure. + * + */ +class CloudErrorBody { + /** + * Create a CloudErrorBody. + * @member {string} [code] Error code string. + * @member {string} [message] Descriptive error information. + * @member {string} [target] Error target + * @member {array} [details] More detailed error information. + */ + constructor() { + } + + /** + * Defines the metadata of CloudErrorBody + * + * @returns {object} metadata of CloudErrorBody + * + */ + mapper() { + return { + required: false, + serializedName: 'CloudErrorBody', + type: { + name: 'Composite', + className: 'CloudErrorBody', + modelProperties: { + code: { + required: false, + readOnly: true, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + target: { + required: false, + serializedName: 'target', + type: { + name: 'String' + } + }, + details: { + required: false, + serializedName: 'details', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CloudErrorBodyElementType', + type: { + name: 'Composite', + className: 'CloudErrorBody' + } + } + } + } + } + } + }; + } +} + +module.exports = CloudErrorBody; diff --git a/lib/services/deploymentmanagerManagement/lib/models/identity.js b/lib/services/deploymentmanagerManagement/lib/models/identity.js new file mode 100644 index 0000000000..e3cdf743d9 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/identity.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Identity for the resource. + * + */ +class Identity { + /** + * Create a Identity. + * @member {string} type The identity type. + * @member {array} identityIds The list of identities. + */ + constructor() { + } + + /** + * Defines the metadata of Identity + * + * @returns {object} metadata of Identity + * + */ + mapper() { + return { + required: false, + serializedName: 'Identity', + type: { + name: 'Composite', + className: 'Identity', + modelProperties: { + type: { + required: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + identityIds: { + required: true, + serializedName: 'identityIds', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Identity; diff --git a/lib/services/deploymentmanagerManagement/lib/models/index.d.ts b/lib/services/deploymentmanagerManagement/lib/models/index.d.ts new file mode 100644 index 0000000000..fd6ed33a89 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/index.d.ts @@ -0,0 +1,715 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { BaseResource } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the Identity class. + * @constructor + * Identity for the resource. + * + * @member {string} type The identity type. + * @member {array} identityIds The list of identities. + */ +export interface Identity { + type: string; + identityIds: string[]; +} + +/** + * @class + * Initializes a new instance of the PrePostStep class. + * @constructor + * The properties that define a step. + * + * @member {string} stepId The reference to the ARM resource Id of a step. + */ +export interface PrePostStep { + stepId: string; +} + +/** + * @class + * Initializes a new instance of the Step class. + * @constructor + * The properties that define an Azure Deployment Manager step. + * + * @member {string} name The name of the step. + * @member {array} [dependsOnStepGroup] The list of step names on which this + * step depends. + * @member {array} [preDeploymentSteps] The list of step names to be run before + * deploying the target. + * @member {string} deploymentTargetId The reference to the ARM service unit + * resource to be deployed. + * @member {array} [postDeploymentSteps] The list of step names to be run after + * deploying the target. + */ +export interface Step { + name: string; + dependsOnStepGroup?: string[]; + preDeploymentSteps?: PrePostStep[]; + deploymentTargetId: string; + postDeploymentSteps?: PrePostStep[]; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * @member {string} [id] Fully qualified resource Id for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * @member {string} [name] The name of the resource + * @member {string} [type] The type of the resource. Ex- + * Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the TrackedResource class. + * @constructor + * The resource model definition for a ARM tracked top level resource + * + * @member {object} [tags] Resource tags. + * @member {string} location The geo-location where the resource lives + */ +export interface TrackedResource extends Resource { + tags?: { [propertyName: string]: string }; + location: string; +} + +/** + * @class + * Initializes a new instance of the RolloutRequest class. + * @constructor + * Defines the resource format for creating a rollout. + * + * @member {object} identity Identity for the resource. + * @member {string} [identity.type] The identity type. + * @member {array} [identity.identityIds] The list of identities. + * @member {string} buildVersion The version of the build being deployed. + * @member {string} [artifactSourceId] The reference to the ARM resource Id + * where the payload is located. + * @member {string} targetServiceTopologyId The reference to the resource Id of + * the service topology from which services are chosen to be deployed. + * @member {array} stepGroups The list of steps that define the orchestration. + */ +export interface RolloutRequest extends TrackedResource { + identity: Identity; + buildVersion: string; + artifactSourceId?: string; + targetServiceTopologyId: string; + stepGroups: Step[]; +} + +/** + * @class + * Initializes a new instance of the ArtifactSource class. + * @constructor + * The resource that define the source location where the artifacts are + * located. + * + * @member {string} sourceType The type of artifact source used. + * @member {string} [artifactRoot] The root folder under which all artifacts + * for all environments are expected to be organized. + * @member {object} authentication The authentication method to use to access + * the artifact source. + * @member {string} [authentication.type] Polymorphic Discriminator + */ +export interface ArtifactSource extends TrackedResource { + sourceType: string; + artifactRoot?: string; + authentication: Authentication; +} + +/** + * @class + * Initializes a new instance of the Authentication class. + * @constructor + * Defines the authentication method and properties to access the artifacts. + * + * @member {string} type Polymorphic Discriminator + */ +export interface Authentication { + type: string; +} + +/** + * @class + * Initializes a new instance of the ArtifactSourcePropertiesModel class. + * @constructor + * The properties that define the source location where the artifacts are + * located. + * + * @member {string} sourceType The type of artifact source used. + * @member {string} [artifactRoot] The root folder under which all artifacts + * for all environments are expected to be organized. + * @member {object} authentication The authentication method to use to access + * the artifact source. + * @member {string} [authentication.type] Polymorphic Discriminator + */ +export interface ArtifactSourcePropertiesModel { + sourceType: string; + artifactRoot?: string; + authentication: Authentication; +} + +/** + * @class + * Initializes a new instance of the SasAuthentication class. + * @constructor + * Defines the authentication properties to access the artifacts using Azure + * Storage SAS URI. + * + * @member {string} sasUri The complete SAS URI to the location of the + * artifacts. + */ +export interface SasAuthentication extends Authentication { + sasUri: string; +} + +/** + * @class + * Initializes a new instance of the CloudErrorBody class. + * @constructor + * Detailed error information of any failure. + * + * @member {string} [code] Error code string. + * @member {string} [message] Descriptive error information. + * @member {string} [target] Error target + * @member {array} [details] More detailed error information. + */ +export interface CloudErrorBody { + readonly code?: string; + readonly message?: string; + target?: string; + details?: CloudErrorBody[]; +} + +/** + * @class + * Initializes a new instance of the RolloutOperationInfo class. + * @constructor + * Detailed runtime information of the rollout. + * + * @member {number} [retryAttempt] The ordinal count of retry attempt. 0 if no + * retries of the rollout have been performed. + * @member {boolean} [skipSucceededOnRetry] True if skipping all successful + * steps in the given retry attempt was chosen. False otherwise. + * @member {date} [startTime] The start time of the rollout in UTC. + * @member {date} [endTime] The start time of the rollout in UTC. This property + * will not be set if the rollout has not completed yet. + * @member {object} [error] The detailed error information for any failure. + * @member {string} [error.code] Error code string. + * @member {string} [error.message] Descriptive error information. + * @member {string} [error.target] Error target + * @member {array} [error.details] More detailed error information. + */ +export interface RolloutOperationInfo { + readonly retryAttempt?: number; + readonly skipSucceededOnRetry?: boolean; + readonly startTime?: Date; + readonly endTime?: Date; + readonly error?: CloudErrorBody; +} + +/** + * @class + * Initializes a new instance of the StepOperationInfo class. + * @constructor + * Detailed information of specific step execution. + * + * @member {string} [deploymentName] The name of the Azure Resource Manager + * deployment initiated as part of the step. + * @member {string} [correlationId] Unique identifier to track the request for + * ARM-based resources. + * @member {date} [startTime] Start time of the action in UTC. + * @member {date} [endTime] End time of the action in UTC. + * @member {date} [lastUpdatedTime] Last time in UTC this operation was + * updated. + * @member {object} [error] The errors, if any, for the action. + * @member {string} [error.code] Error code string. + * @member {string} [error.message] Descriptive error information. + * @member {string} [error.target] Error target + * @member {array} [error.details] More detailed error information. + */ +export interface StepOperationInfo { + readonly deploymentName?: string; + readonly correlationId?: string; + readonly startTime?: Date; + readonly endTime?: Date; + readonly lastUpdatedTime?: Date; + error?: CloudErrorBody; +} + +/** + * @class + * Initializes a new instance of the ResourceOperation class. + * @constructor + * Individial resource operation information. + * + * @member {string} [resourceName] Name of the resource as specified in the + * artifacts. For ARM resources, this is the name of the resource specified in + * the template. + * @member {string} [operationId] Unique identifier of the operation. For ARM + * resources, this is the operationId obtained from ARM service. + * @member {string} [resourceType] Type of the resource as specified in the + * artifacts. For ARM resources, this is the type of the resource specified in + * the template. + * @member {string} [provisioningState] State of the resource deployment. For + * ARM resources, this is the current provisioning state of the resource. + * @member {string} [statusMessage] Descriptive information of the resource + * operation. + * @member {string} [statusCode] Http status code of the operation. + */ +export interface ResourceOperation { + resourceName?: string; + readonly operationId?: string; + resourceType?: string; + readonly provisioningState?: string; + readonly statusMessage?: string; + readonly statusCode?: string; +} + +/** + * @class + * Initializes a new instance of the Message class. + * @constructor + * Supplementary contextual messages during a rollout. + * + * @member {date} [timeStamp] Time in UTC this message was provided. + * @member {string} [message] The actual message text. + */ +export interface Message { + readonly timeStamp?: Date; + readonly message?: string; +} + +/** + * @class + * Initializes a new instance of the RolloutStep class. + * @constructor + * Defines a specific step on a target service unit. + * + * @member {string} name Name of the step as specified in the rollout + * specification input artifact. + * @member {string} [status] Current state of the step. + * @member {string} [stepGroup] The step group the current step is part of. + * @member {object} [operationInfo] Detailed information of specific action + * execution. + * @member {string} [operationInfo.deploymentName] The name of the Azure + * Resource Manager deployment initiated as part of the step. + * @member {string} [operationInfo.correlationId] Unique identifier to track + * the request for ARM-based resources. + * @member {date} [operationInfo.startTime] Start time of the action in UTC. + * @member {date} [operationInfo.endTime] End time of the action in UTC. + * @member {date} [operationInfo.lastUpdatedTime] Last time in UTC this + * operation was updated. + * @member {object} [operationInfo.error] The errors, if any, for the action. + * @member {string} [operationInfo.error.code] Error code string. + * @member {string} [operationInfo.error.message] Descriptive error + * information. + * @member {string} [operationInfo.error.target] Error target + * @member {array} [operationInfo.error.details] More detailed error + * information. + * @member {array} [resourceOperations] Set of resource operations that were + * performed on the Azure resource that the action acted upon. + * @member {array} [messages] Supplementary informative messages during + * rollout. + */ +export interface RolloutStep { + name: string; + readonly status?: string; + stepGroup?: string; + readonly operationInfo?: StepOperationInfo; + readonly resourceOperations?: ResourceOperation[]; + readonly messages?: Message[]; +} + +/** + * @class + * Initializes a new instance of the ServiceUnitProperties class. + * @constructor + * Defines the properties of a service unit. + * + * @member {string} targetResourceGroup The Azure Resource Group to which the + * resources in the service unit belong to. + * @member {string} deploymentMode Describes the type of ARM deployment to be + * performed on the resource. Possible values include: 'Incremental', + * 'Complete' + * @member {object} [artifacts] The artifacts for the service unit. + * @member {string} [artifacts.templateUri] The full URI of the ARM template + * file with the SAS token. + * @member {string} [artifacts.parametersUri] The full URI of the ARM + * parameters file with the SAS token. + * @member {string} [artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * @member {string} [artifacts.parametersArtifactSourceRelativePath] The path + * to the ARM parameters file relative to the artifact source. + */ +export interface ServiceUnitProperties { + targetResourceGroup: string; + deploymentMode: string; + artifacts?: ServiceUnitArtifacts; +} + +/** + * @class + * Initializes a new instance of the ServiceUnit class. + * @constructor + * Defines a service unit. + * + * @member {string} [name] Name of the service unit. + * @member {array} [steps] Detailed step information, if present. + */ +export interface ServiceUnit extends ServiceUnitProperties { + name?: string; + steps?: RolloutStep[]; +} + +/** + * @class + * Initializes a new instance of the ServiceProperties class. + * @constructor + * The properties of a service. + * + * @member {string} targetLocation The Azure location to which the resources in + * the service belong to. + * @member {string} targetSubscriptionId The subscription to which the + * resources in the service belong to. + */ +export interface ServiceProperties { + targetLocation: string; + targetSubscriptionId: string; +} + +/** + * @class + * Initializes a new instance of the Service class. + * @constructor + * Defines a service. + * + * @member {string} [name] Name of the service. + * @member {array} [serviceUnits] The detailed information about the units that + * make up the service. + */ +export interface Service extends ServiceProperties { + name?: string; + serviceUnits?: ServiceUnit[]; +} + +/** + * @class + * Initializes a new instance of the Rollout class. + * @constructor + * Defines the rollout resource. + * + * @member {object} [identity] Identity for the resource. + * @member {string} [identity.type] The identity type. + * @member {array} [identity.identityIds] The list of identities. + * @member {string} buildVersion The version of the build being deployed. + * @member {string} [artifactSourceId] The reference to the ARM resource Id + * where the payload is located. + * @member {string} targetServiceTopologyId The reference to the resource Id of + * the service topology from which services are chosen to be deployed. + * @member {array} stepGroups The list of steps that define the orchestration. + * @member {string} [status] The current status of the rollout. + * @member {number} [totalRetryAttempts] The cardinal count of total number of + * retries performed on the rollout at a given time. + * @member {object} [operationInfo] Operational information of the rollout. + * @member {number} [operationInfo.retryAttempt] The ordinal count of retry + * attempt. 0 if no retries of the rollout have been performed. + * @member {boolean} [operationInfo.skipSucceededOnRetry] True if skipping all + * successful steps in the given retry attempt was chosen. False otherwise. + * @member {date} [operationInfo.startTime] The start time of the rollout in + * UTC. + * @member {date} [operationInfo.endTime] The start time of the rollout in UTC. + * This property will not be set if the rollout has not completed yet. + * @member {object} [operationInfo.error] The detailed error information for + * any failure. + * @member {string} [operationInfo.error.code] Error code string. + * @member {string} [operationInfo.error.message] Descriptive error + * information. + * @member {string} [operationInfo.error.target] Error target + * @member {array} [operationInfo.error.details] More detailed error + * information. + * @member {array} [services] Set of detailed step result information on target + * resource groups. + */ +export interface Rollout extends TrackedResource { + identity?: Identity; + buildVersion: string; + artifactSourceId?: string; + targetServiceTopologyId: string; + stepGroups: Step[]; + readonly status?: string; + readonly totalRetryAttempts?: number; + readonly operationInfo?: RolloutOperationInfo; + readonly services?: Service[]; +} + +/** + * @class + * Initializes a new instance of the RolloutPropertiesModel class. + * @constructor + * Defines the properties of a rollout. + * + * @member {string} [status] The current status of the rollout. + * @member {number} [totalRetryAttempts] The cardinal count of total number of + * retries performed on the rollout at a given time. + * @member {object} [operationInfo] Operational information of the rollout. + * @member {number} [operationInfo.retryAttempt] The ordinal count of retry + * attempt. 0 if no retries of the rollout have been performed. + * @member {boolean} [operationInfo.skipSucceededOnRetry] True if skipping all + * successful steps in the given retry attempt was chosen. False otherwise. + * @member {date} [operationInfo.startTime] The start time of the rollout in + * UTC. + * @member {date} [operationInfo.endTime] The start time of the rollout in UTC. + * This property will not be set if the rollout has not completed yet. + * @member {object} [operationInfo.error] The detailed error information for + * any failure. + * @member {string} [operationInfo.error.code] Error code string. + * @member {string} [operationInfo.error.message] Descriptive error + * information. + * @member {string} [operationInfo.error.target] Error target + * @member {array} [operationInfo.error.details] More detailed error + * information. + * @member {array} [services] Set of detailed step result information on target + * resource groups. + */ +export interface RolloutPropertiesModel { + readonly status?: string; + readonly totalRetryAttempts?: number; + readonly operationInfo?: RolloutOperationInfo; + readonly services?: Service[]; +} + +/** + * @class + * Initializes a new instance of the ServiceTopologyResource class. + * @constructor + * The resource representation of a service topology. + * + * @member {string} [artifactSourceId] The artifact source that contains the + * artifacts that can be referenced in the service units. + */ +export interface ServiceTopologyResource extends TrackedResource { + artifactSourceId?: string; +} + +/** + * @class + * Initializes a new instance of the ServiceTopologyProperties class. + * @constructor + * The properties of a service topology. + * + * @member {string} [artifactSourceId] The artifact source that contains the + * artifacts that can be referenced in the service units. + */ +export interface ServiceTopologyProperties { + artifactSourceId?: string; +} + +/** + * @class + * Initializes a new instance of the ServiceResource class. + * @constructor + * The resource representation of a service in a topology. + * + * @member {string} targetLocation The Azure location to which the resources in + * the service belong to. + * @member {string} targetSubscriptionId The subscription to which the + * resources in the service belong to. + */ +export interface ServiceResource extends TrackedResource { + targetLocation: string; + targetSubscriptionId: string; +} + +/** + * @class + * Initializes a new instance of the ServiceUnitResource class. + * @constructor + * Represents the response of a service unit resource. + * + * @member {string} targetResourceGroup The Azure Resource Group to which the + * resources in the service unit belong to. + * @member {string} deploymentMode Describes the type of ARM deployment to be + * performed on the resource. Possible values include: 'Incremental', + * 'Complete' + * @member {object} [artifacts] The artifacts for the service unit. + * @member {string} [artifacts.templateUri] The full URI of the ARM template + * file with the SAS token. + * @member {string} [artifacts.parametersUri] The full URI of the ARM + * parameters file with the SAS token. + * @member {string} [artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * @member {string} [artifacts.parametersArtifactSourceRelativePath] The path + * to the ARM parameters file relative to the artifact source. + */ +export interface ServiceUnitResource extends TrackedResource { + targetResourceGroup: string; + deploymentMode: string; + artifacts?: ServiceUnitArtifacts; +} + +/** + * @class + * Initializes a new instance of the ServiceUnitArtifacts class. + * @constructor + * Defines the artifacts of a service unit. + * + * @member {string} [templateUri] The full URI of the ARM template file with + * the SAS token. + * @member {string} [parametersUri] The full URI of the ARM parameters file + * with the SAS token. + * @member {string} [templateArtifactSourceRelativePath] The path to the ARM + * template file relative to the artifact source. + * @member {string} [parametersArtifactSourceRelativePath] The path to the ARM + * parameters file relative to the artifact source. + */ +export interface ServiceUnitArtifacts { + templateUri?: string; + parametersUri?: string; + templateArtifactSourceRelativePath?: string; + parametersArtifactSourceRelativePath?: string; +} + +/** + * @class + * Initializes a new instance of the OperationDetail class. + * @constructor + * The detail about an operation. + * + * @member {string} [provider] The name of the provider that supports the + * operation. + * @member {string} [resource] The resource type on which this operation can be + * performed. + * @member {string} [operation] The name of the operation. + * @member {string} [description] The description of the operation. + */ +export interface OperationDetail { + provider?: string; + resource?: string; + operation?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * Represents an operation that can be performed on the service. + * + * @member {string} [name] The name of the operation. + * @member {object} [display] The display name of the operation. + * @member {string} [display.provider] The name of the provider that supports + * the operation. + * @member {string} [display.resource] The resource type on which this + * operation can be performed. + * @member {string} [display.operation] The name of the operation. + * @member {string} [display.description] The description of the operation. + * @member {string} [origin] The origin of the operation. + * @member {object} [properties] The properties of the operation. + */ +export interface Operation { + name?: string; + display?: OperationDetail; + origin?: string; + properties?: any; +} + +/** + * @class + * Initializes a new instance of the StepProperties class. + * @constructor + * The properties of a step resource. + * + * @member {string} stepType Polymorphic Discriminator + */ +export interface StepProperties { + stepType: string; +} + +/** + * @class + * Initializes a new instance of the StepResource class. + * @constructor + * The resource representation of a deployment step. + * + * @member {object} properties The properties for the resource. + * @member {string} [properties.stepType] Polymorphic Discriminator + */ +export interface StepResource extends TrackedResource { + properties: StepProperties; +} + +/** + * @class + * Initializes a new instance of the WaitStepAttributes class. + * @constructor + * The parameters for the wait step. + * + * @member {string} duration The duration in ISO 8601 format of how long the + * wait should be. + */ +export interface WaitStepAttributes { + duration: string; +} + +/** + * @class + * Initializes a new instance of the WaitStepProperties class. + * @constructor + * Defines the properties of a Wait step. + * + * @member {object} [attributes] The Wait attributes + * @member {string} [attributes.duration] The duration in ISO 8601 format of + * how long the wait should be. + */ +export interface WaitStepProperties extends StepProperties { + attributes?: WaitStepAttributes; +} + +/** + * @class + * Initializes a new instance of the ProxyResource class. + * @constructor + * The resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags + * + */ +export interface ProxyResource extends Resource { +} + +/** + * @class + * Initializes a new instance of the AzureEntityResource class. + * @constructor + * The resource model definition for a Azure Resource Manager resource with an + * etag. + * + * @member {string} [etag] Resource Etag. + */ +export interface AzureEntityResource extends Resource { + readonly etag?: string; +} + diff --git a/lib/services/deploymentmanagerManagement/lib/models/index.js b/lib/services/deploymentmanagerManagement/lib/models/index.js new file mode 100644 index 0000000000..2be1d683c1 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/index.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.Identity = require('./identity'); +exports.PrePostStep = require('./prePostStep'); +exports.Step = require('./step'); +exports.Resource = require('./resource'); +exports.TrackedResource = require('./trackedResource'); +exports.RolloutRequest = require('./rolloutRequest'); +exports.ArtifactSource = require('./artifactSource'); +exports.Authentication = require('./authentication'); +exports.ArtifactSourcePropertiesModel = require('./artifactSourcePropertiesModel'); +exports.SasAuthentication = require('./sasAuthentication'); +exports.CloudErrorBody = require('./cloudErrorBody'); +exports.RolloutOperationInfo = require('./rolloutOperationInfo'); +exports.StepOperationInfo = require('./stepOperationInfo'); +exports.ResourceOperation = require('./resourceOperation'); +exports.Message = require('./message'); +exports.RolloutStep = require('./rolloutStep'); +exports.ServiceUnitProperties = require('./serviceUnitProperties'); +exports.ServiceUnit = require('./serviceUnit'); +exports.ServiceProperties = require('./serviceProperties'); +exports.Service = require('./service'); +exports.Rollout = require('./rollout'); +exports.RolloutPropertiesModel = require('./rolloutPropertiesModel'); +exports.ServiceTopologyResource = require('./serviceTopologyResource'); +exports.ServiceTopologyProperties = require('./serviceTopologyProperties'); +exports.ServiceResource = require('./serviceResource'); +exports.ServiceUnitResource = require('./serviceUnitResource'); +exports.ServiceUnitArtifacts = require('./serviceUnitArtifacts'); +exports.OperationDetail = require('./operationDetail'); +exports.Operation = require('./operation'); +exports.StepProperties = require('./stepProperties'); +exports.StepResource = require('./stepResource'); +exports.WaitStepAttributes = require('./waitStepAttributes'); +exports.WaitStepProperties = require('./waitStepProperties'); +exports.ProxyResource = require('./proxyResource'); +exports.AzureEntityResource = require('./azureEntityResource'); +exports.discriminators = { + 'Authentication' : exports.Authentication, + 'Authentication.Sas' : exports.SasAuthentication, + 'StepProperties' : exports.StepProperties, + 'StepProperties.Wait' : exports.WaitStepProperties +}; diff --git a/lib/services/deploymentmanagerManagement/lib/models/message.js b/lib/services/deploymentmanagerManagement/lib/models/message.js new file mode 100644 index 0000000000..c74728da96 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/message.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Supplementary contextual messages during a rollout. + * + */ +class Message { + /** + * Create a Message. + * @member {date} [timeStamp] Time in UTC this message was provided. + * @member {string} [message] The actual message text. + */ + constructor() { + } + + /** + * Defines the metadata of Message + * + * @returns {object} metadata of Message + * + */ + mapper() { + return { + required: false, + serializedName: 'Message', + type: { + name: 'Composite', + className: 'Message', + modelProperties: { + timeStamp: { + required: false, + readOnly: true, + serializedName: 'timeStamp', + type: { + name: 'DateTime' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Message; diff --git a/lib/services/deploymentmanagerManagement/lib/models/operation.js b/lib/services/deploymentmanagerManagement/lib/models/operation.js new file mode 100644 index 0000000000..62a03bdca7 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/operation.js @@ -0,0 +1,83 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Represents an operation that can be performed on the service. + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} [name] The name of the operation. + * @member {object} [display] The display name of the operation. + * @member {string} [display.provider] The name of the provider that supports + * the operation. + * @member {string} [display.resource] The resource type on which this + * operation can be performed. + * @member {string} [display.operation] The name of the operation. + * @member {string} [display.description] The description of the operation. + * @member {string} [origin] The origin of the operation. + * @member {object} [properties] The properties of the operation. + */ + constructor() { + } + + /** + * Defines the metadata of Operation + * + * @returns {object} metadata of Operation + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation', + type: { + name: 'Composite', + className: 'Operation', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDetail' + } + }, + origin: { + required: false, + serializedName: 'origin', + type: { + name: 'String' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Object' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/deploymentmanagerManagement/lib/models/operationDetail.js b/lib/services/deploymentmanagerManagement/lib/models/operationDetail.js new file mode 100644 index 0000000000..293275e7b4 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/operationDetail.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The detail about an operation. + * + */ +class OperationDetail { + /** + * Create a OperationDetail. + * @member {string} [provider] The name of the provider that supports the + * operation. + * @member {string} [resource] The resource type on which this operation can + * be performed. + * @member {string} [operation] The name of the operation. + * @member {string} [description] The description of the operation. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDetail + * + * @returns {object} metadata of OperationDetail + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationDetail', + type: { + name: 'Composite', + className: 'OperationDetail', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDetail; diff --git a/lib/services/deploymentmanagerManagement/lib/models/prePostStep.js b/lib/services/deploymentmanagerManagement/lib/models/prePostStep.js new file mode 100644 index 0000000000..704476f0c4 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/prePostStep.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The properties that define a step. + * + */ +class PrePostStep { + /** + * Create a PrePostStep. + * @member {string} stepId The reference to the ARM resource Id of a step. + */ + constructor() { + } + + /** + * Defines the metadata of PrePostStep + * + * @returns {object} metadata of PrePostStep + * + */ + mapper() { + return { + required: false, + serializedName: 'PrePostStep', + type: { + name: 'Composite', + className: 'PrePostStep', + modelProperties: { + stepId: { + required: true, + serializedName: 'stepId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PrePostStep; diff --git a/lib/services/deploymentmanagerManagement/lib/models/proxyResource.js b/lib/services/deploymentmanagerManagement/lib/models/proxyResource.js new file mode 100644 index 0000000000..43e93ec60e --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/proxyResource.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags + * + * @extends models['Resource'] + */ +class ProxyResource extends models['Resource'] { + /** + * Create a ProxyResource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ProxyResource + * + * @returns {object} metadata of ProxyResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ProxyResource', + type: { + name: 'Composite', + className: 'ProxyResource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ProxyResource; diff --git a/lib/services/deploymentmanagerManagement/lib/models/resource.js b/lib/services/deploymentmanagerManagement/lib/models/resource.js new file mode 100644 index 0000000000..b9797bc86d --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/resource.js @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a Resource. + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] Fully qualified resource Id for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * @member {string} [name] The name of the resource + * @member {string} [type] The type of the resource. Ex- + * Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/deploymentmanagerManagement/lib/models/resourceOperation.js b/lib/services/deploymentmanagerManagement/lib/models/resourceOperation.js new file mode 100644 index 0000000000..c0897d311f --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/resourceOperation.js @@ -0,0 +1,103 @@ +/* + * 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'; + +/** + * Individial resource operation information. + * + */ +class ResourceOperation { + /** + * Create a ResourceOperation. + * @member {string} [resourceName] Name of the resource as specified in the + * artifacts. For ARM resources, this is the name of the resource specified + * in the template. + * @member {string} [operationId] Unique identifier of the operation. For ARM + * resources, this is the operationId obtained from ARM service. + * @member {string} [resourceType] Type of the resource as specified in the + * artifacts. For ARM resources, this is the type of the resource specified + * in the template. + * @member {string} [provisioningState] State of the resource deployment. For + * ARM resources, this is the current provisioning state of the resource. + * @member {string} [statusMessage] Descriptive information of the resource + * operation. + * @member {string} [statusCode] Http status code of the operation. + */ + constructor() { + } + + /** + * Defines the metadata of ResourceOperation + * + * @returns {object} metadata of ResourceOperation + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceOperation', + type: { + name: 'Composite', + className: 'ResourceOperation', + modelProperties: { + resourceName: { + required: false, + serializedName: 'resourceName', + type: { + name: 'String' + } + }, + operationId: { + required: false, + readOnly: true, + serializedName: 'operationId', + type: { + name: 'String' + } + }, + resourceType: { + required: false, + serializedName: 'resourceType', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + statusMessage: { + required: false, + readOnly: true, + serializedName: 'statusMessage', + type: { + name: 'String' + } + }, + statusCode: { + required: false, + readOnly: true, + serializedName: 'statusCode', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResourceOperation; diff --git a/lib/services/deploymentmanagerManagement/lib/models/rollout.js b/lib/services/deploymentmanagerManagement/lib/models/rollout.js new file mode 100644 index 0000000000..23d22700f5 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/rollout.js @@ -0,0 +1,211 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Defines the rollout resource. + * + * @extends models['TrackedResource'] + */ +class Rollout extends models['TrackedResource'] { + /** + * Create a Rollout. + * @member {object} [identity] Identity for the resource. + * @member {string} [identity.type] The identity type. + * @member {array} [identity.identityIds] The list of identities. + * @member {string} buildVersion The version of the build being deployed. + * @member {string} [artifactSourceId] The reference to the ARM resource Id + * where the payload is located. + * @member {string} targetServiceTopologyId The reference to the resource Id + * of the service topology from which services are chosen to be deployed. + * @member {array} stepGroups The list of steps that define the + * orchestration. + * @member {string} [status] The current status of the rollout. + * @member {number} [totalRetryAttempts] The cardinal count of total number + * of retries performed on the rollout at a given time. + * @member {object} [operationInfo] Operational information of the rollout. + * @member {number} [operationInfo.retryAttempt] The ordinal count of retry + * attempt. 0 if no retries of the rollout have been performed. + * @member {boolean} [operationInfo.skipSucceededOnRetry] True if skipping + * all successful steps in the given retry attempt was chosen. False + * otherwise. + * @member {date} [operationInfo.startTime] The start time of the rollout in + * UTC. + * @member {date} [operationInfo.endTime] The start time of the rollout in + * UTC. This property will not be set if the rollout has not completed yet. + * @member {object} [operationInfo.error] The detailed error information for + * any failure. + * @member {string} [operationInfo.error.code] Error code string. + * @member {string} [operationInfo.error.message] Descriptive error + * information. + * @member {string} [operationInfo.error.target] Error target + * @member {array} [operationInfo.error.details] More detailed error + * information. + * @member {array} [services] Set of detailed step result information on + * target resource groups. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Rollout + * + * @returns {object} metadata of Rollout + * + */ + mapper() { + return { + required: false, + serializedName: 'Rollout', + type: { + name: 'Composite', + className: 'Rollout', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + identity: { + required: false, + serializedName: 'identity', + type: { + name: 'Composite', + className: 'Identity' + } + }, + buildVersion: { + required: true, + serializedName: 'properties.buildVersion', + type: { + name: 'String' + } + }, + artifactSourceId: { + required: false, + serializedName: 'properties.artifactSourceId', + type: { + name: 'String' + } + }, + targetServiceTopologyId: { + required: true, + serializedName: 'properties.targetServiceTopologyId', + type: { + name: 'String' + } + }, + stepGroups: { + required: true, + serializedName: 'properties.stepGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StepElementType', + type: { + name: 'Composite', + className: 'Step' + } + } + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + totalRetryAttempts: { + required: false, + readOnly: true, + serializedName: 'properties.totalRetryAttempts', + type: { + name: 'Number' + } + }, + operationInfo: { + required: false, + readOnly: true, + serializedName: 'properties.operationInfo', + type: { + name: 'Composite', + className: 'RolloutOperationInfo' + } + }, + services: { + required: false, + readOnly: true, + serializedName: 'properties.services', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServiceElementType', + type: { + name: 'Composite', + className: 'Service' + } + } + } + } + } + } + }; + } +} + +module.exports = Rollout; diff --git a/lib/services/deploymentmanagerManagement/lib/models/rolloutOperationInfo.js b/lib/services/deploymentmanagerManagement/lib/models/rolloutOperationInfo.js new file mode 100644 index 0000000000..a7c504dc41 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/rolloutOperationInfo.js @@ -0,0 +1,97 @@ +/* + * 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'; + +/** + * Detailed runtime information of the rollout. + * + */ +class RolloutOperationInfo { + /** + * Create a RolloutOperationInfo. + * @member {number} [retryAttempt] The ordinal count of retry attempt. 0 if + * no retries of the rollout have been performed. + * @member {boolean} [skipSucceededOnRetry] True if skipping all successful + * steps in the given retry attempt was chosen. False otherwise. + * @member {date} [startTime] The start time of the rollout in UTC. + * @member {date} [endTime] The start time of the rollout in UTC. This + * property will not be set if the rollout has not completed yet. + * @member {object} [error] The detailed error information for any failure. + * @member {string} [error.code] Error code string. + * @member {string} [error.message] Descriptive error information. + * @member {string} [error.target] Error target + * @member {array} [error.details] More detailed error information. + */ + constructor() { + } + + /** + * Defines the metadata of RolloutOperationInfo + * + * @returns {object} metadata of RolloutOperationInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'RolloutOperationInfo', + type: { + name: 'Composite', + className: 'RolloutOperationInfo', + modelProperties: { + retryAttempt: { + required: false, + readOnly: true, + serializedName: 'retryAttempt', + type: { + name: 'Number' + } + }, + skipSucceededOnRetry: { + required: false, + readOnly: true, + serializedName: 'skipSucceededOnRetry', + type: { + name: 'Boolean' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + }, + error: { + required: false, + readOnly: true, + serializedName: 'error', + type: { + name: 'Composite', + className: 'CloudErrorBody' + } + } + } + } + }; + } +} + +module.exports = RolloutOperationInfo; diff --git a/lib/services/deploymentmanagerManagement/lib/models/rolloutPropertiesModel.js b/lib/services/deploymentmanagerManagement/lib/models/rolloutPropertiesModel.js new file mode 100644 index 0000000000..1b6a4456a7 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/rolloutPropertiesModel.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'; + +/** + * Defines the properties of a rollout. + * + */ +class RolloutPropertiesModel { + /** + * Create a RolloutPropertiesModel. + * @member {string} [status] The current status of the rollout. + * @member {number} [totalRetryAttempts] The cardinal count of total number + * of retries performed on the rollout at a given time. + * @member {object} [operationInfo] Operational information of the rollout. + * @member {number} [operationInfo.retryAttempt] The ordinal count of retry + * attempt. 0 if no retries of the rollout have been performed. + * @member {boolean} [operationInfo.skipSucceededOnRetry] True if skipping + * all successful steps in the given retry attempt was chosen. False + * otherwise. + * @member {date} [operationInfo.startTime] The start time of the rollout in + * UTC. + * @member {date} [operationInfo.endTime] The start time of the rollout in + * UTC. This property will not be set if the rollout has not completed yet. + * @member {object} [operationInfo.error] The detailed error information for + * any failure. + * @member {string} [operationInfo.error.code] Error code string. + * @member {string} [operationInfo.error.message] Descriptive error + * information. + * @member {string} [operationInfo.error.target] Error target + * @member {array} [operationInfo.error.details] More detailed error + * information. + * @member {array} [services] Set of detailed step result information on + * target resource groups. + */ + constructor() { + } + + /** + * Defines the metadata of RolloutPropertiesModel + * + * @returns {object} metadata of RolloutPropertiesModel + * + */ + mapper() { + return { + required: false, + serializedName: 'RolloutProperties', + type: { + name: 'Composite', + className: 'RolloutPropertiesModel', + modelProperties: { + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + }, + totalRetryAttempts: { + required: false, + readOnly: true, + serializedName: 'totalRetryAttempts', + type: { + name: 'Number' + } + }, + operationInfo: { + required: false, + readOnly: true, + serializedName: 'operationInfo', + type: { + name: 'Composite', + className: 'RolloutOperationInfo' + } + }, + services: { + required: false, + readOnly: true, + serializedName: 'services', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServiceElementType', + type: { + name: 'Composite', + className: 'Service' + } + } + } + } + } + } + }; + } +} + +module.exports = RolloutPropertiesModel; diff --git a/lib/services/deploymentmanagerManagement/lib/models/rolloutRequest.js b/lib/services/deploymentmanagerManagement/lib/models/rolloutRequest.js new file mode 100644 index 0000000000..00052432ce --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/rolloutRequest.js @@ -0,0 +1,147 @@ +/* + * 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'); + +/** + * Defines the resource format for creating a rollout. + * + * @extends models['TrackedResource'] + */ +class RolloutRequest extends models['TrackedResource'] { + /** + * Create a RolloutRequest. + * @member {object} identity Identity for the resource. + * @member {string} [identity.type] The identity type. + * @member {array} [identity.identityIds] The list of identities. + * @member {string} buildVersion The version of the build being deployed. + * @member {string} [artifactSourceId] The reference to the ARM resource Id + * where the payload is located. + * @member {string} targetServiceTopologyId The reference to the resource Id + * of the service topology from which services are chosen to be deployed. + * @member {array} stepGroups The list of steps that define the + * orchestration. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RolloutRequest + * + * @returns {object} metadata of RolloutRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'RolloutRequest', + type: { + name: 'Composite', + className: 'RolloutRequest', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + identity: { + required: true, + serializedName: 'identity', + type: { + name: 'Composite', + className: 'Identity' + } + }, + buildVersion: { + required: true, + serializedName: 'properties.buildVersion', + type: { + name: 'String' + } + }, + artifactSourceId: { + required: false, + serializedName: 'properties.artifactSourceId', + type: { + name: 'String' + } + }, + targetServiceTopologyId: { + required: true, + serializedName: 'properties.targetServiceTopologyId', + type: { + name: 'String' + } + }, + stepGroups: { + required: true, + serializedName: 'properties.stepGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StepElementType', + type: { + name: 'Composite', + className: 'Step' + } + } + } + } + } + } + }; + } +} + +module.exports = RolloutRequest; diff --git a/lib/services/deploymentmanagerManagement/lib/models/rolloutStep.js b/lib/services/deploymentmanagerManagement/lib/models/rolloutStep.js new file mode 100644 index 0000000000..9b3fdfa530 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/rolloutStep.js @@ -0,0 +1,132 @@ +/* + * 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'; + +/** + * Defines a specific step on a target service unit. + * + */ +class RolloutStep { + /** + * Create a RolloutStep. + * @member {string} name Name of the step as specified in the rollout + * specification input artifact. + * @member {string} [status] Current state of the step. + * @member {string} [stepGroup] The step group the current step is part of. + * @member {object} [operationInfo] Detailed information of specific action + * execution. + * @member {string} [operationInfo.deploymentName] The name of the Azure + * Resource Manager deployment initiated as part of the step. + * @member {string} [operationInfo.correlationId] Unique identifier to track + * the request for ARM-based resources. + * @member {date} [operationInfo.startTime] Start time of the action in UTC. + * @member {date} [operationInfo.endTime] End time of the action in UTC. + * @member {date} [operationInfo.lastUpdatedTime] Last time in UTC this + * operation was updated. + * @member {object} [operationInfo.error] The errors, if any, for the action. + * @member {string} [operationInfo.error.code] Error code string. + * @member {string} [operationInfo.error.message] Descriptive error + * information. + * @member {string} [operationInfo.error.target] Error target + * @member {array} [operationInfo.error.details] More detailed error + * information. + * @member {array} [resourceOperations] Set of resource operations that were + * performed on the Azure resource that the action acted upon. + * @member {array} [messages] Supplementary informative messages during + * rollout. + */ + constructor() { + } + + /** + * Defines the metadata of RolloutStep + * + * @returns {object} metadata of RolloutStep + * + */ + mapper() { + return { + required: false, + serializedName: 'RolloutStep', + type: { + name: 'Composite', + className: 'RolloutStep', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + }, + stepGroup: { + required: false, + serializedName: 'stepGroup', + type: { + name: 'String' + } + }, + operationInfo: { + required: false, + readOnly: true, + serializedName: 'operationInfo', + type: { + name: 'Composite', + className: 'StepOperationInfo' + } + }, + resourceOperations: { + required: false, + readOnly: true, + serializedName: 'resourceOperations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ResourceOperationElementType', + type: { + name: 'Composite', + className: 'ResourceOperation' + } + } + } + }, + messages: { + required: false, + readOnly: true, + serializedName: 'messages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MessageElementType', + type: { + name: 'Composite', + className: 'Message' + } + } + } + } + } + } + }; + } +} + +module.exports = RolloutStep; diff --git a/lib/services/deploymentmanagerManagement/lib/models/sasAuthentication.js b/lib/services/deploymentmanagerManagement/lib/models/sasAuthentication.js new file mode 100644 index 0000000000..8199811e0c --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/sasAuthentication.js @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Defines the authentication properties to access the artifacts using Azure + * Storage SAS URI. + * + * @extends models['Authentication'] + */ +class SasAuthentication extends models['Authentication'] { + /** + * Create a SasAuthentication. + * @member {string} sasUri The complete SAS URI to the location of the + * artifacts. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SasAuthentication + * + * @returns {object} metadata of SasAuthentication + * + */ + mapper() { + return { + required: false, + serializedName: 'Sas', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'type', + clientName: 'type' + }, + uberParent: 'Authentication', + className: 'SasAuthentication', + modelProperties: { + type: { + required: true, + serializedName: 'type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + sasUri: { + required: true, + serializedName: 'properties.sasUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SasAuthentication; diff --git a/lib/services/deploymentmanagerManagement/lib/models/service.js b/lib/services/deploymentmanagerManagement/lib/models/service.js new file mode 100644 index 0000000000..2b2884b7ce --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/service.js @@ -0,0 +1,87 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Defines a service. + * + * @extends models['ServiceProperties'] + */ +class Service extends models['ServiceProperties'] { + /** + * Create a Service. + * @member {string} [name] Name of the service. + * @member {array} [serviceUnits] The detailed information about the units + * that make up the service. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Service + * + * @returns {object} metadata of Service + * + */ + mapper() { + return { + required: false, + serializedName: 'Service', + type: { + name: 'Composite', + className: 'Service', + modelProperties: { + targetLocation: { + required: true, + serializedName: 'targetLocation', + type: { + name: 'String' + } + }, + targetSubscriptionId: { + required: true, + serializedName: 'targetSubscriptionId', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + serviceUnits: { + required: false, + serializedName: 'serviceUnits', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServiceUnitElementType', + type: { + name: 'Composite', + className: 'ServiceUnit' + } + } + } + } + } + } + }; + } +} + +module.exports = Service; diff --git a/lib/services/deploymentmanagerManagement/lib/models/serviceProperties.js b/lib/services/deploymentmanagerManagement/lib/models/serviceProperties.js new file mode 100644 index 0000000000..e592408824 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/serviceProperties.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The properties of a service. + * + */ +class ServiceProperties { + /** + * Create a ServiceProperties. + * @member {string} targetLocation The Azure location to which the resources + * in the service belong to. + * @member {string} targetSubscriptionId The subscription to which the + * resources in the service belong to. + */ + constructor() { + } + + /** + * Defines the metadata of ServiceProperties + * + * @returns {object} metadata of ServiceProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceProperties', + type: { + name: 'Composite', + className: 'ServiceProperties', + modelProperties: { + targetLocation: { + required: true, + serializedName: 'targetLocation', + type: { + name: 'String' + } + }, + targetSubscriptionId: { + required: true, + serializedName: 'targetSubscriptionId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServiceProperties; diff --git a/lib/services/deploymentmanagerManagement/lib/models/serviceResource.js b/lib/services/deploymentmanagerManagement/lib/models/serviceResource.js new file mode 100644 index 0000000000..aa59a4ec6a --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/serviceResource.js @@ -0,0 +1,111 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource representation of a service in a topology. + * + * @extends models['TrackedResource'] + */ +class ServiceResource extends models['TrackedResource'] { + /** + * Create a ServiceResource. + * @member {string} targetLocation The Azure location to which the resources + * in the service belong to. + * @member {string} targetSubscriptionId The subscription to which the + * resources in the service belong to. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServiceResource + * + * @returns {object} metadata of ServiceResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceResource', + type: { + name: 'Composite', + className: 'ServiceResource', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + targetLocation: { + required: true, + serializedName: 'properties.targetLocation', + type: { + name: 'String' + } + }, + targetSubscriptionId: { + required: true, + serializedName: 'properties.targetSubscriptionId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServiceResource; diff --git a/lib/services/deploymentmanagerManagement/lib/models/serviceTopologyProperties.js b/lib/services/deploymentmanagerManagement/lib/models/serviceTopologyProperties.js new file mode 100644 index 0000000000..f6ff63d8f1 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/serviceTopologyProperties.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The properties of a service topology. + * + */ +class ServiceTopologyProperties { + /** + * Create a ServiceTopologyProperties. + * @member {string} [artifactSourceId] The artifact source that contains the + * artifacts that can be referenced in the service units. + */ + constructor() { + } + + /** + * Defines the metadata of ServiceTopologyProperties + * + * @returns {object} metadata of ServiceTopologyProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceTopologyProperties', + type: { + name: 'Composite', + className: 'ServiceTopologyProperties', + modelProperties: { + artifactSourceId: { + required: false, + serializedName: 'artifactSourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServiceTopologyProperties; diff --git a/lib/services/deploymentmanagerManagement/lib/models/serviceTopologyResource.js b/lib/services/deploymentmanagerManagement/lib/models/serviceTopologyResource.js new file mode 100644 index 0000000000..68213f4f90 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/serviceTopologyResource.js @@ -0,0 +1,102 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource representation of a service topology. + * + * @extends models['TrackedResource'] + */ +class ServiceTopologyResource extends models['TrackedResource'] { + /** + * Create a ServiceTopologyResource. + * @member {string} [artifactSourceId] The artifact source that contains the + * artifacts that can be referenced in the service units. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServiceTopologyResource + * + * @returns {object} metadata of ServiceTopologyResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceTopologyResource', + type: { + name: 'Composite', + className: 'ServiceTopologyResource', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + artifactSourceId: { + required: false, + serializedName: 'properties.artifactSourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServiceTopologyResource; diff --git a/lib/services/deploymentmanagerManagement/lib/models/serviceUnit.js b/lib/services/deploymentmanagerManagement/lib/models/serviceUnit.js new file mode 100644 index 0000000000..9b46ca8c0f --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/serviceUnit.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Defines a service unit. + * + * @extends models['ServiceUnitProperties'] + */ +class ServiceUnit extends models['ServiceUnitProperties'] { + /** + * Create a ServiceUnit. + * @member {string} [name] Name of the service unit. + * @member {array} [steps] Detailed step information, if present. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServiceUnit + * + * @returns {object} metadata of ServiceUnit + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceUnit', + type: { + name: 'Composite', + className: 'ServiceUnit', + modelProperties: { + targetResourceGroup: { + required: true, + serializedName: 'targetResourceGroup', + type: { + name: 'String' + } + }, + deploymentMode: { + required: true, + serializedName: 'deploymentMode', + type: { + name: 'Enum', + allowedValues: [ 'Incremental', 'Complete' ] + } + }, + artifacts: { + required: false, + serializedName: 'artifacts', + type: { + name: 'Composite', + className: 'ServiceUnitArtifacts' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + steps: { + required: false, + serializedName: 'steps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RolloutStepElementType', + type: { + name: 'Composite', + className: 'RolloutStep' + } + } + } + } + } + } + }; + } +} + +module.exports = ServiceUnit; diff --git a/lib/services/deploymentmanagerManagement/lib/models/serviceUnitArtifacts.js b/lib/services/deploymentmanagerManagement/lib/models/serviceUnitArtifacts.js new file mode 100644 index 0000000000..d4f90be216 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/serviceUnitArtifacts.js @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Defines the artifacts of a service unit. + * + */ +class ServiceUnitArtifacts { + /** + * Create a ServiceUnitArtifacts. + * @member {string} [templateUri] The full URI of the ARM template file with + * the SAS token. + * @member {string} [parametersUri] The full URI of the ARM parameters file + * with the SAS token. + * @member {string} [templateArtifactSourceRelativePath] The path to the ARM + * template file relative to the artifact source. + * @member {string} [parametersArtifactSourceRelativePath] The path to the + * ARM parameters file relative to the artifact source. + */ + constructor() { + } + + /** + * Defines the metadata of ServiceUnitArtifacts + * + * @returns {object} metadata of ServiceUnitArtifacts + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceUnitArtifacts', + type: { + name: 'Composite', + className: 'ServiceUnitArtifacts', + modelProperties: { + templateUri: { + required: false, + serializedName: 'templateUri', + type: { + name: 'String' + } + }, + parametersUri: { + required: false, + serializedName: 'parametersUri', + type: { + name: 'String' + } + }, + templateArtifactSourceRelativePath: { + required: false, + serializedName: 'templateArtifactSourceRelativePath', + type: { + name: 'String' + } + }, + parametersArtifactSourceRelativePath: { + required: false, + serializedName: 'parametersArtifactSourceRelativePath', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServiceUnitArtifacts; diff --git a/lib/services/deploymentmanagerManagement/lib/models/serviceUnitProperties.js b/lib/services/deploymentmanagerManagement/lib/models/serviceUnitProperties.js new file mode 100644 index 0000000000..85165dd672 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/serviceUnitProperties.js @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Defines the properties of a service unit. + * + */ +class ServiceUnitProperties { + /** + * Create a ServiceUnitProperties. + * @member {string} targetResourceGroup The Azure Resource Group to which the + * resources in the service unit belong to. + * @member {string} deploymentMode Describes the type of ARM deployment to be + * performed on the resource. Possible values include: 'Incremental', + * 'Complete' + * @member {object} [artifacts] The artifacts for the service unit. + * @member {string} [artifacts.templateUri] The full URI of the ARM template + * file with the SAS token. + * @member {string} [artifacts.parametersUri] The full URI of the ARM + * parameters file with the SAS token. + * @member {string} [artifacts.templateArtifactSourceRelativePath] The path + * to the ARM template file relative to the artifact source. + * @member {string} [artifacts.parametersArtifactSourceRelativePath] The path + * to the ARM parameters file relative to the artifact source. + */ + constructor() { + } + + /** + * Defines the metadata of ServiceUnitProperties + * + * @returns {object} metadata of ServiceUnitProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceUnitProperties', + type: { + name: 'Composite', + className: 'ServiceUnitProperties', + modelProperties: { + targetResourceGroup: { + required: true, + serializedName: 'targetResourceGroup', + type: { + name: 'String' + } + }, + deploymentMode: { + required: true, + serializedName: 'deploymentMode', + type: { + name: 'Enum', + allowedValues: [ 'Incremental', 'Complete' ] + } + }, + artifacts: { + required: false, + serializedName: 'artifacts', + type: { + name: 'Composite', + className: 'ServiceUnitArtifacts' + } + } + } + } + }; + } +} + +module.exports = ServiceUnitProperties; diff --git a/lib/services/deploymentmanagerManagement/lib/models/serviceUnitResource.js b/lib/services/deploymentmanagerManagement/lib/models/serviceUnitResource.js new file mode 100644 index 0000000000..c3f92de71e --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/serviceUnitResource.js @@ -0,0 +1,130 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents the response of a service unit resource. + * + * @extends models['TrackedResource'] + */ +class ServiceUnitResource extends models['TrackedResource'] { + /** + * Create a ServiceUnitResource. + * @member {string} targetResourceGroup The Azure Resource Group to which the + * resources in the service unit belong to. + * @member {string} deploymentMode Describes the type of ARM deployment to be + * performed on the resource. Possible values include: 'Incremental', + * 'Complete' + * @member {object} [artifacts] The artifacts for the service unit. + * @member {string} [artifacts.templateUri] The full URI of the ARM template + * file with the SAS token. + * @member {string} [artifacts.parametersUri] The full URI of the ARM + * parameters file with the SAS token. + * @member {string} [artifacts.templateArtifactSourceRelativePath] The path + * to the ARM template file relative to the artifact source. + * @member {string} [artifacts.parametersArtifactSourceRelativePath] The path + * to the ARM parameters file relative to the artifact source. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServiceUnitResource + * + * @returns {object} metadata of ServiceUnitResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceUnitResource', + type: { + name: 'Composite', + className: 'ServiceUnitResource', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + targetResourceGroup: { + required: true, + serializedName: 'properties.targetResourceGroup', + type: { + name: 'String' + } + }, + deploymentMode: { + required: true, + serializedName: 'properties.deploymentMode', + type: { + name: 'Enum', + allowedValues: [ 'Incremental', 'Complete' ] + } + }, + artifacts: { + required: false, + serializedName: 'properties.artifacts', + type: { + name: 'Composite', + className: 'ServiceUnitArtifacts' + } + } + } + } + }; + } +} + +module.exports = ServiceUnitResource; diff --git a/lib/services/deploymentmanagerManagement/lib/models/step.js b/lib/services/deploymentmanagerManagement/lib/models/step.js new file mode 100644 index 0000000000..2efadc47ca --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/step.js @@ -0,0 +1,111 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The properties that define an Azure Deployment Manager step. + * + */ +class Step { + /** + * Create a Step. + * @member {string} name The name of the step. + * @member {array} [dependsOnStepGroup] The list of step names on which this + * step depends. + * @member {array} [preDeploymentSteps] The list of step names to be run + * before deploying the target. + * @member {string} deploymentTargetId The reference to the ARM service unit + * resource to be deployed. + * @member {array} [postDeploymentSteps] The list of step names to be run + * after deploying the target. + */ + constructor() { + } + + /** + * Defines the metadata of Step + * + * @returns {object} metadata of Step + * + */ + mapper() { + return { + required: false, + serializedName: 'Step', + type: { + name: 'Composite', + className: 'Step', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + dependsOnStepGroup: { + required: false, + serializedName: 'dependsOnStepGroup', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + preDeploymentSteps: { + required: false, + serializedName: 'preDeploymentSteps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PrePostStepElementType', + type: { + name: 'Composite', + className: 'PrePostStep' + } + } + } + }, + deploymentTargetId: { + required: true, + serializedName: 'deploymentTargetId', + type: { + name: 'String' + } + }, + postDeploymentSteps: { + required: false, + serializedName: 'postDeploymentSteps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PrePostStepElementType', + type: { + name: 'Composite', + className: 'PrePostStep' + } + } + } + } + } + } + }; + } +} + +module.exports = Step; diff --git a/lib/services/deploymentmanagerManagement/lib/models/stepOperationInfo.js b/lib/services/deploymentmanagerManagement/lib/models/stepOperationInfo.js new file mode 100644 index 0000000000..948ba08230 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/stepOperationInfo.js @@ -0,0 +1,105 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Detailed information of specific step execution. + * + */ +class StepOperationInfo { + /** + * Create a StepOperationInfo. + * @member {string} [deploymentName] The name of the Azure Resource Manager + * deployment initiated as part of the step. + * @member {string} [correlationId] Unique identifier to track the request + * for ARM-based resources. + * @member {date} [startTime] Start time of the action in UTC. + * @member {date} [endTime] End time of the action in UTC. + * @member {date} [lastUpdatedTime] Last time in UTC this operation was + * updated. + * @member {object} [error] The errors, if any, for the action. + * @member {string} [error.code] Error code string. + * @member {string} [error.message] Descriptive error information. + * @member {string} [error.target] Error target + * @member {array} [error.details] More detailed error information. + */ + constructor() { + } + + /** + * Defines the metadata of StepOperationInfo + * + * @returns {object} metadata of StepOperationInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'StepOperationInfo', + type: { + name: 'Composite', + className: 'StepOperationInfo', + modelProperties: { + deploymentName: { + required: false, + readOnly: true, + serializedName: 'deploymentName', + type: { + name: 'String' + } + }, + correlationId: { + required: false, + readOnly: true, + serializedName: 'correlationId', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + }, + lastUpdatedTime: { + required: false, + readOnly: true, + serializedName: 'lastUpdatedTime', + type: { + name: 'DateTime' + } + }, + error: { + required: false, + serializedName: 'error', + type: { + name: 'Composite', + className: 'CloudErrorBody' + } + } + } + } + }; + } +} + +module.exports = StepOperationInfo; diff --git a/lib/services/deploymentmanagerManagement/lib/models/stepProperties.js b/lib/services/deploymentmanagerManagement/lib/models/stepProperties.js new file mode 100644 index 0000000000..101eede6ce --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/stepProperties.js @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The properties of a step resource. + * + */ +class StepProperties { + /** + * Create a StepProperties. + * @member {string} stepType Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of StepProperties + * + * @returns {object} metadata of StepProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'StepProperties', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'stepType', + clientName: 'stepType' + }, + uberParent: 'StepProperties', + className: 'StepProperties', + modelProperties: { + stepType: { + required: true, + serializedName: 'stepType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = StepProperties; diff --git a/lib/services/deploymentmanagerManagement/lib/models/stepResource.js b/lib/services/deploymentmanagerManagement/lib/models/stepResource.js new file mode 100644 index 0000000000..d949061865 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/stepResource.js @@ -0,0 +1,108 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource representation of a deployment step. + * + * @extends models['TrackedResource'] + */ +class StepResource extends models['TrackedResource'] { + /** + * Create a StepResource. + * @member {object} properties The properties for the resource. + * @member {string} [properties.stepType] Polymorphic Discriminator + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StepResource + * + * @returns {object} metadata of StepResource + * + */ + mapper() { + return { + required: false, + serializedName: 'StepResource', + type: { + name: 'Composite', + className: 'StepResource', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + properties: { + required: true, + serializedName: 'properties', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'stepType', + clientName: 'stepType' + }, + uberParent: 'StepProperties', + className: 'StepProperties' + } + } + } + } + }; + } +} + +module.exports = StepResource; diff --git a/lib/services/deploymentmanagerManagement/lib/models/trackedResource.js b/lib/services/deploymentmanagerManagement/lib/models/trackedResource.js new file mode 100644 index 0000000000..5c6804d7c8 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/trackedResource.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource model definition for a ARM tracked top level resource + * + * @extends models['Resource'] + */ +class TrackedResource extends models['Resource'] { + /** + * Create a TrackedResource. + * @member {object} [tags] Resource tags. + * @member {string} location The geo-location where the resource lives + */ + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TrackedResource; diff --git a/lib/services/deploymentmanagerManagement/lib/models/waitStepAttributes.js b/lib/services/deploymentmanagerManagement/lib/models/waitStepAttributes.js new file mode 100644 index 0000000000..c8af4355de --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/waitStepAttributes.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The parameters for the wait step. + * + */ +class WaitStepAttributes { + /** + * Create a WaitStepAttributes. + * @member {string} duration The duration in ISO 8601 format of how long the + * wait should be. + */ + constructor() { + } + + /** + * Defines the metadata of WaitStepAttributes + * + * @returns {object} metadata of WaitStepAttributes + * + */ + mapper() { + return { + required: false, + serializedName: 'WaitStepAttributes', + type: { + name: 'Composite', + className: 'WaitStepAttributes', + modelProperties: { + duration: { + required: true, + serializedName: 'duration', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WaitStepAttributes; diff --git a/lib/services/deploymentmanagerManagement/lib/models/waitStepProperties.js b/lib/services/deploymentmanagerManagement/lib/models/waitStepProperties.js new file mode 100644 index 0000000000..0e75b6442d --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/models/waitStepProperties.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Defines the properties of a Wait step. + * + * @extends models['StepProperties'] + */ +class WaitStepProperties extends models['StepProperties'] { + /** + * Create a WaitStepProperties. + * @member {object} [attributes] The Wait attributes + * @member {string} [attributes.duration] The duration in ISO 8601 format of + * how long the wait should be. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of WaitStepProperties + * + * @returns {object} metadata of WaitStepProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'Wait', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'stepType', + clientName: 'stepType' + }, + uberParent: 'StepProperties', + className: 'WaitStepProperties', + modelProperties: { + stepType: { + required: true, + serializedName: 'stepType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'WaitStepAttributes' + } + } + } + } + }; + } +} + +module.exports = WaitStepProperties; diff --git a/lib/services/deploymentmanagerManagement/lib/operations/artifactSources.js b/lib/services/deploymentmanagerManagement/lib/operations/artifactSources.js new file mode 100644 index 0000000000..dc9b2026ce --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/operations/artifactSources.js @@ -0,0 +1,841 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * @summary Creates or updates an Artifact source. + * + * Synchronously creates a new artifact source or updates an existing artifact + * source. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.artifactSourceInfo] Source object that defines the + * resource. + * + * @param {string} options.artifactSourceInfo.sourceType The type of artifact + * source used. + * + * @param {string} [options.artifactSourceInfo.artifactRoot] The root folder + * under which all artifacts for all environments are expected to be organized. + * + * @param {object} options.artifactSourceInfo.authentication The authentication + * method to use to access the artifact source. + * + * @param {string} options.artifactSourceInfo.authentication.type Polymorphic + * Discriminator + * + * @param {object} [options.artifactSourceInfo.tags] Resource tags. + * + * @param {string} options.artifactSourceInfo.location The geo-location where + * the resource lives + * + * @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 ArtifactSource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, artifactSourceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let artifactSourceInfo = (options && options.artifactSourceInfo !== undefined) ? options.artifactSourceInfo : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (artifactSourceName === null || artifactSourceName === undefined || typeof artifactSourceName.valueOf() !== 'string') { + throw new Error('artifactSourceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{artifactSourceName}', encodeURIComponent(artifactSourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (artifactSourceInfo !== null && artifactSourceInfo !== undefined) { + let requestModelMapper = new client.models['ArtifactSource']().mapper(); + requestModel = client.serialize(requestModelMapper, artifactSourceInfo, 'artifactSourceInfo'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(artifactSourceInfo, 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 !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ArtifactSource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets an artifact resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @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 ArtifactSource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, artifactSourceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (artifactSourceName === null || artifactSourceName === undefined || typeof artifactSourceName.valueOf() !== 'string') { + throw new Error('artifactSourceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{artifactSourceName}', encodeURIComponent(artifactSourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ArtifactSource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes an artifact source resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, artifactSourceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (artifactSourceName === null || artifactSourceName === undefined || typeof artifactSourceName.valueOf() !== 'string') { + throw new Error('artifactSourceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{artifactSourceName}', encodeURIComponent(artifactSourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ArtifactSources. */ +class ArtifactSources { + /** + * Create a ArtifactSources. + * @param {AzureDeploymentManager} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + } + + /** + * @summary Creates or updates an Artifact source. + * + * Synchronously creates a new artifact source or updates an existing artifact + * source. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.artifactSourceInfo] Source object that defines the + * resource. + * + * @param {string} options.artifactSourceInfo.sourceType The type of artifact + * source used. + * + * @param {string} [options.artifactSourceInfo.artifactRoot] The root folder + * under which all artifacts for all environments are expected to be organized. + * + * @param {object} options.artifactSourceInfo.authentication The authentication + * method to use to access the artifact source. + * + * @param {string} options.artifactSourceInfo.authentication.type Polymorphic + * Discriminator + * + * @param {object} [options.artifactSourceInfo.tags] Resource tags. + * + * @param {string} options.artifactSourceInfo.location The geo-location where + * the resource lives + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, artifactSourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, artifactSourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates an Artifact source. + * + * Synchronously creates a new artifact source or updates an existing artifact + * source. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.artifactSourceInfo] Source object that defines the + * resource. + * + * @param {string} options.artifactSourceInfo.sourceType The type of artifact + * source used. + * + * @param {string} [options.artifactSourceInfo.artifactRoot] The root folder + * under which all artifacts for all environments are expected to be organized. + * + * @param {object} options.artifactSourceInfo.authentication The authentication + * method to use to access the artifact source. + * + * @param {string} options.artifactSourceInfo.authentication.type Polymorphic + * Discriminator + * + * @param {object} [options.artifactSourceInfo.tags] Resource tags. + * + * @param {string} options.artifactSourceInfo.location The geo-location where + * the resource lives + * + * @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 {ArtifactSource} - 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 ArtifactSource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, artifactSourceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, artifactSourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, artifactSourceName, options, optionalCallback); + } + } + + /** + * @summary Gets an artifact resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, artifactSourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, artifactSourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets an artifact resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @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 {ArtifactSource} - 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 ArtifactSource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, artifactSourceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, artifactSourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, artifactSourceName, options, optionalCallback); + } + } + + /** + * @summary Deletes an artifact source resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, artifactSourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, artifactSourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes an artifact source resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, artifactSourceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, artifactSourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, artifactSourceName, options, optionalCallback); + } + } + +} + +module.exports = ArtifactSources; diff --git a/lib/services/deploymentmanagerManagement/lib/operations/index.d.ts b/lib/services/deploymentmanagerManagement/lib/operations/index.d.ts new file mode 100644 index 0000000000..7db3fa509c --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/operations/index.d.ts @@ -0,0 +1,1934 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. +*/ + +import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as models from '../models'; + + +/** + * @class + * ServiceTopologies + * __NOTE__: An instance of this class is automatically created for an + * instance of the AzureDeploymentManager. + */ +export interface ServiceTopologies { + + + /** + * @summary Creates or updates a service topology. + * + * Synchronously creates a new service topology or updates an existing service + * topology. + * + * @param {object} serviceTopologyInfo Source topology object defines the + * resource. + * + * @param {string} [serviceTopologyInfo.artifactSourceId] The artifact source + * that contains the artifacts that can be referenced in the service units. + * + * @param {object} [serviceTopologyInfo.tags] Resource tags. + * + * @param {string} serviceTopologyInfo.location The geo-location where the + * resource lives + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(serviceTopologyInfo: models.ServiceTopologyResource, resourceGroupName: string, serviceTopologyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates a service topology. + * + * Synchronously creates a new service topology or updates an existing service + * topology. + * + * @param {object} serviceTopologyInfo Source topology object defines the + * resource. + * + * @param {string} [serviceTopologyInfo.artifactSourceId] The artifact source + * that contains the artifacts that can be referenced in the service units. + * + * @param {object} [serviceTopologyInfo.tags] Resource tags. + * + * @param {string} serviceTopologyInfo.location The geo-location where the + * resource lives + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @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 {ServiceTopologyResource} - 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. + * + * {ServiceTopologyResource} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceTopologyResource} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(serviceTopologyInfo: models.ServiceTopologyResource, resourceGroupName: string, serviceTopologyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(serviceTopologyInfo: models.ServiceTopologyResource, resourceGroupName: string, serviceTopologyName: string, callback: ServiceCallback): void; + createOrUpdate(serviceTopologyInfo: models.ServiceTopologyResource, resourceGroupName: string, serviceTopologyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serviceTopologyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @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 {ServiceTopologyResource} - 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. + * + * {ServiceTopologyResource} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceTopologyResource} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serviceTopologyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceTopologyName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceTopologyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceTopologyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serviceTopologyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceTopologyName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceTopologyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Services + * __NOTE__: An instance of this class is automatically created for an + * instance of the AzureDeploymentManager. + */ +export interface Services { + + + /** + * @summary Creates or updates a service in the topology. + * + * Synchronously creates a new service or updates an existing service. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} serviceInfo The topoogy group resource object + * + * @param {string} serviceInfo.targetLocation The Azure location to which the + * resources in the service belong to. + * + * @param {string} serviceInfo.targetSubscriptionId The subscription to which + * the resources in the service belong to. + * + * @param {object} [serviceInfo.tags] Resource tags. + * + * @param {string} serviceInfo.location The geo-location where the resource + * lives + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceInfo: models.ServiceResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates a service in the topology. + * + * Synchronously creates a new service or updates an existing service. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} serviceInfo The topoogy group resource object + * + * @param {string} serviceInfo.targetLocation The Azure location to which the + * resources in the service belong to. + * + * @param {string} serviceInfo.targetSubscriptionId The subscription to which + * the resources in the service belong to. + * + * @param {object} [serviceInfo.tags] Resource tags. + * + * @param {string} serviceInfo.location The geo-location where the resource + * lives + * + * @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 {ServiceResource} - 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. + * + * {ServiceResource} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceInfo: models.ServiceResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceInfo: models.ServiceResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceInfo: models.ServiceResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets a service resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serviceTopologyName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets a service resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @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 {ServiceResource} - 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. + * + * {ServiceResource} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serviceTopologyName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceTopologyName: string, serviceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceTopologyName: string, serviceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a service resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceTopologyName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a service resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serviceTopologyName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceTopologyName: string, serviceName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceTopologyName: string, serviceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ServiceUnits + * __NOTE__: An instance of this class is automatically created for an + * instance of the AzureDeploymentManager. + */ +export interface ServiceUnits { + + + /** + * @summary Creates or updates a service unit in the service within the + * referenced topology resource. + * + * This is an asynchronous operation and can be polled to completion using the + * operation resource returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} serviceUnitInfo The service unit resource object. + * + * @param {string} serviceUnitInfo.targetResourceGroup The Azure Resource Group + * to which the resources in the service unit belong to. + * + * @param {string} serviceUnitInfo.deploymentMode Describes the type of ARM + * deployment to be performed on the resource. Possible values include: + * 'Incremental', 'Complete' + * + * @param {object} [serviceUnitInfo.artifacts] The artifacts for the service + * unit. + * + * @param {string} [serviceUnitInfo.artifacts.templateUri] The full URI of the + * ARM template file with the SAS token. + * + * @param {string} [serviceUnitInfo.artifacts.parametersUri] The full URI of + * the ARM parameters file with the SAS token. + * + * @param {string} + * [serviceUnitInfo.artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * + * @param {string} + * [serviceUnitInfo.artifacts.parametersArtifactSourceRelativePath] The path to + * the ARM parameters file relative to the artifact source. + * + * @param {object} [serviceUnitInfo.tags] Resource tags. + * + * @param {string} serviceUnitInfo.location The geo-location where the resource + * lives + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, serviceUnitInfo: models.ServiceUnitResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates a service unit in the service within the + * referenced topology resource. + * + * This is an asynchronous operation and can be polled to completion using the + * operation resource returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} serviceUnitInfo The service unit resource object. + * + * @param {string} serviceUnitInfo.targetResourceGroup The Azure Resource Group + * to which the resources in the service unit belong to. + * + * @param {string} serviceUnitInfo.deploymentMode Describes the type of ARM + * deployment to be performed on the resource. Possible values include: + * 'Incremental', 'Complete' + * + * @param {object} [serviceUnitInfo.artifacts] The artifacts for the service + * unit. + * + * @param {string} [serviceUnitInfo.artifacts.templateUri] The full URI of the + * ARM template file with the SAS token. + * + * @param {string} [serviceUnitInfo.artifacts.parametersUri] The full URI of + * the ARM parameters file with the SAS token. + * + * @param {string} + * [serviceUnitInfo.artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * + * @param {string} + * [serviceUnitInfo.artifacts.parametersArtifactSourceRelativePath] The path to + * the ARM parameters file relative to the artifact source. + * + * @param {object} [serviceUnitInfo.tags] Resource tags. + * + * @param {string} serviceUnitInfo.location The geo-location where the resource + * lives + * + * @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 {ServiceUnitResource} - 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. + * + * {ServiceUnitResource} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceUnitResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, serviceUnitInfo: models.ServiceUnitResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, serviceUnitInfo: models.ServiceUnitResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, serviceUnitInfo: models.ServiceUnitResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets a service unit resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets a service unit resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @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 {ServiceUnitResource} - 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. + * + * {ServiceUnitResource} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceUnitResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a service unit resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a service unit resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Creates or updates a service unit in the service within the + * referenced topology resource. + * + * This is an asynchronous operation and can be polled to completion using the + * operation resource returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} serviceUnitInfo The service unit resource object. + * + * @param {string} serviceUnitInfo.targetResourceGroup The Azure Resource Group + * to which the resources in the service unit belong to. + * + * @param {string} serviceUnitInfo.deploymentMode Describes the type of ARM + * deployment to be performed on the resource. Possible values include: + * 'Incremental', 'Complete' + * + * @param {object} [serviceUnitInfo.artifacts] The artifacts for the service + * unit. + * + * @param {string} [serviceUnitInfo.artifacts.templateUri] The full URI of the + * ARM template file with the SAS token. + * + * @param {string} [serviceUnitInfo.artifacts.parametersUri] The full URI of + * the ARM parameters file with the SAS token. + * + * @param {string} + * [serviceUnitInfo.artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * + * @param {string} + * [serviceUnitInfo.artifacts.parametersArtifactSourceRelativePath] The path to + * the ARM parameters file relative to the artifact source. + * + * @param {object} [serviceUnitInfo.tags] Resource tags. + * + * @param {string} serviceUnitInfo.location The geo-location where the resource + * lives + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, serviceUnitInfo: models.ServiceUnitResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates a service unit in the service within the + * referenced topology resource. + * + * This is an asynchronous operation and can be polled to completion using the + * operation resource returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} serviceUnitInfo The service unit resource object. + * + * @param {string} serviceUnitInfo.targetResourceGroup The Azure Resource Group + * to which the resources in the service unit belong to. + * + * @param {string} serviceUnitInfo.deploymentMode Describes the type of ARM + * deployment to be performed on the resource. Possible values include: + * 'Incremental', 'Complete' + * + * @param {object} [serviceUnitInfo.artifacts] The artifacts for the service + * unit. + * + * @param {string} [serviceUnitInfo.artifacts.templateUri] The full URI of the + * ARM template file with the SAS token. + * + * @param {string} [serviceUnitInfo.artifacts.parametersUri] The full URI of + * the ARM parameters file with the SAS token. + * + * @param {string} + * [serviceUnitInfo.artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * + * @param {string} + * [serviceUnitInfo.artifacts.parametersArtifactSourceRelativePath] The path to + * the ARM parameters file relative to the artifact source. + * + * @param {object} [serviceUnitInfo.tags] Resource tags. + * + * @param {string} serviceUnitInfo.location The geo-location where the resource + * lives + * + * @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 {ServiceUnitResource} - 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. + * + * {ServiceUnitResource} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceUnitResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, serviceUnitInfo: models.ServiceUnitResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, serviceUnitInfo: models.ServiceUnitResource, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serviceTopologyName: string, serviceName: string, serviceUnitName: string, serviceUnitInfo: models.ServiceUnitResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Steps + * __NOTE__: An instance of this class is automatically created for an + * instance of the AzureDeploymentManager. + */ +export interface Steps { + + + /** + * @summary Creates or updates a deployment step. + * + * Synchronously creates a new step or updates an existing step. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.stepInfo] The resource object. + * + * @param {object} options.stepInfo.properties The properties for the resource. + * + * @param {string} options.stepInfo.properties.stepType Polymorphic + * Discriminator + * + * @param {object} [options.stepInfo.tags] Resource tags. + * + * @param {string} options.stepInfo.location The geo-location where the + * resource lives + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, stepName: string, options?: { stepInfo? : models.StepResource, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates a deployment step. + * + * Synchronously creates a new step or updates an existing step. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.stepInfo] The resource object. + * + * @param {object} options.stepInfo.properties The properties for the resource. + * + * @param {string} options.stepInfo.properties.stepType Polymorphic + * Discriminator + * + * @param {object} [options.stepInfo.tags] Resource tags. + * + * @param {string} options.stepInfo.location The geo-location where the + * resource lives + * + * @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 {StepResource} - 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. + * + * {StepResource} [result] - The deserialized result object if an error did not occur. + * See {@link StepResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, stepName: string, options?: { stepInfo? : models.StepResource, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, stepName: string, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, stepName: string, options: { stepInfo? : models.StepResource, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @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 {StepResource} - 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. + * + * {StepResource} [result] - The deserialized result object if an error did not occur. + * See {@link StepResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, stepName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, stepName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a deployment step. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a deployment step. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, stepName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, stepName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, stepName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Rollouts + * __NOTE__: An instance of this class is automatically created for an + * instance of the AzureDeploymentManager. + */ +export interface Rollouts { + + + /** + * @summary Creates or updates a rollout. + * + * This is an asynchronous operation and can be polled to completion using the + * location header returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.rolloutRequest] Source rollout request object that + * defines the rollout. + * + * @param {object} options.rolloutRequest.identity Identity for the resource. + * + * @param {string} options.rolloutRequest.identity.type The identity type. + * + * @param {array} options.rolloutRequest.identity.identityIds The list of + * identities. + * + * @param {string} options.rolloutRequest.buildVersion The version of the build + * being deployed. + * + * @param {string} [options.rolloutRequest.artifactSourceId] The reference to + * the ARM resource Id where the payload is located. + * + * @param {string} options.rolloutRequest.targetServiceTopologyId The reference + * to the resource Id of the service topology from which services are chosen to + * be deployed. + * + * @param {array} options.rolloutRequest.stepGroups The list of steps that + * define the orchestration. + * + * @param {object} [options.rolloutRequest.tags] Resource tags. + * + * @param {string} options.rolloutRequest.location The geo-location where the + * resource lives + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, rolloutName: string, options?: { rolloutRequest? : models.RolloutRequest, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates a rollout. + * + * This is an asynchronous operation and can be polled to completion using the + * location header returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.rolloutRequest] Source rollout request object that + * defines the rollout. + * + * @param {object} options.rolloutRequest.identity Identity for the resource. + * + * @param {string} options.rolloutRequest.identity.type The identity type. + * + * @param {array} options.rolloutRequest.identity.identityIds The list of + * identities. + * + * @param {string} options.rolloutRequest.buildVersion The version of the build + * being deployed. + * + * @param {string} [options.rolloutRequest.artifactSourceId] The reference to + * the ARM resource Id where the payload is located. + * + * @param {string} options.rolloutRequest.targetServiceTopologyId The reference + * to the resource Id of the service topology from which services are chosen to + * be deployed. + * + * @param {array} options.rolloutRequest.stepGroups The list of steps that + * define the orchestration. + * + * @param {object} [options.rolloutRequest.tags] Resource tags. + * + * @param {string} options.rolloutRequest.location The geo-location where the + * resource lives + * + * @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 {RolloutRequest} - 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. + * + * {RolloutRequest} [result] - The deserialized result object if an error did not occur. + * See {@link RolloutRequest} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, rolloutName: string, options?: { rolloutRequest? : models.RolloutRequest, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, rolloutName: string, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, rolloutName: string, options: { rolloutRequest? : models.RolloutRequest, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets detailed information of an ongoing or completed rollout. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.retryAttempt] Rollout retry attempt ordinal to get + * the result of. If not specified, result of the latest attempt will be + * returned. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, rolloutName: string, options?: { retryAttempt? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets detailed information of an ongoing or completed rollout. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.retryAttempt] Rollout retry attempt ordinal to get + * the result of. If not specified, result of the latest attempt will be + * returned. + * + * @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 {Rollout} - 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. + * + * {Rollout} [result] - The deserialized result object if an error did not occur. + * See {@link Rollout} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, rolloutName: string, options?: { retryAttempt? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, rolloutName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, rolloutName: string, options: { retryAttempt? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a rollout resource. + * + * A rollout can only be deleted if it is in a terminal state. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, rolloutName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a rollout resource. + * + * A rollout can only be deleted if it is in a terminal state. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, rolloutName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, rolloutName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, rolloutName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Stops a running rollout. + * + * A rollout can be canceled only if it is in running state. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + cancelWithHttpOperationResponse(resourceGroupName: string, rolloutName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Stops a running rollout. + * + * A rollout can be canceled only if it is in running state. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Rollout} - 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. + * + * {Rollout} [result] - The deserialized result object if an error did not occur. + * See {@link Rollout} 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. + */ + cancel(resourceGroupName: string, rolloutName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + cancel(resourceGroupName: string, rolloutName: string, callback: ServiceCallback): void; + cancel(resourceGroupName: string, rolloutName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Restarts a failed rollout and optionally skips all succeeded steps. + * + * A rollout can be restarted only if is in a terminal state and failed. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.skipSucceeded] If true, will skip all succeeded + * steps so far in the rollout. If false, will execute the entire rollout again + * regardless of the current state of individual resources. Defaults to false + * if not specified. + * + * @param {object} [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. + */ + restartWithHttpOperationResponse(resourceGroupName: string, rolloutName: string, options?: { skipSucceeded? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Restarts a failed rollout and optionally skips all succeeded steps. + * + * A rollout can be restarted only if is in a terminal state and failed. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.skipSucceeded] If true, will skip all succeeded + * steps so far in the rollout. If false, will execute the entire rollout again + * regardless of the current state of individual resources. Defaults to false + * if not specified. + * + * @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 {Rollout} - 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. + * + * {Rollout} [result] - The deserialized result object if an error did not occur. + * See {@link Rollout} 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. + */ + restart(resourceGroupName: string, rolloutName: string, options?: { skipSucceeded? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise; + restart(resourceGroupName: string, rolloutName: string, callback: ServiceCallback): void; + restart(resourceGroupName: string, rolloutName: string, options: { skipSucceeded? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Creates or updates a rollout. + * + * This is an asynchronous operation and can be polled to completion using the + * location header returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.rolloutRequest] Source rollout request object that + * defines the rollout. + * + * @param {object} options.rolloutRequest.identity Identity for the resource. + * + * @param {string} options.rolloutRequest.identity.type The identity type. + * + * @param {array} options.rolloutRequest.identity.identityIds The list of + * identities. + * + * @param {string} options.rolloutRequest.buildVersion The version of the build + * being deployed. + * + * @param {string} [options.rolloutRequest.artifactSourceId] The reference to + * the ARM resource Id where the payload is located. + * + * @param {string} options.rolloutRequest.targetServiceTopologyId The reference + * to the resource Id of the service topology from which services are chosen to + * be deployed. + * + * @param {array} options.rolloutRequest.stepGroups The list of steps that + * define the orchestration. + * + * @param {object} [options.rolloutRequest.tags] Resource tags. + * + * @param {string} options.rolloutRequest.location The geo-location where the + * resource lives + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, rolloutName: string, options?: { rolloutRequest? : models.RolloutRequest, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates a rollout. + * + * This is an asynchronous operation and can be polled to completion using the + * location header returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.rolloutRequest] Source rollout request object that + * defines the rollout. + * + * @param {object} options.rolloutRequest.identity Identity for the resource. + * + * @param {string} options.rolloutRequest.identity.type The identity type. + * + * @param {array} options.rolloutRequest.identity.identityIds The list of + * identities. + * + * @param {string} options.rolloutRequest.buildVersion The version of the build + * being deployed. + * + * @param {string} [options.rolloutRequest.artifactSourceId] The reference to + * the ARM resource Id where the payload is located. + * + * @param {string} options.rolloutRequest.targetServiceTopologyId The reference + * to the resource Id of the service topology from which services are chosen to + * be deployed. + * + * @param {array} options.rolloutRequest.stepGroups The list of steps that + * define the orchestration. + * + * @param {object} [options.rolloutRequest.tags] Resource tags. + * + * @param {string} options.rolloutRequest.location The geo-location where the + * resource lives + * + * @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 {RolloutRequest} - 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. + * + * {RolloutRequest} [result] - The deserialized result object if an error did not occur. + * See {@link RolloutRequest} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, rolloutName: string, options?: { rolloutRequest? : models.RolloutRequest, customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, rolloutName: string, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, rolloutName: string, options: { rolloutRequest? : models.RolloutRequest, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ArtifactSources + * __NOTE__: An instance of this class is automatically created for an + * instance of the AzureDeploymentManager. + */ +export interface ArtifactSources { + + + /** + * @summary Creates or updates an Artifact source. + * + * Synchronously creates a new artifact source or updates an existing artifact + * source. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.artifactSourceInfo] Source object that defines the + * resource. + * + * @param {string} options.artifactSourceInfo.sourceType The type of artifact + * source used. + * + * @param {string} [options.artifactSourceInfo.artifactRoot] The root folder + * under which all artifacts for all environments are expected to be organized. + * + * @param {object} options.artifactSourceInfo.authentication The authentication + * method to use to access the artifact source. + * + * @param {string} options.artifactSourceInfo.authentication.type Polymorphic + * Discriminator + * + * @param {object} [options.artifactSourceInfo.tags] Resource tags. + * + * @param {string} options.artifactSourceInfo.location The geo-location where + * the resource lives + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, artifactSourceName: string, options?: { artifactSourceInfo? : models.ArtifactSource, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates an Artifact source. + * + * Synchronously creates a new artifact source or updates an existing artifact + * source. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.artifactSourceInfo] Source object that defines the + * resource. + * + * @param {string} options.artifactSourceInfo.sourceType The type of artifact + * source used. + * + * @param {string} [options.artifactSourceInfo.artifactRoot] The root folder + * under which all artifacts for all environments are expected to be organized. + * + * @param {object} options.artifactSourceInfo.authentication The authentication + * method to use to access the artifact source. + * + * @param {string} options.artifactSourceInfo.authentication.type Polymorphic + * Discriminator + * + * @param {object} [options.artifactSourceInfo.tags] Resource tags. + * + * @param {string} options.artifactSourceInfo.location The geo-location where + * the resource lives + * + * @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 {ArtifactSource} - 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. + * + * {ArtifactSource} [result] - The deserialized result object if an error did not occur. + * See {@link ArtifactSource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, artifactSourceName: string, options?: { artifactSourceInfo? : models.ArtifactSource, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, artifactSourceName: string, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, artifactSourceName: string, options: { artifactSourceInfo? : models.ArtifactSource, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets an artifact resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, artifactSourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets an artifact resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @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 {ArtifactSource} - 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. + * + * {ArtifactSource} [result] - The deserialized result object if an error did not occur. + * See {@link ArtifactSource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, artifactSourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, artifactSourceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, artifactSourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes an artifact source resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, artifactSourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes an artifact source resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} artifactSourceName The name of the artifact source. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, artifactSourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, artifactSourceName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, artifactSourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AzureDeploymentManager. + */ +export interface Operations { + + + /** + * @summary Gets an operation resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets an operation resource. + * + * @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 {Array} - 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. + * + * {Array} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(callback: ServiceCallback): void; + get(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/deploymentmanagerManagement/lib/operations/index.js b/lib/services/deploymentmanagerManagement/lib/operations/index.js new file mode 100644 index 0000000000..e42ca15b94 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/operations/index.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.ServiceTopologies = require('./serviceTopologies'); +exports.Services = require('./services'); +exports.ServiceUnits = require('./serviceUnits'); +exports.Steps = require('./steps'); +exports.Rollouts = require('./rollouts'); +exports.ArtifactSources = require('./artifactSources'); +exports.Operations = require('./operations'); diff --git a/lib/services/deploymentmanagerManagement/lib/operations/operations.js b/lib/services/deploymentmanagerManagement/lib/operations/operations.js new file mode 100644 index 0000000000..d6e9fe0b76 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/operations/operations.js @@ -0,0 +1,253 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * @summary Gets an operation resource. + * + * @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. + * + * {array} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.DeploymentManager/operations'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + }; + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Operations. */ +class Operations { + /** + * Create a Operations. + * @param {AzureDeploymentManager} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + } + + /** + * @summary Gets an operation resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets an operation resource. + * + * @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 {Array} - 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. + * + * {array} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/deploymentmanagerManagement/lib/operations/rollouts.js b/lib/services/deploymentmanagerManagement/lib/operations/rollouts.js new file mode 100644 index 0000000000..f5b4b79478 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/operations/rollouts.js @@ -0,0 +1,1683 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * @summary Creates or updates a rollout. + * + * This is an asynchronous operation and can be polled to completion using the + * location header returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.rolloutRequest] Source rollout request object that + * defines the rollout. + * + * @param {object} options.rolloutRequest.identity Identity for the resource. + * + * @param {string} options.rolloutRequest.identity.type The identity type. + * + * @param {array} options.rolloutRequest.identity.identityIds The list of + * identities. + * + * @param {string} options.rolloutRequest.buildVersion The version of the build + * being deployed. + * + * @param {string} [options.rolloutRequest.artifactSourceId] The reference to + * the ARM resource Id where the payload is located. + * + * @param {string} options.rolloutRequest.targetServiceTopologyId The reference + * to the resource Id of the service topology from which services are chosen to + * be deployed. + * + * @param {array} options.rolloutRequest.stepGroups The list of steps that + * define the orchestration. + * + * @param {object} [options.rolloutRequest.tags] Resource tags. + * + * @param {string} options.rolloutRequest.location The geo-location where the + * resource lives + * + * @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 RolloutRequest} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, rolloutName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, rolloutName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RolloutRequest']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * @summary Gets detailed information of an ongoing or completed rollout. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.retryAttempt] Rollout retry attempt ordinal to get + * the result of. If not specified, result of the latest attempt will be + * returned. + * + * @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 Rollout} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, rolloutName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let retryAttempt = (options && options.retryAttempt !== undefined) ? options.retryAttempt : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (rolloutName === null || rolloutName === undefined || typeof rolloutName.valueOf() !== 'string') { + throw new Error('rolloutName 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 (retryAttempt !== null && retryAttempt !== undefined && typeof retryAttempt !== 'number') { + throw new Error('retryAttempt must be of type number.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{rolloutName}', encodeURIComponent(rolloutName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (retryAttempt !== null && retryAttempt !== undefined) { + queryParameters.push('retryAttempt=' + encodeURIComponent(retryAttempt.toString())); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Rollout']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a rollout resource. + * + * A rollout can only be deleted if it is in a terminal state. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, rolloutName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (rolloutName === null || rolloutName === undefined || typeof rolloutName.valueOf() !== 'string') { + throw new Error('rolloutName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{rolloutName}', encodeURIComponent(rolloutName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Stops a running rollout. + * + * A rollout can be canceled only if it is in running state. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Rollout} 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 _cancel(resourceGroupName, rolloutName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (rolloutName === null || rolloutName === undefined || typeof rolloutName.valueOf() !== 'string') { + throw new Error('rolloutName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}/cancel'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{rolloutName}', encodeURIComponent(rolloutName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Rollout']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Restarts a failed rollout and optionally skips all succeeded steps. + * + * A rollout can be restarted only if is in a terminal state and failed. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.skipSucceeded] If true, will skip all succeeded + * steps so far in the rollout. If false, will execute the entire rollout again + * regardless of the current state of individual resources. Defaults to false + * if not specified. + * + * @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 Rollout} 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 _restart(resourceGroupName, rolloutName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let skipSucceeded = (options && options.skipSucceeded !== undefined) ? options.skipSucceeded : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (rolloutName === null || rolloutName === undefined || typeof rolloutName.valueOf() !== 'string') { + throw new Error('rolloutName cannot be null or undefined and it must be of type string.'); + } + if (skipSucceeded !== null && skipSucceeded !== undefined && typeof skipSucceeded !== 'boolean') { + throw new Error('skipSucceeded must be of type boolean.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}/restart'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{rolloutName}', encodeURIComponent(rolloutName)); + let queryParameters = []; + if (skipSucceeded !== null && skipSucceeded !== undefined) { + queryParameters.push('skipSucceeded=' + encodeURIComponent(skipSucceeded.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Rollout']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Creates or updates a rollout. + * + * This is an asynchronous operation and can be polled to completion using the + * location header returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.rolloutRequest] Source rollout request object that + * defines the rollout. + * + * @param {object} options.rolloutRequest.identity Identity for the resource. + * + * @param {string} options.rolloutRequest.identity.type The identity type. + * + * @param {array} options.rolloutRequest.identity.identityIds The list of + * identities. + * + * @param {string} options.rolloutRequest.buildVersion The version of the build + * being deployed. + * + * @param {string} [options.rolloutRequest.artifactSourceId] The reference to + * the ARM resource Id where the payload is located. + * + * @param {string} options.rolloutRequest.targetServiceTopologyId The reference + * to the resource Id of the service topology from which services are chosen to + * be deployed. + * + * @param {array} options.rolloutRequest.stepGroups The list of steps that + * define the orchestration. + * + * @param {object} [options.rolloutRequest.tags] Resource tags. + * + * @param {string} options.rolloutRequest.location The geo-location where the + * resource lives + * + * @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 RolloutRequest} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, rolloutName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let rolloutRequest = (options && options.rolloutRequest !== undefined) ? options.rolloutRequest : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (rolloutName === null || rolloutName === undefined || typeof rolloutName.valueOf() !== 'string') { + throw new Error('rolloutName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{rolloutName}', encodeURIComponent(rolloutName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (rolloutRequest !== null && rolloutRequest !== undefined) { + let requestModelMapper = new client.models['RolloutRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, rolloutRequest, 'rolloutRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(rolloutRequest, 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 !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RolloutRequest']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Rollouts. */ +class Rollouts { + /** + * Create a Rollouts. + * @param {AzureDeploymentManager} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._cancel = _cancel; + this._restart = _restart; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + } + + /** + * @summary Creates or updates a rollout. + * + * This is an asynchronous operation and can be polled to completion using the + * location header returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.rolloutRequest] Source rollout request object that + * defines the rollout. + * + * @param {object} options.rolloutRequest.identity Identity for the resource. + * + * @param {string} options.rolloutRequest.identity.type The identity type. + * + * @param {array} options.rolloutRequest.identity.identityIds The list of + * identities. + * + * @param {string} options.rolloutRequest.buildVersion The version of the build + * being deployed. + * + * @param {string} [options.rolloutRequest.artifactSourceId] The reference to + * the ARM resource Id where the payload is located. + * + * @param {string} options.rolloutRequest.targetServiceTopologyId The reference + * to the resource Id of the service topology from which services are chosen to + * be deployed. + * + * @param {array} options.rolloutRequest.stepGroups The list of steps that + * define the orchestration. + * + * @param {object} [options.rolloutRequest.tags] Resource tags. + * + * @param {string} options.rolloutRequest.location The geo-location where the + * resource lives + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, rolloutName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, rolloutName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates a rollout. + * + * This is an asynchronous operation and can be polled to completion using the + * location header returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.rolloutRequest] Source rollout request object that + * defines the rollout. + * + * @param {object} options.rolloutRequest.identity Identity for the resource. + * + * @param {string} options.rolloutRequest.identity.type The identity type. + * + * @param {array} options.rolloutRequest.identity.identityIds The list of + * identities. + * + * @param {string} options.rolloutRequest.buildVersion The version of the build + * being deployed. + * + * @param {string} [options.rolloutRequest.artifactSourceId] The reference to + * the ARM resource Id where the payload is located. + * + * @param {string} options.rolloutRequest.targetServiceTopologyId The reference + * to the resource Id of the service topology from which services are chosen to + * be deployed. + * + * @param {array} options.rolloutRequest.stepGroups The list of steps that + * define the orchestration. + * + * @param {object} [options.rolloutRequest.tags] Resource tags. + * + * @param {string} options.rolloutRequest.location The geo-location where the + * resource lives + * + * @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 {RolloutRequest} - 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 RolloutRequest} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, rolloutName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, rolloutName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, rolloutName, options, optionalCallback); + } + } + + /** + * @summary Gets detailed information of an ongoing or completed rollout. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.retryAttempt] Rollout retry attempt ordinal to get + * the result of. If not specified, result of the latest attempt will be + * returned. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, rolloutName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, rolloutName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets detailed information of an ongoing or completed rollout. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.retryAttempt] Rollout retry attempt ordinal to get + * the result of. If not specified, result of the latest attempt will be + * returned. + * + * @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 {Rollout} - 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 Rollout} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, rolloutName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, rolloutName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, rolloutName, options, optionalCallback); + } + } + + /** + * @summary Deletes a rollout resource. + * + * A rollout can only be deleted if it is in a terminal state. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, rolloutName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, rolloutName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes a rollout resource. + * + * A rollout can only be deleted if it is in a terminal state. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, rolloutName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, rolloutName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, rolloutName, options, optionalCallback); + } + } + + /** + * @summary Stops a running rollout. + * + * A rollout can be canceled only if it is in running state. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + cancelWithHttpOperationResponse(resourceGroupName, rolloutName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._cancel(resourceGroupName, rolloutName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Stops a running rollout. + * + * A rollout can be canceled only if it is in running state. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Rollout} - 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 Rollout} 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. + */ + cancel(resourceGroupName, rolloutName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._cancel(resourceGroupName, rolloutName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._cancel(resourceGroupName, rolloutName, options, optionalCallback); + } + } + + /** + * @summary Restarts a failed rollout and optionally skips all succeeded steps. + * + * A rollout can be restarted only if is in a terminal state and failed. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.skipSucceeded] If true, will skip all succeeded + * steps so far in the rollout. If false, will execute the entire rollout again + * regardless of the current state of individual resources. Defaults to false + * if not specified. + * + * @param {object} [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. + */ + restartWithHttpOperationResponse(resourceGroupName, rolloutName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._restart(resourceGroupName, rolloutName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Restarts a failed rollout and optionally skips all succeeded steps. + * + * A rollout can be restarted only if is in a terminal state and failed. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.skipSucceeded] If true, will skip all succeeded + * steps so far in the rollout. If false, will execute the entire rollout again + * regardless of the current state of individual resources. Defaults to false + * if not specified. + * + * @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 {Rollout} - 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 Rollout} 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. + */ + restart(resourceGroupName, rolloutName, 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._restart(resourceGroupName, rolloutName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._restart(resourceGroupName, rolloutName, options, optionalCallback); + } + } + + /** + * @summary Creates or updates a rollout. + * + * This is an asynchronous operation and can be polled to completion using the + * location header returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.rolloutRequest] Source rollout request object that + * defines the rollout. + * + * @param {object} options.rolloutRequest.identity Identity for the resource. + * + * @param {string} options.rolloutRequest.identity.type The identity type. + * + * @param {array} options.rolloutRequest.identity.identityIds The list of + * identities. + * + * @param {string} options.rolloutRequest.buildVersion The version of the build + * being deployed. + * + * @param {string} [options.rolloutRequest.artifactSourceId] The reference to + * the ARM resource Id where the payload is located. + * + * @param {string} options.rolloutRequest.targetServiceTopologyId The reference + * to the resource Id of the service topology from which services are chosen to + * be deployed. + * + * @param {array} options.rolloutRequest.stepGroups The list of steps that + * define the orchestration. + * + * @param {object} [options.rolloutRequest.tags] Resource tags. + * + * @param {string} options.rolloutRequest.location The geo-location where the + * resource lives + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, rolloutName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, rolloutName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates a rollout. + * + * This is an asynchronous operation and can be polled to completion using the + * location header returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} rolloutName The rollout name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.rolloutRequest] Source rollout request object that + * defines the rollout. + * + * @param {object} options.rolloutRequest.identity Identity for the resource. + * + * @param {string} options.rolloutRequest.identity.type The identity type. + * + * @param {array} options.rolloutRequest.identity.identityIds The list of + * identities. + * + * @param {string} options.rolloutRequest.buildVersion The version of the build + * being deployed. + * + * @param {string} [options.rolloutRequest.artifactSourceId] The reference to + * the ARM resource Id where the payload is located. + * + * @param {string} options.rolloutRequest.targetServiceTopologyId The reference + * to the resource Id of the service topology from which services are chosen to + * be deployed. + * + * @param {array} options.rolloutRequest.stepGroups The list of steps that + * define the orchestration. + * + * @param {object} [options.rolloutRequest.tags] Resource tags. + * + * @param {string} options.rolloutRequest.location The geo-location where the + * resource lives + * + * @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 {RolloutRequest} - 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 RolloutRequest} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, rolloutName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, rolloutName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, rolloutName, options, optionalCallback); + } + } + +} + +module.exports = Rollouts; diff --git a/lib/services/deploymentmanagerManagement/lib/operations/serviceTopologies.js b/lib/services/deploymentmanagerManagement/lib/operations/serviceTopologies.js new file mode 100644 index 0000000000..1bd741ab0a --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/operations/serviceTopologies.js @@ -0,0 +1,820 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * @summary Creates or updates a service topology. + * + * Synchronously creates a new service topology or updates an existing service + * topology. + * + * @param {object} serviceTopologyInfo Source topology object defines the + * resource. + * + * @param {string} [serviceTopologyInfo.artifactSourceId] The artifact source + * that contains the artifacts that can be referenced in the service units. + * + * @param {object} [serviceTopologyInfo.tags] Resource tags. + * + * @param {string} serviceTopologyInfo.location The geo-location where the + * resource lives + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @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 ServiceTopologyResource} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(serviceTopologyInfo, resourceGroupName, serviceTopologyName, 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 (serviceTopologyInfo === null || serviceTopologyInfo === undefined) { + throw new Error('serviceTopologyInfo cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (serviceTopologyName === null || serviceTopologyName === undefined || typeof serviceTopologyName.valueOf() !== 'string') { + throw new Error('serviceTopologyName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceTopologyName}', encodeURIComponent(serviceTopologyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (serviceTopologyInfo !== null && serviceTopologyInfo !== undefined) { + let requestModelMapper = new client.models['ServiceTopologyResource']().mapper(); + requestModel = client.serialize(requestModelMapper, serviceTopologyInfo, 'serviceTopologyInfo'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(serviceTopologyInfo, 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 !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServiceTopologyResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @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 ServiceTopologyResource} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, serviceTopologyName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (serviceTopologyName === null || serviceTopologyName === undefined || typeof serviceTopologyName.valueOf() !== 'string') { + throw new Error('serviceTopologyName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceTopologyName}', encodeURIComponent(serviceTopologyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServiceTopologyResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serviceTopologyName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (serviceTopologyName === null || serviceTopologyName === undefined || typeof serviceTopologyName.valueOf() !== 'string') { + throw new Error('serviceTopologyName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceTopologyName}', encodeURIComponent(serviceTopologyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ServiceTopologies. */ +class ServiceTopologies { + /** + * Create a ServiceTopologies. + * @param {AzureDeploymentManager} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + } + + /** + * @summary Creates or updates a service topology. + * + * Synchronously creates a new service topology or updates an existing service + * topology. + * + * @param {object} serviceTopologyInfo Source topology object defines the + * resource. + * + * @param {string} [serviceTopologyInfo.artifactSourceId] The artifact source + * that contains the artifacts that can be referenced in the service units. + * + * @param {object} [serviceTopologyInfo.tags] Resource tags. + * + * @param {string} serviceTopologyInfo.location The geo-location where the + * resource lives + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(serviceTopologyInfo, resourceGroupName, serviceTopologyName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(serviceTopologyInfo, resourceGroupName, serviceTopologyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates a service topology. + * + * Synchronously creates a new service topology or updates an existing service + * topology. + * + * @param {object} serviceTopologyInfo Source topology object defines the + * resource. + * + * @param {string} [serviceTopologyInfo.artifactSourceId] The artifact source + * that contains the artifacts that can be referenced in the service units. + * + * @param {object} [serviceTopologyInfo.tags] Resource tags. + * + * @param {string} serviceTopologyInfo.location The geo-location where the + * resource lives + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @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 {ServiceTopologyResource} - 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 ServiceTopologyResource} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(serviceTopologyInfo, resourceGroupName, serviceTopologyName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(serviceTopologyInfo, resourceGroupName, serviceTopologyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(serviceTopologyInfo, resourceGroupName, serviceTopologyName, options, optionalCallback); + } + } + + /** + * @summary Gets a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, serviceTopologyName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serviceTopologyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @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 {ServiceTopologyResource} - 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 ServiceTopologyResource} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, serviceTopologyName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serviceTopologyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serviceTopologyName, options, optionalCallback); + } + } + + /** + * @summary Deletes a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, serviceTopologyName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceTopologyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, serviceTopologyName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceTopologyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, serviceTopologyName, options, optionalCallback); + } + } + +} + +module.exports = ServiceTopologies; diff --git a/lib/services/deploymentmanagerManagement/lib/operations/serviceUnits.js b/lib/services/deploymentmanagerManagement/lib/operations/serviceUnits.js new file mode 100644 index 0000000000..94bfb1688b --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/operations/serviceUnits.js @@ -0,0 +1,1224 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * @summary Creates or updates a service unit in the service within the + * referenced topology resource. + * + * This is an asynchronous operation and can be polled to completion using the + * operation resource returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} serviceUnitInfo The service unit resource object. + * + * @param {string} serviceUnitInfo.targetResourceGroup The Azure Resource Group + * to which the resources in the service unit belong to. + * + * @param {string} serviceUnitInfo.deploymentMode Describes the type of ARM + * deployment to be performed on the resource. Possible values include: + * 'Incremental', 'Complete' + * + * @param {object} [serviceUnitInfo.artifacts] The artifacts for the service + * unit. + * + * @param {string} [serviceUnitInfo.artifacts.templateUri] The full URI of the + * ARM template file with the SAS token. + * + * @param {string} [serviceUnitInfo.artifacts.parametersUri] The full URI of + * the ARM parameters file with the SAS token. + * + * @param {string} + * [serviceUnitInfo.artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * + * @param {string} + * [serviceUnitInfo.artifacts.parametersArtifactSourceRelativePath] The path to + * the ARM parameters file relative to the artifact source. + * + * @param {object} [serviceUnitInfo.tags] Resource tags. + * + * @param {string} serviceUnitInfo.location The geo-location where the resource + * lives + * + * @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 ServiceUnitResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServiceUnitResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * @summary Gets a service unit resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @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 ServiceUnitResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (serviceTopologyName === null || serviceTopologyName === undefined || typeof serviceTopologyName.valueOf() !== 'string') { + throw new Error('serviceTopologyName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (serviceUnitName === null || serviceUnitName === undefined || typeof serviceUnitName.valueOf() !== 'string') { + throw new Error('serviceUnitName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceTopologyName}', encodeURIComponent(serviceTopologyName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{serviceUnitName}', encodeURIComponent(serviceUnitName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServiceUnitResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a service unit resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (serviceTopologyName === null || serviceTopologyName === undefined || typeof serviceTopologyName.valueOf() !== 'string') { + throw new Error('serviceTopologyName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (serviceUnitName === null || serviceUnitName === undefined || typeof serviceUnitName.valueOf() !== 'string') { + throw new Error('serviceUnitName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceTopologyName}', encodeURIComponent(serviceTopologyName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{serviceUnitName}', encodeURIComponent(serviceUnitName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Creates or updates a service unit in the service within the + * referenced topology resource. + * + * This is an asynchronous operation and can be polled to completion using the + * operation resource returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} serviceUnitInfo The service unit resource object. + * + * @param {string} serviceUnitInfo.targetResourceGroup The Azure Resource Group + * to which the resources in the service unit belong to. + * + * @param {string} serviceUnitInfo.deploymentMode Describes the type of ARM + * deployment to be performed on the resource. Possible values include: + * 'Incremental', 'Complete' + * + * @param {object} [serviceUnitInfo.artifacts] The artifacts for the service + * unit. + * + * @param {string} [serviceUnitInfo.artifacts.templateUri] The full URI of the + * ARM template file with the SAS token. + * + * @param {string} [serviceUnitInfo.artifacts.parametersUri] The full URI of + * the ARM parameters file with the SAS token. + * + * @param {string} + * [serviceUnitInfo.artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * + * @param {string} + * [serviceUnitInfo.artifacts.parametersArtifactSourceRelativePath] The path to + * the ARM parameters file relative to the artifact source. + * + * @param {object} [serviceUnitInfo.tags] Resource tags. + * + * @param {string} serviceUnitInfo.location The geo-location where the resource + * lives + * + * @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 ServiceUnitResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (serviceTopologyName === null || serviceTopologyName === undefined || typeof serviceTopologyName.valueOf() !== 'string') { + throw new Error('serviceTopologyName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (serviceUnitName === null || serviceUnitName === undefined || typeof serviceUnitName.valueOf() !== 'string') { + throw new Error('serviceUnitName 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 (serviceUnitInfo === null || serviceUnitInfo === undefined) { + throw new Error('serviceUnitInfo cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceTopologyName}', encodeURIComponent(serviceTopologyName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{serviceUnitName}', encodeURIComponent(serviceUnitName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (serviceUnitInfo !== null && serviceUnitInfo !== undefined) { + let requestModelMapper = new client.models['ServiceUnitResource']().mapper(); + requestModel = client.serialize(requestModelMapper, serviceUnitInfo, 'serviceUnitInfo'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(serviceUnitInfo, 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 !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServiceUnitResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ServiceUnits. */ +class ServiceUnits { + /** + * Create a ServiceUnits. + * @param {AzureDeploymentManager} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + } + + /** + * @summary Creates or updates a service unit in the service within the + * referenced topology resource. + * + * This is an asynchronous operation and can be polled to completion using the + * operation resource returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} serviceUnitInfo The service unit resource object. + * + * @param {string} serviceUnitInfo.targetResourceGroup The Azure Resource Group + * to which the resources in the service unit belong to. + * + * @param {string} serviceUnitInfo.deploymentMode Describes the type of ARM + * deployment to be performed on the resource. Possible values include: + * 'Incremental', 'Complete' + * + * @param {object} [serviceUnitInfo.artifacts] The artifacts for the service + * unit. + * + * @param {string} [serviceUnitInfo.artifacts.templateUri] The full URI of the + * ARM template file with the SAS token. + * + * @param {string} [serviceUnitInfo.artifacts.parametersUri] The full URI of + * the ARM parameters file with the SAS token. + * + * @param {string} + * [serviceUnitInfo.artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * + * @param {string} + * [serviceUnitInfo.artifacts.parametersArtifactSourceRelativePath] The path to + * the ARM parameters file relative to the artifact source. + * + * @param {object} [serviceUnitInfo.tags] Resource tags. + * + * @param {string} serviceUnitInfo.location The geo-location where the resource + * lives + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates a service unit in the service within the + * referenced topology resource. + * + * This is an asynchronous operation and can be polled to completion using the + * operation resource returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} serviceUnitInfo The service unit resource object. + * + * @param {string} serviceUnitInfo.targetResourceGroup The Azure Resource Group + * to which the resources in the service unit belong to. + * + * @param {string} serviceUnitInfo.deploymentMode Describes the type of ARM + * deployment to be performed on the resource. Possible values include: + * 'Incremental', 'Complete' + * + * @param {object} [serviceUnitInfo.artifacts] The artifacts for the service + * unit. + * + * @param {string} [serviceUnitInfo.artifacts.templateUri] The full URI of the + * ARM template file with the SAS token. + * + * @param {string} [serviceUnitInfo.artifacts.parametersUri] The full URI of + * the ARM parameters file with the SAS token. + * + * @param {string} + * [serviceUnitInfo.artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * + * @param {string} + * [serviceUnitInfo.artifacts.parametersArtifactSourceRelativePath] The path to + * the ARM parameters file relative to the artifact source. + * + * @param {object} [serviceUnitInfo.tags] Resource tags. + * + * @param {string} serviceUnitInfo.location The geo-location where the resource + * lives + * + * @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 {ServiceUnitResource} - 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 ServiceUnitResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, optionalCallback); + } + } + + /** + * @summary Gets a service unit resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets a service unit resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @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 {ServiceUnitResource} - 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 ServiceUnitResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options, optionalCallback); + } + } + + /** + * @summary Deletes a service unit resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes a service unit resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, options, optionalCallback); + } + } + + /** + * @summary Creates or updates a service unit in the service within the + * referenced topology resource. + * + * This is an asynchronous operation and can be polled to completion using the + * operation resource returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} serviceUnitInfo The service unit resource object. + * + * @param {string} serviceUnitInfo.targetResourceGroup The Azure Resource Group + * to which the resources in the service unit belong to. + * + * @param {string} serviceUnitInfo.deploymentMode Describes the type of ARM + * deployment to be performed on the resource. Possible values include: + * 'Incremental', 'Complete' + * + * @param {object} [serviceUnitInfo.artifacts] The artifacts for the service + * unit. + * + * @param {string} [serviceUnitInfo.artifacts.templateUri] The full URI of the + * ARM template file with the SAS token. + * + * @param {string} [serviceUnitInfo.artifacts.parametersUri] The full URI of + * the ARM parameters file with the SAS token. + * + * @param {string} + * [serviceUnitInfo.artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * + * @param {string} + * [serviceUnitInfo.artifacts.parametersArtifactSourceRelativePath] The path to + * the ARM parameters file relative to the artifact source. + * + * @param {object} [serviceUnitInfo.tags] Resource tags. + * + * @param {string} serviceUnitInfo.location The geo-location where the resource + * lives + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates a service unit in the service within the + * referenced topology resource. + * + * This is an asynchronous operation and can be polled to completion using the + * operation resource returned by this operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {string} serviceUnitName The name of the service unit resource. + * + * @param {object} serviceUnitInfo The service unit resource object. + * + * @param {string} serviceUnitInfo.targetResourceGroup The Azure Resource Group + * to which the resources in the service unit belong to. + * + * @param {string} serviceUnitInfo.deploymentMode Describes the type of ARM + * deployment to be performed on the resource. Possible values include: + * 'Incremental', 'Complete' + * + * @param {object} [serviceUnitInfo.artifacts] The artifacts for the service + * unit. + * + * @param {string} [serviceUnitInfo.artifacts.templateUri] The full URI of the + * ARM template file with the SAS token. + * + * @param {string} [serviceUnitInfo.artifacts.parametersUri] The full URI of + * the ARM parameters file with the SAS token. + * + * @param {string} + * [serviceUnitInfo.artifacts.templateArtifactSourceRelativePath] The path to + * the ARM template file relative to the artifact source. + * + * @param {string} + * [serviceUnitInfo.artifacts.parametersArtifactSourceRelativePath] The path to + * the ARM parameters file relative to the artifact source. + * + * @param {object} [serviceUnitInfo.tags] Resource tags. + * + * @param {string} serviceUnitInfo.location The geo-location where the resource + * lives + * + * @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 {ServiceUnitResource} - 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 ServiceUnitResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, options, optionalCallback); + } + } + +} + +module.exports = ServiceUnits; diff --git a/lib/services/deploymentmanagerManagement/lib/operations/services.js b/lib/services/deploymentmanagerManagement/lib/operations/services.js new file mode 100644 index 0000000000..f9dd2ff1b3 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/operations/services.js @@ -0,0 +1,849 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * @summary Creates or updates a service in the topology. + * + * Synchronously creates a new service or updates an existing service. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} serviceInfo The topoogy group resource object + * + * @param {string} serviceInfo.targetLocation The Azure location to which the + * resources in the service belong to. + * + * @param {string} serviceInfo.targetSubscriptionId The subscription to which + * the resources in the service belong to. + * + * @param {object} [serviceInfo.tags] Resource tags. + * + * @param {string} serviceInfo.location The geo-location where the resource + * lives + * + * @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 ServiceResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceInfo, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (serviceTopologyName === null || serviceTopologyName === undefined || typeof serviceTopologyName.valueOf() !== 'string') { + throw new Error('serviceTopologyName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName 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 (serviceInfo === null || serviceInfo === undefined) { + throw new Error('serviceInfo cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceTopologyName}', encodeURIComponent(serviceTopologyName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (serviceInfo !== null && serviceInfo !== undefined) { + let requestModelMapper = new client.models['ServiceResource']().mapper(); + requestModel = client.serialize(requestModelMapper, serviceInfo, 'serviceInfo'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(serviceInfo, 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 !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServiceResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets a service resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @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 ServiceResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, serviceTopologyName, serviceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (serviceTopologyName === null || serviceTopologyName === undefined || typeof serviceTopologyName.valueOf() !== 'string') { + throw new Error('serviceTopologyName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceTopologyName}', encodeURIComponent(serviceTopologyName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServiceResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a service resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serviceTopologyName, serviceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (serviceTopologyName === null || serviceTopologyName === undefined || typeof serviceTopologyName.valueOf() !== 'string') { + throw new Error('serviceTopologyName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceTopologyName}', encodeURIComponent(serviceTopologyName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Services. */ +class Services { + /** + * Create a Services. + * @param {AzureDeploymentManager} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + } + + /** + * @summary Creates or updates a service in the topology. + * + * Synchronously creates a new service or updates an existing service. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} serviceInfo The topoogy group resource object + * + * @param {string} serviceInfo.targetLocation The Azure location to which the + * resources in the service belong to. + * + * @param {string} serviceInfo.targetSubscriptionId The subscription to which + * the resources in the service belong to. + * + * @param {object} [serviceInfo.tags] Resource tags. + * + * @param {string} serviceInfo.location The geo-location where the resource + * lives + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, serviceTopologyName, serviceName, serviceInfo, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceInfo, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates a service in the topology. + * + * Synchronously creates a new service or updates an existing service. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} serviceInfo The topoogy group resource object + * + * @param {string} serviceInfo.targetLocation The Azure location to which the + * resources in the service belong to. + * + * @param {string} serviceInfo.targetSubscriptionId The subscription to which + * the resources in the service belong to. + * + * @param {object} [serviceInfo.tags] Resource tags. + * + * @param {string} serviceInfo.location The geo-location where the resource + * lives + * + * @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 {ServiceResource} - 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 ServiceResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceInfo, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceInfo, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, serviceTopologyName, serviceName, serviceInfo, options, optionalCallback); + } + } + + /** + * @summary Gets a service resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, serviceTopologyName, serviceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serviceTopologyName, serviceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets a service resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @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 {ServiceResource} - 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 ServiceResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, serviceTopologyName, serviceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serviceTopologyName, serviceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serviceTopologyName, serviceName, options, optionalCallback); + } + } + + /** + * @summary Deletes a service resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, serviceTopologyName, serviceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceTopologyName, serviceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes a service resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} serviceTopologyName The name of the service topology . + * + * @param {string} serviceName The name of the service resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, serviceTopologyName, serviceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceTopologyName, serviceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, serviceTopologyName, serviceName, options, optionalCallback); + } + } + +} + +module.exports = Services; diff --git a/lib/services/deploymentmanagerManagement/lib/operations/steps.js b/lib/services/deploymentmanagerManagement/lib/operations/steps.js new file mode 100644 index 0000000000..889b5bfab8 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/lib/operations/steps.js @@ -0,0 +1,814 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * @summary Creates or updates a deployment step. + * + * Synchronously creates a new step or updates an existing step. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.stepInfo] The resource object. + * + * @param {object} options.stepInfo.properties The properties for the resource. + * + * @param {string} options.stepInfo.properties.stepType Polymorphic + * Discriminator + * + * @param {object} [options.stepInfo.tags] Resource tags. + * + * @param {string} options.stepInfo.location The geo-location where the + * resource lives + * + * @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 StepResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, stepName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let stepInfo = (options && options.stepInfo !== undefined) ? options.stepInfo : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (stepName === null || stepName === undefined || typeof stepName.valueOf() !== 'string') { + throw new Error('stepName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{stepName}', encodeURIComponent(stepName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (stepInfo !== null && stepInfo !== undefined) { + let requestModelMapper = new client.models['StepResource']().mapper(); + requestModel = client.serialize(requestModelMapper, stepInfo, 'stepInfo'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(stepInfo, 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 !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['StepResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @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 StepResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, stepName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (stepName === null || stepName === undefined || typeof stepName.valueOf() !== 'string') { + throw new Error('stepName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{stepName}', encodeURIComponent(stepName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['StepResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a deployment step. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, stepName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (stepName === null || stepName === undefined || typeof stepName.valueOf() !== 'string') { + throw new Error('stepName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{stepName}', encodeURIComponent(stepName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Steps. */ +class Steps { + /** + * Create a Steps. + * @param {AzureDeploymentManager} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + } + + /** + * @summary Creates or updates a deployment step. + * + * Synchronously creates a new step or updates an existing step. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.stepInfo] The resource object. + * + * @param {object} options.stepInfo.properties The properties for the resource. + * + * @param {string} options.stepInfo.properties.stepType Polymorphic + * Discriminator + * + * @param {object} [options.stepInfo.tags] Resource tags. + * + * @param {string} options.stepInfo.location The geo-location where the + * resource lives + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, stepName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, stepName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates a deployment step. + * + * Synchronously creates a new step or updates an existing step. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.stepInfo] The resource object. + * + * @param {object} options.stepInfo.properties The properties for the resource. + * + * @param {string} options.stepInfo.properties.stepType Polymorphic + * Discriminator + * + * @param {object} [options.stepInfo.tags] Resource tags. + * + * @param {string} options.stepInfo.location The geo-location where the + * resource lives + * + * @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 {StepResource} - 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 StepResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, stepName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, stepName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, stepName, options, optionalCallback); + } + } + + /** + * @summary Gets a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, stepName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, stepName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets a topology resource. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @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 {StepResource} - 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 StepResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, stepName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, stepName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, stepName, options, optionalCallback); + } + } + + /** + * @summary Deletes a deployment step. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, stepName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, stepName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes a deployment step. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} stepName The name of the deployment step. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, stepName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, stepName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, stepName, options, optionalCallback); + } + } + +} + +module.exports = Steps; diff --git a/lib/services/deploymentmanagerManagement/package.json b/lib/services/deploymentmanagerManagement/package.json new file mode 100644 index 0000000000..a8ecfaf721 --- /dev/null +++ b/lib/services/deploymentmanagerManagement/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-deploymentmanager", + "author": "Microsoft Corporation", + "description": "AzureDeploymentManager Library with typescript type definitions for node", + "version": "0.9.0", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ + "node", + "azure" + ], + "license": "MIT", + "main": "./lib/azureDeploymentManager.js", + "types": "./lib/azureDeploymentManager.d.ts", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/deploymentmanagerManagement", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-node/issues" + } +}