From 34d2d1dfc0380e9b825894f197730313c55aa7df Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Wed, 18 Jul 2018 10:12:02 -0700 Subject: [PATCH 1/4] Regenerate azure-arm-resources --- .../lib/feature/featureClient.d.ts | 11 +- .../lib/feature/featureClient.js | 9 +- .../lib/link/managementLinkClient.d.ts | 11 +- .../lib/link/managementLinkClient.js | 9 +- .../lib/link/models/index.d.ts | 2 +- .../lib/link/models/resourceLink.js | 4 +- .../lib/lock/managementLockClient.d.ts | 11 +- .../lib/lock/managementLockClient.js | 9 +- .../lib/managedApplicationClient.d.ts | 63 + .../lib/managedApplicationClient.js | 86 + .../lib/models/appliance.js | 199 + .../lib/models/applianceArtifact.js | 70 + .../lib/models/applianceDefinition.js | 184 + .../models/applianceDefinitionListResult.js | 68 + .../lib/models/applianceListResult.js | 68 + .../lib/models/appliancePatchable.js | 199 + .../models/applianceProviderAuthorization.js | 65 + .../lib/models/errorResponse.js | 70 + .../lib/models/genericResource.js | 131 + .../resourceManagement/lib/models/identity.js | 72 + .../resourceManagement/lib/models/index.d.ts | 327 ++ .../resourceManagement/lib/models/index.js | 34 + .../resourceManagement/lib/models/plan.js | 84 + .../lib/models/planPatchable.js | 84 + .../resourceManagement/lib/models/resource.js | 98 + .../resourceManagement/lib/models/sku.js | 92 + .../lib/operations/applianceDefinitions.js | 3163 ++++++++++++ .../lib/operations/appliances.js | 4508 +++++++++++++++++ .../lib/operations/index.d.ts | 2697 ++++++++++ .../lib/operations/index.js | 18 + .../lib/policy/models/errorResponse.js | 4 +- .../lib/policy/models/index.d.ts | 93 +- .../lib/policy/models/index.js | 4 +- .../lib/policy/models/policyAssignment.js | 6 +- .../lib/policy/models/policyDefinition.js | 10 + .../lib/policy/models/policySku.js | 2 +- .../lib/policy/operations/index.d.ts | 1594 ++++-- .../lib/policy/operations/index.js | 2 +- .../policy/operations/policyAssignments.js | 911 +++- .../policy/operations/policyDefinitions.js | 258 +- .../policy/operations/policySetDefinitions.js | 249 +- .../lib/policy/policyClient.d.ts | 15 +- .../lib/policy/policyClient.js | 12 +- .../lib/resource/models/deployment.js | 16 + .../lib/resource/models/deploymentExtended.js | 23 +- .../resource/models/deploymentProperties.js | 14 + .../models/deploymentPropertiesExtended.js | 16 + .../models/deploymentValidateResult.js | 10 + .../lib/resource/models/genericResource.js | 7 +- .../lib/resource/models/identity.js | 25 +- .../identityUserAssignedIdentitiesValue.js | 61 + .../lib/resource/models/index.d.ts | 117 +- .../lib/resource/models/index.js | 3 + .../lib/resource/models/onErrorDeployment.js | 63 + .../models/onErrorDeploymentExtended.js | 73 + .../lib/resource/models/resourceGroup.js | 4 +- .../lib/resource/models/tagDetails.js | 1 + .../lib/resource/models/tagValue.js | 5 +- .../operations/deploymentOperations.js | 1014 +++- .../lib/resource/operations/deployments.js | 3879 ++++++++++++-- .../lib/resource/operations/index.d.ts | 1700 ++++++- .../lib/resource/operations/resources.js | 192 +- .../resource/resourceManagementClient.d.ts | 11 +- .../lib/resource/resourceManagementClient.js | 11 +- .../lib/subscription/subscriptionClient.d.ts | 11 +- .../lib/subscription/subscriptionClient.js | 9 +- .../resourceManagement/package-lock.json | 473 ++ 67 files changed, 21759 insertions(+), 1585 deletions(-) create mode 100644 lib/services/resourceManagement/lib/managedApplicationClient.d.ts create mode 100644 lib/services/resourceManagement/lib/managedApplicationClient.js create mode 100644 lib/services/resourceManagement/lib/models/appliance.js create mode 100644 lib/services/resourceManagement/lib/models/applianceArtifact.js create mode 100644 lib/services/resourceManagement/lib/models/applianceDefinition.js create mode 100644 lib/services/resourceManagement/lib/models/applianceDefinitionListResult.js create mode 100644 lib/services/resourceManagement/lib/models/applianceListResult.js create mode 100644 lib/services/resourceManagement/lib/models/appliancePatchable.js create mode 100644 lib/services/resourceManagement/lib/models/applianceProviderAuthorization.js create mode 100644 lib/services/resourceManagement/lib/models/errorResponse.js create mode 100644 lib/services/resourceManagement/lib/models/genericResource.js create mode 100644 lib/services/resourceManagement/lib/models/identity.js create mode 100644 lib/services/resourceManagement/lib/models/index.d.ts create mode 100644 lib/services/resourceManagement/lib/models/index.js create mode 100644 lib/services/resourceManagement/lib/models/plan.js create mode 100644 lib/services/resourceManagement/lib/models/planPatchable.js create mode 100644 lib/services/resourceManagement/lib/models/resource.js create mode 100644 lib/services/resourceManagement/lib/models/sku.js create mode 100644 lib/services/resourceManagement/lib/operations/applianceDefinitions.js create mode 100644 lib/services/resourceManagement/lib/operations/appliances.js create mode 100644 lib/services/resourceManagement/lib/operations/index.d.ts create mode 100644 lib/services/resourceManagement/lib/operations/index.js create mode 100644 lib/services/resourceManagement/lib/resource/models/identityUserAssignedIdentitiesValue.js create mode 100644 lib/services/resourceManagement/lib/resource/models/onErrorDeployment.js create mode 100644 lib/services/resourceManagement/lib/resource/models/onErrorDeploymentExtended.js create mode 100644 lib/services/resourceManagement/package-lock.json diff --git a/lib/services/resourceManagement/lib/feature/featureClient.d.ts b/lib/services/resourceManagement/lib/feature/featureClient.d.ts index 2357a212c4..daac7accee 100644 --- a/lib/services/resourceManagement/lib/feature/featureClient.d.ts +++ b/lib/services/resourceManagement/lib/feature/featureClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class FeatureClient extends AzureServiceClient { +export default class FeatureClient extends AzureServiceClient { /** * Initializes a new instance of the FeatureClient class. * @constructor @@ -33,11 +34,11 @@ declare class FeatureClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); @@ -58,4 +59,4 @@ declare class FeatureClient extends AzureServiceClient { features: operations.Features; } -export = FeatureClient; +export { FeatureClient, models as FeatureModels }; diff --git a/lib/services/resourceManagement/lib/feature/featureClient.js b/lib/services/resourceManagement/lib/feature/featureClient.js index a7bce0cc90..6d2d304720 100644 --- a/lib/services/resourceManagement/lib/feature/featureClient.js +++ b/lib/services/resourceManagement/lib/feature/featureClient.js @@ -34,9 +34,9 @@ class FeatureClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ constructor(credentials, subscriptionId, baseUri, options) { if (credentials === null || credentials === undefined) { @@ -80,3 +80,6 @@ class FeatureClient extends ServiceClient { } module.exports = FeatureClient; +module.exports['default'] = FeatureClient; +module.exports.FeatureClient = FeatureClient; +module.exports.FeatureModels = models; diff --git a/lib/services/resourceManagement/lib/link/managementLinkClient.d.ts b/lib/services/resourceManagement/lib/link/managementLinkClient.d.ts index dfea8e2d1e..9a0b67991d 100644 --- a/lib/services/resourceManagement/lib/link/managementLinkClient.d.ts +++ b/lib/services/resourceManagement/lib/link/managementLinkClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class ManagementLinkClient extends AzureServiceClient { +export default class ManagementLinkClient extends AzureServiceClient { /** * Initializes a new instance of the ManagementLinkClient class. * @constructor @@ -33,11 +34,11 @@ declare class ManagementLinkClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); @@ -58,4 +59,4 @@ declare class ManagementLinkClient extends AzureServiceClient { resourceLinks: operations.ResourceLinks; } -export = ManagementLinkClient; +export { ManagementLinkClient, models as ManagementLinkModels }; diff --git a/lib/services/resourceManagement/lib/link/managementLinkClient.js b/lib/services/resourceManagement/lib/link/managementLinkClient.js index bdee35c04b..fb94b69d98 100644 --- a/lib/services/resourceManagement/lib/link/managementLinkClient.js +++ b/lib/services/resourceManagement/lib/link/managementLinkClient.js @@ -34,9 +34,9 @@ class ManagementLinkClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ constructor(credentials, subscriptionId, baseUri, options) { if (credentials === null || credentials === undefined) { @@ -80,3 +80,6 @@ class ManagementLinkClient extends ServiceClient { } module.exports = ManagementLinkClient; +module.exports['default'] = ManagementLinkClient; +module.exports.ManagementLinkClient = ManagementLinkClient; +module.exports.ManagementLinkModels = models; diff --git a/lib/services/resourceManagement/lib/link/models/index.d.ts b/lib/services/resourceManagement/lib/link/models/index.d.ts index 0a50f5cbd7..0b32a93a53 100644 --- a/lib/services/resourceManagement/lib/link/models/index.d.ts +++ b/lib/services/resourceManagement/lib/link/models/index.d.ts @@ -61,7 +61,7 @@ export interface ResourceLinkProperties { * resource in the link. * @member {string} [properties.notes] Notes about the resource link. */ -export interface ResourceLink { +export interface ResourceLink extends BaseResource { readonly id?: string; readonly name?: string; properties?: ResourceLinkProperties; diff --git a/lib/services/resourceManagement/lib/link/models/resourceLink.js b/lib/services/resourceManagement/lib/link/models/resourceLink.js index 0b096a02d9..92de39f4c2 100644 --- a/lib/services/resourceManagement/lib/link/models/resourceLink.js +++ b/lib/services/resourceManagement/lib/link/models/resourceLink.js @@ -15,8 +15,9 @@ const models = require('./index'); /** * The resource link. * + * @extends models['BaseResource'] */ -class ResourceLink { +class ResourceLink extends models['BaseResource'] { /** * Create a ResourceLink. * @member {string} [id] The fully qualified ID of the resource link. @@ -29,6 +30,7 @@ class ResourceLink { * @member {string} [properties.notes] Notes about the resource link. */ constructor() { + super(); } /** diff --git a/lib/services/resourceManagement/lib/lock/managementLockClient.d.ts b/lib/services/resourceManagement/lib/lock/managementLockClient.d.ts index 75cc8b5e0f..8c60918a2f 100644 --- a/lib/services/resourceManagement/lib/lock/managementLockClient.d.ts +++ b/lib/services/resourceManagement/lib/lock/managementLockClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class ManagementLockClient extends AzureServiceClient { +export default class ManagementLockClient extends AzureServiceClient { /** * Initializes a new instance of the ManagementLockClient class. * @constructor @@ -33,11 +34,11 @@ declare class ManagementLockClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); @@ -58,4 +59,4 @@ declare class ManagementLockClient extends AzureServiceClient { managementLocks: operations.ManagementLocks; } -export = ManagementLockClient; +export { ManagementLockClient, models as ManagementLockModels }; diff --git a/lib/services/resourceManagement/lib/lock/managementLockClient.js b/lib/services/resourceManagement/lib/lock/managementLockClient.js index 612b09c0e1..087de2fa72 100644 --- a/lib/services/resourceManagement/lib/lock/managementLockClient.js +++ b/lib/services/resourceManagement/lib/lock/managementLockClient.js @@ -34,9 +34,9 @@ class ManagementLockClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ constructor(credentials, subscriptionId, baseUri, options) { if (credentials === null || credentials === undefined) { @@ -80,3 +80,6 @@ class ManagementLockClient extends ServiceClient { } module.exports = ManagementLockClient; +module.exports['default'] = ManagementLockClient; +module.exports.ManagementLockClient = ManagementLockClient; +module.exports.ManagementLockModels = models; diff --git a/lib/services/resourceManagement/lib/managedApplicationClient.d.ts b/lib/services/resourceManagement/lib/managedApplicationClient.d.ts new file mode 100644 index 0000000000..904f9f4ac0 --- /dev/null +++ b/lib/services/resourceManagement/lib/managedApplicationClient.d.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +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 ManagedApplicationClient extends AzureServiceClient { + /** + * Initializes a new instance of the ManagedApplicationClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The ID of the target subscription. + * + * @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 + appliances: operations.Appliances; + applianceDefinitions: operations.ApplianceDefinitions; +} + +export { ManagedApplicationClient, models as ManagedApplicationModels }; diff --git a/lib/services/resourceManagement/lib/managedApplicationClient.js b/lib/services/resourceManagement/lib/managedApplicationClient.js new file mode 100644 index 0000000000..1c4279323c --- /dev/null +++ b/lib/services/resourceManagement/lib/managedApplicationClient.js @@ -0,0 +1,86 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +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 ManagedApplicationClient. */ +class ManagedApplicationClient extends ServiceClient { + /** + * Create a ManagedApplicationClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The ID of the target subscription. + * @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 = '2016-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.appliances = new operations.Appliances(this); + this.applianceDefinitions = new operations.ApplianceDefinitions(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = ManagedApplicationClient; +module.exports['default'] = ManagedApplicationClient; +module.exports.ManagedApplicationClient = ManagedApplicationClient; +module.exports.ManagedApplicationModels = models; diff --git a/lib/services/resourceManagement/lib/models/appliance.js b/lib/services/resourceManagement/lib/models/appliance.js new file mode 100644 index 0000000000..ba3ebb0779 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/appliance.js @@ -0,0 +1,199 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Information about appliance. + * + * @extends models['GenericResource'] + */ +class Appliance extends models['GenericResource'] { + /** + * Create a Appliance. + * @member {string} managedResourceGroupId The managed resource group Id. + * @member {string} [applianceDefinitionId] The fully qualified path of + * appliance definition Id. + * @member {object} [parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * @member {object} [outputs] Name and value pairs that define the appliance + * outputs. + * @member {string} [provisioningState] The appliance provisioning state. + * Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', + * 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', + * 'Updating' + * @member {string} [uiDefinitionUri] The blob URI where the UI definition + * file is located. + * @member {object} [plan] The plan information. + * @member {string} [plan.name] The plan name. + * @member {string} [plan.publisher] The publisher ID. + * @member {string} [plan.product] The product code. + * @member {string} [plan.promotionCode] The promotion code. + * @member {string} [plan.version] The plan's version. + * @member {string} kind The kind of the appliance. Allowed values are + * MarketPlace and ServiceCatalog. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Appliance + * + * @returns {object} metadata of Appliance + * + */ + mapper() { + return { + required: false, + serializedName: 'Appliance', + type: { + name: 'Composite', + className: 'Appliance', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + managedBy: { + required: false, + serializedName: 'managedBy', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + identity: { + required: false, + serializedName: 'identity', + type: { + name: 'Composite', + className: 'Identity' + } + }, + managedResourceGroupId: { + required: true, + serializedName: 'properties.managedResourceGroupId', + type: { + name: 'String' + } + }, + applianceDefinitionId: { + required: false, + serializedName: 'properties.applianceDefinitionId', + type: { + name: 'String' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Object' + } + }, + outputs: { + required: false, + readOnly: true, + serializedName: 'properties.outputs', + type: { + name: 'Object' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uiDefinitionUri: { + required: false, + serializedName: 'properties.uiDefinitionUri', + type: { + name: 'String' + } + }, + plan: { + required: false, + serializedName: 'plan', + type: { + name: 'Composite', + className: 'Plan' + } + }, + kind: { + required: true, + serializedName: 'kind', + constraints: { + Pattern: '^[-\w\._,\(\)]+$' + }, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Appliance; diff --git a/lib/services/resourceManagement/lib/models/applianceArtifact.js b/lib/services/resourceManagement/lib/models/applianceArtifact.js new file mode 100644 index 0000000000..983a8d5b5d --- /dev/null +++ b/lib/services/resourceManagement/lib/models/applianceArtifact.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Appliance artifact. + * + */ +class ApplianceArtifact { + /** + * Create a ApplianceArtifact. + * @member {string} [name] The appliance artifact name. + * @member {string} [uri] The appliance artifact blob uri. + * @member {string} [type] The the appliance artifact type. Possible values + * include: 'Template', 'Custom' + */ + constructor() { + } + + /** + * Defines the metadata of ApplianceArtifact + * + * @returns {object} metadata of ApplianceArtifact + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplianceArtifact', + type: { + name: 'Composite', + className: 'ApplianceArtifact', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + uri: { + required: false, + serializedName: 'uri', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'Enum', + allowedValues: [ 'Template', 'Custom' ] + } + } + } + } + }; + } +} + +module.exports = ApplianceArtifact; diff --git a/lib/services/resourceManagement/lib/models/applianceDefinition.js b/lib/services/resourceManagement/lib/models/applianceDefinition.js new file mode 100644 index 0000000000..e91cd4044f --- /dev/null +++ b/lib/services/resourceManagement/lib/models/applianceDefinition.js @@ -0,0 +1,184 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Information about appliance definition. + * + * @extends models['GenericResource'] + */ +class ApplianceDefinition extends models['GenericResource'] { + /** + * Create a ApplianceDefinition. + * @member {string} lockLevel The appliance lock level. Possible values + * include: 'CanNotDelete', 'ReadOnly', 'None' + * @member {string} [displayName] The appliance definition display name. + * @member {array} authorizations The appliance provider authorizations. + * @member {array} [artifacts] The collection of appliance artifacts. The + * portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * @member {string} [description] The appliance definition description. + * @member {string} packageFileUri The appliance definition package file Uri. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplianceDefinition + * + * @returns {object} metadata of ApplianceDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplianceDefinition', + type: { + name: 'Composite', + className: 'ApplianceDefinition', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + managedBy: { + required: false, + serializedName: 'managedBy', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + identity: { + required: false, + serializedName: 'identity', + type: { + name: 'Composite', + className: 'Identity' + } + }, + lockLevel: { + required: true, + serializedName: 'properties.lockLevel', + type: { + name: 'Enum', + allowedValues: [ 'CanNotDelete', 'ReadOnly', 'None' ] + } + }, + displayName: { + required: false, + serializedName: 'properties.displayName', + type: { + name: 'String' + } + }, + authorizations: { + required: true, + serializedName: 'properties.authorizations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplianceProviderAuthorizationElementType', + type: { + name: 'Composite', + className: 'ApplianceProviderAuthorization' + } + } + } + }, + artifacts: { + required: false, + serializedName: 'properties.artifacts', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplianceArtifactElementType', + type: { + name: 'Composite', + className: 'ApplianceArtifact' + } + } + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + packageFileUri: { + required: true, + serializedName: 'properties.packageFileUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplianceDefinition; diff --git a/lib/services/resourceManagement/lib/models/applianceDefinitionListResult.js b/lib/services/resourceManagement/lib/models/applianceDefinitionListResult.js new file mode 100644 index 0000000000..ff9634d9af --- /dev/null +++ b/lib/services/resourceManagement/lib/models/applianceDefinitionListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * List of appliance definitions. + */ +class ApplianceDefinitionListResult extends Array { + /** + * Create a ApplianceDefinitionListResult. + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplianceDefinitionListResult + * + * @returns {object} metadata of ApplianceDefinitionListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplianceDefinitionListResult', + type: { + name: 'Composite', + className: 'ApplianceDefinitionListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplianceDefinitionElementType', + type: { + name: 'Composite', + className: 'ApplianceDefinition' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplianceDefinitionListResult; diff --git a/lib/services/resourceManagement/lib/models/applianceListResult.js b/lib/services/resourceManagement/lib/models/applianceListResult.js new file mode 100644 index 0000000000..4fe21fd9ac --- /dev/null +++ b/lib/services/resourceManagement/lib/models/applianceListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * List of appliances. + */ +class ApplianceListResult extends Array { + /** + * Create a ApplianceListResult. + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplianceListResult + * + * @returns {object} metadata of ApplianceListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplianceListResult', + type: { + name: 'Composite', + className: 'ApplianceListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplianceElementType', + type: { + name: 'Composite', + className: 'Appliance' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplianceListResult; diff --git a/lib/services/resourceManagement/lib/models/appliancePatchable.js b/lib/services/resourceManagement/lib/models/appliancePatchable.js new file mode 100644 index 0000000000..8958405901 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/appliancePatchable.js @@ -0,0 +1,199 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Information about appliance. + * + * @extends models['GenericResource'] + */ +class AppliancePatchable extends models['GenericResource'] { + /** + * Create a AppliancePatchable. + * @member {string} [managedResourceGroupId] The managed resource group Id. + * @member {string} [applianceDefinitionId] The fully qualified path of + * appliance definition Id. + * @member {object} [parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * @member {object} [outputs] Name and value pairs that define the appliance + * outputs. + * @member {string} [provisioningState] The appliance provisioning state. + * Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', + * 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', + * 'Updating' + * @member {string} [uiDefinitionUri] The blob URI where the UI definition + * file is located. + * @member {object} [plan] The plan information. + * @member {string} [plan.name] The plan name. + * @member {string} [plan.publisher] The publisher ID. + * @member {string} [plan.product] The product code. + * @member {string} [plan.promotionCode] The promotion code. + * @member {string} [plan.version] The plan's version. + * @member {string} [kind] The kind of the appliance. Allowed values are + * MarketPlace and ServiceCatalog. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AppliancePatchable + * + * @returns {object} metadata of AppliancePatchable + * + */ + mapper() { + return { + required: false, + serializedName: 'AppliancePatchable', + type: { + name: 'Composite', + className: 'AppliancePatchable', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + managedBy: { + required: false, + serializedName: 'managedBy', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + identity: { + required: false, + serializedName: 'identity', + type: { + name: 'Composite', + className: 'Identity' + } + }, + managedResourceGroupId: { + required: false, + serializedName: 'properties.managedResourceGroupId', + type: { + name: 'String' + } + }, + applianceDefinitionId: { + required: false, + serializedName: 'properties.applianceDefinitionId', + type: { + name: 'String' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Object' + } + }, + outputs: { + required: false, + readOnly: true, + serializedName: 'properties.outputs', + type: { + name: 'Object' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uiDefinitionUri: { + required: false, + serializedName: 'properties.uiDefinitionUri', + type: { + name: 'String' + } + }, + plan: { + required: false, + serializedName: 'plan', + type: { + name: 'Composite', + className: 'PlanPatchable' + } + }, + kind: { + required: false, + serializedName: 'kind', + constraints: { + Pattern: '^[-\w\._,\(\)]+$' + }, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AppliancePatchable; diff --git a/lib/services/resourceManagement/lib/models/applianceProviderAuthorization.js b/lib/services/resourceManagement/lib/models/applianceProviderAuthorization.js new file mode 100644 index 0000000000..aaea0ed206 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/applianceProviderAuthorization.js @@ -0,0 +1,65 @@ +/* + * 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 appliance provider authorization. + * + */ +class ApplianceProviderAuthorization { + /** + * Create a ApplianceProviderAuthorization. + * @member {string} principalId The provider's principal identifier. This is + * the identity that the provider will use to call ARM to manage the + * appliance resources. + * @member {string} roleDefinitionId The provider's role definition + * identifier. This role will define all the permissions that the provider + * must have on the appliance's container resource group. This role + * definition cannot have permission to delete the resource group. + */ + constructor() { + } + + /** + * Defines the metadata of ApplianceProviderAuthorization + * + * @returns {object} metadata of ApplianceProviderAuthorization + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplianceProviderAuthorization', + type: { + name: 'Composite', + className: 'ApplianceProviderAuthorization', + modelProperties: { + principalId: { + required: true, + serializedName: 'principalId', + type: { + name: 'String' + } + }, + roleDefinitionId: { + required: true, + serializedName: 'roleDefinitionId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplianceProviderAuthorization; diff --git a/lib/services/resourceManagement/lib/models/errorResponse.js b/lib/services/resourceManagement/lib/models/errorResponse.js new file mode 100644 index 0000000000..559d320b99 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/errorResponse.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Error reponse indicates ARM appliance is not able to process the incoming + * request. The reason is provided in the error message. + * + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @member {string} [httpStatus] Http status code. + * @member {string} [errorCode] Error code. + * @member {string} [errorMessage] Error message indicating why the operation + * failed. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + httpStatus: { + required: false, + serializedName: 'httpStatus', + type: { + name: 'String' + } + }, + errorCode: { + required: false, + serializedName: 'errorCode', + type: { + name: 'String' + } + }, + errorMessage: { + required: false, + serializedName: 'errorMessage', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/resourceManagement/lib/models/genericResource.js b/lib/services/resourceManagement/lib/models/genericResource.js new file mode 100644 index 0000000000..9e265d77fc --- /dev/null +++ b/lib/services/resourceManagement/lib/models/genericResource.js @@ -0,0 +1,131 @@ +/* + * 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'); + +/** + * Resource information. + * + * @extends models['Resource'] + */ +class GenericResource extends models['Resource'] { + /** + * Create a GenericResource. + * @member {string} [managedBy] ID of the resource that manages this + * resource. + * @member {object} [sku] The SKU of the resource. + * @member {string} [sku.name] The SKU name. + * @member {string} [sku.tier] The SKU tier. + * @member {string} [sku.size] The SKU size. + * @member {string} [sku.family] The SKU family. + * @member {string} [sku.model] The SKU model. + * @member {number} [sku.capacity] The SKU capacity. + * @member {object} [identity] The identity of the resource. + * @member {string} [identity.principalId] The principal ID of resource + * identity. + * @member {string} [identity.tenantId] The tenant ID of resource. + * @member {string} [identity.type] The identity type. Possible values + * include: 'SystemAssigned' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of GenericResource + * + * @returns {object} metadata of GenericResource + * + */ + mapper() { + return { + required: false, + serializedName: 'GenericResource', + type: { + name: 'Composite', + className: 'GenericResource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + managedBy: { + required: false, + serializedName: 'managedBy', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + identity: { + required: false, + serializedName: 'identity', + type: { + name: 'Composite', + className: 'Identity' + } + } + } + } + }; + } +} + +module.exports = GenericResource; diff --git a/lib/services/resourceManagement/lib/models/identity.js b/lib/services/resourceManagement/lib/models/identity.js new file mode 100644 index 0000000000..14c1fe4686 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/identity.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'; + +/** + * Identity for the resource. + * + */ +class Identity { + /** + * Create a Identity. + * @member {string} [principalId] The principal ID of resource identity. + * @member {string} [tenantId] The tenant ID of resource. + * @member {string} [type] The identity type. Possible values include: + * 'SystemAssigned' + */ + constructor() { + } + + /** + * Defines the metadata of Identity + * + * @returns {object} metadata of Identity + * + */ + mapper() { + return { + required: false, + serializedName: 'Identity', + type: { + name: 'Composite', + className: 'Identity', + modelProperties: { + principalId: { + required: false, + readOnly: true, + serializedName: 'principalId', + type: { + name: 'String' + } + }, + tenantId: { + required: false, + readOnly: true, + serializedName: 'tenantId', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'Enum', + allowedValues: [ 'SystemAssigned' ] + } + } + } + } + }; + } +} + +module.exports = Identity; diff --git a/lib/services/resourceManagement/lib/models/index.d.ts b/lib/services/resourceManagement/lib/models/index.d.ts new file mode 100644 index 0000000000..0fc960eae3 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/index.d.ts @@ -0,0 +1,327 @@ +/* + * 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 Plan class. + * @constructor + * Plan for the appliance. + * + * @member {string} name The plan name. + * @member {string} publisher The publisher ID. + * @member {string} product The product code. + * @member {string} [promotionCode] The promotion code. + * @member {string} version The plan's version. + */ +export interface Plan { + name: string; + publisher: string; + product: string; + promotionCode?: string; + version: string; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * Resource information. + * + * @member {string} [id] Resource ID + * @member {string} [name] Resource name + * @member {string} [type] Resource type + * @member {string} [location] Resource location + * @member {object} [tags] Resource tags + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the GenericResource class. + * @constructor + * Resource information. + * + * @member {string} [managedBy] ID of the resource that manages this resource. + * @member {object} [sku] The SKU of the resource. + * @member {string} [sku.name] The SKU name. + * @member {string} [sku.tier] The SKU tier. + * @member {string} [sku.size] The SKU size. + * @member {string} [sku.family] The SKU family. + * @member {string} [sku.model] The SKU model. + * @member {number} [sku.capacity] The SKU capacity. + * @member {object} [identity] The identity of the resource. + * @member {string} [identity.principalId] The principal ID of resource + * identity. + * @member {string} [identity.tenantId] The tenant ID of resource. + * @member {string} [identity.type] The identity type. Possible values include: + * 'SystemAssigned' + */ +export interface GenericResource extends Resource { + managedBy?: string; + sku?: Sku; + identity?: Identity; +} + +/** + * @class + * Initializes a new instance of the Appliance class. + * @constructor + * Information about appliance. + * + * @member {string} managedResourceGroupId The managed resource group Id. + * @member {string} [applianceDefinitionId] The fully qualified path of + * appliance definition Id. + * @member {object} [parameters] Name and value pairs that define the appliance + * parameters. It can be a JObject or a well formed JSON string. + * @member {object} [outputs] Name and value pairs that define the appliance + * outputs. + * @member {string} [provisioningState] The appliance provisioning state. + * Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', + * 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', + * 'Updating' + * @member {string} [uiDefinitionUri] The blob URI where the UI definition file + * is located. + * @member {object} [plan] The plan information. + * @member {string} [plan.name] The plan name. + * @member {string} [plan.publisher] The publisher ID. + * @member {string} [plan.product] The product code. + * @member {string} [plan.promotionCode] The promotion code. + * @member {string} [plan.version] The plan's version. + * @member {string} kind The kind of the appliance. Allowed values are + * MarketPlace and ServiceCatalog. + */ +export interface Appliance extends GenericResource { + managedResourceGroupId: string; + applianceDefinitionId?: string; + parameters?: any; + readonly outputs?: any; + readonly provisioningState?: string; + uiDefinitionUri?: string; + plan?: Plan; + kind: string; +} + +/** + * @class + * Initializes a new instance of the PlanPatchable class. + * @constructor + * Plan for the appliance. + * + * @member {string} [name] The plan name. + * @member {string} [publisher] The publisher ID. + * @member {string} [product] The product code. + * @member {string} [promotionCode] The promotion code. + * @member {string} [version] The plan's version. + */ +export interface PlanPatchable { + name?: string; + publisher?: string; + product?: string; + promotionCode?: string; + version?: string; +} + +/** + * @class + * Initializes a new instance of the AppliancePatchable class. + * @constructor + * Information about appliance. + * + * @member {string} [managedResourceGroupId] The managed resource group Id. + * @member {string} [applianceDefinitionId] The fully qualified path of + * appliance definition Id. + * @member {object} [parameters] Name and value pairs that define the appliance + * parameters. It can be a JObject or a well formed JSON string. + * @member {object} [outputs] Name and value pairs that define the appliance + * outputs. + * @member {string} [provisioningState] The appliance provisioning state. + * Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', + * 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', + * 'Updating' + * @member {string} [uiDefinitionUri] The blob URI where the UI definition file + * is located. + * @member {object} [plan] The plan information. + * @member {string} [plan.name] The plan name. + * @member {string} [plan.publisher] The publisher ID. + * @member {string} [plan.product] The product code. + * @member {string} [plan.promotionCode] The promotion code. + * @member {string} [plan.version] The plan's version. + * @member {string} [kind] The kind of the appliance. Allowed values are + * MarketPlace and ServiceCatalog. + */ +export interface AppliancePatchable extends GenericResource { + managedResourceGroupId?: string; + applianceDefinitionId?: string; + parameters?: any; + readonly outputs?: any; + readonly provisioningState?: string; + uiDefinitionUri?: string; + plan?: PlanPatchable; + kind?: string; +} + +/** + * @class + * Initializes a new instance of the ApplianceProviderAuthorization class. + * @constructor + * The appliance provider authorization. + * + * @member {string} principalId The provider's principal identifier. This is + * the identity that the provider will use to call ARM to manage the appliance + * resources. + * @member {string} roleDefinitionId The provider's role definition identifier. + * This role will define all the permissions that the provider must have on the + * appliance's container resource group. This role definition cannot have + * permission to delete the resource group. + */ +export interface ApplianceProviderAuthorization { + principalId: string; + roleDefinitionId: string; +} + +/** + * @class + * Initializes a new instance of the ApplianceArtifact class. + * @constructor + * Appliance artifact. + * + * @member {string} [name] The appliance artifact name. + * @member {string} [uri] The appliance artifact blob uri. + * @member {string} [type] The the appliance artifact type. Possible values + * include: 'Template', 'Custom' + */ +export interface ApplianceArtifact { + name?: string; + uri?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplianceDefinition class. + * @constructor + * Information about appliance definition. + * + * @member {string} lockLevel The appliance lock level. Possible values + * include: 'CanNotDelete', 'ReadOnly', 'None' + * @member {string} [displayName] The appliance definition display name. + * @member {array} authorizations The appliance provider authorizations. + * @member {array} [artifacts] The collection of appliance artifacts. The + * portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * @member {string} [description] The appliance definition description. + * @member {string} packageFileUri The appliance definition package file Uri. + */ +export interface ApplianceDefinition extends GenericResource { + lockLevel: string; + displayName?: string; + authorizations: ApplianceProviderAuthorization[]; + artifacts?: ApplianceArtifact[]; + description?: string; + packageFileUri: string; +} + +/** + * @class + * Initializes a new instance of the Sku class. + * @constructor + * SKU for the resource. + * + * @member {string} name The SKU name. + * @member {string} [tier] The SKU tier. + * @member {string} [size] The SKU size. + * @member {string} [family] The SKU family. + * @member {string} [model] The SKU model. + * @member {number} [capacity] The SKU capacity. + */ +export interface Sku { + name: string; + tier?: string; + size?: string; + family?: string; + model?: string; + capacity?: number; +} + +/** + * @class + * Initializes a new instance of the Identity class. + * @constructor + * Identity for the resource. + * + * @member {string} [principalId] The principal ID of resource identity. + * @member {string} [tenantId] The tenant ID of resource. + * @member {string} [type] The identity type. Possible values include: + * 'SystemAssigned' + */ +export interface Identity { + readonly principalId?: string; + readonly tenantId?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorResponse class. + * @constructor + * Error reponse indicates ARM appliance is not able to process the incoming + * request. The reason is provided in the error message. + * + * @member {string} [httpStatus] Http status code. + * @member {string} [errorCode] Error code. + * @member {string} [errorMessage] Error message indicating why the operation + * failed. + */ +export interface ErrorResponse { + httpStatus?: string; + errorCode?: string; + errorMessage?: string; +} + + +/** + * @class + * Initializes a new instance of the ApplianceListResult class. + * @constructor + * List of appliances. + * + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ +export interface ApplianceListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ApplianceDefinitionListResult class. + * @constructor + * List of appliance definitions. + * + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ +export interface ApplianceDefinitionListResult extends Array { + nextLink?: string; +} diff --git a/lib/services/resourceManagement/lib/models/index.js b/lib/services/resourceManagement/lib/models/index.js new file mode 100644 index 0000000000..317c683d60 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/index.js @@ -0,0 +1,34 @@ +/* + * 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.Plan = require('./plan'); +exports.Resource = require('./resource'); +exports.GenericResource = require('./genericResource'); +exports.Appliance = require('./appliance'); +exports.PlanPatchable = require('./planPatchable'); +exports.AppliancePatchable = require('./appliancePatchable'); +exports.ApplianceProviderAuthorization = require('./applianceProviderAuthorization'); +exports.ApplianceArtifact = require('./applianceArtifact'); +exports.ApplianceDefinition = require('./applianceDefinition'); +exports.Sku = require('./sku'); +exports.Identity = require('./identity'); +exports.ErrorResponse = require('./errorResponse'); +exports.ApplianceListResult = require('./applianceListResult'); +exports.ApplianceDefinitionListResult = require('./applianceDefinitionListResult'); diff --git a/lib/services/resourceManagement/lib/models/plan.js b/lib/services/resourceManagement/lib/models/plan.js new file mode 100644 index 0000000000..fb6fb37d00 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/plan.js @@ -0,0 +1,84 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Plan for the appliance. + * + */ +class Plan { + /** + * Create a Plan. + * @member {string} name The plan name. + * @member {string} publisher The publisher ID. + * @member {string} product The product code. + * @member {string} [promotionCode] The promotion code. + * @member {string} version The plan's version. + */ + constructor() { + } + + /** + * Defines the metadata of Plan + * + * @returns {object} metadata of Plan + * + */ + mapper() { + return { + required: false, + serializedName: 'Plan', + type: { + name: 'Composite', + className: 'Plan', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + publisher: { + required: true, + serializedName: 'publisher', + type: { + name: 'String' + } + }, + product: { + required: true, + serializedName: 'product', + type: { + name: 'String' + } + }, + promotionCode: { + required: false, + serializedName: 'promotionCode', + type: { + name: 'String' + } + }, + version: { + required: true, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Plan; diff --git a/lib/services/resourceManagement/lib/models/planPatchable.js b/lib/services/resourceManagement/lib/models/planPatchable.js new file mode 100644 index 0000000000..b54289ce51 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/planPatchable.js @@ -0,0 +1,84 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Plan for the appliance. + * + */ +class PlanPatchable { + /** + * Create a PlanPatchable. + * @member {string} [name] The plan name. + * @member {string} [publisher] The publisher ID. + * @member {string} [product] The product code. + * @member {string} [promotionCode] The promotion code. + * @member {string} [version] The plan's version. + */ + constructor() { + } + + /** + * Defines the metadata of PlanPatchable + * + * @returns {object} metadata of PlanPatchable + * + */ + mapper() { + return { + required: false, + serializedName: 'PlanPatchable', + type: { + name: 'Composite', + className: 'PlanPatchable', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + publisher: { + required: false, + serializedName: 'publisher', + type: { + name: 'String' + } + }, + product: { + required: false, + serializedName: 'product', + type: { + name: 'String' + } + }, + promotionCode: { + required: false, + serializedName: 'promotionCode', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PlanPatchable; diff --git a/lib/services/resourceManagement/lib/models/resource.js b/lib/services/resourceManagement/lib/models/resource.js new file mode 100644 index 0000000000..aa4fa609c4 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/resource.js @@ -0,0 +1,98 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Resource information. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] Resource ID + * @member {string} [name] Resource name + * @member {string} [type] Resource type + * @member {string} [location] Resource location + * @member {object} [tags] Resource tags + */ + 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' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/resourceManagement/lib/models/sku.js b/lib/services/resourceManagement/lib/models/sku.js new file mode 100644 index 0000000000..601a2e365e --- /dev/null +++ b/lib/services/resourceManagement/lib/models/sku.js @@ -0,0 +1,92 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * SKU for the resource. + * + */ +class Sku { + /** + * Create a Sku. + * @member {string} name The SKU name. + * @member {string} [tier] The SKU tier. + * @member {string} [size] The SKU size. + * @member {string} [family] The SKU family. + * @member {string} [model] The SKU model. + * @member {number} [capacity] The SKU capacity. + */ + constructor() { + } + + /** + * Defines the metadata of Sku + * + * @returns {object} metadata of Sku + * + */ + mapper() { + return { + required: false, + serializedName: 'Sku', + type: { + name: 'Composite', + className: 'Sku', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + tier: { + required: false, + serializedName: 'tier', + type: { + name: 'String' + } + }, + size: { + required: false, + serializedName: 'size', + type: { + name: 'String' + } + }, + family: { + required: false, + serializedName: 'family', + type: { + name: 'String' + } + }, + model: { + required: false, + serializedName: 'model', + type: { + name: 'String' + } + }, + capacity: { + required: false, + serializedName: 'capacity', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = Sku; diff --git a/lib/services/resourceManagement/lib/operations/applianceDefinitions.js b/lib/services/resourceManagement/lib/operations/applianceDefinitions.js new file mode 100644 index 0000000000..449eb73f64 --- /dev/null +++ b/lib/services/resourceManagement/lib/operations/applianceDefinitions.js @@ -0,0 +1,3163 @@ +/* + * 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; + +/** + * Gets the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @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 ApplianceDefinition} 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, applianceDefinitionName, 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 (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 (applianceDefinitionName === null || applianceDefinitionName === undefined || typeof applianceDefinitionName.valueOf() !== 'string') { + throw new Error('applianceDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (applianceDefinitionName !== null && applianceDefinitionName !== undefined) { + if (applianceDefinitionName.length > 64) + { + throw new Error('"applianceDefinitionName" should satisfy the constraint - "MaxLength": 64'); + } + if (applianceDefinitionName.length < 3) + { + throw new Error('"applianceDefinitionName" should satisfy the constraint - "MinLength": 3'); + } + } + 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.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.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.Solutions/applianceDefinitions/{applianceDefinitionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applianceDefinitionName}', encodeURIComponent(applianceDefinitionName)); + 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 && statusCode !== 404) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplianceDefinition']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Deletes the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance definition + * to delete. + * + * @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, applianceDefinitionName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, applianceDefinitionName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Creates a new appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 ApplianceDefinition} 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, applianceDefinitionName, parameters, 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, applianceDefinitionName, parameters, 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['ApplianceDefinition']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists the appliance definitions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @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 ApplianceDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + 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 (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.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.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.Solutions/applianceDefinitions'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplianceDefinitionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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 ApplianceDefinition} 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 _getById(applianceDefinitionId, 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 (applianceDefinitionId === null || applianceDefinitionId === undefined || typeof applianceDefinitionId.valueOf() !== 'string') { + throw new Error('applianceDefinitionId 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('/') ? '' : '/') + '{applianceDefinitionId}'; + requestUrl = requestUrl.replace('{applianceDefinitionId}', applianceDefinitionId); + 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 && statusCode !== 404) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplianceDefinition']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Deletes the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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 _deleteById(applianceDefinitionId, 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.beginDeleteById(applianceDefinitionId, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Creates a new appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 ApplianceDefinition} 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 _createOrUpdateById(applianceDefinitionId, parameters, 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.beginCreateOrUpdateById(applianceDefinitionId, parameters, 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['ApplianceDefinition']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Deletes the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance definition + * to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, applianceDefinitionName, 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 (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 (applianceDefinitionName === null || applianceDefinitionName === undefined || typeof applianceDefinitionName.valueOf() !== 'string') { + throw new Error('applianceDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (applianceDefinitionName !== null && applianceDefinitionName !== undefined) { + if (applianceDefinitionName.length > 64) + { + throw new Error('"applianceDefinitionName" should satisfy the constraint - "MaxLength": 64'); + } + if (applianceDefinitionName.length < 3) + { + throw new Error('"applianceDefinitionName" should satisfy the constraint - "MinLength": 3'); + } + } + 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.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.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.Solutions/applianceDefinitions/{applianceDefinitionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applianceDefinitionName}', encodeURIComponent(applianceDefinitionName)); + 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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a new appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 ApplianceDefinition} 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, applianceDefinitionName, parameters, 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 (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 (applianceDefinitionName === null || applianceDefinitionName === undefined || typeof applianceDefinitionName.valueOf() !== 'string') { + throw new Error('applianceDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (applianceDefinitionName !== null && applianceDefinitionName !== undefined) { + if (applianceDefinitionName.length > 64) + { + throw new Error('"applianceDefinitionName" should satisfy the constraint - "MaxLength": 64'); + } + if (applianceDefinitionName.length < 3) + { + throw new Error('"applianceDefinitionName" should satisfy the constraint - "MinLength": 3'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + 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.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.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.Solutions/applianceDefinitions/{applianceDefinitionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applianceDefinitionName}', encodeURIComponent(applianceDefinitionName)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ApplianceDefinition']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplianceDefinition']().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); + } + } + // 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['ApplianceDefinition']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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 _beginDeleteById(applianceDefinitionId, 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 (applianceDefinitionId === null || applianceDefinitionId === undefined || typeof applianceDefinitionId.valueOf() !== 'string') { + throw new Error('applianceDefinitionId 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('/') ? '' : '/') + '{applianceDefinitionId}'; + requestUrl = requestUrl.replace('{applianceDefinitionId}', applianceDefinitionId); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a new appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 ApplianceDefinition} 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 _beginCreateOrUpdateById(applianceDefinitionId, parameters, 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 (applianceDefinitionId === null || applianceDefinitionId === undefined || typeof applianceDefinitionId.valueOf() !== 'string') { + throw new Error('applianceDefinitionId cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.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('/') ? '' : '/') + '{applianceDefinitionId}'; + requestUrl = requestUrl.replace('{applianceDefinitionId}', applianceDefinitionId); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ApplianceDefinition']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplianceDefinition']().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); + } + } + // 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['ApplianceDefinition']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the appliance definitions in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplianceDefinitionListResult']().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 ApplianceDefinitions. */ +class ApplianceDefinitions { + /** + * Create a ApplianceDefinitions. + * @param {ManagedApplicationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._createOrUpdate = _createOrUpdate; + this._listByResourceGroup = _listByResourceGroup; + this._getById = _getById; + this._deleteById = _deleteById; + this._createOrUpdateById = _createOrUpdateById; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteById = _beginDeleteById; + this._beginCreateOrUpdateById = _beginCreateOrUpdateById; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Gets the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @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, applianceDefinitionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, applianceDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @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 {ApplianceDefinition} - 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 ApplianceDefinition} 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, applianceDefinitionName, 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, applianceDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, applianceDefinitionName, options, optionalCallback); + } + } + + /** + * Deletes the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance definition + * to delete. + * + * @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, applianceDefinitionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, applianceDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance definition + * to delete. + * + * @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, applianceDefinitionName, 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, applianceDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, applianceDefinitionName, options, optionalCallback); + } + } + + /** + * Creates a new appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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, applianceDefinitionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, applianceDefinitionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {ApplianceDefinition} - 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 ApplianceDefinition} 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, applianceDefinitionName, parameters, 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, applianceDefinitionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, applianceDefinitionName, parameters, options, optionalCallback); + } + } + + /** + * Lists the appliance definitions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the appliance definitions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @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 {ApplianceDefinitionListResult} - 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 ApplianceDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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. + */ + getByIdWithHttpOperationResponse(applianceDefinitionId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getById(applianceDefinitionId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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 {ApplianceDefinition} - 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 ApplianceDefinition} 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. + */ + getById(applianceDefinitionId, 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._getById(applianceDefinitionId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getById(applianceDefinitionId, options, optionalCallback); + } + } + + /** + * Deletes the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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. + */ + deleteByIdWithHttpOperationResponse(applianceDefinitionId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteById(applianceDefinitionId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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. + */ + deleteById(applianceDefinitionId, 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._deleteById(applianceDefinitionId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteById(applianceDefinitionId, options, optionalCallback); + } + } + + /** + * Creates a new appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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. + */ + createOrUpdateByIdWithHttpOperationResponse(applianceDefinitionId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdateById(applianceDefinitionId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {ApplianceDefinition} - 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 ApplianceDefinition} 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. + */ + createOrUpdateById(applianceDefinitionId, parameters, 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._createOrUpdateById(applianceDefinitionId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdateById(applianceDefinitionId, parameters, options, optionalCallback); + } + } + + /** + * Deletes the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance definition + * to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, applianceDefinitionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, applianceDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance definition + * to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, applianceDefinitionName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, applianceDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, applianceDefinitionName, options, optionalCallback); + } + } + + /** + * Creates a new appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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, applianceDefinitionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, applianceDefinitionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {ApplianceDefinition} - 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 ApplianceDefinition} 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, applianceDefinitionName, parameters, 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, applianceDefinitionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, applianceDefinitionName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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. + */ + beginDeleteByIdWithHttpOperationResponse(applianceDefinitionId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteById(applianceDefinitionId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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. + */ + beginDeleteById(applianceDefinitionId, 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._beginDeleteById(applianceDefinitionId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteById(applianceDefinitionId, options, optionalCallback); + } + } + + /** + * Creates a new appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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. + */ + beginCreateOrUpdateByIdWithHttpOperationResponse(applianceDefinitionId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdateById(applianceDefinitionId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {ApplianceDefinition} - 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 ApplianceDefinition} 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. + */ + beginCreateOrUpdateById(applianceDefinitionId, parameters, 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._beginCreateOrUpdateById(applianceDefinitionId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdateById(applianceDefinitionId, parameters, options, optionalCallback); + } + } + + /** + * Lists the appliance definitions in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the appliance definitions in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplianceDefinitionListResult} - 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 ApplianceDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ApplianceDefinitions; diff --git a/lib/services/resourceManagement/lib/operations/appliances.js b/lib/services/resourceManagement/lib/operations/appliances.js new file mode 100644 index 0000000000..5e845dacd3 --- /dev/null +++ b/lib/services/resourceManagement/lib/operations/appliances.js @@ -0,0 +1,4508 @@ +/* + * 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; + +/** + * Gets the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @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 Appliance} 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, applianceName, 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 (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 (applianceName === null || applianceName === undefined || typeof applianceName.valueOf() !== 'string') { + throw new Error('applianceName cannot be null or undefined and it must be of type string.'); + } + if (applianceName !== null && applianceName !== undefined) { + if (applianceName.length > 64) + { + throw new Error('"applianceName" should satisfy the constraint - "MaxLength": 64'); + } + if (applianceName.length < 3) + { + throw new Error('"applianceName" should satisfy the constraint - "MinLength": 3'); + } + } + 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.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.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.Solutions/appliances/{applianceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applianceName}', encodeURIComponent(applianceName)); + 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 && statusCode !== 404) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Appliance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Deletes the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @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, applianceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, applianceName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Creates a new appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 Appliance} 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, applianceName, parameters, 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, applianceName, parameters, 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['Appliance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Updates an existing appliance. The only value that can be updated via PATCH + * currently is the tags. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] Parameters supplied to update an + * existing appliance. + * + * @param {string} options.parameters.managedResourceGroupId The managed + * resource group Id. + * + * @param {string} [options.parameters.applianceDefinitionId] The fully + * qualified path of appliance definition Id. + * + * @param {object} [options.parameters.parameters] Name and value pairs that + * define the appliance parameters. It can be a JObject or a well formed JSON + * string. + * + * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the + * UI definition file is located. + * + * @param {object} [options.parameters.plan] The plan information. + * + * @param {string} options.parameters.plan.name The plan name. + * + * @param {string} options.parameters.plan.publisher The publisher ID. + * + * @param {string} options.parameters.plan.product The product code. + * + * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * + * @param {string} options.parameters.plan.version The plan's version. + * + * @param {string} options.parameters.kind The kind of the appliance. Allowed + * values are MarketPlace and ServiceCatalog. + * + * @param {string} [options.parameters.managedBy] ID of the resource that + * manages this resource. + * + * @param {object} [options.parameters.sku] The SKU of the resource. + * + * @param {string} options.parameters.sku.name The SKU name. + * + * @param {string} [options.parameters.sku.tier] The SKU tier. + * + * @param {string} [options.parameters.sku.size] The SKU size. + * + * @param {string} [options.parameters.sku.family] The SKU family. + * + * @param {string} [options.parameters.sku.model] The SKU model. + * + * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * + * @param {object} [options.parameters.identity] The identity of the resource. + * + * @param {string} [options.parameters.identity.type] The identity type. + * Possible values include: 'SystemAssigned' + * + * @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 Appliance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, applianceName, 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 parameters = (options && options.parameters !== undefined) ? options.parameters : undefined; + // Validate + try { + 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 (applianceName === null || applianceName === undefined || typeof applianceName.valueOf() !== 'string') { + throw new Error('applianceName cannot be null or undefined and it must be of type string.'); + } + if (applianceName !== null && applianceName !== undefined) { + if (applianceName.length > 64) + { + throw new Error('"applianceName" should satisfy the constraint - "MaxLength": 64'); + } + if (applianceName.length < 3) + { + throw new Error('"applianceName" should satisfy the constraint - "MinLength": 3'); + } + } + 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.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.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.Solutions/appliances/{applianceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applianceName}', encodeURIComponent(applianceName)); + 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 = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['Appliance']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Appliance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the appliances within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @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 ApplianceListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + 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 (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.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.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.Solutions/appliances'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplianceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the appliances within a subscription. + * + * @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 ApplianceListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscription(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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.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.Solutions/appliances'; + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplianceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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 Appliance} 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 _getById(applianceId, 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 (applianceId === null || applianceId === undefined || typeof applianceId.valueOf() !== 'string') { + throw new Error('applianceId 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('/') ? '' : '/') + '{applianceId}'; + requestUrl = requestUrl.replace('{applianceId}', applianceId); + 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 && statusCode !== 404) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Appliance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Deletes the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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 _deleteById(applianceId, 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.beginDeleteById(applianceId, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Creates a new appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 Appliance} 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 _createOrUpdateById(applianceId, parameters, 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.beginCreateOrUpdateById(applianceId, parameters, 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['Appliance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Updates an existing appliance. The only value that can be updated via PATCH + * currently is the tags. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] Parameters supplied to update an + * existing appliance. + * + * @param {string} options.parameters.managedResourceGroupId The managed + * resource group Id. + * + * @param {string} [options.parameters.applianceDefinitionId] The fully + * qualified path of appliance definition Id. + * + * @param {object} [options.parameters.parameters] Name and value pairs that + * define the appliance parameters. It can be a JObject or a well formed JSON + * string. + * + * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the + * UI definition file is located. + * + * @param {object} [options.parameters.plan] The plan information. + * + * @param {string} options.parameters.plan.name The plan name. + * + * @param {string} options.parameters.plan.publisher The publisher ID. + * + * @param {string} options.parameters.plan.product The product code. + * + * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * + * @param {string} options.parameters.plan.version The plan's version. + * + * @param {string} options.parameters.kind The kind of the appliance. Allowed + * values are MarketPlace and ServiceCatalog. + * + * @param {string} [options.parameters.managedBy] ID of the resource that + * manages this resource. + * + * @param {object} [options.parameters.sku] The SKU of the resource. + * + * @param {string} options.parameters.sku.name The SKU name. + * + * @param {string} [options.parameters.sku.tier] The SKU tier. + * + * @param {string} [options.parameters.sku.size] The SKU size. + * + * @param {string} [options.parameters.sku.family] The SKU family. + * + * @param {string} [options.parameters.sku.model] The SKU model. + * + * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * + * @param {object} [options.parameters.identity] The identity of the resource. + * + * @param {string} [options.parameters.identity.type] The identity type. + * Possible values include: 'SystemAssigned' + * + * @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 Appliance} 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 _updateById(applianceId, 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 parameters = (options && options.parameters !== undefined) ? options.parameters : undefined; + // Validate + try { + if (applianceId === null || applianceId === undefined || typeof applianceId.valueOf() !== 'string') { + throw new Error('applianceId 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('/') ? '' : '/') + '{applianceId}'; + requestUrl = requestUrl.replace('{applianceId}', applianceId); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['Appliance']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Appliance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, applianceName, 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 (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 (applianceName === null || applianceName === undefined || typeof applianceName.valueOf() !== 'string') { + throw new Error('applianceName cannot be null or undefined and it must be of type string.'); + } + if (applianceName !== null && applianceName !== undefined) { + if (applianceName.length > 64) + { + throw new Error('"applianceName" should satisfy the constraint - "MaxLength": 64'); + } + if (applianceName.length < 3) + { + throw new Error('"applianceName" should satisfy the constraint - "MinLength": 3'); + } + } + 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.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.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.Solutions/appliances/{applianceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applianceName}', encodeURIComponent(applianceName)); + 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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a new appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 Appliance} 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, applianceName, parameters, 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 (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 (applianceName === null || applianceName === undefined || typeof applianceName.valueOf() !== 'string') { + throw new Error('applianceName cannot be null or undefined and it must be of type string.'); + } + if (applianceName !== null && applianceName !== undefined) { + if (applianceName.length > 64) + { + throw new Error('"applianceName" should satisfy the constraint - "MaxLength": 64'); + } + if (applianceName.length < 3) + { + throw new Error('"applianceName" should satisfy the constraint - "MinLength": 3'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + 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.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.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.Solutions/appliances/{applianceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applianceName}', encodeURIComponent(applianceName)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['Appliance']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Appliance']().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); + } + } + // 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['Appliance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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 _beginDeleteById(applianceId, 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 (applianceId === null || applianceId === undefined || typeof applianceId.valueOf() !== 'string') { + throw new Error('applianceId 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('/') ? '' : '/') + '{applianceId}'; + requestUrl = requestUrl.replace('{applianceId}', applianceId); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a new appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 Appliance} 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 _beginCreateOrUpdateById(applianceId, parameters, 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 (applianceId === null || applianceId === undefined || typeof applianceId.valueOf() !== 'string') { + throw new Error('applianceId cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.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('/') ? '' : '/') + '{applianceId}'; + requestUrl = requestUrl.replace('{applianceId}', applianceId); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['Appliance']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Appliance']().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); + } + } + // 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['Appliance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the appliances within a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplianceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the appliances within a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscriptionNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplianceListResult']().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 Appliances. */ +class Appliances { + /** + * Create a Appliances. + * @param {ManagedApplicationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._listByResourceGroup = _listByResourceGroup; + this._listBySubscription = _listBySubscription; + this._getById = _getById; + this._deleteById = _deleteById; + this._createOrUpdateById = _createOrUpdateById; + this._updateById = _updateById; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteById = _beginDeleteById; + this._beginCreateOrUpdateById = _beginCreateOrUpdateById; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listBySubscriptionNext = _listBySubscriptionNext; + } + + /** + * Gets the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @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, applianceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, applianceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @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 {Appliance} - 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 Appliance} 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, applianceName, 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, applianceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, applianceName, options, optionalCallback); + } + } + + /** + * Deletes the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @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, applianceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, applianceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @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, applianceName, 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, applianceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, applianceName, options, optionalCallback); + } + } + + /** + * Creates a new appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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, applianceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, applianceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {Appliance} - 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 Appliance} 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, applianceName, parameters, 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, applianceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, applianceName, parameters, options, optionalCallback); + } + } + + /** + * Updates an existing appliance. The only value that can be updated via PATCH + * currently is the tags. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] Parameters supplied to update an + * existing appliance. + * + * @param {string} options.parameters.managedResourceGroupId The managed + * resource group Id. + * + * @param {string} [options.parameters.applianceDefinitionId] The fully + * qualified path of appliance definition Id. + * + * @param {object} [options.parameters.parameters] Name and value pairs that + * define the appliance parameters. It can be a JObject or a well formed JSON + * string. + * + * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the + * UI definition file is located. + * + * @param {object} [options.parameters.plan] The plan information. + * + * @param {string} options.parameters.plan.name The plan name. + * + * @param {string} options.parameters.plan.publisher The publisher ID. + * + * @param {string} options.parameters.plan.product The product code. + * + * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * + * @param {string} options.parameters.plan.version The plan's version. + * + * @param {string} options.parameters.kind The kind of the appliance. Allowed + * values are MarketPlace and ServiceCatalog. + * + * @param {string} [options.parameters.managedBy] ID of the resource that + * manages this resource. + * + * @param {object} [options.parameters.sku] The SKU of the resource. + * + * @param {string} options.parameters.sku.name The SKU name. + * + * @param {string} [options.parameters.sku.tier] The SKU tier. + * + * @param {string} [options.parameters.sku.size] The SKU size. + * + * @param {string} [options.parameters.sku.family] The SKU family. + * + * @param {string} [options.parameters.sku.model] The SKU model. + * + * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * + * @param {object} [options.parameters.identity] The identity of the resource. + * + * @param {string} [options.parameters.identity.type] The identity type. + * Possible values include: 'SystemAssigned' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, applianceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, applianceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing appliance. The only value that can be updated via PATCH + * currently is the tags. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] Parameters supplied to update an + * existing appliance. + * + * @param {string} options.parameters.managedResourceGroupId The managed + * resource group Id. + * + * @param {string} [options.parameters.applianceDefinitionId] The fully + * qualified path of appliance definition Id. + * + * @param {object} [options.parameters.parameters] Name and value pairs that + * define the appliance parameters. It can be a JObject or a well formed JSON + * string. + * + * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the + * UI definition file is located. + * + * @param {object} [options.parameters.plan] The plan information. + * + * @param {string} options.parameters.plan.name The plan name. + * + * @param {string} options.parameters.plan.publisher The publisher ID. + * + * @param {string} options.parameters.plan.product The product code. + * + * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * + * @param {string} options.parameters.plan.version The plan's version. + * + * @param {string} options.parameters.kind The kind of the appliance. Allowed + * values are MarketPlace and ServiceCatalog. + * + * @param {string} [options.parameters.managedBy] ID of the resource that + * manages this resource. + * + * @param {object} [options.parameters.sku] The SKU of the resource. + * + * @param {string} options.parameters.sku.name The SKU name. + * + * @param {string} [options.parameters.sku.tier] The SKU tier. + * + * @param {string} [options.parameters.sku.size] The SKU size. + * + * @param {string} [options.parameters.sku.family] The SKU family. + * + * @param {string} [options.parameters.sku.model] The SKU model. + * + * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * + * @param {object} [options.parameters.identity] The identity of the resource. + * + * @param {string} [options.parameters.identity.type] The identity type. + * Possible values include: 'SystemAssigned' + * + * @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 {Appliance} - 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 Appliance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, applianceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, applianceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, applianceName, options, optionalCallback); + } + } + + /** + * Gets all the appliances within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the appliances within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @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 {ApplianceListResult} - 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 ApplianceListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets all the appliances within a subscription. + * + * @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. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the appliances within a subscription. + * + * @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 {ApplianceListResult} - 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 ApplianceListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + + /** + * Gets the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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. + */ + getByIdWithHttpOperationResponse(applianceId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getById(applianceId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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 {Appliance} - 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 Appliance} 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. + */ + getById(applianceId, 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._getById(applianceId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getById(applianceId, options, optionalCallback); + } + } + + /** + * Deletes the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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. + */ + deleteByIdWithHttpOperationResponse(applianceId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteById(applianceId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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. + */ + deleteById(applianceId, 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._deleteById(applianceId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteById(applianceId, options, optionalCallback); + } + } + + /** + * Creates a new appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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. + */ + createOrUpdateByIdWithHttpOperationResponse(applianceId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdateById(applianceId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {Appliance} - 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 Appliance} 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. + */ + createOrUpdateById(applianceId, parameters, 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._createOrUpdateById(applianceId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdateById(applianceId, parameters, options, optionalCallback); + } + } + + /** + * Updates an existing appliance. The only value that can be updated via PATCH + * currently is the tags. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] Parameters supplied to update an + * existing appliance. + * + * @param {string} options.parameters.managedResourceGroupId The managed + * resource group Id. + * + * @param {string} [options.parameters.applianceDefinitionId] The fully + * qualified path of appliance definition Id. + * + * @param {object} [options.parameters.parameters] Name and value pairs that + * define the appliance parameters. It can be a JObject or a well formed JSON + * string. + * + * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the + * UI definition file is located. + * + * @param {object} [options.parameters.plan] The plan information. + * + * @param {string} options.parameters.plan.name The plan name. + * + * @param {string} options.parameters.plan.publisher The publisher ID. + * + * @param {string} options.parameters.plan.product The product code. + * + * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * + * @param {string} options.parameters.plan.version The plan's version. + * + * @param {string} options.parameters.kind The kind of the appliance. Allowed + * values are MarketPlace and ServiceCatalog. + * + * @param {string} [options.parameters.managedBy] ID of the resource that + * manages this resource. + * + * @param {object} [options.parameters.sku] The SKU of the resource. + * + * @param {string} options.parameters.sku.name The SKU name. + * + * @param {string} [options.parameters.sku.tier] The SKU tier. + * + * @param {string} [options.parameters.sku.size] The SKU size. + * + * @param {string} [options.parameters.sku.family] The SKU family. + * + * @param {string} [options.parameters.sku.model] The SKU model. + * + * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * + * @param {object} [options.parameters.identity] The identity of the resource. + * + * @param {string} [options.parameters.identity.type] The identity type. + * Possible values include: 'SystemAssigned' + * + * @param {object} [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. + */ + updateByIdWithHttpOperationResponse(applianceId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateById(applianceId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing appliance. The only value that can be updated via PATCH + * currently is the tags. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] Parameters supplied to update an + * existing appliance. + * + * @param {string} options.parameters.managedResourceGroupId The managed + * resource group Id. + * + * @param {string} [options.parameters.applianceDefinitionId] The fully + * qualified path of appliance definition Id. + * + * @param {object} [options.parameters.parameters] Name and value pairs that + * define the appliance parameters. It can be a JObject or a well formed JSON + * string. + * + * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the + * UI definition file is located. + * + * @param {object} [options.parameters.plan] The plan information. + * + * @param {string} options.parameters.plan.name The plan name. + * + * @param {string} options.parameters.plan.publisher The publisher ID. + * + * @param {string} options.parameters.plan.product The product code. + * + * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * + * @param {string} options.parameters.plan.version The plan's version. + * + * @param {string} options.parameters.kind The kind of the appliance. Allowed + * values are MarketPlace and ServiceCatalog. + * + * @param {string} [options.parameters.managedBy] ID of the resource that + * manages this resource. + * + * @param {object} [options.parameters.sku] The SKU of the resource. + * + * @param {string} options.parameters.sku.name The SKU name. + * + * @param {string} [options.parameters.sku.tier] The SKU tier. + * + * @param {string} [options.parameters.sku.size] The SKU size. + * + * @param {string} [options.parameters.sku.family] The SKU family. + * + * @param {string} [options.parameters.sku.model] The SKU model. + * + * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * + * @param {object} [options.parameters.identity] The identity of the resource. + * + * @param {string} [options.parameters.identity.type] The identity type. + * Possible values include: 'SystemAssigned' + * + * @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 {Appliance} - 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 Appliance} 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. + */ + updateById(applianceId, 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._updateById(applianceId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateById(applianceId, options, optionalCallback); + } + } + + /** + * Deletes the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, applianceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, applianceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, applianceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, applianceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, applianceName, options, optionalCallback); + } + } + + /** + * Creates a new appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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, applianceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, applianceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {Appliance} - 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 Appliance} 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, applianceName, parameters, 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, applianceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, applianceName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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. + */ + beginDeleteByIdWithHttpOperationResponse(applianceId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteById(applianceId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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. + */ + beginDeleteById(applianceId, 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._beginDeleteById(applianceId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteById(applianceId, options, optionalCallback); + } + } + + /** + * Creates a new appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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. + */ + beginCreateOrUpdateByIdWithHttpOperationResponse(applianceId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdateById(applianceId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {Appliance} - 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 Appliance} 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. + */ + beginCreateOrUpdateById(applianceId, parameters, 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._beginCreateOrUpdateById(applianceId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdateById(applianceId, parameters, options, optionalCallback); + } + } + + /** + * Gets all the appliances within a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the appliances within a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplianceListResult} - 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 ApplianceListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all the appliances within a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the appliances within a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplianceListResult} - 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 ApplianceListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscriptionNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Appliances; diff --git a/lib/services/resourceManagement/lib/operations/index.d.ts b/lib/services/resourceManagement/lib/operations/index.d.ts new file mode 100644 index 0000000000..ab5b941911 --- /dev/null +++ b/lib/services/resourceManagement/lib/operations/index.d.ts @@ -0,0 +1,2697 @@ +/* + * 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 + * Appliances + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedApplicationClient. + */ +export interface Appliances { + + + /** + * Gets the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @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, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @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 {Appliance} - 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. + * + * {Appliance} [result] - The deserialized result object if an error did not occur. + * See {@link Appliance} 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, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, applianceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, applianceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @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, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @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, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, applianceName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, applianceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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, applianceName: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {Appliance} - 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. + * + * {Appliance} [result] - The deserialized result object if an error did not occur. + * See {@link Appliance} 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, applianceName: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, applianceName: string, parameters: models.Appliance, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, applianceName: string, parameters: models.Appliance, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing appliance. The only value that can be updated via PATCH + * currently is the tags. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] Parameters supplied to update an + * existing appliance. + * + * @param {string} options.parameters.managedResourceGroupId The managed + * resource group Id. + * + * @param {string} [options.parameters.applianceDefinitionId] The fully + * qualified path of appliance definition Id. + * + * @param {object} [options.parameters.parameters] Name and value pairs that + * define the appliance parameters. It can be a JObject or a well formed JSON + * string. + * + * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the + * UI definition file is located. + * + * @param {object} [options.parameters.plan] The plan information. + * + * @param {string} options.parameters.plan.name The plan name. + * + * @param {string} options.parameters.plan.publisher The publisher ID. + * + * @param {string} options.parameters.plan.product The product code. + * + * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * + * @param {string} options.parameters.plan.version The plan's version. + * + * @param {string} options.parameters.kind The kind of the appliance. Allowed + * values are MarketPlace and ServiceCatalog. + * + * @param {string} [options.parameters.managedBy] ID of the resource that + * manages this resource. + * + * @param {object} [options.parameters.sku] The SKU of the resource. + * + * @param {string} options.parameters.sku.name The SKU name. + * + * @param {string} [options.parameters.sku.tier] The SKU tier. + * + * @param {string} [options.parameters.sku.size] The SKU size. + * + * @param {string} [options.parameters.sku.family] The SKU family. + * + * @param {string} [options.parameters.sku.model] The SKU model. + * + * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * + * @param {object} [options.parameters.identity] The identity of the resource. + * + * @param {string} [options.parameters.identity.type] The identity type. + * Possible values include: 'SystemAssigned' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, applianceName: string, options?: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing appliance. The only value that can be updated via PATCH + * currently is the tags. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] Parameters supplied to update an + * existing appliance. + * + * @param {string} options.parameters.managedResourceGroupId The managed + * resource group Id. + * + * @param {string} [options.parameters.applianceDefinitionId] The fully + * qualified path of appliance definition Id. + * + * @param {object} [options.parameters.parameters] Name and value pairs that + * define the appliance parameters. It can be a JObject or a well formed JSON + * string. + * + * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the + * UI definition file is located. + * + * @param {object} [options.parameters.plan] The plan information. + * + * @param {string} options.parameters.plan.name The plan name. + * + * @param {string} options.parameters.plan.publisher The publisher ID. + * + * @param {string} options.parameters.plan.product The product code. + * + * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * + * @param {string} options.parameters.plan.version The plan's version. + * + * @param {string} options.parameters.kind The kind of the appliance. Allowed + * values are MarketPlace and ServiceCatalog. + * + * @param {string} [options.parameters.managedBy] ID of the resource that + * manages this resource. + * + * @param {object} [options.parameters.sku] The SKU of the resource. + * + * @param {string} options.parameters.sku.name The SKU name. + * + * @param {string} [options.parameters.sku.tier] The SKU tier. + * + * @param {string} [options.parameters.sku.size] The SKU size. + * + * @param {string} [options.parameters.sku.family] The SKU family. + * + * @param {string} [options.parameters.sku.model] The SKU model. + * + * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * + * @param {object} [options.parameters.identity] The identity of the resource. + * + * @param {string} [options.parameters.identity.type] The identity type. + * Possible values include: 'SystemAssigned' + * + * @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 {Appliance} - 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. + * + * {Appliance} [result] - The deserialized result object if an error did not occur. + * See {@link Appliance} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, applianceName: string, options?: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, applianceName: string, callback: ServiceCallback): void; + update(resourceGroupName: string, applianceName: string, options: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the appliances within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the appliances within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @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 {ApplianceListResult} - 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. + * + * {ApplianceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the appliances within a subscription. + * + * @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. + */ + listBySubscriptionWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the appliances within a subscription. + * + * @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 {ApplianceListResult} - 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. + * + * {ApplianceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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. + */ + getByIdWithHttpOperationResponse(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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 {Appliance} - 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. + * + * {Appliance} [result] - The deserialized result object if an error did not occur. + * See {@link Appliance} 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. + */ + getById(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getById(applianceId: string, callback: ServiceCallback): void; + getById(applianceId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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. + */ + deleteByIdWithHttpOperationResponse(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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. + */ + deleteById(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteById(applianceId: string, callback: ServiceCallback): void; + deleteById(applianceId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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. + */ + createOrUpdateByIdWithHttpOperationResponse(applianceId: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {Appliance} - 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. + * + * {Appliance} [result] - The deserialized result object if an error did not occur. + * See {@link Appliance} 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. + */ + createOrUpdateById(applianceId: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdateById(applianceId: string, parameters: models.Appliance, callback: ServiceCallback): void; + createOrUpdateById(applianceId: string, parameters: models.Appliance, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing appliance. The only value that can be updated via PATCH + * currently is the tags. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] Parameters supplied to update an + * existing appliance. + * + * @param {string} options.parameters.managedResourceGroupId The managed + * resource group Id. + * + * @param {string} [options.parameters.applianceDefinitionId] The fully + * qualified path of appliance definition Id. + * + * @param {object} [options.parameters.parameters] Name and value pairs that + * define the appliance parameters. It can be a JObject or a well formed JSON + * string. + * + * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the + * UI definition file is located. + * + * @param {object} [options.parameters.plan] The plan information. + * + * @param {string} options.parameters.plan.name The plan name. + * + * @param {string} options.parameters.plan.publisher The publisher ID. + * + * @param {string} options.parameters.plan.product The product code. + * + * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * + * @param {string} options.parameters.plan.version The plan's version. + * + * @param {string} options.parameters.kind The kind of the appliance. Allowed + * values are MarketPlace and ServiceCatalog. + * + * @param {string} [options.parameters.managedBy] ID of the resource that + * manages this resource. + * + * @param {object} [options.parameters.sku] The SKU of the resource. + * + * @param {string} options.parameters.sku.name The SKU name. + * + * @param {string} [options.parameters.sku.tier] The SKU tier. + * + * @param {string} [options.parameters.sku.size] The SKU size. + * + * @param {string} [options.parameters.sku.family] The SKU family. + * + * @param {string} [options.parameters.sku.model] The SKU model. + * + * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * + * @param {object} [options.parameters.identity] The identity of the resource. + * + * @param {string} [options.parameters.identity.type] The identity type. + * Possible values include: 'SystemAssigned' + * + * @param {object} [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. + */ + updateByIdWithHttpOperationResponse(applianceId: string, options?: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing appliance. The only value that can be updated via PATCH + * currently is the tags. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] Parameters supplied to update an + * existing appliance. + * + * @param {string} options.parameters.managedResourceGroupId The managed + * resource group Id. + * + * @param {string} [options.parameters.applianceDefinitionId] The fully + * qualified path of appliance definition Id. + * + * @param {object} [options.parameters.parameters] Name and value pairs that + * define the appliance parameters. It can be a JObject or a well formed JSON + * string. + * + * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the + * UI definition file is located. + * + * @param {object} [options.parameters.plan] The plan information. + * + * @param {string} options.parameters.plan.name The plan name. + * + * @param {string} options.parameters.plan.publisher The publisher ID. + * + * @param {string} options.parameters.plan.product The product code. + * + * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * + * @param {string} options.parameters.plan.version The plan's version. + * + * @param {string} options.parameters.kind The kind of the appliance. Allowed + * values are MarketPlace and ServiceCatalog. + * + * @param {string} [options.parameters.managedBy] ID of the resource that + * manages this resource. + * + * @param {object} [options.parameters.sku] The SKU of the resource. + * + * @param {string} options.parameters.sku.name The SKU name. + * + * @param {string} [options.parameters.sku.tier] The SKU tier. + * + * @param {string} [options.parameters.sku.size] The SKU size. + * + * @param {string} [options.parameters.sku.family] The SKU family. + * + * @param {string} [options.parameters.sku.model] The SKU model. + * + * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * + * @param {object} [options.parameters.identity] The identity of the resource. + * + * @param {string} [options.parameters.identity.type] The identity type. + * Possible values include: 'SystemAssigned' + * + * @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 {Appliance} - 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. + * + * {Appliance} [result] - The deserialized result object if an error did not occur. + * See {@link Appliance} 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. + */ + updateById(applianceId: string, options?: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }): Promise; + updateById(applianceId: string, callback: ServiceCallback): void; + updateById(applianceId: string, options: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, applianceName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, applianceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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, applianceName: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new appliance. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceName The name of the appliance. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {Appliance} - 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. + * + * {Appliance} [result] - The deserialized result object if an error did not occur. + * See {@link Appliance} 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, applianceName: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, applianceName: string, parameters: models.Appliance, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, applianceName: string, parameters: models.Appliance, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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. + */ + beginDeleteByIdWithHttpOperationResponse(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-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. + */ + beginDeleteById(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteById(applianceId: string, callback: ServiceCallback): void; + beginDeleteById(applianceId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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. + */ + beginCreateOrUpdateByIdWithHttpOperationResponse(applianceId: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new appliance. + * + * @param {string} applianceId The fully qualified ID of the appliance, + * including the appliance name and the appliance resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance. + * + * @param {string} parameters.managedResourceGroupId The managed resource group + * Id. + * + * @param {string} [parameters.applianceDefinitionId] The fully qualified path + * of appliance definition Id. + * + * @param {object} [parameters.parameters] Name and value pairs that define the + * appliance parameters. It can be a JObject or a well formed JSON string. + * + * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI + * definition file is located. + * + * @param {object} [parameters.plan] The plan information. + * + * @param {string} parameters.plan.name The plan name. + * + * @param {string} parameters.plan.publisher The publisher ID. + * + * @param {string} parameters.plan.product The product code. + * + * @param {string} [parameters.plan.promotionCode] The promotion code. + * + * @param {string} parameters.plan.version The plan's version. + * + * @param {string} parameters.kind The kind of the appliance. Allowed values + * are MarketPlace and ServiceCatalog. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {Appliance} - 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. + * + * {Appliance} [result] - The deserialized result object if an error did not occur. + * See {@link Appliance} 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. + */ + beginCreateOrUpdateById(applianceId: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdateById(applianceId: string, parameters: models.Appliance, callback: ServiceCallback): void; + beginCreateOrUpdateById(applianceId: string, parameters: models.Appliance, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the appliances within a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the appliances within a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplianceListResult} - 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. + * + * {ApplianceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the appliances within a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the appliances within a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplianceListResult} - 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. + * + * {ApplianceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscriptionNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionNext(nextPageLink: string, callback: ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ApplianceDefinitions + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedApplicationClient. + */ +export interface ApplianceDefinitions { + + + /** + * Gets the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @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, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @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 {ApplianceDefinition} - 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. + * + * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceDefinition} 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, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, applianceDefinitionName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, applianceDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance definition + * to delete. + * + * @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, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance definition + * to delete. + * + * @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, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, applianceDefinitionName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, applianceDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {ApplianceDefinition} - 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. + * + * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceDefinition} 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, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, applianceDefinitionName: string, parameters: models.ApplianceDefinition, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the appliance definitions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the appliance definitions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @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 {ApplianceDefinitionListResult} - 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. + * + * {ApplianceDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceDefinitionListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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. + */ + getByIdWithHttpOperationResponse(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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 {ApplianceDefinition} - 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. + * + * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceDefinition} 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. + */ + getById(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getById(applianceDefinitionId: string, callback: ServiceCallback): void; + getById(applianceDefinitionId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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. + */ + deleteByIdWithHttpOperationResponse(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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. + */ + deleteById(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteById(applianceDefinitionId: string, callback: ServiceCallback): void; + deleteById(applianceDefinitionId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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. + */ + createOrUpdateByIdWithHttpOperationResponse(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {ApplianceDefinition} - 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. + * + * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceDefinition} 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. + */ + createOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, callback: ServiceCallback): void; + createOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance definition + * to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance definition + * to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, applianceDefinitionName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, applianceDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new appliance definition. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} applianceDefinitionName The name of the appliance + * definition. + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {ApplianceDefinition} - 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. + * + * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceDefinition} 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, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, applianceDefinitionName: string, parameters: models.ApplianceDefinition, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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. + */ + beginDeleteByIdWithHttpOperationResponse(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-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. + */ + beginDeleteById(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteById(applianceDefinitionId: string, callback: ServiceCallback): void; + beginDeleteById(applianceDefinitionId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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. + */ + beginCreateOrUpdateByIdWithHttpOperationResponse(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new appliance definition. + * + * @param {string} applianceDefinitionId The fully qualified ID of the + * appliance definition, including the appliance name and the appliance + * definition resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * + * @param {object} parameters Parameters supplied to the create or update an + * appliance definition. + * + * @param {string} parameters.lockLevel The appliance lock level. Possible + * values include: 'CanNotDelete', 'ReadOnly', 'None' + * + * @param {string} [parameters.displayName] The appliance definition display + * name. + * + * @param {array} parameters.authorizations The appliance provider + * authorizations. + * + * @param {array} [parameters.artifacts] The collection of appliance artifacts. + * The portal will use the files specified as artifacts to construct the user + * experience of creating an appliance from an appliance definition. + * + * @param {string} [parameters.description] The appliance definition + * description. + * + * @param {string} parameters.packageFileUri The appliance definition package + * file Uri. + * + * @param {string} [parameters.managedBy] ID of the resource that manages this + * resource. + * + * @param {object} [parameters.sku] The SKU of the resource. + * + * @param {string} parameters.sku.name The SKU name. + * + * @param {string} [parameters.sku.tier] The SKU tier. + * + * @param {string} [parameters.sku.size] The SKU size. + * + * @param {string} [parameters.sku.family] The SKU family. + * + * @param {string} [parameters.sku.model] The SKU model. + * + * @param {number} [parameters.sku.capacity] The SKU capacity. + * + * @param {object} [parameters.identity] The identity of the resource. + * + * @param {string} [parameters.identity.type] The identity type. Possible + * values include: 'SystemAssigned' + * + * @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 {ApplianceDefinition} - 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. + * + * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceDefinition} 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. + */ + beginCreateOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, callback: ServiceCallback): void; + beginCreateOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the appliance definitions in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the appliance definitions in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplianceDefinitionListResult} - 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. + * + * {ApplianceDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplianceDefinitionListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/resourceManagement/lib/operations/index.js b/lib/services/resourceManagement/lib/operations/index.js new file mode 100644 index 0000000000..bcc97ad8c9 --- /dev/null +++ b/lib/services/resourceManagement/lib/operations/index.js @@ -0,0 +1,18 @@ +/* + * 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.Appliances = require('./appliances'); +exports.ApplianceDefinitions = require('./applianceDefinitions'); diff --git a/lib/services/resourceManagement/lib/policy/models/errorResponse.js b/lib/services/resourceManagement/lib/policy/models/errorResponse.js index 2915f7c2e0..c138f91bdc 100644 --- a/lib/services/resourceManagement/lib/policy/models/errorResponse.js +++ b/lib/services/resourceManagement/lib/policy/models/errorResponse.js @@ -11,8 +11,8 @@ 'use strict'; /** - * Error reponse indicates ARM is not able to process the incoming request. The - * reason is provided in the error message. + * Error reponse indicates Azure Resource Manager is not able to process the + * incoming request. The reason is provided in the error message. * */ class ErrorResponse { diff --git a/lib/services/resourceManagement/lib/policy/models/index.d.ts b/lib/services/resourceManagement/lib/policy/models/index.d.ts index 73dcae16ee..7fa1904f7f 100644 --- a/lib/services/resourceManagement/lib/policy/models/index.d.ts +++ b/lib/services/resourceManagement/lib/policy/models/index.d.ts @@ -20,7 +20,7 @@ export { CloudError } from 'ms-rest-azure'; * @class * Initializes a new instance of the PolicySku class. * @constructor - * The policy sku. + * The policy sku. This property is optional, obsolete, and will be ignored. * * @member {string} name The name of the policy sku. Possible values are A0 and * A1. @@ -39,7 +39,8 @@ export interface PolicySku { * The policy assignment. * * @member {string} [displayName] The display name of the policy assignment. - * @member {string} [policyDefinitionId] The ID of the policy definition. + * @member {string} [policyDefinitionId] The ID of the policy definition or + * policy set definition being assigned. * @member {string} [scope] The scope for the policy assignment. * @member {array} [notScopes] The policy's excluded scopes. * @member {object} [parameters] Required if a parameter is used in policy @@ -50,7 +51,8 @@ export interface PolicySku { * @member {string} [id] The ID of the policy assignment. * @member {string} [type] The type of the policy assignment. * @member {string} [name] The name of the policy assignment. - * @member {object} [sku] The policy sku. + * @member {object} [sku] The policy sku. This property is optional, obsolete, + * and will be ignored. * @member {string} [sku.name] The name of the policy sku. Possible values are * A0 and A1. * @member {string} [sku.tier] The policy sku tier. Possible values are Free @@ -74,8 +76,8 @@ export interface PolicyAssignment extends BaseResource { * @class * Initializes a new instance of the ErrorResponse class. * @constructor - * Error reponse indicates ARM is not able to process the incoming request. The - * reason is provided in the error message. + * Error reponse indicates Azure Resource Manager is not able to process the + * incoming request. The reason is provided in the error message. * * @member {string} [httpStatus] Http status code. * @member {string} [errorCode] Error code. @@ -88,6 +90,42 @@ export interface ErrorResponse { errorMessage?: string; } +/** + * @class + * Initializes a new instance of the PolicyDefinition class. + * @constructor + * The policy definition. + * + * @member {string} [policyType] The type of policy definition. Possible values + * are NotSpecified, BuiltIn, and Custom. Possible values include: + * 'NotSpecified', 'BuiltIn', 'Custom' + * @member {string} [mode] The policy definition mode. Possible values are + * NotSpecified, Indexed, and All. Possible values include: 'NotSpecified', + * 'Indexed', 'All' + * @member {string} [displayName] The display name of the policy definition. + * @member {string} [description] The policy definition description. + * @member {object} [policyRule] The policy rule. + * @member {object} [metadata] The policy definition metadata. + * @member {object} [parameters] Required if a parameter is used in policy + * rule. + * @member {string} [id] The ID of the policy definition. + * @member {string} [name] The name of the policy definition. + * @member {string} [type] The type of the resource + * (Microsoft.Authorization/policyDefinitions). + */ +export interface PolicyDefinition extends BaseResource { + policyType?: string; + mode?: string; + displayName?: string; + description?: string; + policyRule?: any; + metadata?: any; + parameters?: any; + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + /** * @class * Initializes a new instance of the PolicyDefinitionReference class. @@ -137,39 +175,6 @@ export interface PolicySetDefinition extends BaseResource { readonly type?: string; } -/** - * @class - * Initializes a new instance of the PolicyDefinition class. - * @constructor - * The policy definition. - * - * @member {string} [policyType] The type of policy definition. Possible values - * are NotSpecified, BuiltIn, and Custom. Possible values include: - * 'NotSpecified', 'BuiltIn', 'Custom' - * @member {string} [mode] The policy definition mode. Possible values are - * NotSpecified, Indexed, and All. Possible values include: 'NotSpecified', - * 'Indexed', 'All' - * @member {string} [displayName] The display name of the policy definition. - * @member {string} [description] The policy definition description. - * @member {object} [policyRule] The policy rule. - * @member {object} [metadata] The policy definition metadata. - * @member {object} [parameters] Required if a parameter is used in policy - * rule. - * @member {string} [id] The ID of the policy definition. - * @member {string} [name] The name of the policy definition. - */ -export interface PolicyDefinition extends BaseResource { - policyType?: string; - mode?: string; - displayName?: string; - description?: string; - policyRule?: any; - metadata?: any; - parameters?: any; - readonly id?: string; - readonly name?: string; -} - /** * @class @@ -186,26 +191,26 @@ export interface PolicyAssignmentListResult extends Array { /** * @class - * Initializes a new instance of the PolicySetDefinitionListResult class. + * Initializes a new instance of the PolicyDefinitionListResult class. * @constructor - * List of policy set definitions. + * List of policy definitions. * * @member {string} [nextLink] The URL to use for getting the next set of * results. */ -export interface PolicySetDefinitionListResult extends Array { +export interface PolicyDefinitionListResult extends Array { nextLink?: string; } /** * @class - * Initializes a new instance of the PolicyDefinitionListResult class. + * Initializes a new instance of the PolicySetDefinitionListResult class. * @constructor - * List of policy definitions. + * List of policy set definitions. * * @member {string} [nextLink] The URL to use for getting the next set of * results. */ -export interface PolicyDefinitionListResult extends Array { +export interface PolicySetDefinitionListResult extends Array { nextLink?: string; } diff --git a/lib/services/resourceManagement/lib/policy/models/index.js b/lib/services/resourceManagement/lib/policy/models/index.js index 397b947f9d..99c469b95f 100644 --- a/lib/services/resourceManagement/lib/policy/models/index.js +++ b/lib/services/resourceManagement/lib/policy/models/index.js @@ -21,9 +21,9 @@ exports.CloudError = msRestAzure.CloudError; exports.PolicySku = require('./policySku'); exports.PolicyAssignment = require('./policyAssignment'); exports.ErrorResponse = require('./errorResponse'); +exports.PolicyDefinition = require('./policyDefinition'); exports.PolicyDefinitionReference = require('./policyDefinitionReference'); exports.PolicySetDefinition = require('./policySetDefinition'); -exports.PolicyDefinition = require('./policyDefinition'); exports.PolicyAssignmentListResult = require('./policyAssignmentListResult'); -exports.PolicySetDefinitionListResult = require('./policySetDefinitionListResult'); exports.PolicyDefinitionListResult = require('./policyDefinitionListResult'); +exports.PolicySetDefinitionListResult = require('./policySetDefinitionListResult'); diff --git a/lib/services/resourceManagement/lib/policy/models/policyAssignment.js b/lib/services/resourceManagement/lib/policy/models/policyAssignment.js index 295cb165de..1bd6e8869a 100644 --- a/lib/services/resourceManagement/lib/policy/models/policyAssignment.js +++ b/lib/services/resourceManagement/lib/policy/models/policyAssignment.js @@ -21,7 +21,8 @@ class PolicyAssignment extends models['BaseResource'] { /** * Create a PolicyAssignment. * @member {string} [displayName] The display name of the policy assignment. - * @member {string} [policyDefinitionId] The ID of the policy definition. + * @member {string} [policyDefinitionId] The ID of the policy definition or + * policy set definition being assigned. * @member {string} [scope] The scope for the policy assignment. * @member {array} [notScopes] The policy's excluded scopes. * @member {object} [parameters] Required if a parameter is used in policy @@ -32,7 +33,8 @@ class PolicyAssignment extends models['BaseResource'] { * @member {string} [id] The ID of the policy assignment. * @member {string} [type] The type of the policy assignment. * @member {string} [name] The name of the policy assignment. - * @member {object} [sku] The policy sku. + * @member {object} [sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * @member {string} [sku.name] The name of the policy sku. Possible values * are A0 and A1. * @member {string} [sku.tier] The policy sku tier. Possible values are Free diff --git a/lib/services/resourceManagement/lib/policy/models/policyDefinition.js b/lib/services/resourceManagement/lib/policy/models/policyDefinition.js index aa2181dc7e..7b7d078b11 100644 --- a/lib/services/resourceManagement/lib/policy/models/policyDefinition.js +++ b/lib/services/resourceManagement/lib/policy/models/policyDefinition.js @@ -34,6 +34,8 @@ class PolicyDefinition extends models['BaseResource'] { * rule. * @member {string} [id] The ID of the policy definition. * @member {string} [name] The name of the policy definition. + * @member {string} [type] The type of the resource + * (Microsoft.Authorization/policyDefinitions). */ constructor() { super(); @@ -117,6 +119,14 @@ class PolicyDefinition extends models['BaseResource'] { type: { name: 'String' } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } } } } diff --git a/lib/services/resourceManagement/lib/policy/models/policySku.js b/lib/services/resourceManagement/lib/policy/models/policySku.js index 33c96fec1e..69b4f0a9b9 100644 --- a/lib/services/resourceManagement/lib/policy/models/policySku.js +++ b/lib/services/resourceManagement/lib/policy/models/policySku.js @@ -11,7 +11,7 @@ 'use strict'; /** - * The policy sku. + * The policy sku. This property is optional, obsolete, and will be ignored. * */ class PolicySku { diff --git a/lib/services/resourceManagement/lib/policy/operations/index.d.ts b/lib/services/resourceManagement/lib/policy/operations/index.d.ts index f5a6454d9f..037935befa 100644 --- a/lib/services/resourceManagement/lib/policy/operations/index.d.ts +++ b/lib/services/resourceManagement/lib/policy/operations/index.d.ts @@ -22,9 +22,21 @@ export interface PolicyAssignments { /** - * Deletes a policy assignment. - * - * @param {string} scope The scope of the policy assignment. + * @summary Deletes a policy assignment. + * + * This operation deletes a policy assignment, given its name and the scope it + * was created in. The scope of a policy assignment is the part of its ID + * preceding + * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment to * delete. @@ -43,9 +55,21 @@ export interface PolicyAssignments { deleteMethodWithHttpOperationResponse(scope: string, policyAssignmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a policy assignment. + * @summary Deletes a policy assignment. + * + * This operation deletes a policy assignment, given its name and the scope it + * was created in. The scope of a policy assignment is the part of its ID + * preceding + * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * - * @param {string} scope The scope of the policy assignment. + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment to * delete. @@ -83,13 +107,21 @@ export interface PolicyAssignments { /** - * @summary Creates a policy assignment. + * @summary Creates or updates a policy assignment. * - * Policy assignments are inherited by child resources. For example, when you - * apply a policy to a resource group that policy is assigned to all resources - * in the group. + * This operation creates or updates a policy assignment with the given scope + * and name. Policy assignments apply to all resources contained within their + * scope. For example, when you assign a policy at resource group scope, that + * policy applies to all resources in the group. * - * @param {string} scope The scope of the policy assignment. + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment. * @@ -99,7 +131,7 @@ export interface PolicyAssignments { * assignment. * * @param {string} [parameters.policyDefinitionId] The ID of the policy - * definition. + * definition or policy set definition being assigned. * * @param {string} [parameters.scope] The scope for the policy assignment. * @@ -113,7 +145,8 @@ export interface PolicyAssignments { * * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {object} [parameters.sku] The policy sku. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * * @param {string} parameters.sku.name The name of the policy sku. Possible * values are A0 and A1. @@ -135,13 +168,21 @@ export interface PolicyAssignments { createWithHttpOperationResponse(scope: string, policyAssignmentName: string, parameters: models.PolicyAssignment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * @summary Creates a policy assignment. + * @summary Creates or updates a policy assignment. * - * Policy assignments are inherited by child resources. For example, when you - * apply a policy to a resource group that policy is assigned to all resources - * in the group. + * This operation creates or updates a policy assignment with the given scope + * and name. Policy assignments apply to all resources contained within their + * scope. For example, when you assign a policy at resource group scope, that + * policy applies to all resources in the group. * - * @param {string} scope The scope of the policy assignment. + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment. * @@ -151,7 +192,7 @@ export interface PolicyAssignments { * assignment. * * @param {string} [parameters.policyDefinitionId] The ID of the policy - * definition. + * definition or policy set definition being assigned. * * @param {string} [parameters.scope] The scope for the policy assignment. * @@ -165,7 +206,8 @@ export interface PolicyAssignments { * * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {object} [parameters.sku] The policy sku. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * * @param {string} parameters.sku.name The name of the policy sku. Possible * values are A0 and A1. @@ -206,9 +248,19 @@ export interface PolicyAssignments { /** - * Gets a policy assignment. + * @summary Retrieves a policy assignment. * - * @param {string} scope The scope of the policy assignment. + * This operation retrieves a single policy assignment, given its name and the + * scope it was created at. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment to * get. @@ -227,9 +279,19 @@ export interface PolicyAssignments { getWithHttpOperationResponse(scope: string, policyAssignmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a policy assignment. + * @summary Retrieves a policy assignment. + * + * This operation retrieves a single policy assignment, given its name and the + * scope it was created at. * - * @param {string} scope The scope of the policy assignment. + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment to * get. @@ -267,14 +329,30 @@ export interface PolicyAssignments { /** - * Gets policy assignments for the resource group. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. * * @param {string} resourceGroupName The name of the resource group that * contains policy assignments. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -288,14 +366,30 @@ export interface PolicyAssignments { listForResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets policy assignments for the resource group. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. * * @param {string} resourceGroupName The name of the resource group that * contains policy assignments. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -329,24 +423,56 @@ export interface PolicyAssignments { /** - * Gets policy assignments for a resource. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * * @param {string} resourceGroupName The name of the resource group containing - * the resource. The name is case insensitive. + * the resource. * * @param {string} resourceProviderNamespace The namespace of the resource - * provider. + * provider. For example, the namespace of a virtual machine is + * Microsoft.Compute (from Microsoft.Compute/virtualMachines) * - * @param {string} parentResourcePath The parent resource path. + * @param {string} parentResourcePath The parent resource path. Use empty + * string if there is none. * - * @param {string} resourceType The resource type. + * @param {string} resourceType The resource type name. For example the type + * name of a web app is 'sites' (from Microsoft.Web/sites). * - * @param {string} resourceName The name of the resource with policy - * assignments. + * @param {string} resourceName The name of the resource. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -360,24 +486,56 @@ export interface PolicyAssignments { listForResourceWithHttpOperationResponse(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets policy assignments for a resource. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * * @param {string} resourceGroupName The name of the resource group containing - * the resource. The name is case insensitive. + * the resource. * * @param {string} resourceProviderNamespace The namespace of the resource - * provider. + * provider. For example, the namespace of a virtual machine is + * Microsoft.Compute (from Microsoft.Compute/virtualMachines) * - * @param {string} parentResourcePath The parent resource path. + * @param {string} parentResourcePath The parent resource path. Use empty + * string if there is none. * - * @param {string} resourceType The resource type. + * @param {string} resourceType The resource type name. For example the type + * name of a web app is 'sites' (from Microsoft.Web/sites). * - * @param {string} resourceName The name of the resource with policy - * assignments. + * @param {string} resourceName The name of the resource. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -411,11 +569,27 @@ export interface PolicyAssignments { /** - * Gets all the policy assignments for a subscription. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -429,11 +603,27 @@ export interface PolicyAssignments { listWithHttpOperationResponse(options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the policy assignments for a subscription. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -467,18 +657,22 @@ export interface PolicyAssignments { /** - * @summary Deletes a policy assignment by ID. + * @summary Deletes a policy assignment. * - * When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * This operation deletes the policy with the given ID. Policy assignment IDs + * have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid formats for {scope} are: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}' + * (management group), '/subscriptions/{subscriptionId}' (subscription), + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + * (resource group), or + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * (resource). * * @param {string} policyAssignmentId The ID of the policy assignment to * delete. Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -494,18 +688,22 @@ export interface PolicyAssignments { deleteByIdWithHttpOperationResponse(policyAssignmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * @summary Deletes a policy assignment by ID. + * @summary Deletes a policy assignment. * - * When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * This operation deletes the policy with the given ID. Policy assignment IDs + * have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid formats for {scope} are: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}' + * (management group), '/subscriptions/{subscriptionId}' (subscription), + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + * (resource group), or + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * (resource). * * @param {string} policyAssignmentId The ID of the policy assignment to * delete. Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -540,20 +738,25 @@ export interface PolicyAssignments { /** - * @summary Creates a policy assignment by ID. + * @summary Creates or updates a policy assignment. * - * Policy assignments are inherited by child resources. For example, when you - * apply a policy to a resource group that policy is assigned to all resources - * in the group. When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * This operation creates or updates the policy assignment with the given ID. + * Policy assignments made on a scope apply to all resources contained in that + * scope. For example, when you assign a policy to a resource group that policy + * applies to all resources in the group. Policy assignment IDs have this + * format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * * @param {string} policyAssignmentId The ID of the policy assignment to * create. Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} parameters Parameters for policy assignment. * @@ -561,7 +764,7 @@ export interface PolicyAssignments { * assignment. * * @param {string} [parameters.policyDefinitionId] The ID of the policy - * definition. + * definition or policy set definition being assigned. * * @param {string} [parameters.scope] The scope for the policy assignment. * @@ -575,7 +778,8 @@ export interface PolicyAssignments { * * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {object} [parameters.sku] The policy sku. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * * @param {string} parameters.sku.name The name of the policy sku. Possible * values are A0 and A1. @@ -597,20 +801,25 @@ export interface PolicyAssignments { createByIdWithHttpOperationResponse(policyAssignmentId: string, parameters: models.PolicyAssignment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * @summary Creates a policy assignment by ID. + * @summary Creates or updates a policy assignment. * - * Policy assignments are inherited by child resources. For example, when you - * apply a policy to a resource group that policy is assigned to all resources - * in the group. When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * This operation creates or updates the policy assignment with the given ID. + * Policy assignments made on a scope apply to all resources contained in that + * scope. For example, when you assign a policy to a resource group that policy + * applies to all resources in the group. Policy assignment IDs have this + * format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * * @param {string} policyAssignmentId The ID of the policy assignment to * create. Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} parameters Parameters for policy assignment. * @@ -618,7 +827,7 @@ export interface PolicyAssignments { * assignment. * * @param {string} [parameters.policyDefinitionId] The ID of the policy - * definition. + * definition or policy set definition being assigned. * * @param {string} [parameters.scope] The scope for the policy assignment. * @@ -632,7 +841,8 @@ export interface PolicyAssignments { * * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {object} [parameters.sku] The policy sku. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * * @param {string} parameters.sku.name The name of the policy sku. Possible * values are A0 and A1. @@ -673,18 +883,22 @@ export interface PolicyAssignments { /** - * @summary Gets a policy assignment by ID. + * @summary Retrieves the policy assignment with the given ID. * - * When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * The operation retrieves the policy assignment with the given ID. Policy + * assignment IDs have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * * @param {string} policyAssignmentId The ID of the policy assignment to get. * Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -700,18 +914,22 @@ export interface PolicyAssignments { getByIdWithHttpOperationResponse(policyAssignmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * @summary Gets a policy assignment by ID. + * @summary Retrieves the policy assignment with the given ID. * - * When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * The operation retrieves the policy assignment with the given ID. Policy + * assignment IDs have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * * @param {string} policyAssignmentId The ID of the policy assignment to get. * Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -746,7 +964,21 @@ export interface PolicyAssignments { /** - * Gets policy assignments for the resource group. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -765,7 +997,21 @@ export interface PolicyAssignments { listForResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets policy assignments for the resource group. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -804,7 +1050,35 @@ export interface PolicyAssignments { /** - * Gets policy assignments for a resource. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -823,7 +1097,35 @@ export interface PolicyAssignments { listForResourceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets policy assignments for a resource. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -862,7 +1164,21 @@ export interface PolicyAssignments { /** - * Gets all the policy assignments for a subscription. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -881,7 +1197,21 @@ export interface PolicyAssignments { listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the policy assignments for a subscription. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -921,38 +1251,43 @@ export interface PolicyAssignments { /** * @class - * PolicySetDefinitions + * PolicyDefinitions * __NOTE__: An instance of this class is automatically created for an * instance of the PolicyClient. */ -export interface PolicySetDefinitions { +export interface PolicyDefinitions { /** - * Creates or updates a policy set definition. + * @summary Creates or updates a policy definition in a subscription. * - * @param {string} policySetDefinitionName The name of the policy set - * definition to create. + * This operation creates or updates a policy definition in the given + * subscription with the given name. * - * @param {object} parameters The policy set definition properties. + * @param {string} policyDefinitionName The name of the policy definition to + * create. + * + * @param {object} parameters The policy definition properties. * * @param {string} [parameters.policyType] The type of policy definition. * Possible values are NotSpecified, BuiltIn, and Custom. Possible values * include: 'NotSpecified', 'BuiltIn', 'Custom' * - * @param {string} [parameters.displayName] The display name of the policy set + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy * definition. * - * @param {string} [parameters.description] The policy set definition - * description. + * @param {string} [parameters.description] The policy definition description. * - * @param {object} [parameters.metadata] The policy set definition metadata. + * @param {object} [parameters.policyRule] The policy rule. * - * @param {object} [parameters.parameters] The policy set definition parameters - * that can be used in policy definition references. + * @param {object} [parameters.metadata] The policy definition metadata. * - * @param {array} parameters.policyDefinitions An array of policy definition - * references. + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. * * @param {object} [options] Optional Parameters. * @@ -961,37 +1296,42 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(policySetDefinitionName: string, parameters: models.PolicySetDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(policyDefinitionName: string, parameters: models.PolicyDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a policy set definition. + * @summary Creates or updates a policy definition in a subscription. * - * @param {string} policySetDefinitionName The name of the policy set - * definition to create. + * This operation creates or updates a policy definition in the given + * subscription with the given name. * - * @param {object} parameters The policy set definition properties. + * @param {string} policyDefinitionName The name of the policy definition to + * create. + * + * @param {object} parameters The policy definition properties. * * @param {string} [parameters.policyType] The type of policy definition. * Possible values are NotSpecified, BuiltIn, and Custom. Possible values * include: 'NotSpecified', 'BuiltIn', 'Custom' * - * @param {string} [parameters.displayName] The display name of the policy set + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy * definition. * - * @param {string} [parameters.description] The policy set definition - * description. + * @param {string} [parameters.description] The policy definition description. * - * @param {object} [parameters.metadata] The policy set definition metadata. + * @param {object} [parameters.policyRule] The policy rule. * - * @param {object} [parameters.parameters] The policy set definition parameters - * that can be used in policy definition references. + * @param {object} [parameters.metadata] The policy definition metadata. * - * @param {array} parameters.policyDefinitions An array of policy definition - * references. + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. * * @param {object} [options] Optional Parameters. * @@ -1005,7 +1345,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinition} - The deserialized result object. + * @resolve {PolicyDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1013,23 +1353,26 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinition} for more information. + * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinition} 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(policySetDefinitionName: string, parameters: models.PolicySetDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(policySetDefinitionName: string, parameters: models.PolicySetDefinition, callback: ServiceCallback): void; - createOrUpdate(policySetDefinitionName: string, parameters: models.PolicySetDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(policyDefinitionName: string, parameters: models.PolicyDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(policyDefinitionName: string, parameters: models.PolicyDefinition, callback: ServiceCallback): void; + createOrUpdate(policyDefinitionName: string, parameters: models.PolicyDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a policy set definition. + * @summary Deletes a policy definition in a subscription. * - * @param {string} policySetDefinitionName The name of the policy set - * definition to delete. + * This operation deletes the policy definition in the given subscription with + * the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * delete. * * @param {object} [options] Optional Parameters. * @@ -1042,13 +1385,16 @@ export interface PolicySetDefinitions { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a policy set definition. + * @summary Deletes a policy definition in a subscription. * - * @param {string} policySetDefinitionName The name of the policy set - * definition to delete. + * This operation deletes the policy definition in the given subscription with + * the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * delete. * * @param {object} [options] Optional Parameters. * @@ -1076,16 +1422,19 @@ export interface PolicySetDefinitions { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(policySetDefinitionName: string, callback: ServiceCallback): void; - deleteMethod(policySetDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(policyDefinitionName: string, callback: ServiceCallback): void; + deleteMethod(policyDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the policy set definition. + * @summary Retrieves a policy definition in a subscription. * - * @param {string} policySetDefinitionName The name of the policy set - * definition to get. + * This operation retrieves the policy definition in the given subscription + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * get. * * @param {object} [options] Optional Parameters. * @@ -1094,17 +1443,20 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the policy set definition. + * @summary Retrieves a policy definition in a subscription. * - * @param {string} policySetDefinitionName The name of the policy set - * definition to get. + * This operation retrieves the policy definition in the given subscription + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * get. * * @param {object} [options] Optional Parameters. * @@ -1118,7 +1470,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinition} - The deserialized result object. + * @resolve {PolicyDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1126,22 +1478,24 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinition} for more information. + * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinition} 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(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(policySetDefinitionName: string, callback: ServiceCallback): void; - get(policySetDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(policyDefinitionName: string, callback: ServiceCallback): void; + get(policyDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the built in policy set definition. + * @summary Retrieves a built-in policy definition. * - * @param {string} policySetDefinitionName The name of the policy set + * This operation retrieves the built-in policy definition with the given name. + * + * @param {string} policyDefinitionName The name of the built-in policy * definition to get. * * @param {object} [options] Optional Parameters. @@ -1151,16 +1505,18 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getBuiltInWithHttpOperationResponse(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getBuiltInWithHttpOperationResponse(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the built in policy set definition. + * @summary Retrieves a built-in policy definition. * - * @param {string} policySetDefinitionName The name of the policy set + * This operation retrieves the built-in policy definition with the given name. + * + * @param {string} policyDefinitionName The name of the built-in policy * definition to get. * * @param {object} [options] Optional Parameters. @@ -1175,7 +1531,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinition} - The deserialized result object. + * @resolve {PolicyDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1183,20 +1539,50 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinition} for more information. + * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinition} 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. */ - getBuiltIn(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getBuiltIn(policySetDefinitionName: string, callback: ServiceCallback): void; - getBuiltIn(policySetDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getBuiltIn(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getBuiltIn(policyDefinitionName: string, callback: ServiceCallback): void; + getBuiltIn(policyDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the policy set definitions for a subscription. + * @summary Creates or updates a policy definition in a management group. + * + * This operation creates or updates a policy definition in the given + * management group with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * create. + * + * @param {object} parameters The policy definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy + * definition. + * + * @param {string} [parameters.description] The policy definition description. + * + * @param {object} [parameters.policyRule] The policy rule. + * + * @param {object} [parameters.metadata] The policy definition metadata. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -1205,14 +1591,44 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateAtManagementGroupWithHttpOperationResponse(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the policy set definitions for a subscription. + * @summary Creates or updates a policy definition in a management group. + * + * This operation creates or updates a policy definition in the given + * management group with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * create. + * + * @param {object} parameters The policy definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy + * definition. + * + * @param {string} [parameters.description] The policy definition description. + * + * @param {object} [parameters.policyRule] The policy rule. + * + * @param {object} [parameters.metadata] The policy definition metadata. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -1226,7 +1642,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinitionListResult} - The deserialized result object. + * @resolve {PolicyDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1234,21 +1650,28 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinitionListResult} for more - * information. + * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinition} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, callback: ServiceCallback): void; + createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the built in policy set definitions. + * @summary Deletes a policy definition in a management group. + * + * This operation deletes the policy definition in the given management group + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * delete. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -1257,14 +1680,22 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listBuiltInWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteAtManagementGroupWithHttpOperationResponse(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the built in policy set definitions. + * @summary Deletes a policy definition in a management group. + * + * This operation deletes the policy definition in the given management group + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * delete. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -1278,7 +1709,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinitionListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1286,44 +1717,25 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinitionListResult} for more - * information. + * {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. */ - listBuiltIn(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBuiltIn(callback: ServiceCallback): void; - listBuiltIn(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; + deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a policy set definition at management group level. + * @summary Retrieve a policy definition in a management group. * - * @param {string} policySetDefinitionName The name of the policy set - * definition to create. + * This operation retrieves the policy definition in the given management group + * with the given name. * - * @param {object} parameters The policy set definition properties. - * - * @param {string} [parameters.policyType] The type of policy definition. - * Possible values are NotSpecified, BuiltIn, and Custom. Possible values - * include: 'NotSpecified', 'BuiltIn', 'Custom' - * - * @param {string} [parameters.displayName] The display name of the policy set - * definition. - * - * @param {string} [parameters.description] The policy set definition - * description. - * - * @param {object} [parameters.metadata] The policy set definition metadata. - * - * @param {object} [parameters.parameters] The policy set definition parameters - * that can be used in policy definition references. - * - * @param {array} parameters.policyDefinitions An array of policy definition - * references. + * @param {string} policyDefinitionName The name of the policy definition to + * get. * * @param {string} managementGroupId The ID of the management group. * @@ -1334,37 +1746,20 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateAtManagementGroupWithHttpOperationResponse(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getAtManagementGroupWithHttpOperationResponse(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a policy set definition at management group level. - * - * @param {string} policySetDefinitionName The name of the policy set - * definition to create. - * - * @param {object} parameters The policy set definition properties. - * - * @param {string} [parameters.policyType] The type of policy definition. - * Possible values are NotSpecified, BuiltIn, and Custom. Possible values - * include: 'NotSpecified', 'BuiltIn', 'Custom' - * - * @param {string} [parameters.displayName] The display name of the policy set - * definition. - * - * @param {string} [parameters.description] The policy set definition - * description. - * - * @param {object} [parameters.metadata] The policy set definition metadata. + * @summary Retrieve a policy definition in a management group. * - * @param {object} [parameters.parameters] The policy set definition parameters - * that can be used in policy definition references. + * This operation retrieves the policy definition in the given management group + * with the given name. * - * @param {array} parameters.policyDefinitions An array of policy definition - * references. + * @param {string} policyDefinitionName The name of the policy definition to + * get. * * @param {string} managementGroupId The ID of the management group. * @@ -1380,7 +1775,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinition} - The deserialized result object. + * @resolve {PolicyDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1388,25 +1783,23 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinition} for more information. + * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinition} 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. */ - createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, callback: ServiceCallback): void; - createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; + getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a policy set definition at management group level. - * - * @param {string} policySetDefinitionName The name of the policy set - * definition to delete. + * @summary Retrieves policy definitions in a subscription * - * @param {string} managementGroupId The ID of the management group. + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {object} [options] Optional Parameters. * @@ -1415,19 +1808,17 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteAtManagementGroupWithHttpOperationResponse(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a policy set definition at management group level. - * - * @param {string} policySetDefinitionName The name of the policy set - * definition to delete. + * @summary Retrieves policy definitions in a subscription * - * @param {string} managementGroupId The ID of the management group. + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {object} [options] Optional Parameters. * @@ -1441,7 +1832,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1449,24 +1840,23 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} 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. */ - deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; - deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the policy set definition at management group level. - * - * @param {string} policySetDefinitionName The name of the policy set - * definition to get. + * @summary Retrieve built-in policy definitions * - * @param {string} managementGroupId The ID of the management group. + * This operation retrieves a list of all the built-in policy definitions. * * @param {object} [options] Optional Parameters. * @@ -1475,19 +1865,16 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getAtManagementGroupWithHttpOperationResponse(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBuiltInWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the policy set definition at management group level. - * - * @param {string} policySetDefinitionName The name of the policy set - * definition to get. + * @summary Retrieve built-in policy definitions * - * @param {string} managementGroupId The ID of the management group. + * This operation retrieves a list of all the built-in policy definitions. * * @param {object} [options] Optional Parameters. * @@ -1501,7 +1888,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinition} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1509,20 +1896,24 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinition} for more information. + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} 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. */ - getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; - getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBuiltIn(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBuiltIn(callback: ServiceCallback): void; + listBuiltIn(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the policy set definitions for a subscription at management group. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} managementGroupId The ID of the management group. * @@ -1533,14 +1924,17 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByManagementGroupWithHttpOperationResponse(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByManagementGroupWithHttpOperationResponse(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the policy set definitions for a subscription at management group. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} managementGroupId The ID of the management group. * @@ -1556,7 +1950,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinitionListResult} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1564,21 +1958,24 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinitionListResult} for more + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} 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. */ - listByManagementGroup(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByManagementGroup(managementGroupId: string, callback: ServiceCallback): void; - listByManagementGroup(managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByManagementGroup(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByManagementGroup(managementGroupId: string, callback: ServiceCallback): void; + listByManagementGroup(managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the policy set definitions for a subscription. + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1590,14 +1987,17 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the policy set definitions for a subscription. + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1614,7 +2014,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinitionListResult} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1622,21 +2022,23 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinitionListResult} for more + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listNext(nextPageLink: string, callback: ServiceCallback): void; - listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the built in policy set definitions. + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1648,14 +2050,16 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listBuiltInNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBuiltInNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the built in policy set definitions. + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1672,7 +2076,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinitionListResult} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1680,21 +2084,24 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinitionListResult} for more + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} 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. */ - listBuiltInNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBuiltInNext(nextPageLink: string, callback: ServiceCallback): void; - listBuiltInNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBuiltInNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBuiltInNext(nextPageLink: string, callback: ServiceCallback): void; + listBuiltInNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the policy set definitions for a subscription at management group. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1706,14 +2113,17 @@ export interface PolicySetDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByManagementGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByManagementGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the policy set definitions for a subscription at management group. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1730,7 +2140,7 @@ export interface PolicySetDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicySetDefinitionListResult} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1738,55 +2148,56 @@ export interface PolicySetDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicySetDefinitionListResult} for more + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} 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. */ - listByManagementGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByManagementGroupNext(nextPageLink: string, callback: ServiceCallback): void; - listByManagementGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByManagementGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByManagementGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByManagementGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * PolicyDefinitions + * PolicySetDefinitions * __NOTE__: An instance of this class is automatically created for an * instance of the PolicyClient. */ -export interface PolicyDefinitions { +export interface PolicySetDefinitions { /** - * Creates or updates a policy definition. + * @summary Creates or updates a policy set definition. * - * @param {string} policyDefinitionName The name of the policy definition to - * create. + * This operation creates or updates a policy set definition in the given + * subscription with the given name. * - * @param {object} parameters The policy definition properties. + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. + * + * @param {object} parameters The policy set definition properties. * * @param {string} [parameters.policyType] The type of policy definition. * Possible values are NotSpecified, BuiltIn, and Custom. Possible values * include: 'NotSpecified', 'BuiltIn', 'Custom' * - * @param {string} [parameters.mode] The policy definition mode. Possible - * values are NotSpecified, Indexed, and All. Possible values include: - * 'NotSpecified', 'Indexed', 'All' - * - * @param {string} [parameters.displayName] The display name of the policy + * @param {string} [parameters.displayName] The display name of the policy set * definition. * - * @param {string} [parameters.description] The policy definition description. + * @param {string} [parameters.description] The policy set definition + * description. * - * @param {object} [parameters.policyRule] The policy rule. + * @param {object} [parameters.metadata] The policy set definition metadata. * - * @param {object} [parameters.metadata] The policy definition metadata. + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. * - * @param {object} [parameters.parameters] Required if a parameter is used in - * policy rule. + * @param {array} parameters.policyDefinitions An array of policy definition + * references. * * @param {object} [options] Optional Parameters. * @@ -1795,39 +2206,40 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(policyDefinitionName: string, parameters: models.PolicyDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(policySetDefinitionName: string, parameters: models.PolicySetDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a policy definition. + * @summary Creates or updates a policy set definition. * - * @param {string} policyDefinitionName The name of the policy definition to - * create. + * This operation creates or updates a policy set definition in the given + * subscription with the given name. * - * @param {object} parameters The policy definition properties. + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. + * + * @param {object} parameters The policy set definition properties. * * @param {string} [parameters.policyType] The type of policy definition. * Possible values are NotSpecified, BuiltIn, and Custom. Possible values * include: 'NotSpecified', 'BuiltIn', 'Custom' * - * @param {string} [parameters.mode] The policy definition mode. Possible - * values are NotSpecified, Indexed, and All. Possible values include: - * 'NotSpecified', 'Indexed', 'All' - * - * @param {string} [parameters.displayName] The display name of the policy + * @param {string} [parameters.displayName] The display name of the policy set * definition. * - * @param {string} [parameters.description] The policy definition description. + * @param {string} [parameters.description] The policy set definition + * description. * - * @param {object} [parameters.policyRule] The policy rule. + * @param {object} [parameters.metadata] The policy set definition metadata. * - * @param {object} [parameters.metadata] The policy definition metadata. + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. * - * @param {object} [parameters.parameters] Required if a parameter is used in - * policy rule. + * @param {array} parameters.policyDefinitions An array of policy definition + * references. * * @param {object} [options] Optional Parameters. * @@ -1841,7 +2253,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinition} - The deserialized result object. + * @resolve {PolicySetDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1849,23 +2261,26 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinition} for more information. + * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinition} 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(policyDefinitionName: string, parameters: models.PolicyDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(policyDefinitionName: string, parameters: models.PolicyDefinition, callback: ServiceCallback): void; - createOrUpdate(policyDefinitionName: string, parameters: models.PolicyDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(policySetDefinitionName: string, parameters: models.PolicySetDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(policySetDefinitionName: string, parameters: models.PolicySetDefinition, callback: ServiceCallback): void; + createOrUpdate(policySetDefinitionName: string, parameters: models.PolicySetDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a policy definition. + * @summary Deletes a policy set definition. * - * @param {string} policyDefinitionName The name of the policy definition to - * delete. + * This operation deletes the policy set definition in the given subscription + * with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. * * @param {object} [options] Optional Parameters. * @@ -1878,13 +2293,16 @@ export interface PolicyDefinitions { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a policy definition. + * @summary Deletes a policy set definition. * - * @param {string} policyDefinitionName The name of the policy definition to - * delete. + * This operation deletes the policy set definition in the given subscription + * with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. * * @param {object} [options] Optional Parameters. * @@ -1912,16 +2330,19 @@ export interface PolicyDefinitions { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(policyDefinitionName: string, callback: ServiceCallback): void; - deleteMethod(policyDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(policySetDefinitionName: string, callback: ServiceCallback): void; + deleteMethod(policySetDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the policy definition. + * @summary Retrieves a policy set definition. * - * @param {string} policyDefinitionName The name of the policy definition to - * get. + * This operation retrieves the policy set definition in the given subscription + * with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. * * @param {object} [options] Optional Parameters. * @@ -1930,17 +2351,20 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the policy definition. + * @summary Retrieves a policy set definition. * - * @param {string} policyDefinitionName The name of the policy definition to - * get. + * This operation retrieves the policy set definition in the given subscription + * with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. * * @param {object} [options] Optional Parameters. * @@ -1954,7 +2378,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinition} - The deserialized result object. + * @resolve {PolicySetDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1962,22 +2386,25 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinition} for more information. + * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinition} 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(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(policyDefinitionName: string, callback: ServiceCallback): void; - get(policyDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(policySetDefinitionName: string, callback: ServiceCallback): void; + get(policySetDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the built in policy definition. + * @summary Retrieves a built in policy set definition. * - * @param {string} policyDefinitionName The name of the built in policy + * This operation retrieves the built-in policy set definition with the given + * name. + * + * @param {string} policySetDefinitionName The name of the policy set * definition to get. * * @param {object} [options] Optional Parameters. @@ -1987,16 +2414,19 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getBuiltInWithHttpOperationResponse(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getBuiltInWithHttpOperationResponse(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the built in policy definition. + * @summary Retrieves a built in policy set definition. + * + * This operation retrieves the built-in policy set definition with the given + * name. * - * @param {string} policyDefinitionName The name of the built in policy + * @param {string} policySetDefinitionName The name of the policy set * definition to get. * * @param {object} [options] Optional Parameters. @@ -2011,7 +2441,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinition} - The deserialized result object. + * @resolve {PolicySetDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2019,47 +2449,23 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinition} for more information. + * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinition} 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. */ - getBuiltIn(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getBuiltIn(policyDefinitionName: string, callback: ServiceCallback): void; - getBuiltIn(policyDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getBuiltIn(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getBuiltIn(policySetDefinitionName: string, callback: ServiceCallback): void; + getBuiltIn(policySetDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a policy definition at management group level. - * - * @param {string} policyDefinitionName The name of the policy definition to - * create. + * @summary Retrieves the policy set definitions for a subscription. * - * @param {object} parameters The policy definition properties. - * - * @param {string} [parameters.policyType] The type of policy definition. - * Possible values are NotSpecified, BuiltIn, and Custom. Possible values - * include: 'NotSpecified', 'BuiltIn', 'Custom' - * - * @param {string} [parameters.mode] The policy definition mode. Possible - * values are NotSpecified, Indexed, and All. Possible values include: - * 'NotSpecified', 'Indexed', 'All' - * - * @param {string} [parameters.displayName] The display name of the policy - * definition. - * - * @param {string} [parameters.description] The policy definition description. - * - * @param {object} [parameters.policyRule] The policy rule. - * - * @param {object} [parameters.metadata] The policy definition metadata. - * - * @param {object} [parameters.parameters] Required if a parameter is used in - * policy rule. - * - * @param {string} managementGroupId The ID of the management group. + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {object} [options] Optional Parameters. * @@ -2068,41 +2474,17 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateAtManagementGroupWithHttpOperationResponse(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a policy definition at management group level. + * @summary Retrieves the policy set definitions for a subscription. * - * @param {string} policyDefinitionName The name of the policy definition to - * create. - * - * @param {object} parameters The policy definition properties. - * - * @param {string} [parameters.policyType] The type of policy definition. - * Possible values are NotSpecified, BuiltIn, and Custom. Possible values - * include: 'NotSpecified', 'BuiltIn', 'Custom' - * - * @param {string} [parameters.mode] The policy definition mode. Possible - * values are NotSpecified, Indexed, and All. Possible values include: - * 'NotSpecified', 'Indexed', 'All' - * - * @param {string} [parameters.displayName] The display name of the policy - * definition. - * - * @param {string} [parameters.description] The policy definition description. - * - * @param {object} [parameters.policyRule] The policy rule. - * - * @param {object} [parameters.metadata] The policy definition metadata. - * - * @param {object} [parameters.parameters] Required if a parameter is used in - * policy rule. - * - * @param {string} managementGroupId The ID of the management group. + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {object} [options] Optional Parameters. * @@ -2116,7 +2498,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinition} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2124,25 +2506,23 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinition} for more information. + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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. */ - createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, callback: ServiceCallback): void; - createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a policy definition at management group level. + * @summary Retrieves built-in policy set definitions. * - * @param {string} policyDefinitionName The name of the policy definition to - * delete. - * - * @param {string} managementGroupId The ID of the management group. + * This operation retrieves a list of all the built-in policy set definitions. * * @param {object} [options] Optional Parameters. * @@ -2151,19 +2531,16 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteAtManagementGroupWithHttpOperationResponse(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBuiltInWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a policy definition at management group level. + * @summary Retrieves built-in policy set definitions. * - * @param {string} policyDefinitionName The name of the policy definition to - * delete. - * - * @param {string} managementGroupId The ID of the management group. + * This operation retrieves a list of all the built-in policy set definitions. * * @param {object} [options] Optional Parameters. * @@ -2177,7 +2554,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2185,22 +2562,47 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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. */ - deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; - deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBuiltIn(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBuiltIn(callback: ServiceCallback): void; + listBuiltIn(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the policy definition at management group level. + * @summary Creates or updates a policy set definition. * - * @param {string} policyDefinitionName The name of the policy definition to - * get. + * This operation creates or updates a policy set definition in the given + * management group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. + * + * @param {object} parameters The policy set definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.displayName] The display name of the policy set + * definition. + * + * @param {string} [parameters.description] The policy set definition + * description. + * + * @param {object} [parameters.metadata] The policy set definition metadata. + * + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. + * + * @param {array} parameters.policyDefinitions An array of policy definition + * references. * * @param {string} managementGroupId The ID of the management group. * @@ -2211,17 +2613,40 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getAtManagementGroupWithHttpOperationResponse(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateAtManagementGroupWithHttpOperationResponse(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the policy definition at management group level. + * @summary Creates or updates a policy set definition. * - * @param {string} policyDefinitionName The name of the policy definition to - * get. + * This operation creates or updates a policy set definition in the given + * management group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. + * + * @param {object} parameters The policy set definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.displayName] The display name of the policy set + * definition. + * + * @param {string} [parameters.description] The policy set definition + * description. + * + * @param {object} [parameters.metadata] The policy set definition metadata. + * + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. + * + * @param {array} parameters.policyDefinitions An array of policy definition + * references. * * @param {string} managementGroupId The ID of the management group. * @@ -2237,7 +2662,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinition} - The deserialized result object. + * @resolve {PolicySetDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2245,20 +2670,28 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinition} for more information. + * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinition} 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. */ - getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; - getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, callback: ServiceCallback): void; + createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the policy definitions for a subscription. + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given management + * group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2267,14 +2700,22 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteAtManagementGroupWithHttpOperationResponse(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the policy definitions for a subscription. + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given management + * group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2288,7 +2729,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinitionListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2296,21 +2737,27 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinitionListResult} for more - * information. + * {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. */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; + deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the built in policy definitions. + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given management + * group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2319,14 +2766,22 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listBuiltInWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getAtManagementGroupWithHttpOperationResponse(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the built in policy definitions. + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given management + * group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2340,7 +2795,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinitionListResult} - The deserialized result object. + * @resolve {PolicySetDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2348,22 +2803,23 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinitionListResult} for more - * information. + * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinition} 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. */ - listBuiltIn(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBuiltIn(callback: ServiceCallback): void; - listBuiltIn(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; + getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the policy definitions for a subscription at management group - * level. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} managementGroupId The ID of the management group. * @@ -2374,15 +2830,17 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByManagementGroupWithHttpOperationResponse(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByManagementGroupWithHttpOperationResponse(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the policy definitions for a subscription at management group - * level. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} managementGroupId The ID of the management group. * @@ -2398,7 +2856,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinitionListResult} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2406,21 +2864,24 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinitionListResult} for more + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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. */ - listByManagementGroup(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByManagementGroup(managementGroupId: string, callback: ServiceCallback): void; - listByManagementGroup(managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByManagementGroup(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByManagementGroup(managementGroupId: string, callback: ServiceCallback): void; + listByManagementGroup(managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the policy definitions for a subscription. + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2432,14 +2893,17 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the policy definitions for a subscription. + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2456,7 +2920,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinitionListResult} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2464,21 +2928,23 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinitionListResult} for more + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listNext(nextPageLink: string, callback: ServiceCallback): void; - listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the built in policy definitions. + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2490,14 +2956,16 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listBuiltInNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBuiltInNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the built in policy definitions. + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2514,7 +2982,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinitionListResult} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2522,22 +2990,24 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinitionListResult} for more + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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. */ - listBuiltInNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBuiltInNext(nextPageLink: string, callback: ServiceCallback): void; - listBuiltInNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBuiltInNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBuiltInNext(nextPageLink: string, callback: ServiceCallback): void; + listBuiltInNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the policy definitions for a subscription at management group - * level. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2549,15 +3019,17 @@ export interface PolicyDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByManagementGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByManagementGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the policy definitions for a subscription at management group - * level. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2574,7 +3046,7 @@ export interface PolicyDefinitions { * * {Promise} A promise is returned. * - * @resolve {PolicyDefinitionListResult} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2582,15 +3054,15 @@ export interface PolicyDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link PolicyDefinitionListResult} for more + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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. */ - listByManagementGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByManagementGroupNext(nextPageLink: string, callback: ServiceCallback): void; - listByManagementGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByManagementGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByManagementGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByManagementGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } diff --git a/lib/services/resourceManagement/lib/policy/operations/index.js b/lib/services/resourceManagement/lib/policy/operations/index.js index d60397f3b6..8d6fdd7a3d 100644 --- a/lib/services/resourceManagement/lib/policy/operations/index.js +++ b/lib/services/resourceManagement/lib/policy/operations/index.js @@ -15,5 +15,5 @@ 'use strict'; exports.PolicyAssignments = require('./policyAssignments'); -exports.PolicySetDefinitions = require('./policySetDefinitions'); exports.PolicyDefinitions = require('./policyDefinitions'); +exports.PolicySetDefinitions = require('./policySetDefinitions'); diff --git a/lib/services/resourceManagement/lib/policy/operations/policyAssignments.js b/lib/services/resourceManagement/lib/policy/operations/policyAssignments.js index e5dbd55ea2..91699a6690 100644 --- a/lib/services/resourceManagement/lib/policy/operations/policyAssignments.js +++ b/lib/services/resourceManagement/lib/policy/operations/policyAssignments.js @@ -15,9 +15,21 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Deletes a policy assignment. - * - * @param {string} scope The scope of the policy assignment. + * @summary Deletes a policy assignment. + * + * This operation deletes a policy assignment, given its name and the scope it + * was created in. The scope of a policy assignment is the part of its ID + * preceding + * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment to * delete. @@ -50,7 +62,6 @@ function _deleteMethod(scope, policyAssignmentName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (scope === null || scope === undefined || typeof scope.valueOf() !== 'string') { @@ -59,6 +70,9 @@ function _deleteMethod(scope, policyAssignmentName, options, callback) { if (policyAssignmentName === null || policyAssignmentName === undefined || typeof policyAssignmentName.valueOf() !== 'string') { throw new Error('policyAssignmentName 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.'); } @@ -72,7 +86,7 @@ function _deleteMethod(scope, policyAssignmentName, options, callback) { requestUrl = requestUrl.replace('{scope}', scope); requestUrl = requestUrl.replace('{policyAssignmentName}', encodeURIComponent(policyAssignmentName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -156,13 +170,21 @@ function _deleteMethod(scope, policyAssignmentName, options, callback) { } /** - * @summary Creates a policy assignment. - * - * Policy assignments are inherited by child resources. For example, when you - * apply a policy to a resource group that policy is assigned to all resources - * in the group. - * - * @param {string} scope The scope of the policy assignment. + * @summary Creates or updates a policy assignment. + * + * This operation creates or updates a policy assignment with the given scope + * and name. Policy assignments apply to all resources contained within their + * scope. For example, when you assign a policy at resource group scope, that + * policy applies to all resources in the group. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment. * @@ -172,7 +194,7 @@ function _deleteMethod(scope, policyAssignmentName, options, callback) { * assignment. * * @param {string} [parameters.policyDefinitionId] The ID of the policy - * definition. + * definition or policy set definition being assigned. * * @param {string} [parameters.scope] The scope for the policy assignment. * @@ -186,7 +208,8 @@ function _deleteMethod(scope, policyAssignmentName, options, callback) { * * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {object} [parameters.sku] The policy sku. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * * @param {string} parameters.sku.name The name of the policy sku. Possible * values are A0 and A1. @@ -222,7 +245,6 @@ function _create(scope, policyAssignmentName, parameters, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (scope === null || scope === undefined || typeof scope.valueOf() !== 'string') { @@ -234,6 +256,9 @@ function _create(scope, policyAssignmentName, parameters, options, callback) { if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } + 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.'); } @@ -247,7 +272,7 @@ function _create(scope, policyAssignmentName, parameters, options, callback) { requestUrl = requestUrl.replace('{scope}', scope); requestUrl = requestUrl.replace('{policyAssignmentName}', encodeURIComponent(policyAssignmentName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -345,9 +370,19 @@ function _create(scope, policyAssignmentName, parameters, options, callback) { } /** - * Gets a policy assignment. + * @summary Retrieves a policy assignment. + * + * This operation retrieves a single policy assignment, given its name and the + * scope it was created at. * - * @param {string} scope The scope of the policy assignment. + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment to * get. @@ -380,7 +415,6 @@ function _get(scope, policyAssignmentName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (scope === null || scope === undefined || typeof scope.valueOf() !== 'string') { @@ -389,6 +423,9 @@ function _get(scope, policyAssignmentName, options, callback) { if (policyAssignmentName === null || policyAssignmentName === undefined || typeof policyAssignmentName.valueOf() !== 'string') { throw new Error('policyAssignmentName 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.'); } @@ -402,7 +439,7 @@ function _get(scope, policyAssignmentName, options, callback) { requestUrl = requestUrl.replace('{scope}', scope); requestUrl = requestUrl.replace('{policyAssignmentName}', encodeURIComponent(policyAssignmentName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -486,14 +523,30 @@ function _get(scope, policyAssignmentName, options, callback) { } /** - * Gets policy assignments for the resource group. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. * * @param {string} resourceGroupName The name of the resource group that * contains policy assignments. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -523,7 +576,6 @@ function _listForResourceGroup(resourceGroupName, options, callback) { throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; - let apiVersion = '2017-06-01-preview'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -546,6 +598,9 @@ function _listForResourceGroup(resourceGroupName, options, callback) { if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { throw new Error('filter 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.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.'); } @@ -565,7 +620,7 @@ function _listForResourceGroup(resourceGroupName, options, callback) { if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + filter); } - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -649,24 +704,56 @@ function _listForResourceGroup(resourceGroupName, options, callback) { } /** - * Gets policy assignments for a resource. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * * @param {string} resourceGroupName The name of the resource group containing - * the resource. The name is case insensitive. + * the resource. * * @param {string} resourceProviderNamespace The namespace of the resource - * provider. + * provider. For example, the namespace of a virtual machine is + * Microsoft.Compute (from Microsoft.Compute/virtualMachines) * - * @param {string} parentResourcePath The parent resource path. + * @param {string} parentResourcePath The parent resource path. Use empty + * string if there is none. * - * @param {string} resourceType The resource type. + * @param {string} resourceType The resource type name. For example the type + * name of a web app is 'sites' (from Microsoft.Web/sites). * - * @param {string} resourceName The name of the resource with policy - * assignments. + * @param {string} resourceName The name of the resource. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -696,7 +783,6 @@ function _listForResource(resourceGroupName, resourceProviderNamespace, parentRe throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; - let apiVersion = '2017-06-01-preview'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -731,6 +817,9 @@ function _listForResource(resourceGroupName, resourceProviderNamespace, parentRe if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { throw new Error('filter 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.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.'); } @@ -754,7 +843,7 @@ function _listForResource(resourceGroupName, resourceProviderNamespace, parentRe if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -838,11 +927,27 @@ function _listForResource(resourceGroupName, resourceProviderNamespace, parentRe } /** - * Gets all the policy assignments for a subscription. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -872,12 +977,14 @@ function _list(options, callback) { throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; - let apiVersion = '2017-06-01-preview'; // Validate try { if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { throw new Error('filter 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.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.'); } @@ -896,7 +1003,7 @@ function _list(options, callback) { if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -980,18 +1087,22 @@ function _list(options, callback) { } /** - * @summary Deletes a policy assignment by ID. - * - * When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * @summary Deletes a policy assignment. + * + * This operation deletes the policy with the given ID. Policy assignment IDs + * have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid formats for {scope} are: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}' + * (management group), '/subscriptions/{subscriptionId}' (subscription), + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + * (resource group), or + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * (resource). * * @param {string} policyAssignmentId The ID of the policy assignment to * delete. Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -1021,12 +1132,14 @@ function _deleteById(policyAssignmentId, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (policyAssignmentId === null || policyAssignmentId === undefined || typeof policyAssignmentId.valueOf() !== 'string') { throw new Error('policyAssignmentId 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.'); } @@ -1039,7 +1152,7 @@ function _deleteById(policyAssignmentId, options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + '{policyAssignmentId}'; requestUrl = requestUrl.replace('{policyAssignmentId}', policyAssignmentId); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1071,7 +1184,7 @@ function _deleteById(policyAssignmentId, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1123,20 +1236,25 @@ function _deleteById(policyAssignmentId, options, callback) { } /** - * @summary Creates a policy assignment by ID. - * - * Policy assignments are inherited by child resources. For example, when you - * apply a policy to a resource group that policy is assigned to all resources - * in the group. When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * @summary Creates or updates a policy assignment. + * + * This operation creates or updates the policy assignment with the given ID. + * Policy assignments made on a scope apply to all resources contained in that + * scope. For example, when you assign a policy to a resource group that policy + * applies to all resources in the group. Policy assignment IDs have this + * format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * * @param {string} policyAssignmentId The ID of the policy assignment to * create. Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} parameters Parameters for policy assignment. * @@ -1144,7 +1262,7 @@ function _deleteById(policyAssignmentId, options, callback) { * assignment. * * @param {string} [parameters.policyDefinitionId] The ID of the policy - * definition. + * definition or policy set definition being assigned. * * @param {string} [parameters.scope] The scope for the policy assignment. * @@ -1158,7 +1276,8 @@ function _deleteById(policyAssignmentId, options, callback) { * * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {object} [parameters.sku] The policy sku. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * * @param {string} parameters.sku.name The name of the policy sku. Possible * values are A0 and A1. @@ -1194,7 +1313,6 @@ function _createById(policyAssignmentId, parameters, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (policyAssignmentId === null || policyAssignmentId === undefined || typeof policyAssignmentId.valueOf() !== 'string') { @@ -1203,6 +1321,9 @@ function _createById(policyAssignmentId, parameters, options, callback) { if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } + 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.'); } @@ -1215,7 +1336,7 @@ function _createById(policyAssignmentId, parameters, options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + '{policyAssignmentId}'; requestUrl = requestUrl.replace('{policyAssignmentId}', policyAssignmentId); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1313,18 +1434,22 @@ function _createById(policyAssignmentId, parameters, options, callback) { } /** - * @summary Gets a policy assignment by ID. - * - * When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * @summary Retrieves the policy assignment with the given ID. + * + * The operation retrieves the policy assignment with the given ID. Policy + * assignment IDs have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * * @param {string} policyAssignmentId The ID of the policy assignment to get. * Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -1354,12 +1479,14 @@ function _getById(policyAssignmentId, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (policyAssignmentId === null || policyAssignmentId === undefined || typeof policyAssignmentId.valueOf() !== 'string') { throw new Error('policyAssignmentId 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.'); } @@ -1372,7 +1499,7 @@ function _getById(policyAssignmentId, options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + '{policyAssignmentId}'; requestUrl = requestUrl.replace('{policyAssignmentId}', policyAssignmentId); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1456,7 +1583,21 @@ function _getById(policyAssignmentId, options, callback) { } /** - * Gets policy assignments for the resource group. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1585,7 +1726,35 @@ function _listForResourceGroupNext(nextPageLink, options, callback) { } /** - * Gets policy assignments for a resource. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1714,7 +1883,21 @@ function _listForResourceNext(nextPageLink, options, callback) { } /** - * Gets all the policy assignments for a subscription. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1865,9 +2048,21 @@ class PolicyAssignments { } /** - * Deletes a policy assignment. - * - * @param {string} scope The scope of the policy assignment. + * @summary Deletes a policy assignment. + * + * This operation deletes a policy assignment, given its name and the scope it + * was created in. The scope of a policy assignment is the part of its ID + * preceding + * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment to * delete. @@ -1898,9 +2093,21 @@ class PolicyAssignments { } /** - * Deletes a policy assignment. - * - * @param {string} scope The scope of the policy assignment. + * @summary Deletes a policy assignment. + * + * This operation deletes a policy assignment, given its name and the scope it + * was created in. The scope of a policy assignment is the part of its ID + * preceding + * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment to * delete. @@ -1953,13 +2160,21 @@ class PolicyAssignments { } /** - * @summary Creates a policy assignment. - * - * Policy assignments are inherited by child resources. For example, when you - * apply a policy to a resource group that policy is assigned to all resources - * in the group. - * - * @param {string} scope The scope of the policy assignment. + * @summary Creates or updates a policy assignment. + * + * This operation creates or updates a policy assignment with the given scope + * and name. Policy assignments apply to all resources contained within their + * scope. For example, when you assign a policy at resource group scope, that + * policy applies to all resources in the group. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment. * @@ -1969,7 +2184,7 @@ class PolicyAssignments { * assignment. * * @param {string} [parameters.policyDefinitionId] The ID of the policy - * definition. + * definition or policy set definition being assigned. * * @param {string} [parameters.scope] The scope for the policy assignment. * @@ -1983,7 +2198,8 @@ class PolicyAssignments { * * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {object} [parameters.sku] The policy sku. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * * @param {string} parameters.sku.name The name of the policy sku. Possible * values are A0 and A1. @@ -2017,13 +2233,21 @@ class PolicyAssignments { } /** - * @summary Creates a policy assignment. - * - * Policy assignments are inherited by child resources. For example, when you - * apply a policy to a resource group that policy is assigned to all resources - * in the group. - * - * @param {string} scope The scope of the policy assignment. + * @summary Creates or updates a policy assignment. + * + * This operation creates or updates a policy assignment with the given scope + * and name. Policy assignments apply to all resources contained within their + * scope. For example, when you assign a policy at resource group scope, that + * policy applies to all resources in the group. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment. * @@ -2033,7 +2257,7 @@ class PolicyAssignments { * assignment. * * @param {string} [parameters.policyDefinitionId] The ID of the policy - * definition. + * definition or policy set definition being assigned. * * @param {string} [parameters.scope] The scope for the policy assignment. * @@ -2047,7 +2271,8 @@ class PolicyAssignments { * * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {object} [parameters.sku] The policy sku. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * * @param {string} parameters.sku.name The name of the policy sku. Possible * values are A0 and A1. @@ -2103,9 +2328,19 @@ class PolicyAssignments { } /** - * Gets a policy assignment. + * @summary Retrieves a policy assignment. * - * @param {string} scope The scope of the policy assignment. + * This operation retrieves a single policy assignment, given its name and the + * scope it was created at. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment to * get. @@ -2136,9 +2371,19 @@ class PolicyAssignments { } /** - * Gets a policy assignment. + * @summary Retrieves a policy assignment. + * + * This operation retrieves a single policy assignment, given its name and the + * scope it was created at. * - * @param {string} scope The scope of the policy assignment. + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * * @param {string} policyAssignmentName The name of the policy assignment to * get. @@ -2191,14 +2436,30 @@ class PolicyAssignments { } /** - * Gets policy assignments for the resource group. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. * * @param {string} resourceGroupName The name of the resource group that * contains policy assignments. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2224,14 +2485,30 @@ class PolicyAssignments { } /** - * Gets policy assignments for the resource group. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. * * @param {string} resourceGroupName The name of the resource group that * contains policy assignments. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2280,24 +2557,56 @@ class PolicyAssignments { } /** - * Gets policy assignments for a resource. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * * @param {string} resourceGroupName The name of the resource group containing - * the resource. The name is case insensitive. + * the resource. * * @param {string} resourceProviderNamespace The namespace of the resource - * provider. + * provider. For example, the namespace of a virtual machine is + * Microsoft.Compute (from Microsoft.Compute/virtualMachines) * - * @param {string} parentResourcePath The parent resource path. + * @param {string} parentResourcePath The parent resource path. Use empty + * string if there is none. * - * @param {string} resourceType The resource type. + * @param {string} resourceType The resource type name. For example the type + * name of a web app is 'sites' (from Microsoft.Web/sites). * - * @param {string} resourceName The name of the resource with policy - * assignments. + * @param {string} resourceName The name of the resource. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2323,24 +2632,56 @@ class PolicyAssignments { } /** - * Gets policy assignments for a resource. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * * @param {string} resourceGroupName The name of the resource group containing - * the resource. The name is case insensitive. + * the resource. * * @param {string} resourceProviderNamespace The namespace of the resource - * provider. + * provider. For example, the namespace of a virtual machine is + * Microsoft.Compute (from Microsoft.Compute/virtualMachines) * - * @param {string} parentResourcePath The parent resource path. + * @param {string} parentResourcePath The parent resource path. Use empty + * string if there is none. * - * @param {string} resourceType The resource type. + * @param {string} resourceType The resource type name. For example the type + * name of a web app is 'sites' (from Microsoft.Web/sites). * - * @param {string} resourceName The name of the resource with policy - * assignments. + * @param {string} resourceName The name of the resource. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2389,11 +2730,27 @@ class PolicyAssignments { } /** - * Gets all the policy assignments for a subscription. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2419,11 +2776,27 @@ class PolicyAssignments { } /** - * Gets all the policy assignments for a subscription. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2472,18 +2845,22 @@ class PolicyAssignments { } /** - * @summary Deletes a policy assignment by ID. - * - * When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * @summary Deletes a policy assignment. + * + * This operation deletes the policy with the given ID. Policy assignment IDs + * have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid formats for {scope} are: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}' + * (management group), '/subscriptions/{subscriptionId}' (subscription), + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + * (resource group), or + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * (resource). * * @param {string} policyAssignmentId The ID of the policy assignment to * delete. Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -2511,18 +2888,22 @@ class PolicyAssignments { } /** - * @summary Deletes a policy assignment by ID. - * - * When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * @summary Deletes a policy assignment. + * + * This operation deletes the policy with the given ID. Policy assignment IDs + * have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid formats for {scope} are: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}' + * (management group), '/subscriptions/{subscriptionId}' (subscription), + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + * (resource group), or + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * (resource). * * @param {string} policyAssignmentId The ID of the policy assignment to * delete. Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -2572,20 +2953,25 @@ class PolicyAssignments { } /** - * @summary Creates a policy assignment by ID. - * - * Policy assignments are inherited by child resources. For example, when you - * apply a policy to a resource group that policy is assigned to all resources - * in the group. When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * @summary Creates or updates a policy assignment. + * + * This operation creates or updates the policy assignment with the given ID. + * Policy assignments made on a scope apply to all resources contained in that + * scope. For example, when you assign a policy to a resource group that policy + * applies to all resources in the group. Policy assignment IDs have this + * format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * * @param {string} policyAssignmentId The ID of the policy assignment to * create. Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} parameters Parameters for policy assignment. * @@ -2593,7 +2979,7 @@ class PolicyAssignments { * assignment. * * @param {string} [parameters.policyDefinitionId] The ID of the policy - * definition. + * definition or policy set definition being assigned. * * @param {string} [parameters.scope] The scope for the policy assignment. * @@ -2607,7 +2993,8 @@ class PolicyAssignments { * * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {object} [parameters.sku] The policy sku. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * * @param {string} parameters.sku.name The name of the policy sku. Possible * values are A0 and A1. @@ -2641,20 +3028,25 @@ class PolicyAssignments { } /** - * @summary Creates a policy assignment by ID. - * - * Policy assignments are inherited by child resources. For example, when you - * apply a policy to a resource group that policy is assigned to all resources - * in the group. When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * @summary Creates or updates a policy assignment. + * + * This operation creates or updates the policy assignment with the given ID. + * Policy assignments made on a scope apply to all resources contained in that + * scope. For example, when you assign a policy to a resource group that policy + * applies to all resources in the group. Policy assignment IDs have this + * format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * * @param {string} policyAssignmentId The ID of the policy assignment to * create. Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} parameters Parameters for policy assignment. * @@ -2662,7 +3054,7 @@ class PolicyAssignments { * assignment. * * @param {string} [parameters.policyDefinitionId] The ID of the policy - * definition. + * definition or policy set definition being assigned. * * @param {string} [parameters.scope] The scope for the policy assignment. * @@ -2676,7 +3068,8 @@ class PolicyAssignments { * * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {object} [parameters.sku] The policy sku. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * * @param {string} parameters.sku.name The name of the policy sku. Possible * values are A0 and A1. @@ -2732,18 +3125,22 @@ class PolicyAssignments { } /** - * @summary Gets a policy assignment by ID. - * - * When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * @summary Retrieves the policy assignment with the given ID. + * + * The operation retrieves the policy assignment with the given ID. Policy + * assignment IDs have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * * @param {string} policyAssignmentId The ID of the policy assignment to get. * Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -2771,18 +3168,22 @@ class PolicyAssignments { } /** - * @summary Gets a policy assignment by ID. - * - * When providing a scope for the assigment, use - * '/subscriptions/{subscription-id}/' for subscriptions, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for - * resource groups, and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' - * for resources. + * @summary Retrieves the policy assignment with the given ID. + * + * The operation retrieves the policy assignment with the given ID. Policy + * assignment IDs have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * * @param {string} policyAssignmentId The ID of the policy assignment to get. * Use the format - * '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -2832,7 +3233,21 @@ class PolicyAssignments { } /** - * Gets policy assignments for the resource group. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2863,7 +3278,21 @@ class PolicyAssignments { } /** - * Gets policy assignments for the resource group. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2917,7 +3346,35 @@ class PolicyAssignments { } /** - * Gets policy assignments for a resource. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2948,7 +3405,35 @@ class PolicyAssignments { } /** - * Gets policy assignments for a resource. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -3002,7 +3487,21 @@ class PolicyAssignments { } /** - * Gets all the policy assignments for a subscription. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -3033,7 +3532,21 @@ class PolicyAssignments { } /** - * Gets all the policy assignments for a subscription. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. diff --git a/lib/services/resourceManagement/lib/policy/operations/policyDefinitions.js b/lib/services/resourceManagement/lib/policy/operations/policyDefinitions.js index 889177fc7e..f032586168 100644 --- a/lib/services/resourceManagement/lib/policy/operations/policyDefinitions.js +++ b/lib/services/resourceManagement/lib/policy/operations/policyDefinitions.js @@ -15,7 +15,10 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Creates or updates a policy definition. + * @summary Creates or updates a policy definition in a subscription. + * + * This operation creates or updates a policy definition in the given + * subscription with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * create. @@ -70,7 +73,6 @@ function _createOrUpdate(policyDefinitionName, parameters, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2016-12-01'; // Validate try { if (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { @@ -79,6 +81,9 @@ function _createOrUpdate(policyDefinitionName, parameters, options, callback) { if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } + 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.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.'); } @@ -95,7 +100,7 @@ function _createOrUpdate(policyDefinitionName, parameters, options, callback) { requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -192,7 +197,10 @@ function _createOrUpdate(policyDefinitionName, parameters, options, callback) { } /** - * Deletes a policy definition. + * @summary Deletes a policy definition in a subscription. + * + * This operation deletes the policy definition in the given subscription with + * the given name. * * @param {string} policyDefinitionName The name of the policy definition to * delete. @@ -224,12 +232,14 @@ function _deleteMethod(policyDefinitionName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2016-12-01'; // Validate try { if (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { throw new Error('policyDefinitionName 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.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.'); } @@ -246,7 +256,7 @@ function _deleteMethod(policyDefinitionName, options, callback) { requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -312,7 +322,10 @@ function _deleteMethod(policyDefinitionName, options, callback) { } /** - * Gets the policy definition. + * @summary Retrieves a policy definition in a subscription. + * + * This operation retrieves the policy definition in the given subscription + * with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * get. @@ -345,12 +358,14 @@ function _get(policyDefinitionName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2016-12-01'; // Validate try { if (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { throw new Error('policyDefinitionName 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.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.'); } @@ -367,7 +382,7 @@ function _get(policyDefinitionName, options, callback) { requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -450,9 +465,11 @@ function _get(policyDefinitionName, options, callback) { } /** - * Gets the built in policy definition. + * @summary Retrieves a built-in policy definition. + * + * This operation retrieves the built-in policy definition with the given name. * - * @param {string} policyDefinitionName The name of the built in policy + * @param {string} policyDefinitionName The name of the built-in policy * definition to get. * * @param {object} [options] Optional Parameters. @@ -483,12 +500,14 @@ function _getBuiltIn(policyDefinitionName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2016-12-01'; // Validate try { if (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { throw new Error('policyDefinitionName 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.'); } @@ -501,7 +520,7 @@ function _getBuiltIn(policyDefinitionName, options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'; requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -584,7 +603,10 @@ function _getBuiltIn(policyDefinitionName, options, callback) { } /** - * Creates or updates a policy definition at management group level. + * @summary Creates or updates a policy definition in a management group. + * + * This operation creates or updates a policy definition in the given + * management group with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * create. @@ -641,7 +663,6 @@ function _createOrUpdateAtManagementGroup(policyDefinitionName, parameters, mana if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2016-12-01'; // Validate try { if (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { @@ -650,6 +671,9 @@ function _createOrUpdateAtManagementGroup(policyDefinitionName, parameters, mana if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } + 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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); } @@ -666,7 +690,7 @@ function _createOrUpdateAtManagementGroup(policyDefinitionName, parameters, mana requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -763,7 +787,10 @@ function _createOrUpdateAtManagementGroup(policyDefinitionName, parameters, mana } /** - * Deletes a policy definition at management group level. + * @summary Deletes a policy definition in a management group. + * + * This operation deletes the policy definition in the given management group + * with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * delete. @@ -797,12 +824,14 @@ function _deleteAtManagementGroup(policyDefinitionName, managementGroupId, optio if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2016-12-01'; // Validate try { if (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { throw new Error('policyDefinitionName 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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); } @@ -819,7 +848,7 @@ function _deleteAtManagementGroup(policyDefinitionName, managementGroupId, optio requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -885,7 +914,10 @@ function _deleteAtManagementGroup(policyDefinitionName, managementGroupId, optio } /** - * Gets the policy definition at management group level. + * @summary Retrieve a policy definition in a management group. + * + * This operation retrieves the policy definition in the given management group + * with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * get. @@ -920,12 +952,14 @@ function _getAtManagementGroup(policyDefinitionName, managementGroupId, options, if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2016-12-01'; // Validate try { if (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { throw new Error('policyDefinitionName 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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); } @@ -942,7 +976,7 @@ function _getAtManagementGroup(policyDefinitionName, managementGroupId, options, requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1025,7 +1059,10 @@ function _getAtManagementGroup(policyDefinitionName, managementGroupId, options, } /** - * Gets all the policy definitions for a subscription. + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {object} [options] Optional Parameters. * @@ -1056,9 +1093,11 @@ function _list(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2016-12-01'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } if (this.client.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.'); } @@ -1074,7 +1113,7 @@ function _list(options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1157,7 +1196,9 @@ function _list(options, callback) { } /** - * Gets all the built in policy definitions. + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. * * @param {object} [options] Optional Parameters. * @@ -1188,9 +1229,11 @@ function _listBuiltIn(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2016-12-01'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -1202,7 +1245,7 @@ function _listBuiltIn(options, callback) { let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Authorization/policyDefinitions'; let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1285,8 +1328,10 @@ function _listBuiltIn(options, callback) { } /** - * Gets all the policy definitions for a subscription at management group - * level. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} managementGroupId The ID of the management group. * @@ -1319,9 +1364,11 @@ function _listByManagementGroup(managementGroupId, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2016-12-01'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } if (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); } @@ -1337,7 +1384,7 @@ function _listByManagementGroup(managementGroupId, options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions'; requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1420,7 +1467,10 @@ function _listByManagementGroup(managementGroupId, options, callback) { } /** - * Gets all the policy definitions for a subscription. + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1548,7 +1598,9 @@ function _listNext(nextPageLink, options, callback) { } /** - * Gets all the built in policy definitions. + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1676,8 +1728,10 @@ function _listBuiltInNext(nextPageLink, options, callback) { } /** - * Gets all the policy definitions for a subscription at management group - * level. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1828,7 +1882,10 @@ class PolicyDefinitions { } /** - * Creates or updates a policy definition. + * @summary Creates or updates a policy definition in a subscription. + * + * This operation creates or updates a policy definition in the given + * subscription with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * create. @@ -1881,7 +1938,10 @@ class PolicyDefinitions { } /** - * Creates or updates a policy definition. + * @summary Creates or updates a policy definition in a subscription. + * + * This operation creates or updates a policy definition in the given + * subscription with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * create. @@ -1956,7 +2016,10 @@ class PolicyDefinitions { } /** - * Deletes a policy definition. + * @summary Deletes a policy definition in a subscription. + * + * This operation deletes the policy definition in the given subscription with + * the given name. * * @param {string} policyDefinitionName The name of the policy definition to * delete. @@ -1987,7 +2050,10 @@ class PolicyDefinitions { } /** - * Deletes a policy definition. + * @summary Deletes a policy definition in a subscription. + * + * This operation deletes the policy definition in the given subscription with + * the given name. * * @param {string} policyDefinitionName The name of the policy definition to * delete. @@ -2039,7 +2105,10 @@ class PolicyDefinitions { } /** - * Gets the policy definition. + * @summary Retrieves a policy definition in a subscription. + * + * This operation retrieves the policy definition in the given subscription + * with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * get. @@ -2070,7 +2139,10 @@ class PolicyDefinitions { } /** - * Gets the policy definition. + * @summary Retrieves a policy definition in a subscription. + * + * This operation retrieves the policy definition in the given subscription + * with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * get. @@ -2123,9 +2195,11 @@ class PolicyDefinitions { } /** - * Gets the built in policy definition. + * @summary Retrieves a built-in policy definition. + * + * This operation retrieves the built-in policy definition with the given name. * - * @param {string} policyDefinitionName The name of the built in policy + * @param {string} policyDefinitionName The name of the built-in policy * definition to get. * * @param {object} [options] Optional Parameters. @@ -2154,9 +2228,11 @@ class PolicyDefinitions { } /** - * Gets the built in policy definition. + * @summary Retrieves a built-in policy definition. + * + * This operation retrieves the built-in policy definition with the given name. * - * @param {string} policyDefinitionName The name of the built in policy + * @param {string} policyDefinitionName The name of the built-in policy * definition to get. * * @param {object} [options] Optional Parameters. @@ -2207,7 +2283,10 @@ class PolicyDefinitions { } /** - * Creates or updates a policy definition at management group level. + * @summary Creates or updates a policy definition in a management group. + * + * This operation creates or updates a policy definition in the given + * management group with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * create. @@ -2262,7 +2341,10 @@ class PolicyDefinitions { } /** - * Creates or updates a policy definition at management group level. + * @summary Creates or updates a policy definition in a management group. + * + * This operation creates or updates a policy definition in the given + * management group with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * create. @@ -2339,7 +2421,10 @@ class PolicyDefinitions { } /** - * Deletes a policy definition at management group level. + * @summary Deletes a policy definition in a management group. + * + * This operation deletes the policy definition in the given management group + * with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * delete. @@ -2372,7 +2457,10 @@ class PolicyDefinitions { } /** - * Deletes a policy definition at management group level. + * @summary Deletes a policy definition in a management group. + * + * This operation deletes the policy definition in the given management group + * with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * delete. @@ -2426,7 +2514,10 @@ class PolicyDefinitions { } /** - * Gets the policy definition at management group level. + * @summary Retrieve a policy definition in a management group. + * + * This operation retrieves the policy definition in the given management group + * with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * get. @@ -2459,7 +2550,10 @@ class PolicyDefinitions { } /** - * Gets the policy definition at management group level. + * @summary Retrieve a policy definition in a management group. + * + * This operation retrieves the policy definition in the given management group + * with the given name. * * @param {string} policyDefinitionName The name of the policy definition to * get. @@ -2514,7 +2608,10 @@ class PolicyDefinitions { } /** - * Gets all the policy definitions for a subscription. + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {object} [options] Optional Parameters. * @@ -2542,7 +2639,10 @@ class PolicyDefinitions { } /** - * Gets all the policy definitions for a subscription. + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {object} [options] Optional Parameters. * @@ -2593,7 +2693,9 @@ class PolicyDefinitions { } /** - * Gets all the built in policy definitions. + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. * * @param {object} [options] Optional Parameters. * @@ -2621,7 +2723,9 @@ class PolicyDefinitions { } /** - * Gets all the built in policy definitions. + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. * * @param {object} [options] Optional Parameters. * @@ -2672,8 +2776,10 @@ class PolicyDefinitions { } /** - * Gets all the policy definitions for a subscription at management group - * level. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} managementGroupId The ID of the management group. * @@ -2703,8 +2809,10 @@ class PolicyDefinitions { } /** - * Gets all the policy definitions for a subscription at management group - * level. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} managementGroupId The ID of the management group. * @@ -2757,7 +2865,10 @@ class PolicyDefinitions { } /** - * Gets all the policy definitions for a subscription. + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2788,7 +2899,10 @@ class PolicyDefinitions { } /** - * Gets all the policy definitions for a subscription. + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2842,7 +2956,9 @@ class PolicyDefinitions { } /** - * Gets all the built in policy definitions. + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2873,7 +2989,9 @@ class PolicyDefinitions { } /** - * Gets all the built in policy definitions. + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2927,8 +3045,10 @@ class PolicyDefinitions { } /** - * Gets all the policy definitions for a subscription at management group - * level. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2959,8 +3079,10 @@ class PolicyDefinitions { } /** - * Gets all the policy definitions for a subscription at management group - * level. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. diff --git a/lib/services/resourceManagement/lib/policy/operations/policySetDefinitions.js b/lib/services/resourceManagement/lib/policy/operations/policySetDefinitions.js index 151b618d1b..8e6ffd0fd9 100644 --- a/lib/services/resourceManagement/lib/policy/operations/policySetDefinitions.js +++ b/lib/services/resourceManagement/lib/policy/operations/policySetDefinitions.js @@ -15,7 +15,10 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Creates or updates a policy set definition. + * @summary Creates or updates a policy set definition. + * + * This operation creates or updates a policy set definition in the given + * subscription with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to create. @@ -68,7 +71,6 @@ function _createOrUpdate(policySetDefinitionName, parameters, options, callback) if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { @@ -77,6 +79,9 @@ function _createOrUpdate(policySetDefinitionName, parameters, options, callback) if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } + 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.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.'); } @@ -93,7 +98,7 @@ function _createOrUpdate(policySetDefinitionName, parameters, options, callback) requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -208,7 +213,10 @@ function _createOrUpdate(policySetDefinitionName, parameters, options, callback) } /** - * Deletes a policy set definition. + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given subscription + * with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to delete. @@ -240,12 +248,14 @@ function _deleteMethod(policySetDefinitionName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { throw new Error('policySetDefinitionName 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.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.'); } @@ -262,7 +272,7 @@ function _deleteMethod(policySetDefinitionName, options, callback) { requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -329,7 +339,10 @@ function _deleteMethod(policySetDefinitionName, options, callback) { } /** - * Gets the policy set definition. + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given subscription + * with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to get. @@ -362,12 +375,14 @@ function _get(policySetDefinitionName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { throw new Error('policySetDefinitionName 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.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.'); } @@ -384,7 +399,7 @@ function _get(policySetDefinitionName, options, callback) { requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -468,7 +483,10 @@ function _get(policySetDefinitionName, options, callback) { } /** - * Gets the built in policy set definition. + * @summary Retrieves a built in policy set definition. + * + * This operation retrieves the built-in policy set definition with the given + * name. * * @param {string} policySetDefinitionName The name of the policy set * definition to get. @@ -501,12 +519,14 @@ function _getBuiltIn(policySetDefinitionName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { throw new Error('policySetDefinitionName 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.'); } @@ -519,7 +539,7 @@ function _getBuiltIn(policySetDefinitionName, options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'; requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -603,7 +623,10 @@ function _getBuiltIn(policySetDefinitionName, options, callback) { } /** - * Gets all the policy set definitions for a subscription. + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {object} [options] Optional Parameters. * @@ -634,9 +657,11 @@ function _list(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } if (this.client.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.'); } @@ -652,7 +677,7 @@ function _list(options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -736,7 +761,9 @@ function _list(options, callback) { } /** - * Gets all the built in policy set definitions. + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. * * @param {object} [options] Optional Parameters. * @@ -767,9 +794,11 @@ function _listBuiltIn(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -781,7 +810,7 @@ function _listBuiltIn(options, callback) { let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Authorization/policySetDefinitions'; let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -865,7 +894,10 @@ function _listBuiltIn(options, callback) { } /** - * Creates or updates a policy set definition at management group level. + * @summary Creates or updates a policy set definition. + * + * This operation creates or updates a policy set definition in the given + * management group with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to create. @@ -920,7 +952,6 @@ function _createOrUpdateAtManagementGroup(policySetDefinitionName, parameters, m if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { @@ -929,6 +960,9 @@ function _createOrUpdateAtManagementGroup(policySetDefinitionName, parameters, m if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } + 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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); } @@ -945,7 +979,7 @@ function _createOrUpdateAtManagementGroup(policySetDefinitionName, parameters, m requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1060,7 +1094,10 @@ function _createOrUpdateAtManagementGroup(policySetDefinitionName, parameters, m } /** - * Deletes a policy set definition at management group level. + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given management + * group with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to delete. @@ -1094,12 +1131,14 @@ function _deleteAtManagementGroup(policySetDefinitionName, managementGroupId, op if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { throw new Error('policySetDefinitionName 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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); } @@ -1116,7 +1155,7 @@ function _deleteAtManagementGroup(policySetDefinitionName, managementGroupId, op requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1183,7 +1222,10 @@ function _deleteAtManagementGroup(policySetDefinitionName, managementGroupId, op } /** - * Gets the policy set definition at management group level. + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given management + * group with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to get. @@ -1218,12 +1260,14 @@ function _getAtManagementGroup(policySetDefinitionName, managementGroupId, optio if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { if (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { throw new Error('policySetDefinitionName 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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); } @@ -1240,7 +1284,7 @@ function _getAtManagementGroup(policySetDefinitionName, managementGroupId, optio requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1324,7 +1368,10 @@ function _getAtManagementGroup(policySetDefinitionName, managementGroupId, optio } /** - * Gets all the policy set definitions for a subscription at management group. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} managementGroupId The ID of the management group. * @@ -1357,9 +1404,11 @@ function _listByManagementGroup(managementGroupId, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-06-01-preview'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } if (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); } @@ -1375,7 +1424,7 @@ function _listByManagementGroup(managementGroupId, options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions'; requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1459,7 +1508,10 @@ function _listByManagementGroup(managementGroupId, options, callback) { } /** - * Gets all the policy set definitions for a subscription. + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1588,7 +1640,9 @@ function _listNext(nextPageLink, options, callback) { } /** - * Gets all the built in policy set definitions. + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1717,7 +1771,10 @@ function _listBuiltInNext(nextPageLink, options, callback) { } /** - * Gets all the policy set definitions for a subscription at management group. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1869,7 +1926,10 @@ class PolicySetDefinitions { } /** - * Creates or updates a policy set definition. + * @summary Creates or updates a policy set definition. + * + * This operation creates or updates a policy set definition in the given + * subscription with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to create. @@ -1920,7 +1980,10 @@ class PolicySetDefinitions { } /** - * Creates or updates a policy set definition. + * @summary Creates or updates a policy set definition. + * + * This operation creates or updates a policy set definition in the given + * subscription with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to create. @@ -1993,7 +2056,10 @@ class PolicySetDefinitions { } /** - * Deletes a policy set definition. + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given subscription + * with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to delete. @@ -2024,7 +2090,10 @@ class PolicySetDefinitions { } /** - * Deletes a policy set definition. + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given subscription + * with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to delete. @@ -2076,7 +2145,10 @@ class PolicySetDefinitions { } /** - * Gets the policy set definition. + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given subscription + * with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to get. @@ -2107,7 +2179,10 @@ class PolicySetDefinitions { } /** - * Gets the policy set definition. + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given subscription + * with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to get. @@ -2160,7 +2235,10 @@ class PolicySetDefinitions { } /** - * Gets the built in policy set definition. + * @summary Retrieves a built in policy set definition. + * + * This operation retrieves the built-in policy set definition with the given + * name. * * @param {string} policySetDefinitionName The name of the policy set * definition to get. @@ -2191,7 +2269,10 @@ class PolicySetDefinitions { } /** - * Gets the built in policy set definition. + * @summary Retrieves a built in policy set definition. + * + * This operation retrieves the built-in policy set definition with the given + * name. * * @param {string} policySetDefinitionName The name of the policy set * definition to get. @@ -2244,7 +2325,10 @@ class PolicySetDefinitions { } /** - * Gets all the policy set definitions for a subscription. + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {object} [options] Optional Parameters. * @@ -2272,7 +2356,10 @@ class PolicySetDefinitions { } /** - * Gets all the policy set definitions for a subscription. + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {object} [options] Optional Parameters. * @@ -2323,7 +2410,9 @@ class PolicySetDefinitions { } /** - * Gets all the built in policy set definitions. + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. * * @param {object} [options] Optional Parameters. * @@ -2351,7 +2440,9 @@ class PolicySetDefinitions { } /** - * Gets all the built in policy set definitions. + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. * * @param {object} [options] Optional Parameters. * @@ -2402,7 +2493,10 @@ class PolicySetDefinitions { } /** - * Creates or updates a policy set definition at management group level. + * @summary Creates or updates a policy set definition. + * + * This operation creates or updates a policy set definition in the given + * management group with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to create. @@ -2455,7 +2549,10 @@ class PolicySetDefinitions { } /** - * Creates or updates a policy set definition at management group level. + * @summary Creates or updates a policy set definition. + * + * This operation creates or updates a policy set definition in the given + * management group with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to create. @@ -2530,7 +2627,10 @@ class PolicySetDefinitions { } /** - * Deletes a policy set definition at management group level. + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given management + * group with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to delete. @@ -2563,7 +2663,10 @@ class PolicySetDefinitions { } /** - * Deletes a policy set definition at management group level. + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given management + * group with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to delete. @@ -2617,7 +2720,10 @@ class PolicySetDefinitions { } /** - * Gets the policy set definition at management group level. + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given management + * group with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to get. @@ -2650,7 +2756,10 @@ class PolicySetDefinitions { } /** - * Gets the policy set definition at management group level. + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given management + * group with the given name. * * @param {string} policySetDefinitionName The name of the policy set * definition to get. @@ -2705,7 +2814,10 @@ class PolicySetDefinitions { } /** - * Gets all the policy set definitions for a subscription at management group. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} managementGroupId The ID of the management group. * @@ -2735,7 +2847,10 @@ class PolicySetDefinitions { } /** - * Gets all the policy set definitions for a subscription at management group. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} managementGroupId The ID of the management group. * @@ -2788,7 +2903,10 @@ class PolicySetDefinitions { } /** - * Gets all the policy set definitions for a subscription. + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2819,7 +2937,10 @@ class PolicySetDefinitions { } /** - * Gets all the policy set definitions for a subscription. + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2873,7 +2994,9 @@ class PolicySetDefinitions { } /** - * Gets all the built in policy set definitions. + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2904,7 +3027,9 @@ class PolicySetDefinitions { } /** - * Gets all the built in policy set definitions. + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2958,7 +3083,10 @@ class PolicySetDefinitions { } /** - * Gets all the policy set definitions for a subscription at management group. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2989,7 +3117,10 @@ class PolicySetDefinitions { } /** - * Gets all the policy set definitions for a subscription at management group. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. diff --git a/lib/services/resourceManagement/lib/policy/policyClient.d.ts b/lib/services/resourceManagement/lib/policy/policyClient.d.ts index ee8cef380a..2b1b11dcf8 100644 --- a/lib/services/resourceManagement/lib/policy/policyClient.d.ts +++ b/lib/services/resourceManagement/lib/policy/policyClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class PolicyClient extends AzureServiceClient { +export default class PolicyClient extends AzureServiceClient { /** * Initializes a new instance of the PolicyClient class. * @constructor @@ -33,11 +34,11 @@ declare class PolicyClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); @@ -46,6 +47,8 @@ declare class PolicyClient extends AzureServiceClient { subscriptionId: string; + apiVersion: string; + acceptLanguage: string; longRunningOperationRetryTimeout: number; @@ -54,8 +57,8 @@ declare class PolicyClient extends AzureServiceClient { // Operation groups policyAssignments: operations.PolicyAssignments; - policySetDefinitions: operations.PolicySetDefinitions; policyDefinitions: operations.PolicyDefinitions; + policySetDefinitions: operations.PolicySetDefinitions; } -export = PolicyClient; +export { PolicyClient, models as PolicyModels }; diff --git a/lib/services/resourceManagement/lib/policy/policyClient.js b/lib/services/resourceManagement/lib/policy/policyClient.js index 873abbc464..cbb1768e2c 100644 --- a/lib/services/resourceManagement/lib/policy/policyClient.js +++ b/lib/services/resourceManagement/lib/policy/policyClient.js @@ -34,9 +34,9 @@ class PolicyClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ constructor(credentials, subscriptionId, baseUri, options) { if (credentials === null || credentials === undefined) { @@ -50,6 +50,7 @@ class PolicyClient extends ServiceClient { super(credentials, options); + this.apiVersion = '2018-03-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -72,8 +73,8 @@ class PolicyClient extends ServiceClient { this.generateClientRequestId = options.generateClientRequestId; } this.policyAssignments = new operations.PolicyAssignments(this); - this.policySetDefinitions = new operations.PolicySetDefinitions(this); this.policyDefinitions = new operations.PolicyDefinitions(this); + this.policySetDefinitions = new operations.PolicySetDefinitions(this); this.models = models; msRest.addSerializationMixin(this); } @@ -81,3 +82,6 @@ class PolicyClient extends ServiceClient { } module.exports = PolicyClient; +module.exports['default'] = PolicyClient; +module.exports.PolicyClient = PolicyClient; +module.exports.PolicyModels = models; diff --git a/lib/services/resourceManagement/lib/resource/models/deployment.js b/lib/services/resourceManagement/lib/resource/models/deployment.js index c7540d8412..d36e2e561a 100644 --- a/lib/services/resourceManagement/lib/resource/models/deployment.js +++ b/lib/services/resourceManagement/lib/resource/models/deployment.js @@ -19,6 +19,7 @@ const models = require('./index'); class Deployment { /** * Create a Deployment. + * @member {string} [location] The location to store the deployment data. * @member {object} properties The deployment properties. * @member {object} [properties.template] The template content. You use this * element when you want to pass the template syntax directly in the request @@ -62,6 +63,14 @@ class Deployment { * during deployment. By logging information about the request or response, * you could potentially expose sensitive data that is retrieved through the * deployment operations. + * @member {object} [properties.onErrorDeployment] The deployment on error + * behavior. + * @member {string} [properties.onErrorDeployment.type] The deployment on + * error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * @member {string} [properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. */ constructor() { } @@ -80,6 +89,13 @@ class Deployment { name: 'Composite', className: 'Deployment', modelProperties: { + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, properties: { required: true, serializedName: 'properties', diff --git a/lib/services/resourceManagement/lib/resource/models/deploymentExtended.js b/lib/services/resourceManagement/lib/resource/models/deploymentExtended.js index c60491bae6..c0dabde909 100644 --- a/lib/services/resourceManagement/lib/resource/models/deploymentExtended.js +++ b/lib/services/resourceManagement/lib/resource/models/deploymentExtended.js @@ -15,12 +15,14 @@ const models = require('./index'); /** * Deployment information. * + * @extends models['BaseResource'] */ -class DeploymentExtended { +class DeploymentExtended extends models['BaseResource'] { /** * Create a DeploymentExtended. * @member {string} [id] The ID of the deployment. * @member {string} name The name of the deployment. + * @member {string} [location] the location of the deployment. * @member {object} [properties] Deployment properties. * @member {string} [properties.provisioningState] The state of the * provisioning. @@ -63,8 +65,19 @@ class DeploymentExtended { * during deployment. By logging information about the request or response, * you could potentially expose sensitive data that is retrieved through the * deployment operations. + * @member {object} [properties.onErrorDeployment] The deployment on error + * behavior. + * @member {string} [properties.onErrorDeployment.provisioningState] The + * state of the provisioning for the on error deployment. + * @member {string} [properties.onErrorDeployment.type] The deployment on + * error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * @member {string} [properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. */ constructor() { + super(); } /** @@ -83,6 +96,7 @@ class DeploymentExtended { modelProperties: { id: { required: false, + readOnly: true, serializedName: 'id', type: { name: 'String' @@ -95,6 +109,13 @@ class DeploymentExtended { name: 'String' } }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, properties: { required: false, serializedName: 'properties', diff --git a/lib/services/resourceManagement/lib/resource/models/deploymentProperties.js b/lib/services/resourceManagement/lib/resource/models/deploymentProperties.js index 75709ab10d..e1933320e5 100644 --- a/lib/services/resourceManagement/lib/resource/models/deploymentProperties.js +++ b/lib/services/resourceManagement/lib/resource/models/deploymentProperties.js @@ -58,6 +58,12 @@ class DeploymentProperties { * during deployment. By logging information about the request or response, * you could potentially expose sensitive data that is retrieved through the * deployment operations. + * @member {object} [onErrorDeployment] The deployment on error behavior. + * @member {string} [onErrorDeployment.type] The deployment on error behavior + * type. Possible values are LastSuccessful and SpecificDeployment. Possible + * values include: 'LastSuccessful', 'SpecificDeployment' + * @member {string} [onErrorDeployment.deploymentName] The deployment to be + * used on error case. */ constructor() { } @@ -121,6 +127,14 @@ class DeploymentProperties { name: 'Composite', className: 'DebugSetting' } + }, + onErrorDeployment: { + required: false, + serializedName: 'onErrorDeployment', + type: { + name: 'Composite', + className: 'OnErrorDeployment' + } } } } diff --git a/lib/services/resourceManagement/lib/resource/models/deploymentPropertiesExtended.js b/lib/services/resourceManagement/lib/resource/models/deploymentPropertiesExtended.js index 84e0f9c31a..3a04963066 100644 --- a/lib/services/resourceManagement/lib/resource/models/deploymentPropertiesExtended.js +++ b/lib/services/resourceManagement/lib/resource/models/deploymentPropertiesExtended.js @@ -53,6 +53,14 @@ class DeploymentPropertiesExtended { * during deployment. By logging information about the request or response, * you could potentially expose sensitive data that is retrieved through the * deployment operations. + * @member {object} [onErrorDeployment] The deployment on error behavior. + * @member {string} [onErrorDeployment.provisioningState] The state of the + * provisioning for the on error deployment. + * @member {string} [onErrorDeployment.type] The deployment on error behavior + * type. Possible values are LastSuccessful and SpecificDeployment. Possible + * values include: 'LastSuccessful', 'SpecificDeployment' + * @member {string} [onErrorDeployment.deploymentName] The deployment to be + * used on error case. */ constructor() { } @@ -177,6 +185,14 @@ class DeploymentPropertiesExtended { name: 'Composite', className: 'DebugSetting' } + }, + onErrorDeployment: { + required: false, + serializedName: 'onErrorDeployment', + type: { + name: 'Composite', + className: 'OnErrorDeploymentExtended' + } } } } diff --git a/lib/services/resourceManagement/lib/resource/models/deploymentValidateResult.js b/lib/services/resourceManagement/lib/resource/models/deploymentValidateResult.js index 4afdcc3636..9072ef23f6 100644 --- a/lib/services/resourceManagement/lib/resource/models/deploymentValidateResult.js +++ b/lib/services/resourceManagement/lib/resource/models/deploymentValidateResult.js @@ -68,6 +68,16 @@ class DeploymentValidateResult { * during deployment. By logging information about the request or response, * you could potentially expose sensitive data that is retrieved through the * deployment operations. + * @member {object} [properties.onErrorDeployment] The deployment on error + * behavior. + * @member {string} [properties.onErrorDeployment.provisioningState] The + * state of the provisioning for the on error deployment. + * @member {string} [properties.onErrorDeployment.type] The deployment on + * error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * @member {string} [properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. */ constructor() { } diff --git a/lib/services/resourceManagement/lib/resource/models/genericResource.js b/lib/services/resourceManagement/lib/resource/models/genericResource.js index f4749ed9b4..015ea980f7 100644 --- a/lib/services/resourceManagement/lib/resource/models/genericResource.js +++ b/lib/services/resourceManagement/lib/resource/models/genericResource.js @@ -42,7 +42,12 @@ class GenericResource extends models['Resource'] { * identity. * @member {string} [identity.tenantId] The tenant ID of resource. * @member {string} [identity.type] The identity type. Possible values - * include: 'SystemAssigned' + * include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', + * 'None' + * @member {object} [identity.userAssignedIdentities] The list of user + * identities associated with the resource. The user identity dictionary key + * references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ constructor() { super(); diff --git a/lib/services/resourceManagement/lib/resource/models/identity.js b/lib/services/resourceManagement/lib/resource/models/identity.js index 14c1fe4686..e705cd8d42 100644 --- a/lib/services/resourceManagement/lib/resource/models/identity.js +++ b/lib/services/resourceManagement/lib/resource/models/identity.js @@ -10,6 +10,8 @@ 'use strict'; +const models = require('./index'); + /** * Identity for the resource. * @@ -20,7 +22,11 @@ class Identity { * @member {string} [principalId] The principal ID of resource identity. * @member {string} [tenantId] The tenant ID of resource. * @member {string} [type] The identity type. Possible values include: - * 'SystemAssigned' + * 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + * @member {object} [userAssignedIdentities] The list of user identities + * associated with the resource. The user identity dictionary key references + * will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ constructor() { } @@ -60,7 +66,22 @@ class Identity { serializedName: 'type', type: { name: 'Enum', - allowedValues: [ 'SystemAssigned' ] + allowedValues: [ 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' ] + } + }, + userAssignedIdentities: { + required: false, + serializedName: 'userAssignedIdentities', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'IdentityUserAssignedIdentitiesValueElementType', + type: { + name: 'Composite', + className: 'IdentityUserAssignedIdentitiesValue' + } + } } } } diff --git a/lib/services/resourceManagement/lib/resource/models/identityUserAssignedIdentitiesValue.js b/lib/services/resourceManagement/lib/resource/models/identityUserAssignedIdentitiesValue.js new file mode 100644 index 0000000000..20d7e92efb --- /dev/null +++ b/lib/services/resourceManagement/lib/resource/models/identityUserAssignedIdentitiesValue.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Class representing a IdentityUserAssignedIdentitiesValue. + */ +class IdentityUserAssignedIdentitiesValue { + /** + * Create a IdentityUserAssignedIdentitiesValue. + * @member {string} [principalId] The principal id of user assigned identity. + * @member {string} [clientId] The client id of user assigned identity. + */ + constructor() { + } + + /** + * Defines the metadata of IdentityUserAssignedIdentitiesValue + * + * @returns {object} metadata of IdentityUserAssignedIdentitiesValue + * + */ + mapper() { + return { + required: false, + serializedName: 'Identity_userAssignedIdentitiesValue', + type: { + name: 'Composite', + className: 'IdentityUserAssignedIdentitiesValue', + modelProperties: { + principalId: { + required: false, + readOnly: true, + serializedName: 'principalId', + type: { + name: 'String' + } + }, + clientId: { + required: false, + readOnly: true, + serializedName: 'clientId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IdentityUserAssignedIdentitiesValue; diff --git a/lib/services/resourceManagement/lib/resource/models/index.d.ts b/lib/services/resourceManagement/lib/resource/models/index.d.ts index a7d1abcc78..a184c93aa7 100644 --- a/lib/services/resourceManagement/lib/resource/models/index.d.ts +++ b/lib/services/resourceManagement/lib/resource/models/index.d.ts @@ -104,6 +104,22 @@ export interface DebugSetting { detailLevel?: string; } +/** + * @class + * Initializes a new instance of the OnErrorDeployment class. + * @constructor + * Deployment on error behavior. + * + * @member {string} [type] The deployment on error behavior type. Possible + * values are LastSuccessful and SpecificDeployment. Possible values include: + * 'LastSuccessful', 'SpecificDeployment' + * @member {string} [deploymentName] The deployment to be used on error case. + */ +export interface OnErrorDeployment { + type?: string; + deploymentName?: string; +} + /** * @class * Initializes a new instance of the DeploymentProperties class. @@ -148,6 +164,12 @@ export interface DebugSetting { * deployment. By logging information about the request or response, you could * potentially expose sensitive data that is retrieved through the deployment * operations. + * @member {object} [onErrorDeployment] The deployment on error behavior. + * @member {string} [onErrorDeployment.type] The deployment on error behavior + * type. Possible values are LastSuccessful and SpecificDeployment. Possible + * values include: 'LastSuccessful', 'SpecificDeployment' + * @member {string} [onErrorDeployment.deploymentName] The deployment to be + * used on error case. */ export interface DeploymentProperties { template?: any; @@ -156,6 +178,7 @@ export interface DeploymentProperties { parametersLink?: ParametersLink; mode: string; debugSetting?: DebugSetting; + onErrorDeployment?: OnErrorDeployment; } /** @@ -164,6 +187,7 @@ export interface DeploymentProperties { * @constructor * Deployment operation parameters. * + * @member {string} [location] The location to store the deployment data. * @member {object} properties The deployment properties. * @member {object} [properties.template] The template content. You use this * element when you want to pass the template syntax directly in the request @@ -207,8 +231,16 @@ export interface DeploymentProperties { * deployment. By logging information about the request or response, you could * potentially expose sensitive data that is retrieved through the deployment * operations. + * @member {object} [properties.onErrorDeployment] The deployment on error + * behavior. + * @member {string} [properties.onErrorDeployment.type] The deployment on error + * behavior type. Possible values are LastSuccessful and SpecificDeployment. + * Possible values include: 'LastSuccessful', 'SpecificDeployment' + * @member {string} [properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. */ export interface Deployment { + location?: string; properties: DeploymentProperties; } @@ -344,6 +376,25 @@ export interface Dependency { resourceName?: string; } +/** + * @class + * Initializes a new instance of the OnErrorDeploymentExtended class. + * @constructor + * Deployment on error behavior with additional details. + * + * @member {string} [provisioningState] The state of the provisioning for the + * on error deployment. + * @member {string} [type] The deployment on error behavior type. Possible + * values are LastSuccessful and SpecificDeployment. Possible values include: + * 'LastSuccessful', 'SpecificDeployment' + * @member {string} [deploymentName] The deployment to be used on error case. + */ +export interface OnErrorDeploymentExtended { + readonly provisioningState?: string; + type?: string; + deploymentName?: string; +} + /** * @class * Initializes a new instance of the DeploymentPropertiesExtended class. @@ -382,6 +433,14 @@ export interface Dependency { * deployment. By logging information about the request or response, you could * potentially expose sensitive data that is retrieved through the deployment * operations. + * @member {object} [onErrorDeployment] The deployment on error behavior. + * @member {string} [onErrorDeployment.provisioningState] The state of the + * provisioning for the on error deployment. + * @member {string} [onErrorDeployment.type] The deployment on error behavior + * type. Possible values are LastSuccessful and SpecificDeployment. Possible + * values include: 'LastSuccessful', 'SpecificDeployment' + * @member {string} [onErrorDeployment.deploymentName] The deployment to be + * used on error case. */ export interface DeploymentPropertiesExtended { readonly provisioningState?: string; @@ -396,6 +455,7 @@ export interface DeploymentPropertiesExtended { parametersLink?: ParametersLink; mode?: string; debugSetting?: DebugSetting; + onErrorDeployment?: OnErrorDeploymentExtended; } /** @@ -452,6 +512,15 @@ export interface DeploymentPropertiesExtended { * deployment. By logging information about the request or response, you could * potentially expose sensitive data that is retrieved through the deployment * operations. + * @member {object} [properties.onErrorDeployment] The deployment on error + * behavior. + * @member {string} [properties.onErrorDeployment.provisioningState] The state + * of the provisioning for the on error deployment. + * @member {string} [properties.onErrorDeployment.type] The deployment on error + * behavior type. Possible values are LastSuccessful and SpecificDeployment. + * Possible values include: 'LastSuccessful', 'SpecificDeployment' + * @member {string} [properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. */ export interface DeploymentValidateResult { error?: ResourceManagementErrorWithDetails; @@ -466,6 +535,7 @@ export interface DeploymentValidateResult { * * @member {string} [id] The ID of the deployment. * @member {string} name The name of the deployment. + * @member {string} [location] the location of the deployment. * @member {object} [properties] Deployment properties. * @member {string} [properties.provisioningState] The state of the * provisioning. @@ -507,10 +577,20 @@ export interface DeploymentValidateResult { * deployment. By logging information about the request or response, you could * potentially expose sensitive data that is retrieved through the deployment * operations. + * @member {object} [properties.onErrorDeployment] The deployment on error + * behavior. + * @member {string} [properties.onErrorDeployment.provisioningState] The state + * of the provisioning for the on error deployment. + * @member {string} [properties.onErrorDeployment.type] The deployment on error + * behavior type. Possible values are LastSuccessful and SpecificDeployment. + * Possible values include: 'LastSuccessful', 'SpecificDeployment' + * @member {string} [properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. */ -export interface DeploymentExtended { - id?: string; +export interface DeploymentExtended extends BaseResource { + readonly id?: string; name: string; + location?: string; properties?: DeploymentPropertiesExtended; } @@ -556,6 +636,18 @@ export interface Sku { capacity?: number; } +/** + * @class + * Initializes a new instance of the IdentityUserAssignedIdentitiesValue class. + * @constructor + * @member {string} [principalId] The principal id of user assigned identity. + * @member {string} [clientId] The client id of user assigned identity. + */ +export interface IdentityUserAssignedIdentitiesValue { + readonly principalId?: string; + readonly clientId?: string; +} + /** * @class * Initializes a new instance of the Identity class. @@ -565,12 +657,17 @@ export interface Sku { * @member {string} [principalId] The principal ID of resource identity. * @member {string} [tenantId] The tenant ID of resource. * @member {string} [type] The identity type. Possible values include: - * 'SystemAssigned' + * 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + * @member {object} [userAssignedIdentities] The list of user identities + * associated with the resource. The user identity dictionary key references + * will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ export interface Identity { readonly principalId?: string; readonly tenantId?: string; type?: string; + userAssignedIdentities?: { [propertyName: string]: IdentityUserAssignedIdentitiesValue }; } /** @@ -620,7 +717,11 @@ export interface Resource extends BaseResource { * identity. * @member {string} [identity.tenantId] The tenant ID of resource. * @member {string} [identity.type] The identity type. Possible values include: - * 'SystemAssigned' + * 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + * @member {object} [identity.userAssignedIdentities] The list of user + * identities associated with the resource. The user identity dictionary key + * references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ export interface GenericResource extends Resource { plan?: Plan; @@ -660,7 +761,7 @@ export interface ResourceGroupProperties { * resource group. * @member {object} [tags] The tags attached to the resource group. */ -export interface ResourceGroup { +export interface ResourceGroup extends BaseResource { readonly id?: string; name?: string; properties?: ResourceGroupProperties; @@ -747,8 +848,8 @@ export interface TagCount { * @member {string} [count.type] Type of count. * @member {number} [count.value] Value of count. */ -export interface TagValue { - id?: string; +export interface TagValue extends BaseResource { + readonly id?: string; tagValue?: string; count?: TagCount; } @@ -769,7 +870,7 @@ export interface TagValue { * @member {array} [values] The list of tag values. */ export interface TagDetails { - id?: string; + readonly id?: string; tagName?: string; count?: TagCount; values?: TagValue[]; diff --git a/lib/services/resourceManagement/lib/resource/models/index.js b/lib/services/resourceManagement/lib/resource/models/index.js index d3190d8dc9..0dde90bf64 100644 --- a/lib/services/resourceManagement/lib/resource/models/index.js +++ b/lib/services/resourceManagement/lib/resource/models/index.js @@ -24,6 +24,7 @@ exports.ResourceGroupFilter = require('./resourceGroupFilter'); exports.TemplateLink = require('./templateLink'); exports.ParametersLink = require('./parametersLink'); exports.DebugSetting = require('./debugSetting'); +exports.OnErrorDeployment = require('./onErrorDeployment'); exports.DeploymentProperties = require('./deploymentProperties'); exports.Deployment = require('./deployment'); exports.DeploymentExportResult = require('./deploymentExportResult'); @@ -34,11 +35,13 @@ exports.ProviderResourceType = require('./providerResourceType'); exports.Provider = require('./provider'); exports.BasicDependency = require('./basicDependency'); exports.Dependency = require('./dependency'); +exports.OnErrorDeploymentExtended = require('./onErrorDeploymentExtended'); exports.DeploymentPropertiesExtended = require('./deploymentPropertiesExtended'); exports.DeploymentValidateResult = require('./deploymentValidateResult'); exports.DeploymentExtended = require('./deploymentExtended'); exports.Plan = require('./plan'); exports.Sku = require('./sku'); +exports.IdentityUserAssignedIdentitiesValue = require('./identityUserAssignedIdentitiesValue'); exports.Identity = require('./identity'); exports.Resource = require('./resource'); exports.GenericResource = require('./genericResource'); diff --git a/lib/services/resourceManagement/lib/resource/models/onErrorDeployment.js b/lib/services/resourceManagement/lib/resource/models/onErrorDeployment.js new file mode 100644 index 0000000000..acae2625e4 --- /dev/null +++ b/lib/services/resourceManagement/lib/resource/models/onErrorDeployment.js @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Deployment on error behavior. + * + */ +class OnErrorDeployment { + /** + * Create a OnErrorDeployment. + * @member {string} [type] The deployment on error behavior type. Possible + * values are LastSuccessful and SpecificDeployment. Possible values include: + * 'LastSuccessful', 'SpecificDeployment' + * @member {string} [deploymentName] The deployment to be used on error case. + */ + constructor() { + } + + /** + * Defines the metadata of OnErrorDeployment + * + * @returns {object} metadata of OnErrorDeployment + * + */ + mapper() { + return { + required: false, + serializedName: 'OnErrorDeployment', + type: { + name: 'Composite', + className: 'OnErrorDeployment', + modelProperties: { + type: { + required: false, + serializedName: 'type', + type: { + name: 'Enum', + allowedValues: [ 'LastSuccessful', 'SpecificDeployment' ] + } + }, + deploymentName: { + required: false, + serializedName: 'deploymentName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OnErrorDeployment; diff --git a/lib/services/resourceManagement/lib/resource/models/onErrorDeploymentExtended.js b/lib/services/resourceManagement/lib/resource/models/onErrorDeploymentExtended.js new file mode 100644 index 0000000000..8ab0a6dfde --- /dev/null +++ b/lib/services/resourceManagement/lib/resource/models/onErrorDeploymentExtended.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'; + +/** + * Deployment on error behavior with additional details. + * + */ +class OnErrorDeploymentExtended { + /** + * Create a OnErrorDeploymentExtended. + * @member {string} [provisioningState] The state of the provisioning for the + * on error deployment. + * @member {string} [type] The deployment on error behavior type. Possible + * values are LastSuccessful and SpecificDeployment. Possible values include: + * 'LastSuccessful', 'SpecificDeployment' + * @member {string} [deploymentName] The deployment to be used on error case. + */ + constructor() { + } + + /** + * Defines the metadata of OnErrorDeploymentExtended + * + * @returns {object} metadata of OnErrorDeploymentExtended + * + */ + mapper() { + return { + required: false, + serializedName: 'OnErrorDeploymentExtended', + type: { + name: 'Composite', + className: 'OnErrorDeploymentExtended', + modelProperties: { + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'Enum', + allowedValues: [ 'LastSuccessful', 'SpecificDeployment' ] + } + }, + deploymentName: { + required: false, + serializedName: 'deploymentName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OnErrorDeploymentExtended; diff --git a/lib/services/resourceManagement/lib/resource/models/resourceGroup.js b/lib/services/resourceManagement/lib/resource/models/resourceGroup.js index d95e282632..3f6e068c3d 100644 --- a/lib/services/resourceManagement/lib/resource/models/resourceGroup.js +++ b/lib/services/resourceManagement/lib/resource/models/resourceGroup.js @@ -15,8 +15,9 @@ const models = require('./index'); /** * Resource group information. * + * @extends models['BaseResource'] */ -class ResourceGroup { +class ResourceGroup extends models['BaseResource'] { /** * Create a ResourceGroup. * @member {string} [id] The ID of the resource group. @@ -31,6 +32,7 @@ class ResourceGroup { * @member {object} [tags] The tags attached to the resource group. */ constructor() { + super(); } /** diff --git a/lib/services/resourceManagement/lib/resource/models/tagDetails.js b/lib/services/resourceManagement/lib/resource/models/tagDetails.js index 7898e8d322..160510a2b8 100644 --- a/lib/services/resourceManagement/lib/resource/models/tagDetails.js +++ b/lib/services/resourceManagement/lib/resource/models/tagDetails.js @@ -47,6 +47,7 @@ class TagDetails { modelProperties: { id: { required: false, + readOnly: true, serializedName: 'id', type: { name: 'String' diff --git a/lib/services/resourceManagement/lib/resource/models/tagValue.js b/lib/services/resourceManagement/lib/resource/models/tagValue.js index 0436726c6e..6d1ddaec24 100644 --- a/lib/services/resourceManagement/lib/resource/models/tagValue.js +++ b/lib/services/resourceManagement/lib/resource/models/tagValue.js @@ -15,8 +15,9 @@ const models = require('./index'); /** * Tag information. * + * @extends models['BaseResource'] */ -class TagValue { +class TagValue extends models['BaseResource'] { /** * Create a TagValue. * @member {string} [id] The tag ID. @@ -26,6 +27,7 @@ class TagValue { * @member {number} [count.value] Value of count. */ constructor() { + super(); } /** @@ -44,6 +46,7 @@ class TagValue { modelProperties: { id: { required: false, + readOnly: true, serializedName: 'id', type: { name: 'String' diff --git a/lib/services/resourceManagement/lib/resource/operations/deploymentOperations.js b/lib/services/resourceManagement/lib/resource/operations/deploymentOperations.js index 278d90b590..cb8d1ddea4 100644 --- a/lib/services/resourceManagement/lib/resource/operations/deploymentOperations.js +++ b/lib/services/resourceManagement/lib/resource/operations/deploymentOperations.js @@ -17,9 +17,6 @@ const WebResource = msRest.WebResource; /** * Gets a deployments operation. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * * @param {string} deploymentName The name of the deployment. * * @param {string} operationId The ID of the operation to get. @@ -42,7 +39,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _get(resourceGroupName, deploymentName, operationId, options, callback) { +function _getAtSubscriptionScope(deploymentName, operationId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -54,23 +51,6 @@ function _get(resourceGroupName, deploymentName, operationId, options, callback) } // Validate try { - 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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); } @@ -106,8 +86,7 @@ function _get(resourceGroupName, deploymentName, operationId, options, callback) // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'; requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); requestUrl = requestUrl.replace('{operationId}', encodeURIComponent(operationId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); @@ -197,9 +176,6 @@ function _get(resourceGroupName, deploymentName, operationId, options, callback) /** * Gets all deployments operations for a deployment. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * * @param {string} deploymentName The name of the deployment with the operation * to get. * @@ -224,7 +200,7 @@ function _get(resourceGroupName, deploymentName, operationId, options, callback) * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _list(resourceGroupName, deploymentName, options, callback) { +function _listAtSubscriptionScope(deploymentName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -237,23 +213,6 @@ function _list(resourceGroupName, deploymentName, options, callback) { let top = (options && options.top !== undefined) ? options.top : undefined; // Validate try { - 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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); } @@ -289,8 +248,7 @@ function _list(resourceGroupName, deploymentName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'; requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; @@ -380,10 +338,14 @@ function _list(resourceGroupName, deploymentName, options, callback) { } /** - * Gets all deployments operations for a deployment. + * Gets a deployments operation. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {string} operationId The ID of the operation to get. * * @param {object} [options] Optional Parameters. * @@ -397,14 +359,13 @@ function _list(resourceGroupName, deploymentName, options, callback) { * {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 DeploymentOperationsListResult} for more - * information. + * See {@link DeploymentOperation} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listNext(nextPageLink, options, callback) { +function _get(resourceGroupName, deploymentName, operationId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -416,8 +377,48 @@ function _listNext(nextPageLink, options, callback) { } // Validate try { - if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { - throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + if (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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { + throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); + } + if (deploymentName !== null && deploymentName !== undefined) { + if (deploymentName.length > 64) + { + throw new Error('"deploymentName" should satisfy the constraint - "MaxLength": 64'); + } + if (deploymentName.length < 1) + { + throw new Error('"deploymentName" should satisfy the constraint - "MinLength": 1'); + } + if (deploymentName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"deploymentName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (operationId === null || operationId === undefined || typeof operationId.valueOf() !== 'string') { + throw new Error('operationId 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.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.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -427,8 +428,17 @@ function _listNext(nextPageLink, options, callback) { } // Construct URL - let requestUrl = '{nextLink}'; - requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); + requestUrl = requestUrl.replace('{operationId}', encodeURIComponent(operationId)); + 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(); @@ -492,7 +502,7 @@ function _listNext(nextPageLink, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['DeploymentOperationsListResult']().mapper(); + let resultMapper = new client.models['DeploymentOperation']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -507,102 +517,721 @@ function _listNext(nextPageLink, options, callback) { }); } -/** Class representing a DeploymentOperations. */ -class DeploymentOperations { - /** - * Create a DeploymentOperations. - * @param {ResourceManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._list = _list; - this._listNext = _listNext; +/** + * Gets all deployments operations for a deployment. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment with the operation + * to get. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of results to return. + * + * @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 DeploymentOperationsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, deploymentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; } - - /** - * Gets a deployments operation. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * - * @param {string} deploymentName The name of the deployment. - * - * @param {string} operationId The ID of the operation to get. - * - * @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, deploymentName, operationId, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, deploymentName, operationId, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); + if (!callback) { + throw new Error('callback cannot be null.'); } - - /** - * Gets a deployments operation. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * - * @param {string} deploymentName The name of the deployment. - * - * @param {string} operationId The ID of the operation to get. - * - * @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 {DeploymentOperation} - 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 DeploymentOperation} 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, deploymentName, operationId, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; + let top = (options && options.top !== undefined) ? options.top : undefined; + // Validate + try { + 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 (!optionalCallback) { - return new Promise((resolve, reject) => { - self._get(resourceGroupName, deploymentName, operationId, options, (err, result, request, response) => { - if (err) { reject(err); } + 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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { + throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); + } + if (deploymentName !== null && deploymentName !== undefined) { + if (deploymentName.length > 64) + { + throw new Error('"deploymentName" should satisfy the constraint - "MaxLength": 64'); + } + if (deploymentName.length < 1) + { + throw new Error('"deploymentName" should satisfy the constraint - "MinLength": 1'); + } + if (deploymentName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"deploymentName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + 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.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.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}/deployments/{deploymentName}/operations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.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 = '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['DeploymentOperationsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all deployments operations for a deployment. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentOperationsListResult} 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 _listAtSubscriptionScopeNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DeploymentOperationsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all deployments operations for a deployment. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentOperationsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DeploymentOperationsListResult']().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 DeploymentOperations. */ +class DeploymentOperations { + /** + * Create a DeploymentOperations. + * @param {ResourceManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getAtSubscriptionScope = _getAtSubscriptionScope; + this._listAtSubscriptionScope = _listAtSubscriptionScope; + this._get = _get; + this._list = _list; + this._listAtSubscriptionScopeNext = _listAtSubscriptionScopeNext; + this._listNext = _listNext; + } + + /** + * Gets a deployments operation. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {string} operationId The ID of the operation to get. + * + * @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. + */ + getAtSubscriptionScopeWithHttpOperationResponse(deploymentName, operationId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getAtSubscriptionScope(deploymentName, operationId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a deployments operation. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {string} operationId The ID of the operation to get. + * + * @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 {DeploymentOperation} - 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 DeploymentOperation} 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. + */ + getAtSubscriptionScope(deploymentName, operationId, 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._getAtSubscriptionScope(deploymentName, operationId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getAtSubscriptionScope(deploymentName, operationId, options, optionalCallback); + } + } + + /** + * Gets all deployments operations for a deployment. + * + * @param {string} deploymentName The name of the deployment with the operation + * to get. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of results to return. + * + * @param {object} [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. + */ + listAtSubscriptionScopeWithHttpOperationResponse(deploymentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param {string} deploymentName The name of the deployment with the operation + * to get. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of results to return. + * + * @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 {DeploymentOperationsListResult} - 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 DeploymentOperationsListResult} 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. + */ + listAtSubscriptionScope(deploymentName, 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._listAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAtSubscriptionScope(deploymentName, options, optionalCallback); + } + } + + /** + * Gets a deployments operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {string} operationId The ID of the operation to get. + * + * @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, deploymentName, operationId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, deploymentName, operationId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a deployments operation. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {string} operationId The ID of the operation to get. + * + * @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 {DeploymentOperation} - 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 DeploymentOperation} 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, deploymentName, operationId, 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, deploymentName, operationId, options, (err, result, request, response) => { + if (err) { reject(err); } else { resolve(result); } return; }); @@ -707,6 +1336,91 @@ class DeploymentOperations { } } + /** + * Gets all deployments operations for a deployment. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAtSubscriptionScopeNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAtSubscriptionScopeNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DeploymentOperationsListResult} - 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 DeploymentOperationsListResult} 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. + */ + listAtSubscriptionScopeNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listAtSubscriptionScopeNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAtSubscriptionScopeNext(nextPageLink, options, optionalCallback); + } + } + /** * Gets all deployments operations for a deployment. * diff --git a/lib/services/resourceManagement/lib/resource/operations/deployments.js b/lib/services/resourceManagement/lib/resource/operations/deployments.js index 2232d1ec2a..f4b17d475c 100644 --- a/lib/services/resourceManagement/lib/resource/operations/deployments.js +++ b/lib/services/resourceManagement/lib/resource/operations/deployments.js @@ -19,9 +19,8 @@ const WebResource = msRest.WebResource; * @summary Deletes a deployment from the deployment history. * * A template deployment that is currently running cannot be deleted. Deleting - * a template deployment removes the associated deployment operations. Deleting - * a template deployment does not affect the state of the resource group. This - * is an asynchronous operation that returns a status of 202 until the template + * a template deployment removes the associated deployment operations. This is + * an asynchronous operation that returns a status of 202 until the template * deployment is successfully deleted. The Location response header contains * the URI that is used to obtain the status of the process. While the process * is running, a call to the URI in the Location header returns a status of @@ -29,9 +28,6 @@ const WebResource = msRest.WebResource; * status of 204 on success. If the asynchronous request failed, the URI in the * Location header returns an error-level status code. * - * @param {string} resourceGroupName The name of the resource group with the - * deployment to delete. The name is case insensitive. - * * @param {string} deploymentName The name of the deployment to delete. * * @param {object} [options] Optional Parameters. @@ -51,7 +47,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _deleteMethod(resourceGroupName, deploymentName, options, callback) { +function _deleteAtSubscriptionScope(deploymentName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -64,7 +60,7 @@ function _deleteMethod(resourceGroupName, deploymentName, options, callback) { } // Send request - this.beginDeleteMethod(resourceGroupName, deploymentName, options, (err, parsedResult, httpRequest, response) => { + this.beginDeleteAtSubscriptionScope(deploymentName, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -92,9 +88,6 @@ function _deleteMethod(resourceGroupName, deploymentName, options, callback) { /** * Checks whether the deployment exists. * - * @param {string} resourceGroupName The name of the resource group with the - * deployment to check. The name is case insensitive. - * * @param {string} deploymentName The name of the deployment to check. * * @param {object} [options] Optional Parameters. @@ -114,7 +107,7 @@ function _deleteMethod(resourceGroupName, deploymentName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _checkExistence(resourceGroupName, deploymentName, options, callback) { +function _checkExistenceAtSubscriptionScope(deploymentName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -126,23 +119,6 @@ function _checkExistence(resourceGroupName, deploymentName, options, callback) { } // Validate try { - 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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); } @@ -175,8 +151,7 @@ function _checkExistence(resourceGroupName, deploymentName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'; requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; @@ -248,19 +223,18 @@ function _checkExistence(resourceGroupName, deploymentName, options, callback) { /** - * @summary Deploys resources to a resource group. + * @summary Deploys resources at subscription scope. * * You can provide the template and parameters directly in the request or link * to JSON files. * - * @param {string} resourceGroupName The name of the resource group to deploy - * the resources to. The name is case insensitive. The resource group must - * already exist. - * * @param {string} deploymentName The name of the deployment. * * @param {object} parameters Additional parameters supplied to the operation. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -317,6 +291,17 @@ function _checkExistence(resourceGroupName, deploymentName, options, callback) { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -335,7 +320,7 @@ function _checkExistence(resourceGroupName, deploymentName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _createOrUpdate(resourceGroupName, deploymentName, parameters, options, callback) { +function _createOrUpdateAtSubscriptionScope(deploymentName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -348,7 +333,7 @@ function _createOrUpdate(resourceGroupName, deploymentName, parameters, options, } // Send request - this.beginCreateOrUpdate(resourceGroupName, deploymentName, parameters, options, (err, parsedResult, httpRequest, response) => { + this.beginCreateOrUpdateAtSubscriptionScope(deploymentName, parameters, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -390,9 +375,6 @@ function _createOrUpdate(resourceGroupName, deploymentName, parameters, options, /** * Gets a deployment. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * * @param {string} deploymentName The name of the deployment to get. * * @param {object} [options] Optional Parameters. @@ -413,7 +395,7 @@ function _createOrUpdate(resourceGroupName, deploymentName, parameters, options, * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _get(resourceGroupName, deploymentName, options, callback) { +function _getAtSubscriptionScope(deploymentName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -425,23 +407,6 @@ function _get(resourceGroupName, deploymentName, options, callback) { } // Validate try { - 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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); } @@ -474,8 +439,7 @@ function _get(resourceGroupName, deploymentName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'; requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; @@ -567,10 +531,7 @@ function _get(resourceGroupName, deploymentName, options, callback) { * You can cancel a deployment only if the provisioningState is Accepted or * Running. After the deployment is canceled, the provisioningState is set to * Canceled. Canceling a template deployment stops the currently running - * template deployment and leaves the resource group partially deployed. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * template deployment and leaves the resources partially deployed. * * @param {string} deploymentName The name of the deployment to cancel. * @@ -591,7 +552,7 @@ function _get(resourceGroupName, deploymentName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _cancel(resourceGroupName, deploymentName, options, callback) { +function _cancelAtSubscriptionScope(deploymentName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -603,23 +564,6 @@ function _cancel(resourceGroupName, deploymentName, options, callback) { } // Validate try { - 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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); } @@ -652,8 +596,7 @@ function _cancel(resourceGroupName, deploymentName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'; requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; @@ -726,13 +669,13 @@ function _cancel(resourceGroupName, deploymentName, options, callback) { * Validates whether the specified template is syntactically correct and will * be accepted by Azure Resource Manager.. * - * @param {string} resourceGroupName The name of the resource group the - * template will be deployed to. The name is case insensitive. - * * @param {string} deploymentName The name of the deployment. * * @param {object} parameters Parameters to validate. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -789,6 +732,17 @@ function _cancel(resourceGroupName, deploymentName, options, callback) { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -808,7 +762,7 @@ function _cancel(resourceGroupName, deploymentName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _validate(resourceGroupName, deploymentName, parameters, options, callback) { +function _validateAtSubscriptionScope(deploymentName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -820,23 +774,6 @@ function _validate(resourceGroupName, deploymentName, parameters, options, callb } // Validate try { - 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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); } @@ -872,8 +809,7 @@ function _validate(resourceGroupName, deploymentName, parameters, options, callb // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'; requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; @@ -993,9 +929,6 @@ function _validate(resourceGroupName, deploymentName, parameters, options, callb /** * Exports the template used for specified deployment. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * * @param {string} deploymentName The name of the deployment from which to get * the template. * @@ -1018,7 +951,7 @@ function _validate(resourceGroupName, deploymentName, parameters, options, callb * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _exportTemplate(resourceGroupName, deploymentName, options, callback) { +function _exportTemplateAtSubscriptionScope(deploymentName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1030,23 +963,6 @@ function _exportTemplate(resourceGroupName, deploymentName, options, callback) { } // Validate try { - 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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); } @@ -1079,8 +995,7 @@ function _exportTemplate(resourceGroupName, deploymentName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'; requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; @@ -1167,10 +1082,7 @@ function _exportTemplate(resourceGroupName, deploymentName, options, callback) { } /** - * Get all the deployments for a resource group. - * - * @param {string} resourceGroupName The name of the resource group with the - * deployments to get. The name is case insensitive. + * Get all the deployments for a subscription. * * @param {object} [options] Optional Parameters. * @@ -1196,7 +1108,7 @@ function _exportTemplate(resourceGroupName, deploymentName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listByResourceGroup(resourceGroupName, options, callback) { +function _listAtSubscriptionScope(options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1210,23 +1122,6 @@ function _listByResourceGroup(resourceGroupName, options, callback) { let top = (options && options.top !== undefined) ? options.top : undefined; // Validate try { - 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 (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { throw new Error('filter must be of type string.'); } @@ -1248,8 +1143,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; if (filter !== null && filter !== undefined) { @@ -1340,6 +1234,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { }); } + /** * @summary Deletes a deployment from the deployment history. * @@ -1376,7 +1271,70 @@ function _listByResourceGroup(resourceGroupName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginDeleteMethod(resourceGroupName, deploymentName, options, callback) { +function _deleteMethod(resourceGroupName, deploymentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, deploymentName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Checks whether the deployment exists. + * + * @param {string} resourceGroupName The name of the resource group with the + * deployment to check. The name is case insensitive. + * + * @param {string} deploymentName The name of the deployment to check. + * + * @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. + * + * {boolean} [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 _checkExistence(resourceGroupName, deploymentName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1449,7 +1407,7 @@ function _beginDeleteMethod(resourceGroupName, deploymentName, options, callback // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'DELETE'; + httpRequest.method = 'HEAD'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1474,7 +1432,7 @@ function _beginDeleteMethod(resourceGroupName, deploymentName, options, callback return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 202 && statusCode !== 204) { + if (statusCode !== 204 && statusCode !== 404) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1502,11 +1460,13 @@ function _beginDeleteMethod(resourceGroupName, deploymentName, options, callback // Create Result let result = null; if (responseBody === '') responseBody = null; + result = (statusCode === 204); return callback(null, result, httpRequest, response); }); } + /** * @summary Deploys resources to a resource group. * @@ -1521,6 +1481,9 @@ function _beginDeleteMethod(resourceGroupName, deploymentName, options, callback * * @param {object} parameters Additional parameters supplied to the operation. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -1577,6 +1540,17 @@ function _beginDeleteMethod(resourceGroupName, deploymentName, options, callback * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1595,30 +1569,108 @@ function _beginDeleteMethod(resourceGroupName, deploymentName, options, callback * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginCreateOrUpdate(resourceGroupName, deploymentName, parameters, options, callback) { +function _createOrUpdate(resourceGroupName, deploymentName, parameters, 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 (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'); - } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, deploymentName, parameters, 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['DeploymentExtended']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets a deployment. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment to get. + * + * @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 DeploymentExtended} 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, deploymentName, 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 (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\._\(\)]+$/'); @@ -1641,9 +1693,6 @@ function _beginCreateOrUpdate(resourceGroupName, deploymentName, parameters, opt throw new Error('"deploymentName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); } } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } 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.'); } @@ -1671,7 +1720,7 @@ function _beginCreateOrUpdate(resourceGroupName, deploymentName, parameters, opt // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1689,28 +1738,14 @@ function _beginCreateOrUpdate(resourceGroupName, deploymentName, parameters, opt } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['Deployment']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; + 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 !== 201) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1755,33 +1790,23 @@ function _beginCreateOrUpdate(resourceGroupName, deploymentName, parameters, opt return callback(deserializationError); } } - // 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['DeploymentExtended']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError1.request = msRest.stripRequest(httpRequest); - deserializationError1.response = msRest.stripResponse(response); - return callback(deserializationError1); - } - } return callback(null, result, httpRequest, response); }); } /** - * Get all the deployments for a resource group. + * @summary Cancels a currently running template deployment. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * You can cancel a deployment only if the provisioningState is Accepted or + * Running. After the deployment is canceled, the provisioningState is set to + * Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment to cancel. * * @param {object} [options] Optional Parameters. * @@ -1794,14 +1819,13 @@ function _beginCreateOrUpdate(resourceGroupName, deploymentName, parameters, opt * * {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 DeploymentListResult} for more information. + * {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 _listByResourceGroupNext(nextPageLink, options, callback) { +function _cancel(resourceGroupName, deploymentName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1813,8 +1837,45 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { } // Validate try { - if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { - throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + if (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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { + throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); + } + if (deploymentName !== null && deploymentName !== undefined) { + if (deploymentName.length > 64) + { + throw new Error('"deploymentName" should satisfy the constraint - "MaxLength": 64'); + } + if (deploymentName.length < 1) + { + throw new Error('"deploymentName" should satisfy the constraint - "MinLength": 1'); + } + if (deploymentName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"deploymentName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -1824,12 +1885,20 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { } // Construct URL - let requestUrl = '{nextLink}'; - requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); + 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.method = 'POST'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1854,7 +1923,7 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1882,47 +1951,2776 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { // 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['DeploymentListResult']().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 Deployments. */ -class Deployments { - /** - * Create a Deployments. - * @param {ResourceManagementClient} client Reference to the service client. +/** + * Validates whether the specified template is syntactically correct and will + * be accepted by Azure Resource Manager.. + * + * @param {string} resourceGroupName The name of the resource group the + * template will be deployed to. The name is case insensitive. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Parameters to validate. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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 DeploymentValidateResult} 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 _validate(resourceGroupName, deploymentName, parameters, 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 (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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { + throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); + } + if (deploymentName !== null && deploymentName !== undefined) { + if (deploymentName.length > 64) + { + throw new Error('"deploymentName" should satisfy the constraint - "MaxLength": 64'); + } + if (deploymentName.length < 1) + { + throw new Error('"deploymentName" should satisfy the constraint - "MinLength": 1'); + } + if (deploymentName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"deploymentName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + 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.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.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.Resources/deployments/{deploymentName}/validate'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); + 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 = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['Deployment']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 400) { + 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['DeploymentValidateResult']().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); + } + } + // Deserialize Response + if (statusCode === 400) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DeploymentValidateResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Exports the template used for specified deployment. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment from which to get + * the template. + * + * @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 DeploymentExportResult} 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 _exportTemplate(resourceGroupName, deploymentName, 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 (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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { + throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); + } + if (deploymentName !== null && deploymentName !== undefined) { + if (deploymentName.length > 64) + { + throw new Error('"deploymentName" should satisfy the constraint - "MaxLength": 64'); + } + if (deploymentName.length < 1) + { + throw new Error('"deploymentName" should satisfy the constraint - "MinLength": 1'); + } + if (deploymentName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"deploymentName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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.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.Resources/deployments/{deploymentName}/exportTemplate'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); + 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 = '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['DeploymentExportResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get all the deployments for a resource group. + * + * @param {string} resourceGroupName The name of the resource group with the + * deployments to get. The name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * example, you can use $filter=provisioningState eq '{state}'. + * + * @param {number} [options.top] The number of results to get. If null is + * passed, returns all deployments. + * + * @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 DeploymentListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + // Validate + try { + 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 (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + 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.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.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.Resources/deployments/'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.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 = '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['DeploymentListResult']().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 from the deployment history. + * + * A template deployment that is currently running cannot be deleted. Deleting + * a template deployment removes the associated deployment operations. This is + * an asynchronous operation that returns a status of 202 until the template + * deployment is successfully deleted. The Location response header contains + * the URI that is used to obtain the status of the process. While the process + * is running, a call to the URI in the Location header returns a status of + * 202. When the process finishes, the URI in the Location header returns a + * status of 204 on success. If the asynchronous request failed, the URI in the + * Location header returns an error-level status code. + * + * @param {string} deploymentName The name of the deployment to delete. + * + * @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 _beginDeleteAtSubscriptionScope(deploymentName, 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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { + throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); + } + if (deploymentName !== null && deploymentName !== undefined) { + if (deploymentName.length > 64) + { + throw new Error('"deploymentName" should satisfy the constraint - "MaxLength": 64'); + } + if (deploymentName.length < 1) + { + throw new Error('"deploymentName" should satisfy the constraint - "MinLength": 1'); + } + if (deploymentName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"deploymentName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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.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.Resources/deployments/{deploymentName}'; + requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); + 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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deploys resources at subscription scope. + * + * You can provide the template and parameters directly in the request or link + * to JSON files. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Additional parameters supplied to the operation. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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 DeploymentExtended} 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 _beginCreateOrUpdateAtSubscriptionScope(deploymentName, parameters, 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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { + throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); + } + if (deploymentName !== null && deploymentName !== undefined) { + if (deploymentName.length > 64) + { + throw new Error('"deploymentName" should satisfy the constraint - "MaxLength": 64'); + } + if (deploymentName.length < 1) + { + throw new Error('"deploymentName" should satisfy the constraint - "MinLength": 1'); + } + if (deploymentName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"deploymentName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + 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.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.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.Resources/deployments/{deploymentName}'; + requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['Deployment']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 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 === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DeploymentExtended']().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); + } + } + // 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['DeploymentExtended']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a deployment from the deployment history. + * + * A template deployment that is currently running cannot be deleted. Deleting + * a template deployment removes the associated deployment operations. Deleting + * a template deployment does not affect the state of the resource group. This + * is an asynchronous operation that returns a status of 202 until the template + * deployment is successfully deleted. The Location response header contains + * the URI that is used to obtain the status of the process. While the process + * is running, a call to the URI in the Location header returns a status of + * 202. When the process finishes, the URI in the Location header returns a + * status of 204 on success. If the asynchronous request failed, the URI in the + * Location header returns an error-level status code. + * + * @param {string} resourceGroupName The name of the resource group with the + * deployment to delete. The name is case insensitive. + * + * @param {string} deploymentName The name of the deployment to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, deploymentName, 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 (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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { + throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); + } + if (deploymentName !== null && deploymentName !== undefined) { + if (deploymentName.length > 64) + { + throw new Error('"deploymentName" should satisfy the constraint - "MaxLength": 64'); + } + if (deploymentName.length < 1) + { + throw new Error('"deploymentName" should satisfy the constraint - "MinLength": 1'); + } + if (deploymentName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"deploymentName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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.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.Resources/deployments/{deploymentName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); + 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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deploys resources to a resource group. + * + * You can provide the template and parameters directly in the request or link + * to JSON files. + * + * @param {string} resourceGroupName The name of the resource group to deploy + * the resources to. The name is case insensitive. The resource group must + * already exist. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Additional parameters supplied to the operation. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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 DeploymentExtended} 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, deploymentName, parameters, 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 (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 (deploymentName === null || deploymentName === undefined || typeof deploymentName.valueOf() !== 'string') { + throw new Error('deploymentName cannot be null or undefined and it must be of type string.'); + } + if (deploymentName !== null && deploymentName !== undefined) { + if (deploymentName.length > 64) + { + throw new Error('"deploymentName" should satisfy the constraint - "MaxLength": 64'); + } + if (deploymentName.length < 1) + { + throw new Error('"deploymentName" should satisfy the constraint - "MinLength": 1'); + } + if (deploymentName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"deploymentName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + 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.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.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.Resources/deployments/{deploymentName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{deploymentName}', encodeURIComponent(deploymentName)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['Deployment']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 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 === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DeploymentExtended']().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); + } + } + // 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['DeploymentExtended']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get all the deployments for a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentListResult} 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 _listAtSubscriptionScopeNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DeploymentListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get all the deployments for a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DeploymentListResult']().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 Deployments. */ +class Deployments { + /** + * Create a Deployments. + * @param {ResourceManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteAtSubscriptionScope = _deleteAtSubscriptionScope; + this._checkExistenceAtSubscriptionScope = _checkExistenceAtSubscriptionScope; + this._createOrUpdateAtSubscriptionScope = _createOrUpdateAtSubscriptionScope; + this._getAtSubscriptionScope = _getAtSubscriptionScope; + this._cancelAtSubscriptionScope = _cancelAtSubscriptionScope; + this._validateAtSubscriptionScope = _validateAtSubscriptionScope; + this._exportTemplateAtSubscriptionScope = _exportTemplateAtSubscriptionScope; + this._listAtSubscriptionScope = _listAtSubscriptionScope; + this._deleteMethod = _deleteMethod; + this._checkExistence = _checkExistence; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._cancel = _cancel; + this._validate = _validate; + this._exportTemplate = _exportTemplate; + this._listByResourceGroup = _listByResourceGroup; + this._beginDeleteAtSubscriptionScope = _beginDeleteAtSubscriptionScope; + this._beginCreateOrUpdateAtSubscriptionScope = _beginCreateOrUpdateAtSubscriptionScope; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listAtSubscriptionScopeNext = _listAtSubscriptionScopeNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * @summary Deletes a deployment from the deployment history. + * + * A template deployment that is currently running cannot be deleted. Deleting + * a template deployment removes the associated deployment operations. This is + * an asynchronous operation that returns a status of 202 until the template + * deployment is successfully deleted. The Location response header contains + * the URI that is used to obtain the status of the process. While the process + * is running, a call to the URI in the Location header returns a status of + * 202. When the process finishes, the URI in the Location header returns a + * status of 204 on success. If the asynchronous request failed, the URI in the + * Location header returns an error-level status code. + * + * @param {string} deploymentName The name of the deployment to delete. + * + * @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. + */ + deleteAtSubscriptionScopeWithHttpOperationResponse(deploymentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteAtSubscriptionScope(deploymentName, 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 from the deployment history. + * + * A template deployment that is currently running cannot be deleted. Deleting + * a template deployment removes the associated deployment operations. This is + * an asynchronous operation that returns a status of 202 until the template + * deployment is successfully deleted. The Location response header contains + * the URI that is used to obtain the status of the process. While the process + * is running, a call to the URI in the Location header returns a status of + * 202. When the process finishes, the URI in the Location header returns a + * status of 204 on success. If the asynchronous request failed, the URI in the + * Location header returns an error-level status code. + * + * @param {string} deploymentName The name of the deployment to delete. + * + * @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. + */ + deleteAtSubscriptionScope(deploymentName, 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._deleteAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteAtSubscriptionScope(deploymentName, options, optionalCallback); + } + } + + /** + * Checks whether the deployment exists. + * + * @param {string} deploymentName The name of the deployment to check. + * + * @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. + */ + checkExistenceAtSubscriptionScopeWithHttpOperationResponse(deploymentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._checkExistenceAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Checks whether the deployment exists. + * + * @param {string} deploymentName The name of the deployment to check. + * + * @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 {Boolean} - 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. + * + * {boolean} [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. + */ + checkExistenceAtSubscriptionScope(deploymentName, 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._checkExistenceAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkExistenceAtSubscriptionScope(deploymentName, options, optionalCallback); + } + } + + /** + * @summary Deploys resources at subscription scope. + * + * You can provide the template and parameters directly in the request or link + * to JSON files. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Additional parameters supplied to the operation. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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. + */ + createOrUpdateAtSubscriptionScopeWithHttpOperationResponse(deploymentName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdateAtSubscriptionScope(deploymentName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deploys resources at subscription scope. + * + * You can provide the template and parameters directly in the request or link + * to JSON files. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Additional parameters supplied to the operation. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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 {DeploymentExtended} - 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 DeploymentExtended} 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. + */ + createOrUpdateAtSubscriptionScope(deploymentName, parameters, 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._createOrUpdateAtSubscriptionScope(deploymentName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdateAtSubscriptionScope(deploymentName, parameters, options, optionalCallback); + } + } + + /** + * Gets a deployment. + * + * @param {string} deploymentName The name of the deployment to get. + * + * @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. + */ + getAtSubscriptionScopeWithHttpOperationResponse(deploymentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a deployment. + * + * @param {string} deploymentName The name of the deployment to get. + * + * @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 {DeploymentExtended} - 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 DeploymentExtended} 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. + */ + getAtSubscriptionScope(deploymentName, 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._getAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getAtSubscriptionScope(deploymentName, options, optionalCallback); + } + } + + /** + * @summary Cancels a currently running template deployment. + * + * You can cancel a deployment only if the provisioningState is Accepted or + * Running. After the deployment is canceled, the provisioningState is set to + * Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param {string} deploymentName The name of the deployment to cancel. + * + * @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. + */ + cancelAtSubscriptionScopeWithHttpOperationResponse(deploymentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._cancelAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Cancels a currently running template deployment. + * + * You can cancel a deployment only if the provisioningState is Accepted or + * Running. After the deployment is canceled, the provisioningState is set to + * Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param {string} deploymentName The name of the deployment to cancel. + * + * @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. + */ + cancelAtSubscriptionScope(deploymentName, 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._cancelAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._cancelAtSubscriptionScope(deploymentName, options, optionalCallback); + } + } + + /** + * Validates whether the specified template is syntactically correct and will + * be accepted by Azure Resource Manager.. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Parameters to validate. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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. + */ + validateAtSubscriptionScopeWithHttpOperationResponse(deploymentName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._validateAtSubscriptionScope(deploymentName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Validates whether the specified template is syntactically correct and will + * be accepted by Azure Resource Manager.. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Parameters to validate. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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 {DeploymentValidateResult} - 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 DeploymentValidateResult} 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. + */ + validateAtSubscriptionScope(deploymentName, parameters, 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._validateAtSubscriptionScope(deploymentName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._validateAtSubscriptionScope(deploymentName, parameters, options, optionalCallback); + } + } + + /** + * Exports the template used for specified deployment. + * + * @param {string} deploymentName The name of the deployment from which to get + * the template. + * + * @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. + */ + exportTemplateAtSubscriptionScopeWithHttpOperationResponse(deploymentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._exportTemplateAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param {string} deploymentName The name of the deployment from which to get + * the template. + * + * @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 {DeploymentExportResult} - 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 DeploymentExportResult} 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. + */ + exportTemplateAtSubscriptionScope(deploymentName, 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._exportTemplateAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._exportTemplateAtSubscriptionScope(deploymentName, options, optionalCallback); + } + } + + /** + * Get all the deployments for a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * example, you can use $filter=provisioningState eq '{state}'. + * + * @param {number} [options.top] The number of results to get. If null is + * passed, returns all deployments. + * + * @param {object} [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. + */ + listAtSubscriptionScopeWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAtSubscriptionScope(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all the deployments for a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * example, you can use $filter=provisioningState eq '{state}'. + * + * @param {number} [options.top] The number of results to get. If null is + * passed, returns all deployments. + * + * @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 {DeploymentListResult} - 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 DeploymentListResult} 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. */ - constructor(client) { - this.client = client; - this._deleteMethod = _deleteMethod; - this._checkExistence = _checkExistence; - this._createOrUpdate = _createOrUpdate; - this._get = _get; - this._cancel = _cancel; - this._validate = _validate; - this._exportTemplate = _exportTemplate; - this._listByResourceGroup = _listByResourceGroup; - this._beginDeleteMethod = _beginDeleteMethod; - this._beginCreateOrUpdate = _beginCreateOrUpdate; - this._listByResourceGroupNext = _listByResourceGroupNext; + listAtSubscriptionScope(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._listAtSubscriptionScope(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAtSubscriptionScope(options, optionalCallback); + } } /** @@ -2135,6 +4933,9 @@ class Deployments { * * @param {object} parameters Additional parameters supplied to the operation. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -2191,6 +4992,17 @@ class Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2230,6 +5042,9 @@ class Deployments { * * @param {object} parameters Additional parameters supplied to the operation. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -2286,6 +5101,17 @@ class Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2529,6 +5355,9 @@ class Deployments { * * @param {object} parameters Parameters to validate. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -2585,6 +5414,17 @@ class Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2621,6 +5461,9 @@ class Deployments { * * @param {object} parameters Parameters to validate. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -2677,6 +5520,17 @@ class Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2765,8 +5619,207 @@ class Deployments { * @param {string} resourceGroupName The name of the resource group. The name * is case insensitive. * - * @param {string} deploymentName The name of the deployment from which to get - * the template. + * @param {string} deploymentName The name of the deployment from which to get + * the template. + * + * @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 {DeploymentExportResult} - 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 DeploymentExportResult} 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. + */ + exportTemplate(resourceGroupName, deploymentName, 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._exportTemplate(resourceGroupName, deploymentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._exportTemplate(resourceGroupName, deploymentName, options, optionalCallback); + } + } + + /** + * Get all the deployments for a resource group. + * + * @param {string} resourceGroupName The name of the resource group with the + * deployments to get. The name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * example, you can use $filter=provisioningState eq '{state}'. + * + * @param {number} [options.top] The number of results to get. If null is + * passed, returns all deployments. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param {string} resourceGroupName The name of the resource group with the + * deployments to get. The name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * example, you can use $filter=provisioningState eq '{state}'. + * + * @param {number} [options.top] The number of results to get. If null is + * passed, returns all deployments. + * + * @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 {DeploymentListResult} - 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 DeploymentListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Deletes a deployment from the deployment history. + * + * A template deployment that is currently running cannot be deleted. Deleting + * a template deployment removes the associated deployment operations. This is + * an asynchronous operation that returns a status of 202 until the template + * deployment is successfully deleted. The Location response header contains + * the URI that is used to obtain the status of the process. While the process + * is running, a call to the URI in the Location header returns a status of + * 202. When the process finishes, the URI in the Location header returns a + * status of 204 on success. If the asynchronous request failed, the URI in the + * Location header returns an error-level status code. + * + * @param {string} deploymentName The name of the deployment to delete. + * + * @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. + */ + beginDeleteAtSubscriptionScopeWithHttpOperationResponse(deploymentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteAtSubscriptionScope(deploymentName, 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 from the deployment history. + * + * A template deployment that is currently running cannot be deleted. Deleting + * a template deployment removes the associated deployment operations. This is + * an asynchronous operation that returns a status of 202 until the template + * deployment is successfully deleted. The Location response header contains + * the URI that is used to obtain the status of the process. While the process + * is running, a call to the URI in the Location header returns a status of + * 202. When the process finishes, the URI in the Location header returns a + * status of 204 on success. If the asynchronous request failed, the URI in the + * Location header returns an error-level status code. + * + * @param {string} deploymentName The name of the deployment to delete. * * @param {object} [options] Optional Parameters. * @@ -2780,7 +5833,7 @@ class Deployments { * * {Promise} A promise is returned * - * @resolve {DeploymentExportResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2788,15 +5841,13 @@ class Deployments { * * {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 DeploymentExportResult} for more - * information. + * {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. */ - exportTemplate(resourceGroupName, deploymentName, options, optionalCallback) { + beginDeleteAtSubscriptionScope(deploymentName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2805,45 +5856,113 @@ class Deployments { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._exportTemplate(resourceGroupName, deploymentName, options, (err, result, request, response) => { + self._beginDeleteAtSubscriptionScope(deploymentName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._exportTemplate(resourceGroupName, deploymentName, options, optionalCallback); + return self._beginDeleteAtSubscriptionScope(deploymentName, options, optionalCallback); } } /** - * Get all the deployments for a resource group. + * @summary Deploys resources at subscription scope. * - * @param {string} resourceGroupName The name of the resource group with the - * deployments to get. The name is case insensitive. + * You can provide the template and parameters directly in the request or link + * to JSON files. * - * @param {object} [options] Optional Parameters. + * @param {string} deploymentName The name of the deployment. * - * @param {string} [options.filter] The filter to apply on the operation. For - * example, you can use $filter=provisioningState eq '{state}'. + * @param {object} parameters Additional parameters supplied to the operation. * - * @param {number} [options.top] The number of results to get. If null is - * passed, returns all deployments. + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + beginCreateOrUpdateAtSubscriptionScopeWithHttpOperationResponse(deploymentName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + self._beginCreateOrUpdateAtSubscriptionScope(deploymentName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2854,18 +5973,86 @@ class Deployments { } /** - * Get all the deployments for a resource group. + * @summary Deploys resources at subscription scope. * - * @param {string} resourceGroupName The name of the resource group with the - * deployments to get. The name is case insensitive. + * You can provide the template and parameters directly in the request or link + * to JSON files. * - * @param {object} [options] Optional Parameters. + * @param {string} deploymentName The name of the deployment. * - * @param {string} [options.filter] The filter to apply on the operation. For - * example, you can use $filter=provisioningState eq '{state}'. + * @param {object} parameters Additional parameters supplied to the operation. * - * @param {number} [options.top] The number of results to get. If null is - * passed, returns all deployments. + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2877,7 +6064,7 @@ class Deployments { * * {Promise} A promise is returned * - * @resolve {DeploymentListResult} - The deserialized result object. + * @resolve {DeploymentExtended} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2886,13 +6073,13 @@ class Deployments { * {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 DeploymentListResult} for more information. + * See {@link DeploymentExtended} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroup(resourceGroupName, options, optionalCallback) { + beginCreateOrUpdateAtSubscriptionScope(deploymentName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2901,14 +6088,14 @@ class Deployments { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + self._beginCreateOrUpdateAtSubscriptionScope(deploymentName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + return self._beginCreateOrUpdateAtSubscriptionScope(deploymentName, parameters, options, optionalCallback); } } @@ -3035,6 +6222,9 @@ class Deployments { * * @param {object} parameters Additional parameters supplied to the operation. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -3091,6 +6281,17 @@ class Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3130,6 +6331,9 @@ class Deployments { * * @param {object} parameters Additional parameters supplied to the operation. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -3186,6 +6390,17 @@ class Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3233,6 +6448,90 @@ class Deployments { } } + /** + * Get all the deployments for a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAtSubscriptionScopeNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAtSubscriptionScopeNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all the deployments for a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DeploymentListResult} - 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 DeploymentListResult} 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. + */ + listAtSubscriptionScopeNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listAtSubscriptionScopeNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAtSubscriptionScopeNext(nextPageLink, options, optionalCallback); + } + } + /** * Get all the deployments for a resource group. * diff --git a/lib/services/resourceManagement/lib/resource/operations/index.d.ts b/lib/services/resourceManagement/lib/resource/operations/index.d.ts index 2a8e41ce8b..60e02f6309 100644 --- a/lib/services/resourceManagement/lib/resource/operations/index.d.ts +++ b/lib/services/resourceManagement/lib/resource/operations/index.d.ts @@ -25,9 +25,8 @@ export interface Deployments { * @summary Deletes a deployment from the deployment history. * * A template deployment that is currently running cannot be deleted. Deleting - * a template deployment removes the associated deployment operations. Deleting - * a template deployment does not affect the state of the resource group. This - * is an asynchronous operation that returns a status of 202 until the template + * a template deployment removes the associated deployment operations. This is + * an asynchronous operation that returns a status of 202 until the template * deployment is successfully deleted. The Location response header contains * the URI that is used to obtain the status of the process. While the process * is running, a call to the URI in the Location header returns a status of @@ -35,9 +34,6 @@ export interface Deployments { * status of 204 on success. If the asynchronous request failed, the URI in the * Location header returns an error-level status code. * - * @param {string} resourceGroupName The name of the resource group with the - * deployment to delete. The name is case insensitive. - * * @param {string} deploymentName The name of the deployment to delete. * * @param {object} [options] Optional Parameters. @@ -51,15 +47,14 @@ export interface Deployments { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * @summary Deletes a deployment from the deployment history. * * A template deployment that is currently running cannot be deleted. Deleting - * a template deployment removes the associated deployment operations. Deleting - * a template deployment does not affect the state of the resource group. This - * is an asynchronous operation that returns a status of 202 until the template + * a template deployment removes the associated deployment operations. This is + * an asynchronous operation that returns a status of 202 until the template * deployment is successfully deleted. The Location response header contains * the URI that is used to obtain the status of the process. While the process * is running, a call to the URI in the Location header returns a status of @@ -67,9 +62,6 @@ export interface Deployments { * status of 204 on success. If the asynchronous request failed, the URI in the * Location header returns an error-level status code. * - * @param {string} resourceGroupName The name of the resource group with the - * deployment to delete. The name is case insensitive. - * * @param {string} deploymentName The name of the deployment to delete. * * @param {object} [options] Optional Parameters. @@ -98,17 +90,14 @@ export interface Deployments { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, deploymentName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteAtSubscriptionScope(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteAtSubscriptionScope(deploymentName: string, callback: ServiceCallback): void; + deleteAtSubscriptionScope(deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** * Checks whether the deployment exists. * - * @param {string} resourceGroupName The name of the resource group with the - * deployment to check. The name is case insensitive. - * * @param {string} deploymentName The name of the deployment to check. * * @param {object} [options] Optional Parameters. @@ -122,14 +111,11 @@ export interface Deployments { * * @reject {Error|ServiceError} - The error object. */ - checkExistenceWithHttpOperationResponse(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + checkExistenceAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Checks whether the deployment exists. * - * @param {string} resourceGroupName The name of the resource group with the - * deployment to check. The name is case insensitive. - * * @param {string} deploymentName The name of the deployment to check. * * @param {object} [options] Optional Parameters. @@ -158,25 +144,24 @@ export interface Deployments { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - checkExistence(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - checkExistence(resourceGroupName: string, deploymentName: string, callback: ServiceCallback): void; - checkExistence(resourceGroupName: string, deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + checkExistenceAtSubscriptionScope(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkExistenceAtSubscriptionScope(deploymentName: string, callback: ServiceCallback): void; + checkExistenceAtSubscriptionScope(deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * @summary Deploys resources to a resource group. + * @summary Deploys resources at subscription scope. * * You can provide the template and parameters directly in the request or link * to JSON files. * - * @param {string} resourceGroupName The name of the resource group to deploy - * the resources to. The name is case insensitive. The resource group must - * already exist. - * * @param {string} deploymentName The name of the deployment. * * @param {object} parameters Additional parameters supplied to the operation. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -233,6 +218,17 @@ export interface Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -244,22 +240,21 @@ export interface Deployments { * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * @summary Deploys resources to a resource group. + * @summary Deploys resources at subscription scope. * * You can provide the template and parameters directly in the request or link * to JSON files. * - * @param {string} resourceGroupName The name of the resource group to deploy - * the resources to. The name is case insensitive. The resource group must - * already exist. - * * @param {string} deploymentName The name of the deployment. * * @param {object} parameters Additional parameters supplied to the operation. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -316,6 +311,17 @@ export interface Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -343,17 +349,14 @@ export interface Deployments { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdateAtSubscriptionScope(deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdateAtSubscriptionScope(deploymentName: string, parameters: models.Deployment, callback: ServiceCallback): void; + createOrUpdateAtSubscriptionScope(deploymentName: string, parameters: models.Deployment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** * Gets a deployment. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * * @param {string} deploymentName The name of the deployment to get. * * @param {object} [options] Optional Parameters. @@ -367,14 +370,11 @@ export interface Deployments { * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a deployment. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * * @param {string} deploymentName The name of the deployment to get. * * @param {object} [options] Optional Parameters. @@ -404,9 +404,9 @@ export interface Deployments { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, deploymentName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getAtSubscriptionScope(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getAtSubscriptionScope(deploymentName: string, callback: ServiceCallback): void; + getAtSubscriptionScope(deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -415,10 +415,7 @@ export interface Deployments { * You can cancel a deployment only if the provisioningState is Accepted or * Running. After the deployment is canceled, the provisioningState is set to * Canceled. Canceling a template deployment stops the currently running - * template deployment and leaves the resource group partially deployed. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * template deployment and leaves the resources partially deployed. * * @param {string} deploymentName The name of the deployment to cancel. * @@ -433,7 +430,7 @@ export interface Deployments { * * @reject {Error|ServiceError} - The error object. */ - cancelWithHttpOperationResponse(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + cancelAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * @summary Cancels a currently running template deployment. @@ -441,10 +438,7 @@ export interface Deployments { * You can cancel a deployment only if the provisioningState is Accepted or * Running. After the deployment is canceled, the provisioningState is set to * Canceled. Canceling a template deployment stops the currently running - * template deployment and leaves the resource group partially deployed. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * template deployment and leaves the resources partially deployed. * * @param {string} deploymentName The name of the deployment to cancel. * @@ -474,22 +468,22 @@ export interface Deployments { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - cancel(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - cancel(resourceGroupName: string, deploymentName: string, callback: ServiceCallback): void; - cancel(resourceGroupName: string, deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + cancelAtSubscriptionScope(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + cancelAtSubscriptionScope(deploymentName: string, callback: ServiceCallback): void; + cancelAtSubscriptionScope(deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** * Validates whether the specified template is syntactically correct and will * be accepted by Azure Resource Manager.. * - * @param {string} resourceGroupName The name of the resource group the - * template will be deployed to. The name is case insensitive. - * * @param {string} deploymentName The name of the deployment. * * @param {object} parameters Parameters to validate. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -546,6 +540,17 @@ export interface Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -557,19 +562,19 @@ export interface Deployments { * * @reject {Error|ServiceError} - The error object. */ - validateWithHttpOperationResponse(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + validateAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Validates whether the specified template is syntactically correct and will * be accepted by Azure Resource Manager.. * - * @param {string} resourceGroupName The name of the resource group the - * template will be deployed to. The name is case insensitive. - * * @param {string} deploymentName The name of the deployment. * * @param {object} parameters Parameters to validate. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -626,6 +631,17 @@ export interface Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -654,17 +670,14 @@ export interface Deployments { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - validate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - validate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, callback: ServiceCallback): void; - validate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + validateAtSubscriptionScope(deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + validateAtSubscriptionScope(deploymentName: string, parameters: models.Deployment, callback: ServiceCallback): void; + validateAtSubscriptionScope(deploymentName: string, parameters: models.Deployment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** * Exports the template used for specified deployment. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * * @param {string} deploymentName The name of the deployment from which to get * the template. * @@ -679,14 +692,11 @@ export interface Deployments { * * @reject {Error|ServiceError} - The error object. */ - exportTemplateWithHttpOperationResponse(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + exportTemplateAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Exports the template used for specified deployment. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * * @param {string} deploymentName The name of the deployment from which to get * the template. * @@ -718,16 +728,13 @@ export interface Deployments { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - exportTemplate(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - exportTemplate(resourceGroupName: string, deploymentName: string, callback: ServiceCallback): void; - exportTemplate(resourceGroupName: string, deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + exportTemplateAtSubscriptionScope(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + exportTemplateAtSubscriptionScope(deploymentName: string, callback: ServiceCallback): void; + exportTemplateAtSubscriptionScope(deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Get all the deployments for a resource group. - * - * @param {string} resourceGroupName The name of the resource group with the - * deployments to get. The name is case insensitive. + * Get all the deployments for a subscription. * * @param {object} [options] Optional Parameters. * @@ -746,21 +753,1124 @@ export interface Deployments { * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { filter? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + listAtSubscriptionScopeWithHttpOperationResponse(options?: { filter? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Get all the deployments for a resource group. + * Get all the deployments for a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * example, you can use $filter=provisioningState eq '{state}'. + * + * @param {number} [options.top] The number of results to get. If null is + * passed, returns all deployments. + * + * @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 {DeploymentListResult} - 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. + * + * {DeploymentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentListResult} 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. + */ + listAtSubscriptionScope(options?: { filter? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listAtSubscriptionScope(callback: ServiceCallback): void; + listAtSubscriptionScope(options: { filter? : string, top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a deployment from the deployment history. + * + * A template deployment that is currently running cannot be deleted. Deleting + * a template deployment removes the associated deployment operations. Deleting + * a template deployment does not affect the state of the resource group. This + * is an asynchronous operation that returns a status of 202 until the template + * deployment is successfully deleted. The Location response header contains + * the URI that is used to obtain the status of the process. While the process + * is running, a call to the URI in the Location header returns a status of + * 202. When the process finishes, the URI in the Location header returns a + * status of 204 on success. If the asynchronous request failed, the URI in the + * Location header returns an error-level status code. * * @param {string} resourceGroupName The name of the resource group with the - * deployments to get. The name is case insensitive. + * deployment to delete. The name is case insensitive. + * + * @param {string} deploymentName The name of the deployment to delete. + * + * @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, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a deployment from the deployment history. + * + * A template deployment that is currently running cannot be deleted. Deleting + * a template deployment removes the associated deployment operations. Deleting + * a template deployment does not affect the state of the resource group. This + * is an asynchronous operation that returns a status of 202 until the template + * deployment is successfully deleted. The Location response header contains + * the URI that is used to obtain the status of the process. While the process + * is running, a call to the URI in the Location header returns a status of + * 202. When the process finishes, the URI in the Location header returns a + * status of 204 on success. If the asynchronous request failed, the URI in the + * Location header returns an error-level status code. + * + * @param {string} resourceGroupName The name of the resource group with the + * deployment to delete. The name is case insensitive. + * + * @param {string} deploymentName The name of the deployment to delete. + * + * @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, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, deploymentName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Checks whether the deployment exists. + * + * @param {string} resourceGroupName The name of the resource group with the + * deployment to check. The name is case insensitive. + * + * @param {string} deploymentName The name of the deployment to check. + * + * @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. + */ + checkExistenceWithHttpOperationResponse(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Checks whether the deployment exists. + * + * @param {string} resourceGroupName The name of the resource group with the + * deployment to check. The name is case insensitive. + * + * @param {string} deploymentName The name of the deployment to check. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. For - * example, you can use $filter=provisioningState eq '{state}'. + * @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 {Boolean} - 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. + * + * {Boolean} [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. + */ + checkExistence(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkExistence(resourceGroupName: string, deploymentName: string, callback: ServiceCallback): void; + checkExistence(resourceGroupName: string, deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deploys resources to a resource group. + * + * You can provide the template and parameters directly in the request or link + * to JSON files. + * + * @param {string} resourceGroupName The name of the resource group to deploy + * the resources to. The name is case insensitive. The resource group must + * already exist. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Additional parameters supplied to the operation. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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, deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deploys resources to a resource group. + * + * You can provide the template and parameters directly in the request or link + * to JSON files. + * + * @param {string} resourceGroupName The name of the resource group to deploy + * the resources to. The name is case insensitive. The resource group must + * already exist. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Additional parameters supplied to the operation. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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 {DeploymentExtended} - 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. + * + * {DeploymentExtended} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentExtended} 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, deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a deployment. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment to get. + * + * @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, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a deployment. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment to get. + * + * @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 {DeploymentExtended} - 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. + * + * {DeploymentExtended} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentExtended} 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, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, deploymentName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Cancels a currently running template deployment. + * + * You can cancel a deployment only if the provisioningState is Accepted or + * Running. After the deployment is canceled, the provisioningState is set to + * Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment to cancel. + * + * @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, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Cancels a currently running template deployment. + * + * You can cancel a deployment only if the provisioningState is Accepted or + * Running. After the deployment is canceled, the provisioningState is set to + * Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment to cancel. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + cancel(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + cancel(resourceGroupName: string, deploymentName: string, callback: ServiceCallback): void; + cancel(resourceGroupName: string, deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Validates whether the specified template is syntactically correct and will + * be accepted by Azure Resource Manager.. + * + * @param {string} resourceGroupName The name of the resource group the + * template will be deployed to. The name is case insensitive. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Parameters to validate. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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. + */ + validateWithHttpOperationResponse(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Validates whether the specified template is syntactically correct and will + * be accepted by Azure Resource Manager.. + * + * @param {string} resourceGroupName The name of the resource group the + * template will be deployed to. The name is case insensitive. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Parameters to validate. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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 {DeploymentValidateResult} - 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. + * + * {DeploymentValidateResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentValidateResult} 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. + */ + validate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + validate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, callback: ServiceCallback): void; + validate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Exports the template used for specified deployment. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment from which to get + * the template. + * + * @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. + */ + exportTemplateWithHttpOperationResponse(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Exports the template used for specified deployment. + * + * @param {string} resourceGroupName The name of the resource group. The name + * is case insensitive. + * + * @param {string} deploymentName The name of the deployment from which to get + * the template. + * + * @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 {DeploymentExportResult} - 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. + * + * {DeploymentExportResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentExportResult} 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. + */ + exportTemplate(resourceGroupName: string, deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + exportTemplate(resourceGroupName: string, deploymentName: string, callback: ServiceCallback): void; + exportTemplate(resourceGroupName: string, deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get all the deployments for a resource group. + * + * @param {string} resourceGroupName The name of the resource group with the + * deployments to get. The name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * example, you can use $filter=provisioningState eq '{state}'. + * + * @param {number} [options.top] The number of results to get. If null is + * passed, returns all deployments. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { filter? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get all the deployments for a resource group. + * + * @param {string} resourceGroupName The name of the resource group with the + * deployments to get. The name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * example, you can use $filter=provisioningState eq '{state}'. + * + * @param {number} [options.top] The number of results to get. If null is + * passed, returns all deployments. + * + * @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 {DeploymentListResult} - 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. + * + * {DeploymentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { filter? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { filter? : string, top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a deployment from the deployment history. + * + * A template deployment that is currently running cannot be deleted. Deleting + * a template deployment removes the associated deployment operations. This is + * an asynchronous operation that returns a status of 202 until the template + * deployment is successfully deleted. The Location response header contains + * the URI that is used to obtain the status of the process. While the process + * is running, a call to the URI in the Location header returns a status of + * 202. When the process finishes, the URI in the Location header returns a + * status of 204 on success. If the asynchronous request failed, the URI in the + * Location header returns an error-level status code. + * + * @param {string} deploymentName The name of the deployment to delete. + * + * @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. + */ + beginDeleteAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a deployment from the deployment history. + * + * A template deployment that is currently running cannot be deleted. Deleting + * a template deployment removes the associated deployment operations. This is + * an asynchronous operation that returns a status of 202 until the template + * deployment is successfully deleted. The Location response header contains + * the URI that is used to obtain the status of the process. While the process + * is running, a call to the URI in the Location header returns a status of + * 202. When the process finishes, the URI in the Location header returns a + * status of 204 on success. If the asynchronous request failed, the URI in the + * Location header returns an error-level status code. + * + * @param {string} deploymentName The name of the deployment to delete. + * + * @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. + */ + beginDeleteAtSubscriptionScope(deploymentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteAtSubscriptionScope(deploymentName: string, callback: ServiceCallback): void; + beginDeleteAtSubscriptionScope(deploymentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deploys resources at subscription scope. + * + * You can provide the template and parameters directly in the request or link + * to JSON files. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Additional parameters supplied to the operation. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * + * @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. + */ + beginCreateOrUpdateAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deploys resources at subscription scope. + * + * You can provide the template and parameters directly in the request or link + * to JSON files. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {object} parameters Additional parameters supplied to the operation. + * + * @param {string} [parameters.location] The location to store the deployment + * data. + * + * @param {object} parameters.properties The deployment properties. + * + * @param {object} [parameters.properties.template] The template content. You + * use this element when you want to pass the template syntax directly in the + * request rather than link to an existing template. It can be a JObject or + * well-formed JSON string. Use either the templateLink property or the + * template property, but not both. + * + * @param {object} [parameters.properties.templateLink] The URI of the + * template. Use either the templateLink property or the template property, but + * not both. + * + * @param {string} parameters.properties.templateLink.uri The URI of the + * template to deploy. + * + * @param {string} [parameters.properties.templateLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {object} [parameters.properties.parameters] Name and value pairs that + * define the deployment parameters for the template. You use this element when + * you want to provide the parameter values directly in the request rather than + * link to an existing parameter file. Use either the parametersLink property + * or the parameters property, but not both. It can be a JObject or a well + * formed JSON string. + * + * @param {object} [parameters.properties.parametersLink] The URI of parameters + * file. You use this element to link to an existing parameters file. Use + * either the parametersLink property or the parameters property, but not both. + * + * @param {string} parameters.properties.parametersLink.uri The URI of the + * parameters file. + * + * @param {string} [parameters.properties.parametersLink.contentVersion] If + * included, must match the ContentVersion in the template. + * + * @param {string} parameters.properties.mode The mode that is used to deploy + * resources. This value can be either Incremental or Complete. In Incremental + * mode, resources are deployed without deleting existing resources that are + * not included in the template. In Complete mode, resources are deployed and + * existing resources in the resource group that are not included in the + * template are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: 'Incremental', + * 'Complete' + * + * @param {object} [parameters.properties.debugSetting] The debug setting of + * the deployment. + * + * @param {string} [parameters.properties.debugSetting.detailLevel] Specifies + * the type of information to log for debugging. The permitted values are none, + * requestContent, responseContent, or both requestContent and responseContent + * separated by a comma. The default is none. When setting this value, + * carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could + * potentially expose sensitive data that is retrieved through the deployment + * operations. + * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. * - * @param {number} [options.top] The number of results to get. If null is - * passed, returns all deployments. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -772,7 +1882,7 @@ export interface Deployments { * * {Promise} A promise is returned. * - * @resolve {DeploymentListResult} - The deserialized result object. + * @resolve {DeploymentExtended} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -780,16 +1890,16 @@ export interface Deployments { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DeploymentListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DeploymentListResult} for more information. + * {DeploymentExtended} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentExtended} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroup(resourceGroupName: string, options?: { filter? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { filter? : string, top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdateAtSubscriptionScope(deploymentName: string, parameters: models.Deployment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdateAtSubscriptionScope(deploymentName: string, parameters: models.Deployment, callback: ServiceCallback): void; + beginCreateOrUpdateAtSubscriptionScope(deploymentName: string, parameters: models.Deployment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -888,6 +1998,9 @@ export interface Deployments { * * @param {object} parameters Additional parameters supplied to the operation. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -944,6 +2057,17 @@ export interface Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -971,6 +2095,9 @@ export interface Deployments { * * @param {object} parameters Additional parameters supplied to the operation. * + * @param {string} [parameters.location] The location to store the deployment + * data. + * * @param {object} parameters.properties The deployment properties. * * @param {object} [parameters.properties.template] The template content. You @@ -1027,6 +2154,17 @@ export interface Deployments { * potentially expose sensitive data that is retrieved through the deployment * operations. * + * @param {object} [parameters.properties.onErrorDeployment] The deployment on + * error behavior. + * + * @param {string} [parameters.properties.onErrorDeployment.type] The + * deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. Possible values include: 'LastSuccessful', + * 'SpecificDeployment' + * + * @param {string} [parameters.properties.onErrorDeployment.deploymentName] The + * deployment to be used on error case. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1059,6 +2197,63 @@ export interface Deployments { beginCreateOrUpdate(resourceGroupName: string, deploymentName: string, parameters: models.Deployment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Get all the deployments for a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAtSubscriptionScopeNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get all the deployments for a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DeploymentListResult} - 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. + * + * {DeploymentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentListResult} 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. + */ + listAtSubscriptionScopeNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAtSubscriptionScopeNext(nextPageLink: string, callback: ServiceCallback): void; + listAtSubscriptionScopeNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Get all the deployments for a resource group. * @@ -1950,7 +3145,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -2024,7 +3225,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -2117,7 +3324,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -2191,7 +3404,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -2479,7 +3698,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -2545,7 +3770,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -2630,7 +3861,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -2696,7 +3933,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -3096,7 +4339,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -3170,7 +4419,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -3263,7 +4518,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -3337,7 +4598,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -3484,7 +4751,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -3550,7 +4823,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -3635,7 +4914,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -3701,7 +4986,13 @@ export interface Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -4845,6 +6136,127 @@ export interface Tags { export interface DeploymentOperations { + /** + * Gets a deployments operation. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {string} operationId The ID of the operation to get. + * + * @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. + */ + getAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, operationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a deployments operation. + * + * @param {string} deploymentName The name of the deployment. + * + * @param {string} operationId The ID of the operation to get. + * + * @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 {DeploymentOperation} - 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. + * + * {DeploymentOperation} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentOperation} 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. + */ + getAtSubscriptionScope(deploymentName: string, operationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getAtSubscriptionScope(deploymentName: string, operationId: string, callback: ServiceCallback): void; + getAtSubscriptionScope(deploymentName: string, operationId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all deployments operations for a deployment. + * + * @param {string} deploymentName The name of the deployment with the operation + * to get. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of results to return. + * + * @param {object} [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. + */ + listAtSubscriptionScopeWithHttpOperationResponse(deploymentName: string, options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all deployments operations for a deployment. + * + * @param {string} deploymentName The name of the deployment with the operation + * to get. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of results to return. + * + * @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 {DeploymentOperationsListResult} - 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. + * + * {DeploymentOperationsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentOperationsListResult} 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. + */ + listAtSubscriptionScope(deploymentName: string, options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listAtSubscriptionScope(deploymentName: string, callback: ServiceCallback): void; + listAtSubscriptionScope(deploymentName: string, options: { top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Gets a deployments operation. * @@ -4978,6 +6390,64 @@ export interface DeploymentOperations { list(resourceGroupName: string, deploymentName: string, options: { top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Gets all deployments operations for a deployment. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAtSubscriptionScopeNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all deployments operations for a deployment. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DeploymentOperationsListResult} - 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. + * + * {DeploymentOperationsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeploymentOperationsListResult} 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. + */ + listAtSubscriptionScopeNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAtSubscriptionScopeNext(nextPageLink: string, callback: ServiceCallback): void; + listAtSubscriptionScopeNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Gets all deployments operations for a deployment. * diff --git a/lib/services/resourceManagement/lib/resource/operations/resources.js b/lib/services/resourceManagement/lib/resource/operations/resources.js index 4c4a91a30a..6c6d5f2ac0 100644 --- a/lib/services/resourceManagement/lib/resource/operations/resources.js +++ b/lib/services/resourceManagement/lib/resource/operations/resources.js @@ -802,7 +802,13 @@ function _deleteMethod(resourceGroupName, resourceProviderNamespace, parentResou * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -934,7 +940,13 @@ function _createOrUpdate(resourceGroupName, resourceProviderNamespace, parentRes * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -1426,7 +1438,13 @@ function _deleteById(resourceId, apiVersion, options, callback) { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -1550,7 +1568,13 @@ function _createOrUpdateById(resourceId, apiVersion, parameters, options, callba * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -2316,7 +2340,13 @@ function _beginDeleteMethod(resourceGroupName, resourceProviderNamespace, parent * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -2575,7 +2605,13 @@ function _beginCreateOrUpdate(resourceGroupName, resourceProviderNamespace, pare * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -2930,7 +2966,13 @@ function _beginDeleteById(resourceId, apiVersion, options, callback) { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -3147,7 +3189,13 @@ function _beginCreateOrUpdateById(resourceId, apiVersion, parameters, options, c * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -4265,7 +4313,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -4351,7 +4405,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -4459,7 +4519,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -4545,7 +4611,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -4929,7 +5001,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -5007,7 +5085,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -5107,7 +5191,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -5185,7 +5275,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -5708,7 +5804,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -5794,7 +5896,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -5902,7 +6010,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -5988,7 +6102,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -6177,7 +6297,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -6255,7 +6381,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -6355,7 +6487,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * @@ -6433,7 +6571,13 @@ class Resources { * @param {object} [parameters.identity] The identity of the resource. * * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + * UserAssigned', 'None' + * + * @param {object} [parameters.identity.userAssignedIdentities] The list of + * user identities associated with the resource. The user identity dictionary + * key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. * * @param {string} [parameters.location] Resource location * diff --git a/lib/services/resourceManagement/lib/resource/resourceManagementClient.d.ts b/lib/services/resourceManagement/lib/resource/resourceManagementClient.d.ts index 402b3e7334..913f6f2d7b 100644 --- a/lib/services/resourceManagement/lib/resource/resourceManagementClient.d.ts +++ b/lib/services/resourceManagement/lib/resource/resourceManagementClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class ResourceManagementClient extends AzureServiceClient { +export default class ResourceManagementClient extends AzureServiceClient { /** * Initializes a new instance of the ResourceManagementClient class. * @constructor @@ -33,11 +34,11 @@ declare class ResourceManagementClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); @@ -63,4 +64,4 @@ declare class ResourceManagementClient extends AzureServiceClient { deploymentOperations: operations.DeploymentOperations; } -export = ResourceManagementClient; +export { ResourceManagementClient, models as ResourceManagementModels }; diff --git a/lib/services/resourceManagement/lib/resource/resourceManagementClient.js b/lib/services/resourceManagement/lib/resource/resourceManagementClient.js index 9e7be32a70..bb290b78b9 100644 --- a/lib/services/resourceManagement/lib/resource/resourceManagementClient.js +++ b/lib/services/resourceManagement/lib/resource/resourceManagementClient.js @@ -34,9 +34,9 @@ class ResourceManagementClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ constructor(credentials, subscriptionId, baseUri, options) { if (credentials === null || credentials === undefined) { @@ -50,7 +50,7 @@ class ResourceManagementClient extends ServiceClient { super(credentials, options); - this.apiVersion = '2017-05-10'; + this.apiVersion = '2018-05-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -85,3 +85,6 @@ class ResourceManagementClient extends ServiceClient { } module.exports = ResourceManagementClient; +module.exports['default'] = ResourceManagementClient; +module.exports.ResourceManagementClient = ResourceManagementClient; +module.exports.ResourceManagementModels = models; diff --git a/lib/services/resourceManagement/lib/subscription/subscriptionClient.d.ts b/lib/services/resourceManagement/lib/subscription/subscriptionClient.d.ts index 0e6b67a50b..47d2ca95e5 100644 --- a/lib/services/resourceManagement/lib/subscription/subscriptionClient.d.ts +++ b/lib/services/resourceManagement/lib/subscription/subscriptionClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class SubscriptionClient extends AzureServiceClient { +export default class SubscriptionClient extends AzureServiceClient { /** * Initializes a new instance of the SubscriptionClient class. * @constructor @@ -31,11 +32,11 @@ declare class SubscriptionClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ constructor(credentials: ServiceClientCredentials, baseUri?: string, options?: AzureServiceClientOptions); @@ -55,4 +56,4 @@ declare class SubscriptionClient extends AzureServiceClient { tenants: operations.Tenants; } -export = SubscriptionClient; +export { SubscriptionClient, models as SubscriptionModels }; diff --git a/lib/services/resourceManagement/lib/subscription/subscriptionClient.js b/lib/services/resourceManagement/lib/subscription/subscriptionClient.js index d7e00d2370..a8dcf1d7d2 100644 --- a/lib/services/resourceManagement/lib/subscription/subscriptionClient.js +++ b/lib/services/resourceManagement/lib/subscription/subscriptionClient.js @@ -33,9 +33,9 @@ class SubscriptionClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ constructor(credentials, baseUri, options) { if (credentials === null || credentials === undefined) { @@ -76,3 +76,6 @@ class SubscriptionClient extends ServiceClient { } module.exports = SubscriptionClient; +module.exports['default'] = SubscriptionClient; +module.exports.SubscriptionClient = SubscriptionClient; +module.exports.SubscriptionModels = models; diff --git a/lib/services/resourceManagement/package-lock.json b/lib/services/resourceManagement/package-lock.json new file mode 100644 index 0000000000..696c5384e4 --- /dev/null +++ b/lib/services/resourceManagement/package-lock.json @@ -0,0 +1,473 @@ +{ + "name": "azure-arm-resource", + "version": "3.1.1-preview", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "8.10.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.21.tgz", + "integrity": "sha512-87XkD9qDXm8fIax+5y7drx84cXsu34ZZqfB7Cial3Q/2lxSoJ/+DRaWckkCbxP41wFSIrrb939VhzaNxj4eY1w==" + }, + "adal-node": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/adal-node/-/adal-node-0.1.28.tgz", + "integrity": "sha1-RoxLs+u9lrEnBmn0ucuk4AZepIU=", + "requires": { + "@types/node": "^8.0.47", + "async": ">=0.6.0", + "date-utils": "*", + "jws": "3.x.x", + "request": ">= 2.52.0", + "underscore": ">= 1.3.1", + "uuid": "^3.1.0", + "xmldom": ">= 0.1.x", + "xpath.js": "~1.1.0" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "^4.14.0" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "date-utils": { + "version": "1.2.21", + "resolved": "https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz", + "integrity": "sha1-YfsWzcEnSzyayq/+n8ad+HIKK2Q=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "ecdsa-sig-formatter": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz", + "integrity": "sha1-HFlQAPBKiJffuFAAiSoPTDOvhsM=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "^5.1.0", + "har-schema": "^2.0.0" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jwa": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.6.tgz", + "integrity": "sha512-tBO/cf++BUsJkYql/kBbJroKOgHWEigTKBAjjBEmrMGYd1QMBC74Hr4Wo2zCZw6ZrVhlJPvoMrkcOnlWR/DJfw==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.10", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.5.tgz", + "integrity": "sha512-GsCSexFADNQUr8T5HPJvayTjvPIfoyJPtLQBwn5a4WZQchcrPMPMAWcC1AzJVRDKyD6ZPROPAxgv6rfHViO4uQ==", + "requires": { + "jwa": "^1.1.5", + "safe-buffer": "^5.0.1" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + }, + "mime-db": { + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" + }, + "mime-types": { + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "requires": { + "mime-db": "~1.35.0" + } + }, + "moment": { + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" + }, + "ms-rest": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/ms-rest/-/ms-rest-2.3.6.tgz", + "integrity": "sha512-M+Lx9P7Wy4TeAk7jqPLwGS1QS1gvxF6Xo+OHv5j1g3Kcb44T/GTUuSjxTKarF6aKyeacZH1ZD++Nt7pcql7dDA==", + "requires": { + "duplexer": "^0.1.1", + "is-buffer": "^1.1.6", + "is-stream": "^1.1.0", + "moment": "^2.21.0", + "request": "^2.87.0", + "through": "^2.3.8", + "tunnel": "0.0.5", + "uuid": "^3.2.1" + } + }, + "ms-rest-azure": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/ms-rest-azure/-/ms-rest-azure-2.5.7.tgz", + "integrity": "sha512-e4lgB0z29Dx4ufu/c+PmEAYY1WXq98GYUBkE+iRx7WsxsN04lrM3B1vj8y+B8rKt7clPUE0niqB9VovVL8zvag==", + "requires": { + "adal-node": "^0.1.28", + "async": "2.6.0", + "moment": "^2.22.2", + "ms-rest": "^2.3.2", + "uuid": "^3.2.1" + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "request": { + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", + "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "requires": { + "punycode": "^1.4.1" + } + }, + "tunnel": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz", + "integrity": "sha512-gj5sdqherx4VZKMcBA4vewER7zdK25Td+z1npBqpbDys4eJrLx+SlYjJvq1bDXs2irkuJM5pf8ktaEQVipkrbA==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "xmldom": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", + "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=" + }, + "xpath.js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz", + "integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ==" + } + } +} From 8735d81ea3e330996871a06ad3f90c9bb456d8d2 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Wed, 18 Jul 2018 10:12:31 -0700 Subject: [PATCH 2/4] Bump azure-arm-resources to v3.2.1 --- lib/services/resourceManagement/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/resourceManagement/package.json b/lib/services/resourceManagement/package.json index d4232729ed..4f568523bd 100644 --- a/lib/services/resourceManagement/package.json +++ b/lib/services/resourceManagement/package.json @@ -6,7 +6,7 @@ "Zavery, Amar ", "Srinivasan, Vivek " ], - "version": "3.1.1-preview", + "version": "3.2.1-preview", "description": "Microsoft Azure Resource Management Client Library for node", "tags": [ "azure", From 51c1f42af54219f2db1869acd9f5fd2e89e871e1 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Wed, 18 Jul 2018 10:48:27 -0700 Subject: [PATCH 3/4] Regenerate policy --- .../lib/models/errorResponse.js | 4 +- .../resourceManagement/lib/models/index.d.ts | 355 +- .../resourceManagement/lib/models/index.js | 21 +- .../lib/models/policyAssignment.js | 155 + .../lib/models/policyAssignmentListResult.js | 68 + .../lib/models/policyDefinition.js | 137 + .../lib/models/policyDefinitionListResult.js | 68 + .../lib/models/policyDefinitionReference.js | 62 + .../lib/models/policySetDefinition.js | 137 + .../models/policySetDefinitionListResult.js | 68 + .../lib/models/policySku.js | 62 + .../lib/operations/index.d.ts | 2743 +++++++------ .../lib/operations/index.js | 5 +- .../lib/operations/policyAssignments.js | 3604 +++++++++++++++++ .../lib/operations/policyDefinitions.js | 3140 ++++++++++++++ .../lib/operations/policySetDefinitions.js | 3178 +++++++++++++++ .../resourceManagement/lib/policyClient.d.ts | 64 + .../resourceManagement/lib/policyClient.js | 87 + 18 files changed, 12522 insertions(+), 1436 deletions(-) create mode 100644 lib/services/resourceManagement/lib/models/policyAssignment.js create mode 100644 lib/services/resourceManagement/lib/models/policyAssignmentListResult.js create mode 100644 lib/services/resourceManagement/lib/models/policyDefinition.js create mode 100644 lib/services/resourceManagement/lib/models/policyDefinitionListResult.js create mode 100644 lib/services/resourceManagement/lib/models/policyDefinitionReference.js create mode 100644 lib/services/resourceManagement/lib/models/policySetDefinition.js create mode 100644 lib/services/resourceManagement/lib/models/policySetDefinitionListResult.js create mode 100644 lib/services/resourceManagement/lib/models/policySku.js create mode 100644 lib/services/resourceManagement/lib/operations/policyAssignments.js create mode 100644 lib/services/resourceManagement/lib/operations/policyDefinitions.js create mode 100644 lib/services/resourceManagement/lib/operations/policySetDefinitions.js create mode 100644 lib/services/resourceManagement/lib/policyClient.d.ts create mode 100644 lib/services/resourceManagement/lib/policyClient.js diff --git a/lib/services/resourceManagement/lib/models/errorResponse.js b/lib/services/resourceManagement/lib/models/errorResponse.js index 559d320b99..c138f91bdc 100644 --- a/lib/services/resourceManagement/lib/models/errorResponse.js +++ b/lib/services/resourceManagement/lib/models/errorResponse.js @@ -11,8 +11,8 @@ 'use strict'; /** - * Error reponse indicates ARM appliance is not able to process the incoming - * request. The reason is provided in the error message. + * Error reponse indicates Azure Resource Manager is not able to process the + * incoming request. The reason is provided in the error message. * */ class ErrorResponse { diff --git a/lib/services/resourceManagement/lib/models/index.d.ts b/lib/services/resourceManagement/lib/models/index.d.ts index 0fc960eae3..7fa1904f7f 100644 --- a/lib/services/resourceManagement/lib/models/index.d.ts +++ b/lib/services/resourceManagement/lib/models/index.d.ts @@ -18,310 +18,199 @@ export { CloudError } from 'ms-rest-azure'; /** * @class - * Initializes a new instance of the Plan class. + * Initializes a new instance of the PolicySku class. * @constructor - * Plan for the appliance. + * The policy sku. This property is optional, obsolete, and will be ignored. * - * @member {string} name The plan name. - * @member {string} publisher The publisher ID. - * @member {string} product The product code. - * @member {string} [promotionCode] The promotion code. - * @member {string} version The plan's version. + * @member {string} name The name of the policy sku. Possible values are A0 and + * A1. + * @member {string} [tier] The policy sku tier. Possible values are Free and + * Standard. */ -export interface Plan { +export interface PolicySku { name: string; - publisher: string; - product: string; - promotionCode?: string; - version: string; + tier?: string; } /** * @class - * Initializes a new instance of the Resource class. + * Initializes a new instance of the PolicyAssignment class. * @constructor - * Resource information. + * The policy assignment. * - * @member {string} [id] Resource ID - * @member {string} [name] Resource name - * @member {string} [type] Resource type - * @member {string} [location] Resource location - * @member {object} [tags] Resource tags + * @member {string} [displayName] The display name of the policy assignment. + * @member {string} [policyDefinitionId] The ID of the policy definition or + * policy set definition being assigned. + * @member {string} [scope] The scope for the policy assignment. + * @member {array} [notScopes] The policy's excluded scopes. + * @member {object} [parameters] Required if a parameter is used in policy + * rule. + * @member {string} [description] This message will be part of response in case + * of policy violation. + * @member {object} [metadata] The policy assignment metadata. + * @member {string} [id] The ID of the policy assignment. + * @member {string} [type] The type of the policy assignment. + * @member {string} [name] The name of the policy assignment. + * @member {object} [sku] The policy sku. This property is optional, obsolete, + * and will be ignored. + * @member {string} [sku.name] The name of the policy sku. Possible values are + * A0 and A1. + * @member {string} [sku.tier] The policy sku tier. Possible values are Free + * and Standard. */ -export interface Resource extends BaseResource { +export interface PolicyAssignment extends BaseResource { + displayName?: string; + policyDefinitionId?: string; + scope?: string; + notScopes?: string[]; + parameters?: any; + description?: string; + metadata?: any; readonly id?: string; - readonly name?: string; readonly type?: string; - location?: string; - tags?: { [propertyName: string]: string }; + readonly name?: string; + sku?: PolicySku; } /** * @class - * Initializes a new instance of the GenericResource class. + * Initializes a new instance of the ErrorResponse class. * @constructor - * Resource information. + * Error reponse indicates Azure Resource Manager is not able to process the + * incoming request. The reason is provided in the error message. * - * @member {string} [managedBy] ID of the resource that manages this resource. - * @member {object} [sku] The SKU of the resource. - * @member {string} [sku.name] The SKU name. - * @member {string} [sku.tier] The SKU tier. - * @member {string} [sku.size] The SKU size. - * @member {string} [sku.family] The SKU family. - * @member {string} [sku.model] The SKU model. - * @member {number} [sku.capacity] The SKU capacity. - * @member {object} [identity] The identity of the resource. - * @member {string} [identity.principalId] The principal ID of resource - * identity. - * @member {string} [identity.tenantId] The tenant ID of resource. - * @member {string} [identity.type] The identity type. Possible values include: - * 'SystemAssigned' + * @member {string} [httpStatus] Http status code. + * @member {string} [errorCode] Error code. + * @member {string} [errorMessage] Error message indicating why the operation + * failed. */ -export interface GenericResource extends Resource { - managedBy?: string; - sku?: Sku; - identity?: Identity; +export interface ErrorResponse { + httpStatus?: string; + errorCode?: string; + errorMessage?: string; } /** * @class - * Initializes a new instance of the Appliance class. + * Initializes a new instance of the PolicyDefinition class. * @constructor - * Information about appliance. + * The policy definition. * - * @member {string} managedResourceGroupId The managed resource group Id. - * @member {string} [applianceDefinitionId] The fully qualified path of - * appliance definition Id. - * @member {object} [parameters] Name and value pairs that define the appliance - * parameters. It can be a JObject or a well formed JSON string. - * @member {object} [outputs] Name and value pairs that define the appliance - * outputs. - * @member {string} [provisioningState] The appliance provisioning state. - * Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', - * 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', - * 'Updating' - * @member {string} [uiDefinitionUri] The blob URI where the UI definition file - * is located. - * @member {object} [plan] The plan information. - * @member {string} [plan.name] The plan name. - * @member {string} [plan.publisher] The publisher ID. - * @member {string} [plan.product] The product code. - * @member {string} [plan.promotionCode] The promotion code. - * @member {string} [plan.version] The plan's version. - * @member {string} kind The kind of the appliance. Allowed values are - * MarketPlace and ServiceCatalog. + * @member {string} [policyType] The type of policy definition. Possible values + * are NotSpecified, BuiltIn, and Custom. Possible values include: + * 'NotSpecified', 'BuiltIn', 'Custom' + * @member {string} [mode] The policy definition mode. Possible values are + * NotSpecified, Indexed, and All. Possible values include: 'NotSpecified', + * 'Indexed', 'All' + * @member {string} [displayName] The display name of the policy definition. + * @member {string} [description] The policy definition description. + * @member {object} [policyRule] The policy rule. + * @member {object} [metadata] The policy definition metadata. + * @member {object} [parameters] Required if a parameter is used in policy + * rule. + * @member {string} [id] The ID of the policy definition. + * @member {string} [name] The name of the policy definition. + * @member {string} [type] The type of the resource + * (Microsoft.Authorization/policyDefinitions). */ -export interface Appliance extends GenericResource { - managedResourceGroupId: string; - applianceDefinitionId?: string; +export interface PolicyDefinition extends BaseResource { + policyType?: string; + mode?: string; + displayName?: string; + description?: string; + policyRule?: any; + metadata?: any; parameters?: any; - readonly outputs?: any; - readonly provisioningState?: string; - uiDefinitionUri?: string; - plan?: Plan; - kind: string; -} - -/** - * @class - * Initializes a new instance of the PlanPatchable class. - * @constructor - * Plan for the appliance. - * - * @member {string} [name] The plan name. - * @member {string} [publisher] The publisher ID. - * @member {string} [product] The product code. - * @member {string} [promotionCode] The promotion code. - * @member {string} [version] The plan's version. - */ -export interface PlanPatchable { - name?: string; - publisher?: string; - product?: string; - promotionCode?: string; - version?: string; + readonly id?: string; + readonly name?: string; + readonly type?: string; } /** * @class - * Initializes a new instance of the AppliancePatchable class. + * Initializes a new instance of the PolicyDefinitionReference class. * @constructor - * Information about appliance. + * The policy definition reference. * - * @member {string} [managedResourceGroupId] The managed resource group Id. - * @member {string} [applianceDefinitionId] The fully qualified path of - * appliance definition Id. - * @member {object} [parameters] Name and value pairs that define the appliance - * parameters. It can be a JObject or a well formed JSON string. - * @member {object} [outputs] Name and value pairs that define the appliance - * outputs. - * @member {string} [provisioningState] The appliance provisioning state. - * Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', - * 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', - * 'Updating' - * @member {string} [uiDefinitionUri] The blob URI where the UI definition file - * is located. - * @member {object} [plan] The plan information. - * @member {string} [plan.name] The plan name. - * @member {string} [plan.publisher] The publisher ID. - * @member {string} [plan.product] The product code. - * @member {string} [plan.promotionCode] The promotion code. - * @member {string} [plan.version] The plan's version. - * @member {string} [kind] The kind of the appliance. Allowed values are - * MarketPlace and ServiceCatalog. + * @member {string} [policyDefinitionId] The ID of the policy definition or + * policy set definition. + * @member {object} [parameters] Required if a parameter is used in policy + * rule. */ -export interface AppliancePatchable extends GenericResource { - managedResourceGroupId?: string; - applianceDefinitionId?: string; +export interface PolicyDefinitionReference { + policyDefinitionId?: string; parameters?: any; - readonly outputs?: any; - readonly provisioningState?: string; - uiDefinitionUri?: string; - plan?: PlanPatchable; - kind?: string; -} - -/** - * @class - * Initializes a new instance of the ApplianceProviderAuthorization class. - * @constructor - * The appliance provider authorization. - * - * @member {string} principalId The provider's principal identifier. This is - * the identity that the provider will use to call ARM to manage the appliance - * resources. - * @member {string} roleDefinitionId The provider's role definition identifier. - * This role will define all the permissions that the provider must have on the - * appliance's container resource group. This role definition cannot have - * permission to delete the resource group. - */ -export interface ApplianceProviderAuthorization { - principalId: string; - roleDefinitionId: string; } /** * @class - * Initializes a new instance of the ApplianceArtifact class. + * Initializes a new instance of the PolicySetDefinition class. * @constructor - * Appliance artifact. + * The policy set definition. * - * @member {string} [name] The appliance artifact name. - * @member {string} [uri] The appliance artifact blob uri. - * @member {string} [type] The the appliance artifact type. Possible values - * include: 'Template', 'Custom' + * @member {string} [policyType] The type of policy definition. Possible values + * are NotSpecified, BuiltIn, and Custom. Possible values include: + * 'NotSpecified', 'BuiltIn', 'Custom' + * @member {string} [displayName] The display name of the policy set + * definition. + * @member {string} [description] The policy set definition description. + * @member {object} [metadata] The policy set definition metadata. + * @member {object} [parameters] The policy set definition parameters that can + * be used in policy definition references. + * @member {array} policyDefinitions An array of policy definition references. + * @member {string} [id] The ID of the policy set definition. + * @member {string} [name] The name of the policy set definition. + * @member {string} [type] The type of the resource + * (Microsoft.Authorization/policySetDefinitions). */ -export interface ApplianceArtifact { - name?: string; - uri?: string; - type?: string; -} - -/** - * @class - * Initializes a new instance of the ApplianceDefinition class. - * @constructor - * Information about appliance definition. - * - * @member {string} lockLevel The appliance lock level. Possible values - * include: 'CanNotDelete', 'ReadOnly', 'None' - * @member {string} [displayName] The appliance definition display name. - * @member {array} authorizations The appliance provider authorizations. - * @member {array} [artifacts] The collection of appliance artifacts. The - * portal will use the files specified as artifacts to construct the user - * experience of creating an appliance from an appliance definition. - * @member {string} [description] The appliance definition description. - * @member {string} packageFileUri The appliance definition package file Uri. - */ -export interface ApplianceDefinition extends GenericResource { - lockLevel: string; +export interface PolicySetDefinition extends BaseResource { + policyType?: string; displayName?: string; - authorizations: ApplianceProviderAuthorization[]; - artifacts?: ApplianceArtifact[]; description?: string; - packageFileUri: string; -} - -/** - * @class - * Initializes a new instance of the Sku class. - * @constructor - * SKU for the resource. - * - * @member {string} name The SKU name. - * @member {string} [tier] The SKU tier. - * @member {string} [size] The SKU size. - * @member {string} [family] The SKU family. - * @member {string} [model] The SKU model. - * @member {number} [capacity] The SKU capacity. - */ -export interface Sku { - name: string; - tier?: string; - size?: string; - family?: string; - model?: string; - capacity?: number; + metadata?: any; + parameters?: any; + policyDefinitions: PolicyDefinitionReference[]; + readonly id?: string; + readonly name?: string; + readonly type?: string; } -/** - * @class - * Initializes a new instance of the Identity class. - * @constructor - * Identity for the resource. - * - * @member {string} [principalId] The principal ID of resource identity. - * @member {string} [tenantId] The tenant ID of resource. - * @member {string} [type] The identity type. Possible values include: - * 'SystemAssigned' - */ -export interface Identity { - readonly principalId?: string; - readonly tenantId?: string; - type?: string; -} /** * @class - * Initializes a new instance of the ErrorResponse class. + * Initializes a new instance of the PolicyAssignmentListResult class. * @constructor - * Error reponse indicates ARM appliance is not able to process the incoming - * request. The reason is provided in the error message. + * List of policy assignments. * - * @member {string} [httpStatus] Http status code. - * @member {string} [errorCode] Error code. - * @member {string} [errorMessage] Error message indicating why the operation - * failed. + * @member {string} [nextLink] The URL to use for getting the next set of + * results. */ -export interface ErrorResponse { - httpStatus?: string; - errorCode?: string; - errorMessage?: string; +export interface PolicyAssignmentListResult extends Array { + nextLink?: string; } - /** * @class - * Initializes a new instance of the ApplianceListResult class. + * Initializes a new instance of the PolicyDefinitionListResult class. * @constructor - * List of appliances. + * List of policy definitions. * * @member {string} [nextLink] The URL to use for getting the next set of * results. */ -export interface ApplianceListResult extends Array { +export interface PolicyDefinitionListResult extends Array { nextLink?: string; } /** * @class - * Initializes a new instance of the ApplianceDefinitionListResult class. + * Initializes a new instance of the PolicySetDefinitionListResult class. * @constructor - * List of appliance definitions. + * List of policy set definitions. * * @member {string} [nextLink] The URL to use for getting the next set of * results. */ -export interface ApplianceDefinitionListResult extends Array { +export interface PolicySetDefinitionListResult extends Array { nextLink?: string; } diff --git a/lib/services/resourceManagement/lib/models/index.js b/lib/services/resourceManagement/lib/models/index.js index 317c683d60..99c469b95f 100644 --- a/lib/services/resourceManagement/lib/models/index.js +++ b/lib/services/resourceManagement/lib/models/index.js @@ -18,17 +18,12 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; -exports.Plan = require('./plan'); -exports.Resource = require('./resource'); -exports.GenericResource = require('./genericResource'); -exports.Appliance = require('./appliance'); -exports.PlanPatchable = require('./planPatchable'); -exports.AppliancePatchable = require('./appliancePatchable'); -exports.ApplianceProviderAuthorization = require('./applianceProviderAuthorization'); -exports.ApplianceArtifact = require('./applianceArtifact'); -exports.ApplianceDefinition = require('./applianceDefinition'); -exports.Sku = require('./sku'); -exports.Identity = require('./identity'); +exports.PolicySku = require('./policySku'); +exports.PolicyAssignment = require('./policyAssignment'); exports.ErrorResponse = require('./errorResponse'); -exports.ApplianceListResult = require('./applianceListResult'); -exports.ApplianceDefinitionListResult = require('./applianceDefinitionListResult'); +exports.PolicyDefinition = require('./policyDefinition'); +exports.PolicyDefinitionReference = require('./policyDefinitionReference'); +exports.PolicySetDefinition = require('./policySetDefinition'); +exports.PolicyAssignmentListResult = require('./policyAssignmentListResult'); +exports.PolicyDefinitionListResult = require('./policyDefinitionListResult'); +exports.PolicySetDefinitionListResult = require('./policySetDefinitionListResult'); diff --git a/lib/services/resourceManagement/lib/models/policyAssignment.js b/lib/services/resourceManagement/lib/models/policyAssignment.js new file mode 100644 index 0000000000..1bd6e8869a --- /dev/null +++ b/lib/services/resourceManagement/lib/models/policyAssignment.js @@ -0,0 +1,155 @@ +/* + * 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 policy assignment. + * + * @extends models['BaseResource'] + */ +class PolicyAssignment extends models['BaseResource'] { + /** + * Create a PolicyAssignment. + * @member {string} [displayName] The display name of the policy assignment. + * @member {string} [policyDefinitionId] The ID of the policy definition or + * policy set definition being assigned. + * @member {string} [scope] The scope for the policy assignment. + * @member {array} [notScopes] The policy's excluded scopes. + * @member {object} [parameters] Required if a parameter is used in policy + * rule. + * @member {string} [description] This message will be part of response in + * case of policy violation. + * @member {object} [metadata] The policy assignment metadata. + * @member {string} [id] The ID of the policy assignment. + * @member {string} [type] The type of the policy assignment. + * @member {string} [name] The name of the policy assignment. + * @member {object} [sku] The policy sku. This property is optional, + * obsolete, and will be ignored. + * @member {string} [sku.name] The name of the policy sku. Possible values + * are A0 and A1. + * @member {string} [sku.tier] The policy sku tier. Possible values are Free + * and Standard. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PolicyAssignment + * + * @returns {object} metadata of PolicyAssignment + * + */ + mapper() { + return { + required: false, + serializedName: 'PolicyAssignment', + type: { + name: 'Composite', + className: 'PolicyAssignment', + modelProperties: { + displayName: { + required: false, + serializedName: 'properties.displayName', + type: { + name: 'String' + } + }, + policyDefinitionId: { + required: false, + serializedName: 'properties.policyDefinitionId', + type: { + name: 'String' + } + }, + scope: { + required: false, + serializedName: 'properties.scope', + type: { + name: 'String' + } + }, + notScopes: { + required: false, + serializedName: 'properties.notScopes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Object' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + metadata: { + required: false, + serializedName: 'properties.metadata', + type: { + name: 'Object' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'PolicySku' + } + } + } + } + }; + } +} + +module.exports = PolicyAssignment; diff --git a/lib/services/resourceManagement/lib/models/policyAssignmentListResult.js b/lib/services/resourceManagement/lib/models/policyAssignmentListResult.js new file mode 100644 index 0000000000..f54fe0542a --- /dev/null +++ b/lib/services/resourceManagement/lib/models/policyAssignmentListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * List of policy assignments. + */ +class PolicyAssignmentListResult extends Array { + /** + * Create a PolicyAssignmentListResult. + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PolicyAssignmentListResult + * + * @returns {object} metadata of PolicyAssignmentListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'PolicyAssignmentListResult', + type: { + name: 'Composite', + className: 'PolicyAssignmentListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PolicyAssignmentElementType', + type: { + name: 'Composite', + className: 'PolicyAssignment' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PolicyAssignmentListResult; diff --git a/lib/services/resourceManagement/lib/models/policyDefinition.js b/lib/services/resourceManagement/lib/models/policyDefinition.js new file mode 100644 index 0000000000..7b7d078b11 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/policyDefinition.js @@ -0,0 +1,137 @@ +/* + * 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 policy definition. + * + * @extends models['BaseResource'] + */ +class PolicyDefinition extends models['BaseResource'] { + /** + * Create a PolicyDefinition. + * @member {string} [policyType] The type of policy definition. Possible + * values are NotSpecified, BuiltIn, and Custom. Possible values include: + * 'NotSpecified', 'BuiltIn', 'Custom' + * @member {string} [mode] The policy definition mode. Possible values are + * NotSpecified, Indexed, and All. Possible values include: 'NotSpecified', + * 'Indexed', 'All' + * @member {string} [displayName] The display name of the policy definition. + * @member {string} [description] The policy definition description. + * @member {object} [policyRule] The policy rule. + * @member {object} [metadata] The policy definition metadata. + * @member {object} [parameters] Required if a parameter is used in policy + * rule. + * @member {string} [id] The ID of the policy definition. + * @member {string} [name] The name of the policy definition. + * @member {string} [type] The type of the resource + * (Microsoft.Authorization/policyDefinitions). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PolicyDefinition + * + * @returns {object} metadata of PolicyDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'PolicyDefinition', + type: { + name: 'Composite', + className: 'PolicyDefinition', + modelProperties: { + policyType: { + required: false, + serializedName: 'properties.policyType', + type: { + name: 'String' + } + }, + mode: { + required: false, + serializedName: 'properties.mode', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'properties.displayName', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + policyRule: { + required: false, + serializedName: 'properties.policyRule', + type: { + name: 'Object' + } + }, + metadata: { + required: false, + serializedName: 'properties.metadata', + type: { + name: 'Object' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Object' + } + }, + 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 = PolicyDefinition; diff --git a/lib/services/resourceManagement/lib/models/policyDefinitionListResult.js b/lib/services/resourceManagement/lib/models/policyDefinitionListResult.js new file mode 100644 index 0000000000..f34f1cf1f8 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/policyDefinitionListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * List of policy definitions. + */ +class PolicyDefinitionListResult extends Array { + /** + * Create a PolicyDefinitionListResult. + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PolicyDefinitionListResult + * + * @returns {object} metadata of PolicyDefinitionListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'PolicyDefinitionListResult', + type: { + name: 'Composite', + className: 'PolicyDefinitionListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PolicyDefinitionElementType', + type: { + name: 'Composite', + className: 'PolicyDefinition' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PolicyDefinitionListResult; diff --git a/lib/services/resourceManagement/lib/models/policyDefinitionReference.js b/lib/services/resourceManagement/lib/models/policyDefinitionReference.js new file mode 100644 index 0000000000..d677a17728 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/policyDefinitionReference.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 policy definition reference. + * + */ +class PolicyDefinitionReference { + /** + * Create a PolicyDefinitionReference. + * @member {string} [policyDefinitionId] The ID of the policy definition or + * policy set definition. + * @member {object} [parameters] Required if a parameter is used in policy + * rule. + */ + constructor() { + } + + /** + * Defines the metadata of PolicyDefinitionReference + * + * @returns {object} metadata of PolicyDefinitionReference + * + */ + mapper() { + return { + required: false, + serializedName: 'PolicyDefinitionReference', + type: { + name: 'Composite', + className: 'PolicyDefinitionReference', + modelProperties: { + policyDefinitionId: { + required: false, + serializedName: 'policyDefinitionId', + type: { + name: 'String' + } + }, + parameters: { + required: false, + serializedName: 'parameters', + type: { + name: 'Object' + } + } + } + } + }; + } +} + +module.exports = PolicyDefinitionReference; diff --git a/lib/services/resourceManagement/lib/models/policySetDefinition.js b/lib/services/resourceManagement/lib/models/policySetDefinition.js new file mode 100644 index 0000000000..278747c98b --- /dev/null +++ b/lib/services/resourceManagement/lib/models/policySetDefinition.js @@ -0,0 +1,137 @@ +/* + * 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 policy set definition. + * + * @extends models['BaseResource'] + */ +class PolicySetDefinition extends models['BaseResource'] { + /** + * Create a PolicySetDefinition. + * @member {string} [policyType] The type of policy definition. Possible + * values are NotSpecified, BuiltIn, and Custom. Possible values include: + * 'NotSpecified', 'BuiltIn', 'Custom' + * @member {string} [displayName] The display name of the policy set + * definition. + * @member {string} [description] The policy set definition description. + * @member {object} [metadata] The policy set definition metadata. + * @member {object} [parameters] The policy set definition parameters that + * can be used in policy definition references. + * @member {array} policyDefinitions An array of policy definition + * references. + * @member {string} [id] The ID of the policy set definition. + * @member {string} [name] The name of the policy set definition. + * @member {string} [type] The type of the resource + * (Microsoft.Authorization/policySetDefinitions). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PolicySetDefinition + * + * @returns {object} metadata of PolicySetDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'PolicySetDefinition', + type: { + name: 'Composite', + className: 'PolicySetDefinition', + modelProperties: { + policyType: { + required: false, + serializedName: 'properties.policyType', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'properties.displayName', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + metadata: { + required: false, + serializedName: 'properties.metadata', + type: { + name: 'Object' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Object' + } + }, + policyDefinitions: { + required: true, + serializedName: 'properties.policyDefinitions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PolicyDefinitionReferenceElementType', + type: { + name: 'Composite', + className: 'PolicyDefinitionReference' + } + } + } + }, + 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 = PolicySetDefinition; diff --git a/lib/services/resourceManagement/lib/models/policySetDefinitionListResult.js b/lib/services/resourceManagement/lib/models/policySetDefinitionListResult.js new file mode 100644 index 0000000000..a3892c6aff --- /dev/null +++ b/lib/services/resourceManagement/lib/models/policySetDefinitionListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * List of policy set definitions. + */ +class PolicySetDefinitionListResult extends Array { + /** + * Create a PolicySetDefinitionListResult. + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PolicySetDefinitionListResult + * + * @returns {object} metadata of PolicySetDefinitionListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'PolicySetDefinitionListResult', + type: { + name: 'Composite', + className: 'PolicySetDefinitionListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PolicySetDefinitionElementType', + type: { + name: 'Composite', + className: 'PolicySetDefinition' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PolicySetDefinitionListResult; diff --git a/lib/services/resourceManagement/lib/models/policySku.js b/lib/services/resourceManagement/lib/models/policySku.js new file mode 100644 index 0000000000..69b4f0a9b9 --- /dev/null +++ b/lib/services/resourceManagement/lib/models/policySku.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 policy sku. This property is optional, obsolete, and will be ignored. + * + */ +class PolicySku { + /** + * Create a PolicySku. + * @member {string} name The name of the policy sku. Possible values are A0 + * and A1. + * @member {string} [tier] The policy sku tier. Possible values are Free and + * Standard. + */ + constructor() { + } + + /** + * Defines the metadata of PolicySku + * + * @returns {object} metadata of PolicySku + * + */ + mapper() { + return { + required: false, + serializedName: 'PolicySku', + type: { + name: 'Composite', + className: 'PolicySku', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + tier: { + required: false, + serializedName: 'tier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PolicySku; diff --git a/lib/services/resourceManagement/lib/operations/index.d.ts b/lib/services/resourceManagement/lib/operations/index.d.ts index ab5b941911..037935befa 100644 --- a/lib/services/resourceManagement/lib/operations/index.d.ts +++ b/lib/services/resourceManagement/lib/operations/index.d.ts @@ -14,20 +14,32 @@ import * as models from '../models'; /** * @class - * Appliances + * PolicyAssignments * __NOTE__: An instance of this class is automatically created for an - * instance of the ManagedApplicationClient. + * instance of the PolicyClient. */ -export interface Appliances { +export interface PolicyAssignments { /** - * Gets the appliance. + * @summary Deletes a policy assignment. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * This operation deletes a policy assignment, given its name and the scope it + * was created in. The scope of a policy assignment is the part of its ID + * preceding + * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * - * @param {string} applianceName The name of the appliance. + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment to + * delete. * * @param {object} [options] Optional Parameters. * @@ -36,19 +48,31 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(scope: string, policyAssignmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the appliance. + * @summary Deletes a policy assignment. + * + * This operation deletes a policy assignment, given its name and the scope it + * was created in. The scope of a policy assignment is the part of its ID + * preceding + * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * - * @param {string} applianceName The name of the appliance. + * @param {string} policyAssignmentName The name of the policy assignment to + * delete. * * @param {object} [options] Optional Parameters. * @@ -62,7 +86,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {Appliance} - The deserialized result object. + * @resolve {PolicyAssignment} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -70,25 +94,65 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Appliance} [result] - The deserialized result object if an error did not occur. - * See {@link Appliance} for more information. + * {PolicyAssignment} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignment} 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, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, applianceName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, applianceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(scope: string, policyAssignmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(scope: string, policyAssignmentName: string, callback: ServiceCallback): void; + deleteMethod(scope: string, policyAssignmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the appliance. + * @summary Creates or updates a policy assignment. + * + * This operation creates or updates a policy assignment with the given scope + * and name. Policy assignments apply to all resources contained within their + * scope. For example, when you assign a policy at resource group scope, that + * policy applies to all resources in the group. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment. + * + * @param {object} parameters Parameters for the policy assignment. + * + * @param {string} [parameters.displayName] The display name of the policy + * assignment. + * + * @param {string} [parameters.policyDefinitionId] The ID of the policy + * definition or policy set definition being assigned. + * + * @param {string} [parameters.scope] The scope for the policy assignment. + * + * @param {array} [parameters.notScopes] The policy's excluded scopes. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {string} [parameters.description] This message will be part of + * response in case of policy violation. * - * @param {string} applianceName The name of the appliance. + * @param {object} [parameters.metadata] The policy assignment metadata. + * + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. + * + * @param {string} parameters.sku.name The name of the policy sku. Possible + * values are A0 and A1. + * + * @param {string} [parameters.sku.tier] The policy sku tier. Possible values + * are Free and Standard. * * @param {object} [options] Optional Parameters. * @@ -97,19 +161,59 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(scope: string, policyAssignmentName: string, parameters: models.PolicyAssignment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the appliance. + * @summary Creates or updates a policy assignment. + * + * This operation creates or updates a policy assignment with the given scope + * and name. Policy assignments apply to all resources contained within their + * scope. For example, when you assign a policy at resource group scope, that + * policy applies to all resources in the group. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment. + * + * @param {object} parameters Parameters for the policy assignment. + * + * @param {string} [parameters.displayName] The display name of the policy + * assignment. + * + * @param {string} [parameters.policyDefinitionId] The ID of the policy + * definition or policy set definition being assigned. + * + * @param {string} [parameters.scope] The scope for the policy assignment. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {array} [parameters.notScopes] The policy's excluded scopes. * - * @param {string} applianceName The name of the appliance. + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} [parameters.description] This message will be part of + * response in case of policy violation. + * + * @param {object} [parameters.metadata] The policy assignment metadata. + * + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. + * + * @param {string} parameters.sku.name The name of the policy sku. Possible + * values are A0 and A1. + * + * @param {string} [parameters.sku.tier] The policy sku tier. Possible values + * are Free and Standard. * * @param {object} [options] Optional Parameters. * @@ -123,7 +227,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {PolicyAssignment} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -131,152 +235,308 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {PolicyAssignment} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignment} 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. */ - deleteMethod(resourceGroupName: string, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, applianceName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, applianceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(scope: string, policyAssignmentName: string, parameters: models.PolicyAssignment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(scope: string, policyAssignmentName: string, parameters: models.PolicyAssignment, callback: ServiceCallback): void; + create(scope: string, policyAssignmentName: string, parameters: models.PolicyAssignment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new appliance. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @summary Retrieves a policy assignment. * - * @param {string} applianceName The name of the appliance. + * This operation retrieves a single policy assignment, given its name and the + * scope it was created at. * - * @param {object} parameters Parameters supplied to the create or update an - * appliance. + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * - * @param {string} parameters.managedResourceGroupId The managed resource group - * Id. + * @param {string} policyAssignmentName The name of the policy assignment to + * get. * - * @param {string} [parameters.applianceDefinitionId] The fully qualified path - * of appliance definition Id. + * @param {object} [options] Optional Parameters. * - * @param {object} [parameters.parameters] Name and value pairs that define the - * appliance parameters. It can be a JObject or a well formed JSON string. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI - * definition file is located. + * @returns {Promise} A promise is returned * - * @param {object} [parameters.plan] The plan information. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} parameters.plan.name The plan name. + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(scope: string, policyAssignmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Retrieves a policy assignment. * - * @param {string} parameters.plan.publisher The publisher ID. + * This operation retrieves a single policy assignment, given its name and the + * scope it was created at. * - * @param {string} parameters.plan.product The product code. + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' * - * @param {string} [parameters.plan.promotionCode] The promotion code. + * @param {string} policyAssignmentName The name of the policy assignment to + * get. * - * @param {string} parameters.plan.version The plan's version. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.kind The kind of the appliance. Allowed values - * are MarketPlace and ServiceCatalog. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {object} [parameters.sku] The SKU of the resource. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {string} parameters.sku.name The SKU name. + * {Promise} A promise is returned. * - * @param {string} [parameters.sku.tier] The SKU tier. + * @resolve {PolicyAssignment} - The deserialized result object. * - * @param {string} [parameters.sku.size] The SKU size. + * @reject {Error|ServiceError} - The error object. * - * @param {string} [parameters.sku.family] The SKU family. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [parameters.sku.model] The SKU model. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {number} [parameters.sku.capacity] The SKU capacity. + * {PolicyAssignment} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignment} for more information. * - * @param {object} [parameters.identity] The identity of the resource. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(scope: string, policyAssignmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(scope: string, policyAssignmentName: string, callback: ServiceCallback): void; + get(scope: string, policyAssignmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. + * + * @param {string} resourceGroupName The name of the resource group that + * contains policy assignments. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, applianceName: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listForResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new appliance. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. + * + * @param {string} resourceGroupName The name of the resource group that + * contains policy assignments. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * - * @param {string} applianceName The name of the appliance. - * - * @param {object} parameters Parameters supplied to the create or update an - * appliance. - * - * @param {string} parameters.managedResourceGroupId The managed resource group - * Id. - * - * @param {string} [parameters.applianceDefinitionId] The fully qualified path - * of appliance definition Id. - * - * @param {object} [parameters.parameters] Name and value pairs that define the - * appliance parameters. It can be a JObject or a well formed JSON string. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI - * definition file is located. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * - * @param {object} [parameters.plan] The plan information. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} parameters.plan.name The plan name. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {string} parameters.plan.publisher The publisher ID. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {string} parameters.plan.product The product code. + * {Promise} A promise is returned. * - * @param {string} [parameters.plan.promotionCode] The promotion code. + * @resolve {PolicyAssignmentListResult} - The deserialized result object. * - * @param {string} parameters.plan.version The plan's version. + * @reject {Error|ServiceError} - The error object. * - * @param {string} parameters.kind The kind of the appliance. Allowed values - * are MarketPlace and ServiceCatalog. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {object} [parameters.sku] The SKU of the resource. + * {PolicyAssignmentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignmentListResult} for more + * information. * - * @param {string} parameters.sku.name The SKU name. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [parameters.sku.tier] The SKU tier. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listForResourceGroup(resourceGroupName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listForResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listForResourceGroup(resourceGroupName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param {string} resourceGroupName The name of the resource group containing + * the resource. + * + * @param {string} resourceProviderNamespace The namespace of the resource + * provider. For example, the namespace of a virtual machine is + * Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * + * @param {string} parentResourcePath The parent resource path. Use empty + * string if there is none. + * + * @param {string} resourceType The resource type name. For example the type + * name of a web app is 'sites' (from Microsoft.Web/sites). + * + * @param {string} resourceName The name of the resource. * - * @param {string} [parameters.sku.size] The SKU size. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.sku.family] The SKU family. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * - * @param {string} [parameters.sku.model] The SKU model. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {number} [parameters.sku.capacity] The SKU capacity. + * @returns {Promise} A promise is returned * - * @param {object} [parameters.identity] The identity of the resource. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @reject {Error|ServiceError} - The error object. + */ + listForResourceWithHttpOperationResponse(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param {string} resourceGroupName The name of the resource group containing + * the resource. + * + * @param {string} resourceProviderNamespace The namespace of the resource + * provider. For example, the namespace of a virtual machine is + * Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * + * @param {string} parentResourcePath The parent resource path. Use empty + * string if there is none. + * + * @param {string} resourceType The resource type name. For example the type + * name of a web app is 'sites' (from Microsoft.Web/sites). + * + * @param {string} resourceName The name of the resource. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -287,7 +547,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {Appliance} - The deserialized result object. + * @resolve {PolicyAssignmentListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -295,156 +555,302 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Appliance} [result] - The deserialized result object if an error did not occur. - * See {@link Appliance} for more information. + * {PolicyAssignmentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignmentListResult} 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, applianceName: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, applianceName: string, parameters: models.Appliance, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, applianceName: string, parameters: models.Appliance, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, callback: ServiceCallback): void; + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing appliance. The only value that can be updated via PATCH - * currently is the tags. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {object} [options] Optional Parameters. * - * @param {string} applianceName The name of the appliance. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * - * @param {object} [options] Optional Parameters. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} [options.parameters] Parameters supplied to update an - * existing appliance. + * @returns {Promise} A promise is returned * - * @param {string} options.parameters.managedResourceGroupId The managed - * resource group Id. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [options.parameters.applianceDefinitionId] The fully - * qualified path of appliance definition Id. + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * - * @param {object} [options.parameters.parameters] Name and value pairs that - * define the appliance parameters. It can be a JObject or a well formed JSON - * string. + * @param {object} [options] Optional Parameters. * - * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the - * UI definition file is located. + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. * - * @param {object} [options.parameters.plan] The plan information. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} options.parameters.plan.name The plan name. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {string} options.parameters.plan.publisher The publisher ID. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {string} options.parameters.plan.product The product code. + * {Promise} A promise is returned. * - * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * @resolve {PolicyAssignmentListResult} - The deserialized result object. * - * @param {string} options.parameters.plan.version The plan's version. + * @reject {Error|ServiceError} - The error object. * - * @param {string} options.parameters.kind The kind of the appliance. Allowed - * values are MarketPlace and ServiceCatalog. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [options.parameters.managedBy] ID of the resource that - * manages this resource. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {object} [options.parameters.sku] The SKU of the resource. + * {PolicyAssignmentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignmentListResult} for more + * information. * - * @param {string} options.parameters.sku.name The SKU name. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [options.parameters.sku.tier] The SKU tier. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a policy assignment. + * + * This operation deletes the policy with the given ID. Policy assignment IDs + * have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid formats for {scope} are: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}' + * (management group), '/subscriptions/{subscriptionId}' (subscription), + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + * (resource group), or + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * (resource). + * + * @param {string} policyAssignmentId The ID of the policy assignment to + * delete. Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * - * @param {string} [options.parameters.sku.size] The SKU size. + * @param {object} [options] Optional Parameters. * - * @param {string} [options.parameters.sku.family] The SKU family. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [options.parameters.sku.model] The SKU model. + * @returns {Promise} A promise is returned * - * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {object} [options.parameters.identity] The identity of the resource. + * @reject {Error|ServiceError} - The error object. + */ + deleteByIdWithHttpOperationResponse(policyAssignmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a policy assignment. + * + * This operation deletes the policy with the given ID. Policy assignment IDs + * have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid formats for {scope} are: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}' + * (management group), '/subscriptions/{subscriptionId}' (subscription), + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + * (resource group), or + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * (resource). + * + * @param {string} policyAssignmentId The ID of the policy assignment to + * delete. Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * - * @param {string} [options.parameters.identity.type] The identity type. - * Possible values include: 'SystemAssigned' + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * - * @returns {Promise} A promise is returned + * @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. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * {Promise} A promise is returned. * - * @reject {Error|ServiceError} - The error object. + * @resolve {PolicyAssignment} - 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. + * + * {PolicyAssignment} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignment} 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. */ - updateWithHttpOperationResponse(resourceGroupName: string, applianceName: string, options?: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteById(policyAssignmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteById(policyAssignmentId: string, callback: ServiceCallback): void; + deleteById(policyAssignmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** - * Updates an existing appliance. The only value that can be updated via PATCH - * currently is the tags. + * @summary Creates or updates a policy assignment. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * This operation creates or updates the policy assignment with the given ID. + * Policy assignments made on a scope apply to all resources contained in that + * scope. For example, when you assign a policy to a resource group that policy + * applies to all resources in the group. Policy assignment IDs have this + * format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * - * @param {string} applianceName The name of the appliance. + * @param {string} policyAssignmentId The ID of the policy assignment to + * create. Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters Parameters for policy assignment. + * + * @param {string} [parameters.displayName] The display name of the policy + * assignment. * - * @param {object} [options.parameters] Parameters supplied to update an - * existing appliance. + * @param {string} [parameters.policyDefinitionId] The ID of the policy + * definition or policy set definition being assigned. * - * @param {string} options.parameters.managedResourceGroupId The managed - * resource group Id. + * @param {string} [parameters.scope] The scope for the policy assignment. * - * @param {string} [options.parameters.applianceDefinitionId] The fully - * qualified path of appliance definition Id. + * @param {array} [parameters.notScopes] The policy's excluded scopes. * - * @param {object} [options.parameters.parameters] Name and value pairs that - * define the appliance parameters. It can be a JObject or a well formed JSON - * string. + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. * - * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the - * UI definition file is located. + * @param {string} [parameters.description] This message will be part of + * response in case of policy violation. * - * @param {object} [options.parameters.plan] The plan information. + * @param {object} [parameters.metadata] The policy assignment metadata. * - * @param {string} options.parameters.plan.name The plan name. + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. * - * @param {string} options.parameters.plan.publisher The publisher ID. + * @param {string} parameters.sku.name The name of the policy sku. Possible + * values are A0 and A1. * - * @param {string} options.parameters.plan.product The product code. + * @param {string} [parameters.sku.tier] The policy sku tier. Possible values + * are Free and Standard. * - * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * @param {object} [options] Optional Parameters. * - * @param {string} options.parameters.plan.version The plan's version. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} options.parameters.kind The kind of the appliance. Allowed - * values are MarketPlace and ServiceCatalog. + * @returns {Promise} A promise is returned * - * @param {string} [options.parameters.managedBy] ID of the resource that - * manages this resource. + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createByIdWithHttpOperationResponse(policyAssignmentId: string, parameters: models.PolicyAssignment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates a policy assignment. * - * @param {object} [options.parameters.sku] The SKU of the resource. + * This operation creates or updates the policy assignment with the given ID. + * Policy assignments made on a scope apply to all resources contained in that + * scope. For example, when you assign a policy to a resource group that policy + * applies to all resources in the group. Policy assignment IDs have this + * format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. * - * @param {string} options.parameters.sku.name The SKU name. + * @param {string} policyAssignmentId The ID of the policy assignment to + * create. Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * - * @param {string} [options.parameters.sku.tier] The SKU tier. + * @param {object} parameters Parameters for policy assignment. * - * @param {string} [options.parameters.sku.size] The SKU size. + * @param {string} [parameters.displayName] The display name of the policy + * assignment. * - * @param {string} [options.parameters.sku.family] The SKU family. + * @param {string} [parameters.policyDefinitionId] The ID of the policy + * definition or policy set definition being assigned. * - * @param {string} [options.parameters.sku.model] The SKU model. + * @param {string} [parameters.scope] The scope for the policy assignment. * - * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * @param {array} [parameters.notScopes] The policy's excluded scopes. * - * @param {object} [options.parameters.identity] The identity of the resource. + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. * - * @param {string} [options.parameters.identity.type] The identity type. - * Possible values include: 'SystemAssigned' + * @param {string} [parameters.description] This message will be part of + * response in case of policy violation. + * + * @param {object} [parameters.metadata] The policy assignment metadata. + * + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. + * + * @param {string} parameters.sku.name The name of the policy sku. Possible + * values are A0 and A1. + * + * @param {string} [parameters.sku.tier] The policy sku tier. Possible values + * are Free and Standard. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -456,7 +862,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {Appliance} - The deserialized result object. + * @resolve {PolicyAssignment} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -464,23 +870,35 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Appliance} [result] - The deserialized result object if an error did not occur. - * See {@link Appliance} for more information. + * {PolicyAssignment} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignment} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, applianceName: string, options?: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, applianceName: string, callback: ServiceCallback): void; - update(resourceGroupName: string, applianceName: string, options: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createById(policyAssignmentId: string, parameters: models.PolicyAssignment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createById(policyAssignmentId: string, parameters: models.PolicyAssignment, callback: ServiceCallback): void; + createById(policyAssignmentId: string, parameters: models.PolicyAssignment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the appliances within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @summary Retrieves the policy assignment with the given ID. + * + * The operation retrieves the policy assignment with the given ID. Policy + * assignment IDs have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param {string} policyAssignmentId The ID of the policy assignment to get. + * Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -489,17 +907,29 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getByIdWithHttpOperationResponse(policyAssignmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the appliances within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @summary Retrieves the policy assignment with the given ID. + * + * The operation retrieves the policy assignment with the given ID. Policy + * assignment IDs have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param {string} policyAssignmentId The ID of the policy assignment to get. + * Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. * * @param {object} [options] Optional Parameters. * @@ -513,7 +943,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {ApplianceListResult} - The deserialized result object. + * @resolve {PolicyAssignment} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -521,20 +951,37 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceListResult} for more information. + * {PolicyAssignment} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignment} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getById(policyAssignmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getById(policyAssignmentId: string, callback: ServiceCallback): void; + getById(policyAssignmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the appliances within a subscription. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -543,14 +990,31 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listBySubscriptionWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listForResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the appliances within a subscription. + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -564,7 +1028,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {ApplianceListResult} - The deserialized result object. + * @resolve {PolicyAssignmentListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -572,25 +1036,52 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceListResult} for more information. + * {PolicyAssignmentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignmentListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listBySubscription(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBySubscription(callback: ServiceCallback): void; - listBySubscription(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listForResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listForResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listForResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the appliance. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -599,19 +1090,45 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getByIdWithHttpOperationResponse(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listForResourceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the appliance. + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -625,7 +1142,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {Appliance} - The deserialized result object. + * @resolve {PolicyAssignmentListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -633,25 +1150,38 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Appliance} [result] - The deserialized result object if an error did not occur. - * See {@link Appliance} for more information. + * {PolicyAssignmentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignmentListResult} 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. */ - getById(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getById(applianceId: string, callback: ServiceCallback): void; - getById(applianceId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listForResourceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listForResourceNext(nextPageLink: string, callback: ServiceCallback): void; + listForResourceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the appliance. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -660,19 +1190,31 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteByIdWithHttpOperationResponse(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the appliance. + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -686,7 +1228,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {PolicyAssignmentListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -694,76 +1236,58 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {PolicyAssignmentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignmentListResult} 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. */ - deleteById(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteById(applianceId: string, callback: ServiceCallback): void; - deleteById(applianceId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * PolicyDefinitions + * __NOTE__: An instance of this class is automatically created for an + * instance of the PolicyClient. + */ +export interface PolicyDefinitions { /** - * Creates a new appliance. - * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * - * @param {object} parameters Parameters supplied to the create or update an - * appliance. - * - * @param {string} parameters.managedResourceGroupId The managed resource group - * Id. - * - * @param {string} [parameters.applianceDefinitionId] The fully qualified path - * of appliance definition Id. - * - * @param {object} [parameters.parameters] Name and value pairs that define the - * appliance parameters. It can be a JObject or a well formed JSON string. - * - * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI - * definition file is located. - * - * @param {object} [parameters.plan] The plan information. - * - * @param {string} parameters.plan.name The plan name. - * - * @param {string} parameters.plan.publisher The publisher ID. + * @summary Creates or updates a policy definition in a subscription. * - * @param {string} parameters.plan.product The product code. + * This operation creates or updates a policy definition in the given + * subscription with the given name. * - * @param {string} [parameters.plan.promotionCode] The promotion code. + * @param {string} policyDefinitionName The name of the policy definition to + * create. * - * @param {string} parameters.plan.version The plan's version. + * @param {object} parameters The policy definition properties. * - * @param {string} parameters.kind The kind of the appliance. Allowed values - * are MarketPlace and ServiceCatalog. + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' * - * @param {object} [parameters.sku] The SKU of the resource. - * - * @param {string} parameters.sku.name The SKU name. - * - * @param {string} [parameters.sku.tier] The SKU tier. - * - * @param {string} [parameters.sku.size] The SKU size. - * - * @param {string} [parameters.sku.family] The SKU family. + * @param {string} [parameters.displayName] The display name of the policy + * definition. * - * @param {string} [parameters.sku.model] The SKU model. + * @param {string} [parameters.description] The policy definition description. * - * @param {number} [parameters.sku.capacity] The SKU capacity. + * @param {object} [parameters.policyRule] The policy rule. * - * @param {object} [parameters.identity] The identity of the resource. + * @param {object} [parameters.metadata] The policy definition metadata. * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. * * @param {object} [options] Optional Parameters. * @@ -772,71 +1296,42 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateByIdWithHttpOperationResponse(applianceId: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(policyDefinitionName: string, parameters: models.PolicyDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new appliance. - * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * - * @param {object} parameters Parameters supplied to the create or update an - * appliance. - * - * @param {string} parameters.managedResourceGroupId The managed resource group - * Id. - * - * @param {string} [parameters.applianceDefinitionId] The fully qualified path - * of appliance definition Id. - * - * @param {object} [parameters.parameters] Name and value pairs that define the - * appliance parameters. It can be a JObject or a well formed JSON string. - * - * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI - * definition file is located. + * @summary Creates or updates a policy definition in a subscription. * - * @param {object} [parameters.plan] The plan information. + * This operation creates or updates a policy definition in the given + * subscription with the given name. * - * @param {string} parameters.plan.name The plan name. + * @param {string} policyDefinitionName The name of the policy definition to + * create. * - * @param {string} parameters.plan.publisher The publisher ID. + * @param {object} parameters The policy definition properties. * - * @param {string} parameters.plan.product The product code. + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' * - * @param {string} [parameters.plan.promotionCode] The promotion code. + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' * - * @param {string} parameters.plan.version The plan's version. - * - * @param {string} parameters.kind The kind of the appliance. Allowed values - * are MarketPlace and ServiceCatalog. - * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. - * - * @param {object} [parameters.sku] The SKU of the resource. - * - * @param {string} parameters.sku.name The SKU name. - * - * @param {string} [parameters.sku.tier] The SKU tier. - * - * @param {string} [parameters.sku.size] The SKU size. - * - * @param {string} [parameters.sku.family] The SKU family. + * @param {string} [parameters.displayName] The display name of the policy + * definition. * - * @param {string} [parameters.sku.model] The SKU model. + * @param {string} [parameters.description] The policy definition description. * - * @param {number} [parameters.sku.capacity] The SKU capacity. + * @param {object} [parameters.policyRule] The policy rule. * - * @param {object} [parameters.identity] The identity of the resource. + * @param {object} [parameters.metadata] The policy definition metadata. * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. * * @param {object} [options] Optional Parameters. * @@ -850,7 +1345,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {Appliance} - The deserialized result object. + * @resolve {PolicyDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -858,156 +1353,173 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Appliance} [result] - The deserialized result object if an error did not occur. - * See {@link Appliance} for more information. + * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinition} 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. */ - createOrUpdateById(applianceId: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdateById(applianceId: string, parameters: models.Appliance, callback: ServiceCallback): void; - createOrUpdateById(applianceId: string, parameters: models.Appliance, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(policyDefinitionName: string, parameters: models.PolicyDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(policyDefinitionName: string, parameters: models.PolicyDefinition, callback: ServiceCallback): void; + createOrUpdate(policyDefinitionName: string, parameters: models.PolicyDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing appliance. The only value that can be updated via PATCH - * currently is the tags. + * @summary Deletes a policy definition in a subscription. * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * This operation deletes the policy definition in the given subscription with + * the given name. * - * @param {object} [options] Optional Parameters. + * @param {string} policyDefinitionName The name of the policy definition to + * delete. * - * @param {object} [options.parameters] Parameters supplied to update an - * existing appliance. + * @param {object} [options] Optional Parameters. * - * @param {string} options.parameters.managedResourceGroupId The managed - * resource group Id. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [options.parameters.applianceDefinitionId] The fully - * qualified path of appliance definition Id. + * @returns {Promise} A promise is returned * - * @param {object} [options.parameters.parameters] Name and value pairs that - * define the appliance parameters. It can be a JObject or a well formed JSON - * string. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the - * UI definition file is located. + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a policy definition in a subscription. * - * @param {object} [options.parameters.plan] The plan information. + * This operation deletes the policy definition in the given subscription with + * the given name. * - * @param {string} options.parameters.plan.name The plan name. + * @param {string} policyDefinitionName The name of the policy definition to + * delete. * - * @param {string} options.parameters.plan.publisher The publisher ID. + * @param {object} [options] Optional Parameters. * - * @param {string} options.parameters.plan.product The product code. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {string} options.parameters.plan.version The plan's version. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {string} options.parameters.kind The kind of the appliance. Allowed - * values are MarketPlace and ServiceCatalog. + * {Promise} A promise is returned. * - * @param {string} [options.parameters.managedBy] ID of the resource that - * manages this resource. + * @resolve {null} - The deserialized result object. * - * @param {object} [options.parameters.sku] The SKU of the resource. + * @reject {Error|ServiceError} - The error object. * - * @param {string} options.parameters.sku.name The SKU name. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [options.parameters.sku.tier] The SKU tier. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [options.parameters.sku.size] The SKU size. + * {null} [result] - The deserialized result object if an error did not occur. * - * @param {string} [options.parameters.sku.family] The SKU family. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [options.parameters.sku.model] The SKU model. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(policyDefinitionName: string, callback: ServiceCallback): void; + deleteMethod(policyDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieves a policy definition in a subscription. * - * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * This operation retrieves the policy definition in the given subscription + * with the given name. * - * @param {object} [options.parameters.identity] The identity of the resource. + * @param {string} policyDefinitionName The name of the policy definition to + * get. * - * @param {string} [options.parameters.identity.type] The identity type. - * Possible values include: 'SystemAssigned' + * @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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateByIdWithHttpOperationResponse(applianceId: string, options?: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates an existing appliance. The only value that can be updated via PATCH - * currently is the tags. + * @summary Retrieves a policy definition in a subscription. * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * This operation retrieves the policy definition in the given subscription + * with the given name. * - * @param {object} [options] Optional Parameters. + * @param {string} policyDefinitionName The name of the policy definition to + * get. * - * @param {object} [options.parameters] Parameters supplied to update an - * existing appliance. + * @param {object} [options] Optional Parameters. * - * @param {string} options.parameters.managedResourceGroupId The managed - * resource group Id. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [options.parameters.applianceDefinitionId] The fully - * qualified path of appliance definition Id. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {object} [options.parameters.parameters] Name and value pairs that - * define the appliance parameters. It can be a JObject or a well formed JSON - * string. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {string} [options.parameters.uiDefinitionUri] The blob URI where the - * UI definition file is located. + * {Promise} A promise is returned. * - * @param {object} [options.parameters.plan] The plan information. + * @resolve {PolicyDefinition} - The deserialized result object. * - * @param {string} options.parameters.plan.name The plan name. + * @reject {Error|ServiceError} - The error object. * - * @param {string} options.parameters.plan.publisher The publisher ID. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} options.parameters.plan.product The product code. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [options.parameters.plan.promotionCode] The promotion code. + * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinition} for more information. * - * @param {string} options.parameters.plan.version The plan's version. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} options.parameters.kind The kind of the appliance. Allowed - * values are MarketPlace and ServiceCatalog. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(policyDefinitionName: string, callback: ServiceCallback): void; + get(policyDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieves a built-in policy definition. * - * @param {string} [options.parameters.managedBy] ID of the resource that - * manages this resource. + * This operation retrieves the built-in policy definition with the given name. * - * @param {object} [options.parameters.sku] The SKU of the resource. + * @param {string} policyDefinitionName The name of the built-in policy + * definition to get. * - * @param {string} options.parameters.sku.name The SKU name. + * @param {object} [options] Optional Parameters. * - * @param {string} [options.parameters.sku.tier] The SKU tier. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [options.parameters.sku.size] The SKU size. + * @returns {Promise} A promise is returned * - * @param {string} [options.parameters.sku.family] The SKU family. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [options.parameters.sku.model] The SKU model. + * @reject {Error|ServiceError} - The error object. + */ + getBuiltInWithHttpOperationResponse(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Retrieves a built-in policy definition. * - * @param {number} [options.parameters.sku.capacity] The SKU capacity. + * This operation retrieves the built-in policy definition with the given name. * - * @param {object} [options.parameters.identity] The identity of the resource. + * @param {string} policyDefinitionName The name of the built-in policy + * definition to get. * - * @param {string} [options.parameters.identity.type] The identity type. - * Possible values include: 'SystemAssigned' + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1019,7 +1531,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {Appliance} - The deserialized result object. + * @resolve {PolicyDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1027,25 +1539,50 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Appliance} [result] - The deserialized result object if an error did not occur. - * See {@link Appliance} for more information. + * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinition} 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. */ - updateById(applianceId: string, options?: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }): Promise; - updateById(applianceId: string, callback: ServiceCallback): void; - updateById(applianceId: string, options: { parameters? : models.Appliance, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getBuiltIn(policyDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getBuiltIn(policyDefinitionName: string, callback: ServiceCallback): void; + getBuiltIn(policyDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the appliance. + * @summary Creates or updates a policy definition in a management group. + * + * This operation creates or updates a policy definition in the given + * management group with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * create. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {object} parameters The policy definition properties. * - * @param {string} applianceName The name of the appliance. + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy + * definition. + * + * @param {string} [parameters.description] The policy definition description. + * + * @param {object} [parameters.policyRule] The policy rule. + * + * @param {object} [parameters.metadata] The policy definition metadata. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -1054,19 +1591,44 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateAtManagementGroupWithHttpOperationResponse(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the appliance. + * @summary Creates or updates a policy definition in a management group. + * + * This operation creates or updates a policy definition in the given + * management group with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * create. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {object} parameters The policy definition properties. * - * @param {string} applianceName The name of the appliance. + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy + * definition. + * + * @param {string} [parameters.description] The policy definition description. + * + * @param {object} [parameters.policyRule] The policy rule. + * + * @param {object} [parameters.metadata] The policy definition metadata. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -1080,7 +1642,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {PolicyDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1088,76 +1650,94 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinition} 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. */ - beginDeleteMethod(resourceGroupName: string, applianceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, applianceName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, applianceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, callback: ServiceCallback): void; + createOrUpdateAtManagementGroup(policyDefinitionName: string, parameters: models.PolicyDefinition, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new appliance. + * @summary Deletes a policy definition in a management group. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * This operation deletes the policy definition in the given management group + * with the given name. * - * @param {string} applianceName The name of the appliance. + * @param {string} policyDefinitionName The name of the policy definition to + * delete. * - * @param {object} parameters Parameters supplied to the create or update an - * appliance. + * @param {string} managementGroupId The ID of the management group. * - * @param {string} parameters.managedResourceGroupId The managed resource group - * Id. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.applianceDefinitionId] The fully qualified path - * of appliance definition Id. + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {object} [parameters.parameters] Name and value pairs that define the - * appliance parameters. It can be a JObject or a well formed JSON string. + * @reject {Error|ServiceError} - The error object. + */ + deleteAtManagementGroupWithHttpOperationResponse(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a policy definition in a management group. * - * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI - * definition file is located. + * This operation deletes the policy definition in the given management group + * with the given name. * - * @param {object} [parameters.plan] The plan information. + * @param {string} policyDefinitionName The name of the policy definition to + * delete. * - * @param {string} parameters.plan.name The plan name. + * @param {string} managementGroupId The ID of the management group. * - * @param {string} parameters.plan.publisher The publisher ID. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.plan.product The product code. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [parameters.plan.promotionCode] The promotion code. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {string} parameters.plan.version The plan's version. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {string} parameters.kind The kind of the appliance. Allowed values - * are MarketPlace and ServiceCatalog. + * {Promise} A promise is returned. * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. + * @resolve {null} - The deserialized result object. * - * @param {object} [parameters.sku] The SKU of the resource. + * @reject {Error|ServiceError} - The error object. * - * @param {string} parameters.sku.name The SKU name. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [parameters.sku.tier] The SKU tier. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [parameters.sku.size] The SKU size. + * {null} [result] - The deserialized result object if an error did not occur. * - * @param {string} [parameters.sku.family] The SKU family. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [parameters.sku.model] The SKU model. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; + deleteAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieve a policy definition in a management group. * - * @param {number} [parameters.sku.capacity] The SKU capacity. + * This operation retrieves the policy definition in the given management group + * with the given name. * - * @param {object} [parameters.identity] The identity of the resource. + * @param {string} policyDefinitionName The name of the policy definition to + * get. * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -1166,71 +1746,79 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, applianceName: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getAtManagementGroupWithHttpOperationResponse(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new appliance. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * - * @param {string} applianceName The name of the appliance. + * @summary Retrieve a policy definition in a management group. * - * @param {object} parameters Parameters supplied to the create or update an - * appliance. + * This operation retrieves the policy definition in the given management group + * with the given name. * - * @param {string} parameters.managedResourceGroupId The managed resource group - * Id. + * @param {string} policyDefinitionName The name of the policy definition to + * get. * - * @param {string} [parameters.applianceDefinitionId] The fully qualified path - * of appliance definition Id. + * @param {string} managementGroupId The ID of the management group. * - * @param {object} [parameters.parameters] Name and value pairs that define the - * appliance parameters. It can be a JObject or a well formed JSON string. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI - * definition file is located. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} [parameters.plan] The plan information. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {string} parameters.plan.name The plan name. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {string} parameters.plan.publisher The publisher ID. + * {Promise} A promise is returned. * - * @param {string} parameters.plan.product The product code. + * @resolve {PolicyDefinition} - The deserialized result object. * - * @param {string} [parameters.plan.promotionCode] The promotion code. + * @reject {Error|ServiceError} - The error object. * - * @param {string} parameters.plan.version The plan's version. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} parameters.kind The kind of the appliance. Allowed values - * are MarketPlace and ServiceCatalog. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. + * {PolicyDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinition} for more information. * - * @param {object} [parameters.sku] The SKU of the resource. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} parameters.sku.name The SKU name. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; + getAtManagementGroup(policyDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieves policy definitions in a subscription * - * @param {string} [parameters.sku.tier] The SKU tier. + * This operation retrieves a list of all the policy definitions in a given + * subscription. * - * @param {string} [parameters.sku.size] The SKU size. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.sku.family] The SKU family. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [parameters.sku.model] The SKU model. + * @returns {Promise} A promise is returned * - * @param {number} [parameters.sku.capacity] The SKU capacity. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {object} [parameters.identity] The identity of the resource. + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Retrieves policy definitions in a subscription * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * This operation retrieves a list of all the policy definitions in a given + * subscription. * * @param {object} [options] Optional Parameters. * @@ -1244,7 +1832,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {Appliance} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1252,25 +1840,23 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Appliance} [result] - The deserialized result object if an error did not occur. - * See {@link Appliance} for more information. + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} 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, applianceName: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, applianceName: string, parameters: models.Appliance, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, applianceName: string, parameters: models.Appliance, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the appliance. + * @summary Retrieve built-in policy definitions * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * This operation retrieves a list of all the built-in policy definitions. * * @param {object} [options] Optional Parameters. * @@ -1279,19 +1865,16 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginDeleteByIdWithHttpOperationResponse(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBuiltInWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the appliance. + * @summary Retrieve built-in policy definitions * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * This operation retrieves a list of all the built-in policy definitions. * * @param {object} [options] Optional Parameters. * @@ -1305,7 +1888,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1313,76 +1896,26 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} 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. */ - beginDeleteById(applianceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteById(applianceId: string, callback: ServiceCallback): void; - beginDeleteById(applianceId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBuiltIn(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBuiltIn(callback: ServiceCallback): void; + listBuiltIn(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new appliance. - * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * - * @param {object} parameters Parameters supplied to the create or update an - * appliance. - * - * @param {string} parameters.managedResourceGroupId The managed resource group - * Id. - * - * @param {string} [parameters.applianceDefinitionId] The fully qualified path - * of appliance definition Id. - * - * @param {object} [parameters.parameters] Name and value pairs that define the - * appliance parameters. It can be a JObject or a well formed JSON string. - * - * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI - * definition file is located. - * - * @param {object} [parameters.plan] The plan information. - * - * @param {string} parameters.plan.name The plan name. - * - * @param {string} parameters.plan.publisher The publisher ID. - * - * @param {string} parameters.plan.product The product code. + * @summary Retrieve policy definitions in a management group * - * @param {string} [parameters.plan.promotionCode] The promotion code. + * This operation retrieves a list of all the policy definitions in a given + * management group. * - * @param {string} parameters.plan.version The plan's version. - * - * @param {string} parameters.kind The kind of the appliance. Allowed values - * are MarketPlace and ServiceCatalog. - * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. - * - * @param {object} [parameters.sku] The SKU of the resource. - * - * @param {string} parameters.sku.name The SKU name. - * - * @param {string} [parameters.sku.tier] The SKU tier. - * - * @param {string} [parameters.sku.size] The SKU size. - * - * @param {string} [parameters.sku.family] The SKU family. - * - * @param {string} [parameters.sku.model] The SKU model. - * - * @param {number} [parameters.sku.capacity] The SKU capacity. - * - * @param {object} [parameters.identity] The identity of the resource. - * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -1391,71 +1924,83 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateByIdWithHttpOperationResponse(applianceId: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByManagementGroupWithHttpOperationResponse(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new appliance. + * @summary Retrieve policy definitions in a management group * - * @param {string} applianceId The fully qualified ID of the appliance, - * including the appliance name and the appliance resource type. Use the - * format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} + * This operation retrieves a list of all the policy definitions in a given + * management group. * - * @param {object} parameters Parameters supplied to the create or update an - * appliance. + * @param {string} managementGroupId The ID of the management group. * - * @param {string} parameters.managedResourceGroupId The managed resource group - * Id. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.applianceDefinitionId] The fully qualified path - * of appliance definition Id. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} [parameters.parameters] Name and value pairs that define the - * appliance parameters. It can be a JObject or a well formed JSON string. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {string} [parameters.uiDefinitionUri] The blob URI where the UI - * definition file is located. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {object} [parameters.plan] The plan information. + * {Promise} A promise is returned. * - * @param {string} parameters.plan.name The plan name. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * - * @param {string} parameters.plan.publisher The publisher ID. + * @reject {Error|ServiceError} - The error object. * - * @param {string} parameters.plan.product The product code. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [parameters.plan.promotionCode] The promotion code. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} parameters.plan.version The plan's version. + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} for more + * information. * - * @param {string} parameters.kind The kind of the appliance. Allowed values - * are MarketPlace and ServiceCatalog. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByManagementGroup(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByManagementGroup(managementGroupId: string, callback: ServiceCallback): void; + listByManagementGroup(managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieves policy definitions in a subscription * - * @param {object} [parameters.sku] The SKU of the resource. + * This operation retrieves a list of all the policy definitions in a given + * subscription. * - * @param {string} parameters.sku.name The SKU name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {string} [parameters.sku.tier] The SKU tier. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.sku.size] The SKU size. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [parameters.sku.family] The SKU family. + * @returns {Promise} A promise is returned * - * @param {string} [parameters.sku.model] The SKU model. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {number} [parameters.sku.capacity] The SKU capacity. + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Retrieves policy definitions in a subscription * - * @param {object} [parameters.identity] The identity of the resource. + * This operation retrieves a list of all the policy definitions in a given + * subscription. * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -1469,7 +2014,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {Appliance} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1477,20 +2022,23 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Appliance} [result] - The deserialized result object if an error did not occur. - * See {@link Appliance} for more information. + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} 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. */ - beginCreateOrUpdateById(applianceId: string, parameters: models.Appliance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdateById(applianceId: string, parameters: models.Appliance, callback: ServiceCallback): void; - beginCreateOrUpdateById(applianceId: string, parameters: models.Appliance, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the appliances within a resource group. + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1502,14 +2050,16 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBuiltInNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the appliances within a resource group. + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1526,7 +2076,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {ApplianceListResult} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1534,20 +2084,24 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceListResult} for more information. + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; - listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBuiltInNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBuiltInNext(nextPageLink: string, callback: ServiceCallback): void; + listBuiltInNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets all the appliances within a subscription. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1559,14 +2113,17 @@ export interface Appliances { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listBySubscriptionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByManagementGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets all the appliances within a subscription. + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1583,7 +2140,7 @@ export interface Appliances { * * {Promise} A promise is returned. * - * @resolve {ApplianceListResult} - The deserialized result object. + * @resolve {PolicyDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1591,36 +2148,57 @@ export interface Appliances { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceListResult} for more information. + * {PolicyDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listBySubscriptionNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBySubscriptionNext(nextPageLink: string, callback: ServiceCallback): void; - listBySubscriptionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByManagementGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByManagementGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByManagementGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ApplianceDefinitions + * PolicySetDefinitions * __NOTE__: An instance of this class is automatically created for an - * instance of the ManagedApplicationClient. + * instance of the PolicyClient. */ -export interface ApplianceDefinitions { +export interface PolicySetDefinitions { /** - * Gets the appliance definition. + * @summary Creates or updates a policy set definition. + * + * This operation creates or updates a policy set definition in the given + * subscription with the given name. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. * - * @param {string} applianceDefinitionName The name of the appliance + * @param {object} parameters The policy set definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.displayName] The display name of the policy set * definition. * + * @param {string} [parameters.description] The policy set definition + * description. + * + * @param {object} [parameters.metadata] The policy set definition metadata. + * + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. + * + * @param {array} parameters.policyDefinitions An array of policy definition + * references. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1628,21 +2206,41 @@ export interface ApplianceDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(policySetDefinitionName: string, parameters: models.PolicySetDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the appliance definition. + * @summary Creates or updates a policy set definition. + * + * This operation creates or updates a policy set definition in the given + * subscription with the given name. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. * - * @param {string} applianceDefinitionName The name of the appliance + * @param {object} parameters The policy set definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.displayName] The display name of the policy set * definition. * + * @param {string} [parameters.description] The policy set definition + * description. + * + * @param {object} [parameters.metadata] The policy set definition metadata. + * + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. + * + * @param {array} parameters.policyDefinitions An array of policy definition + * references. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1655,7 +2253,7 @@ export interface ApplianceDefinitions { * * {Promise} A promise is returned. * - * @resolve {ApplianceDefinition} - The deserialized result object. + * @resolve {PolicySetDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1663,26 +2261,26 @@ export interface ApplianceDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceDefinition} for more information. + * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinition} 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, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, applianceDefinitionName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, applianceDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(policySetDefinitionName: string, parameters: models.PolicySetDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(policySetDefinitionName: string, parameters: models.PolicySetDefinition, callback: ServiceCallback): void; + createOrUpdate(policySetDefinitionName: string, parameters: models.PolicySetDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the appliance definition. + * @summary Deletes a policy set definition. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * This operation deletes the policy set definition in the given subscription + * with the given name. * - * @param {string} applianceDefinitionName The name of the appliance definition - * to delete. + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. * * @param {object} [options] Optional Parameters. * @@ -1695,16 +2293,16 @@ export interface ApplianceDefinitions { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the appliance definition. + * @summary Deletes a policy set definition. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * This operation deletes the policy set definition in the given subscription + * with the given name. * - * @param {string} applianceDefinitionName The name of the appliance definition - * to delete. + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. * * @param {object} [options] Optional Parameters. * @@ -1732,63 +2330,19 @@ export interface ApplianceDefinitions { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, applianceDefinitionName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, applianceDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(policySetDefinitionName: string, callback: ServiceCallback): void; + deleteMethod(policySetDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new appliance definition. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * - * @param {string} applianceDefinitionName The name of the appliance - * definition. - * - * @param {object} parameters Parameters supplied to the create or update an - * appliance definition. - * - * @param {string} parameters.lockLevel The appliance lock level. Possible - * values include: 'CanNotDelete', 'ReadOnly', 'None' - * - * @param {string} [parameters.displayName] The appliance definition display - * name. - * - * @param {array} parameters.authorizations The appliance provider - * authorizations. - * - * @param {array} [parameters.artifacts] The collection of appliance artifacts. - * The portal will use the files specified as artifacts to construct the user - * experience of creating an appliance from an appliance definition. - * - * @param {string} [parameters.description] The appliance definition - * description. - * - * @param {string} parameters.packageFileUri The appliance definition package - * file Uri. - * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. - * - * @param {object} [parameters.sku] The SKU of the resource. - * - * @param {string} parameters.sku.name The SKU name. - * - * @param {string} [parameters.sku.tier] The SKU tier. - * - * @param {string} [parameters.sku.size] The SKU size. + * @summary Retrieves a policy set definition. * - * @param {string} [parameters.sku.family] The SKU family. + * This operation retrieves the policy set definition in the given subscription + * with the given name. * - * @param {string} [parameters.sku.model] The SKU model. - * - * @param {number} [parameters.sku.capacity] The SKU capacity. - * - * @param {object} [parameters.identity] The identity of the resource. - * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. * * @param {object} [options] Optional Parameters. * @@ -1797,64 +2351,20 @@ export interface ApplianceDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new appliance definition. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * - * @param {string} applianceDefinitionName The name of the appliance - * definition. - * - * @param {object} parameters Parameters supplied to the create or update an - * appliance definition. - * - * @param {string} parameters.lockLevel The appliance lock level. Possible - * values include: 'CanNotDelete', 'ReadOnly', 'None' - * - * @param {string} [parameters.displayName] The appliance definition display - * name. - * - * @param {array} parameters.authorizations The appliance provider - * authorizations. - * - * @param {array} [parameters.artifacts] The collection of appliance artifacts. - * The portal will use the files specified as artifacts to construct the user - * experience of creating an appliance from an appliance definition. - * - * @param {string} [parameters.description] The appliance definition - * description. - * - * @param {string} parameters.packageFileUri The appliance definition package - * file Uri. - * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. + * @summary Retrieves a policy set definition. * - * @param {object} [parameters.sku] The SKU of the resource. + * This operation retrieves the policy set definition in the given subscription + * with the given name. * - * @param {string} parameters.sku.name The SKU name. - * - * @param {string} [parameters.sku.tier] The SKU tier. - * - * @param {string} [parameters.sku.size] The SKU size. - * - * @param {string} [parameters.sku.family] The SKU family. - * - * @param {string} [parameters.sku.model] The SKU model. - * - * @param {number} [parameters.sku.capacity] The SKU capacity. - * - * @param {object} [parameters.identity] The identity of the resource. - * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. * * @param {object} [options] Optional Parameters. * @@ -1868,7 +2378,7 @@ export interface ApplianceDefinitions { * * {Promise} A promise is returned. * - * @resolve {ApplianceDefinition} - The deserialized result object. + * @resolve {PolicySetDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1876,23 +2386,26 @@ export interface ApplianceDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceDefinition} for more information. + * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinition} 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, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, applianceDefinitionName: string, parameters: models.ApplianceDefinition, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(policySetDefinitionName: string, callback: ServiceCallback): void; + get(policySetDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists the appliance definitions in a resource group. + * @summary Retrieves a built in policy set definition. + * + * This operation retrieves the built-in policy set definition with the given + * name. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. * * @param {object} [options] Optional Parameters. * @@ -1901,17 +2414,20 @@ export interface ApplianceDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getBuiltInWithHttpOperationResponse(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists the appliance definitions in a resource group. + * @summary Retrieves a built in policy set definition. + * + * This operation retrieves the built-in policy set definition with the given + * name. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. * * @param {object} [options] Optional Parameters. * @@ -1925,7 +2441,7 @@ export interface ApplianceDefinitions { * * {Promise} A promise is returned. * - * @resolve {ApplianceDefinitionListResult} - The deserialized result object. + * @resolve {PolicySetDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1933,26 +2449,23 @@ export interface ApplianceDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceDefinitionListResult} for more - * information. + * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinition} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getBuiltIn(policySetDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getBuiltIn(policySetDefinitionName: string, callback: ServiceCallback): void; + getBuiltIn(policySetDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the appliance definition. + * @summary Retrieves the policy set definitions for a subscription. * - * @param {string} applianceDefinitionId The fully qualified ID of the - * appliance definition, including the appliance name and the appliance - * definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {object} [options] Optional Parameters. * @@ -1961,19 +2474,17 @@ export interface ApplianceDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getByIdWithHttpOperationResponse(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the appliance definition. + * @summary Retrieves the policy set definitions for a subscription. * - * @param {string} applianceDefinitionId The fully qualified ID of the - * appliance definition, including the appliance name and the appliance - * definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * * @param {object} [options] Optional Parameters. * @@ -1987,7 +2498,7 @@ export interface ApplianceDefinitions { * * {Promise} A promise is returned. * - * @resolve {ApplianceDefinition} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1995,25 +2506,23 @@ export interface ApplianceDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceDefinition} for more information. + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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. */ - getById(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getById(applianceDefinitionId: string, callback: ServiceCallback): void; - getById(applianceDefinitionId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the appliance definition. + * @summary Retrieves built-in policy set definitions. * - * @param {string} applianceDefinitionId The fully qualified ID of the - * appliance definition, including the appliance name and the appliance - * definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * This operation retrieves a list of all the built-in policy set definitions. * * @param {object} [options] Optional Parameters. * @@ -2022,19 +2531,16 @@ export interface ApplianceDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteByIdWithHttpOperationResponse(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBuiltInWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the appliance definition. + * @summary Retrieves built-in policy set definitions. * - * @param {string} applianceDefinitionId The fully qualified ID of the - * appliance definition, including the appliance name and the appliance - * definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * This operation retrieves a list of all the built-in policy set definitions. * * @param {object} [options] Optional Parameters. * @@ -2048,7 +2554,7 @@ export interface ApplianceDefinitions { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2056,68 +2562,49 @@ export interface ApplianceDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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. */ - deleteById(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteById(applianceDefinitionId: string, callback: ServiceCallback): void; - deleteById(applianceDefinitionId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBuiltIn(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBuiltIn(callback: ServiceCallback): void; + listBuiltIn(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new appliance definition. - * - * @param {string} applianceDefinitionId The fully qualified ID of the - * appliance definition, including the appliance name and the appliance - * definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * @summary Creates or updates a policy set definition. * - * @param {object} parameters Parameters supplied to the create or update an - * appliance definition. + * This operation creates or updates a policy set definition in the given + * management group with the given name. * - * @param {string} parameters.lockLevel The appliance lock level. Possible - * values include: 'CanNotDelete', 'ReadOnly', 'None' + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. * - * @param {string} [parameters.displayName] The appliance definition display - * name. + * @param {object} parameters The policy set definition properties. * - * @param {array} parameters.authorizations The appliance provider - * authorizations. + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' * - * @param {array} [parameters.artifacts] The collection of appliance artifacts. - * The portal will use the files specified as artifacts to construct the user - * experience of creating an appliance from an appliance definition. + * @param {string} [parameters.displayName] The display name of the policy set + * definition. * - * @param {string} [parameters.description] The appliance definition + * @param {string} [parameters.description] The policy set definition * description. * - * @param {string} parameters.packageFileUri The appliance definition package - * file Uri. - * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. - * - * @param {object} [parameters.sku] The SKU of the resource. - * - * @param {string} parameters.sku.name The SKU name. - * - * @param {string} [parameters.sku.tier] The SKU tier. + * @param {object} [parameters.metadata] The policy set definition metadata. * - * @param {string} [parameters.sku.size] The SKU size. + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. * - * @param {string} [parameters.sku.family] The SKU family. + * @param {array} parameters.policyDefinitions An array of policy definition + * references. * - * @param {string} [parameters.sku.model] The SKU model. - * - * @param {number} [parameters.sku.capacity] The SKU capacity. - * - * @param {object} [parameters.identity] The identity of the resource. - * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2126,63 +2613,42 @@ export interface ApplianceDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateByIdWithHttpOperationResponse(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateAtManagementGroupWithHttpOperationResponse(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new appliance definition. - * - * @param {string} applianceDefinitionId The fully qualified ID of the - * appliance definition, including the appliance name and the appliance - * definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * @summary Creates or updates a policy set definition. * - * @param {object} parameters Parameters supplied to the create or update an - * appliance definition. + * This operation creates or updates a policy set definition in the given + * management group with the given name. * - * @param {string} parameters.lockLevel The appliance lock level. Possible - * values include: 'CanNotDelete', 'ReadOnly', 'None' + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. * - * @param {string} [parameters.displayName] The appliance definition display - * name. + * @param {object} parameters The policy set definition properties. * - * @param {array} parameters.authorizations The appliance provider - * authorizations. + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' * - * @param {array} [parameters.artifacts] The collection of appliance artifacts. - * The portal will use the files specified as artifacts to construct the user - * experience of creating an appliance from an appliance definition. + * @param {string} [parameters.displayName] The display name of the policy set + * definition. * - * @param {string} [parameters.description] The appliance definition + * @param {string} [parameters.description] The policy set definition * description. * - * @param {string} parameters.packageFileUri The appliance definition package - * file Uri. - * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. - * - * @param {object} [parameters.sku] The SKU of the resource. + * @param {object} [parameters.metadata] The policy set definition metadata. * - * @param {string} parameters.sku.name The SKU name. + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. * - * @param {string} [parameters.sku.tier] The SKU tier. + * @param {array} parameters.policyDefinitions An array of policy definition + * references. * - * @param {string} [parameters.sku.size] The SKU size. - * - * @param {string} [parameters.sku.family] The SKU family. - * - * @param {string} [parameters.sku.model] The SKU model. - * - * @param {number} [parameters.sku.capacity] The SKU capacity. - * - * @param {object} [parameters.identity] The identity of the resource. - * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2196,7 +2662,7 @@ export interface ApplianceDefinitions { * * {Promise} A promise is returned. * - * @resolve {ApplianceDefinition} - The deserialized result object. + * @resolve {PolicySetDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2204,26 +2670,28 @@ export interface ApplianceDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceDefinition} for more information. + * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinition} 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. */ - createOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, callback: ServiceCallback): void; - createOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, callback: ServiceCallback): void; + createOrUpdateAtManagementGroup(policySetDefinitionName: string, parameters: models.PolicySetDefinition, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the appliance definition. + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given management + * group with the given name. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. * - * @param {string} applianceDefinitionName The name of the appliance definition - * to delete. + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2236,16 +2704,18 @@ export interface ApplianceDefinitions { * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteAtManagementGroupWithHttpOperationResponse(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the appliance definition. + * @summary Deletes a policy set definition. * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. + * This operation deletes the policy set definition in the given management + * group with the given name. * - * @param {string} applianceDefinitionName The name of the appliance definition - * to delete. + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. + * + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2273,63 +2743,21 @@ export interface ApplianceDefinitions { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, applianceDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, applianceDefinitionName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, applianceDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; + deleteAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new appliance definition. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * - * @param {string} applianceDefinitionName The name of the appliance - * definition. - * - * @param {object} parameters Parameters supplied to the create or update an - * appliance definition. - * - * @param {string} parameters.lockLevel The appliance lock level. Possible - * values include: 'CanNotDelete', 'ReadOnly', 'None' - * - * @param {string} [parameters.displayName] The appliance definition display - * name. - * - * @param {array} parameters.authorizations The appliance provider - * authorizations. - * - * @param {array} [parameters.artifacts] The collection of appliance artifacts. - * The portal will use the files specified as artifacts to construct the user - * experience of creating an appliance from an appliance definition. + * @summary Retrieves a policy set definition. * - * @param {string} [parameters.description] The appliance definition - * description. - * - * @param {string} parameters.packageFileUri The appliance definition package - * file Uri. - * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. - * - * @param {object} [parameters.sku] The SKU of the resource. - * - * @param {string} parameters.sku.name The SKU name. - * - * @param {string} [parameters.sku.tier] The SKU tier. - * - * @param {string} [parameters.sku.size] The SKU size. - * - * @param {string} [parameters.sku.family] The SKU family. + * This operation retrieves the policy set definition in the given management + * group with the given name. * - * @param {string} [parameters.sku.model] The SKU model. + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. * - * @param {number} [parameters.sku.capacity] The SKU capacity. - * - * @param {object} [parameters.identity] The identity of the resource. - * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2338,64 +2766,22 @@ export interface ApplianceDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getAtManagementGroupWithHttpOperationResponse(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new appliance definition. - * - * @param {string} resourceGroupName The name of the resource group. The name - * is case insensitive. - * - * @param {string} applianceDefinitionName The name of the appliance - * definition. - * - * @param {object} parameters Parameters supplied to the create or update an - * appliance definition. - * - * @param {string} parameters.lockLevel The appliance lock level. Possible - * values include: 'CanNotDelete', 'ReadOnly', 'None' - * - * @param {string} [parameters.displayName] The appliance definition display - * name. - * - * @param {array} parameters.authorizations The appliance provider - * authorizations. - * - * @param {array} [parameters.artifacts] The collection of appliance artifacts. - * The portal will use the files specified as artifacts to construct the user - * experience of creating an appliance from an appliance definition. - * - * @param {string} [parameters.description] The appliance definition - * description. - * - * @param {string} parameters.packageFileUri The appliance definition package - * file Uri. - * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. - * - * @param {object} [parameters.sku] The SKU of the resource. + * @summary Retrieves a policy set definition. * - * @param {string} parameters.sku.name The SKU name. + * This operation retrieves the policy set definition in the given management + * group with the given name. * - * @param {string} [parameters.sku.tier] The SKU tier. + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. * - * @param {string} [parameters.sku.size] The SKU size. - * - * @param {string} [parameters.sku.family] The SKU family. - * - * @param {string} [parameters.sku.model] The SKU model. - * - * @param {number} [parameters.sku.capacity] The SKU capacity. - * - * @param {object} [parameters.identity] The identity of the resource. - * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2409,7 +2795,7 @@ export interface ApplianceDefinitions { * * {Promise} A promise is returned. * - * @resolve {ApplianceDefinition} - The deserialized result object. + * @resolve {PolicySetDefinition} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2417,25 +2803,25 @@ export interface ApplianceDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceDefinition} for more information. + * {PolicySetDefinition} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinition} 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, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, applianceDefinitionName: string, parameters: models.ApplianceDefinition, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, applianceDefinitionName: string, parameters: models.ApplianceDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, callback: ServiceCallback): void; + getAtManagementGroup(policySetDefinitionName: string, managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the appliance definition. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * - * @param {string} applianceDefinitionId The fully qualified ID of the - * appliance definition, including the appliance name and the appliance - * definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2444,19 +2830,19 @@ export interface ApplianceDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginDeleteByIdWithHttpOperationResponse(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByManagementGroupWithHttpOperationResponse(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the appliance definition. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * - * @param {string} applianceDefinitionId The fully qualified ID of the - * appliance definition, including the appliance name and the appliance - * definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * @param {string} managementGroupId The ID of the management group. * * @param {object} [options] Optional Parameters. * @@ -2470,7 +2856,7 @@ export interface ApplianceDefinitions { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2478,68 +2864,27 @@ export interface ApplianceDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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. */ - beginDeleteById(applianceDefinitionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteById(applianceDefinitionId: string, callback: ServiceCallback): void; - beginDeleteById(applianceDefinitionId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByManagementGroup(managementGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByManagementGroup(managementGroupId: string, callback: ServiceCallback): void; + listByManagementGroup(managementGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new appliance definition. - * - * @param {string} applianceDefinitionId The fully qualified ID of the - * appliance definition, including the appliance name and the appliance - * definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} - * - * @param {object} parameters Parameters supplied to the create or update an - * appliance definition. - * - * @param {string} parameters.lockLevel The appliance lock level. Possible - * values include: 'CanNotDelete', 'ReadOnly', 'None' - * - * @param {string} [parameters.displayName] The appliance definition display - * name. - * - * @param {array} parameters.authorizations The appliance provider - * authorizations. - * - * @param {array} [parameters.artifacts] The collection of appliance artifacts. - * The portal will use the files specified as artifacts to construct the user - * experience of creating an appliance from an appliance definition. - * - * @param {string} [parameters.description] The appliance definition - * description. - * - * @param {string} parameters.packageFileUri The appliance definition package - * file Uri. - * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. - * - * @param {object} [parameters.sku] The SKU of the resource. - * - * @param {string} parameters.sku.name The SKU name. + * @summary Retrieves the policy set definitions for a subscription. * - * @param {string} [parameters.sku.tier] The SKU tier. + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * - * @param {string} [parameters.sku.size] The SKU size. - * - * @param {string} [parameters.sku.family] The SKU family. - * - * @param {string} [parameters.sku.model] The SKU model. - * - * @param {number} [parameters.sku.capacity] The SKU capacity. - * - * @param {object} [parameters.identity] The identity of the resource. - * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2548,63 +2893,82 @@ export interface ApplianceDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateByIdWithHttpOperationResponse(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new appliance definition. + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. * - * @param {string} applianceDefinitionId The fully qualified ID of the - * appliance definition, including the appliance name and the appliance - * definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. * - * @param {object} parameters Parameters supplied to the create or update an - * appliance definition. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} parameters.lockLevel The appliance lock level. Possible - * values include: 'CanNotDelete', 'ReadOnly', 'None' + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {string} [parameters.displayName] The appliance definition display - * name. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {array} parameters.authorizations The appliance provider - * authorizations. + * {Promise} A promise is returned. * - * @param {array} [parameters.artifacts] The collection of appliance artifacts. - * The portal will use the files specified as artifacts to construct the user - * experience of creating an appliance from an appliance definition. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * - * @param {string} [parameters.description] The appliance definition - * description. + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} for more + * information. * - * @param {string} parameters.packageFileUri The appliance definition package - * file Uri. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [parameters.managedBy] ID of the resource that manages this - * resource. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieves built-in policy set definitions. * - * @param {object} [parameters.sku] The SKU of the resource. + * This operation retrieves a list of all the built-in policy set definitions. * - * @param {string} parameters.sku.name The SKU name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {string} [parameters.sku.tier] The SKU tier. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.sku.size] The SKU size. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [parameters.sku.family] The SKU family. + * @returns {Promise} A promise is returned * - * @param {string} [parameters.sku.model] The SKU model. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {number} [parameters.sku.capacity] The SKU capacity. + * @reject {Error|ServiceError} - The error object. + */ + listBuiltInNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Retrieves built-in policy set definitions. * - * @param {object} [parameters.identity] The identity of the resource. + * This operation retrieves a list of all the built-in policy set definitions. * - * @param {string} [parameters.identity.type] The identity type. Possible - * values include: 'SystemAssigned' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2618,7 +2982,7 @@ export interface ApplianceDefinitions { * * {Promise} A promise is returned. * - * @resolve {ApplianceDefinition} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2626,20 +2990,24 @@ export interface ApplianceDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceDefinition} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceDefinition} for more information. + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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. */ - beginCreateOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, callback: ServiceCallback): void; - beginCreateOrUpdateById(applianceDefinitionId: string, parameters: models.ApplianceDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBuiltInNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBuiltInNext(nextPageLink: string, callback: ServiceCallback): void; + listBuiltInNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists the appliance definitions in a resource group. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2651,14 +3019,17 @@ export interface ApplianceDefinitions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByManagementGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists the appliance definitions in a resource group. + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2675,7 +3046,7 @@ export interface ApplianceDefinitions { * * {Promise} A promise is returned. * - * @resolve {ApplianceDefinitionListResult} - The deserialized result object. + * @resolve {PolicySetDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2683,15 +3054,15 @@ export interface ApplianceDefinitions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplianceDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApplianceDefinitionListResult} for more + * {PolicySetDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; - listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByManagementGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByManagementGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByManagementGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } diff --git a/lib/services/resourceManagement/lib/operations/index.js b/lib/services/resourceManagement/lib/operations/index.js index bcc97ad8c9..8d6fdd7a3d 100644 --- a/lib/services/resourceManagement/lib/operations/index.js +++ b/lib/services/resourceManagement/lib/operations/index.js @@ -14,5 +14,6 @@ 'use strict'; -exports.Appliances = require('./appliances'); -exports.ApplianceDefinitions = require('./applianceDefinitions'); +exports.PolicyAssignments = require('./policyAssignments'); +exports.PolicyDefinitions = require('./policyDefinitions'); +exports.PolicySetDefinitions = require('./policySetDefinitions'); diff --git a/lib/services/resourceManagement/lib/operations/policyAssignments.js b/lib/services/resourceManagement/lib/operations/policyAssignments.js new file mode 100644 index 0000000000..91699a6690 --- /dev/null +++ b/lib/services/resourceManagement/lib/operations/policyAssignments.js @@ -0,0 +1,3604 @@ +/* + * 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 Deletes a policy assignment. + * + * This operation deletes a policy assignment, given its name and the scope it + * was created in. The scope of a policy assignment is the part of its ID + * preceding + * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment to + * delete. + * + * @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 PolicyAssignment} 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 _deleteMethod(scope, policyAssignmentName, 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 (scope === null || scope === undefined || typeof scope.valueOf() !== 'string') { + throw new Error('scope cannot be null or undefined and it must be of type string.'); + } + if (policyAssignmentName === null || policyAssignmentName === undefined || typeof policyAssignmentName.valueOf() !== 'string') { + throw new Error('policyAssignmentName 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('/') ? '' : '/') + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'; + requestUrl = requestUrl.replace('{scope}', scope); + requestUrl = requestUrl.replace('{policyAssignmentName}', encodeURIComponent(policyAssignmentName)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignment']().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 policy assignment. + * + * This operation creates or updates a policy assignment with the given scope + * and name. Policy assignments apply to all resources contained within their + * scope. For example, when you assign a policy at resource group scope, that + * policy applies to all resources in the group. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment. + * + * @param {object} parameters Parameters for the policy assignment. + * + * @param {string} [parameters.displayName] The display name of the policy + * assignment. + * + * @param {string} [parameters.policyDefinitionId] The ID of the policy + * definition or policy set definition being assigned. + * + * @param {string} [parameters.scope] The scope for the policy assignment. + * + * @param {array} [parameters.notScopes] The policy's excluded scopes. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} [parameters.description] This message will be part of + * response in case of policy violation. + * + * @param {object} [parameters.metadata] The policy assignment metadata. + * + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. + * + * @param {string} parameters.sku.name The name of the policy sku. Possible + * values are A0 and A1. + * + * @param {string} [parameters.sku.tier] The policy sku tier. Possible values + * are Free and Standard. + * + * @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 PolicyAssignment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _create(scope, policyAssignmentName, parameters, 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 (scope === null || scope === undefined || typeof scope.valueOf() !== 'string') { + throw new Error('scope cannot be null or undefined and it must be of type string.'); + } + if (policyAssignmentName === null || policyAssignmentName === undefined || typeof policyAssignmentName.valueOf() !== 'string') { + throw new Error('policyAssignmentName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.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('/') ? '' : '/') + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'; + requestUrl = requestUrl.replace('{scope}', scope); + requestUrl = requestUrl.replace('{policyAssignmentName}', encodeURIComponent(policyAssignmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PolicyAssignment']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignment']().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 Retrieves a policy assignment. + * + * This operation retrieves a single policy assignment, given its name and the + * scope it was created at. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment to + * get. + * + * @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 PolicyAssignment} 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(scope, policyAssignmentName, 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 (scope === null || scope === undefined || typeof scope.valueOf() !== 'string') { + throw new Error('scope cannot be null or undefined and it must be of type string.'); + } + if (policyAssignmentName === null || policyAssignmentName === undefined || typeof policyAssignmentName.valueOf() !== 'string') { + throw new Error('policyAssignmentName 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('/') ? '' : '/') + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'; + requestUrl = requestUrl.replace('{scope}', scope); + requestUrl = requestUrl.replace('{policyAssignmentName}', encodeURIComponent(policyAssignmentName)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignment']().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 Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. + * + * @param {string} resourceGroupName The name of the resource group that + * contains policy assignments. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * + * @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 PolicyAssignmentListResult} 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 _listForResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + // Validate + try { + 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 (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.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.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.Authorization/policyAssignments'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + filter); + } + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignmentListResult']().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 Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param {string} resourceGroupName The name of the resource group containing + * the resource. + * + * @param {string} resourceProviderNamespace The namespace of the resource + * provider. For example, the namespace of a virtual machine is + * Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * + * @param {string} parentResourcePath The parent resource path. Use empty + * string if there is none. + * + * @param {string} resourceType The resource type name. For example the type + * name of a web app is 'sites' (from Microsoft.Web/sites). + * + * @param {string} resourceName The name of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * + * @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 PolicyAssignmentListResult} 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 _listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, 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 filter = (options && options.filter !== undefined) ? options.filter : undefined; + // Validate + try { + 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 (resourceProviderNamespace === null || resourceProviderNamespace === undefined || typeof resourceProviderNamespace.valueOf() !== 'string') { + throw new Error('resourceProviderNamespace cannot be null or undefined and it must be of type string.'); + } + if (parentResourcePath === null || parentResourcePath === undefined || typeof parentResourcePath.valueOf() !== 'string') { + throw new Error('parentResourcePath cannot be null or undefined and it must be of type string.'); + } + if (resourceType === null || resourceType === undefined || typeof resourceType.valueOf() !== 'string') { + throw new Error('resourceType cannot be null or undefined and it must be of type string.'); + } + if (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.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.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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{resourceProviderNamespace}', encodeURIComponent(resourceProviderNamespace)); + requestUrl = requestUrl.replace('{parentResourcePath}', parentResourcePath); + requestUrl = requestUrl.replace('{resourceType}', resourceType); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignmentListResult']().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 Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * + * @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 PolicyAssignmentListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.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.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.Authorization/policyAssignments'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignmentListResult']().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 policy assignment. + * + * This operation deletes the policy with the given ID. Policy assignment IDs + * have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid formats for {scope} are: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}' + * (management group), '/subscriptions/{subscriptionId}' (subscription), + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + * (resource group), or + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * (resource). + * + * @param {string} policyAssignmentId The ID of the policy assignment to + * delete. Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @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 PolicyAssignment} 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 _deleteById(policyAssignmentId, 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 (policyAssignmentId === null || policyAssignmentId === undefined || typeof policyAssignmentId.valueOf() !== 'string') { + throw new Error('policyAssignmentId 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('/') ? '' : '/') + '{policyAssignmentId}'; + requestUrl = requestUrl.replace('{policyAssignmentId}', policyAssignmentId); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignment']().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 policy assignment. + * + * This operation creates or updates the policy assignment with the given ID. + * Policy assignments made on a scope apply to all resources contained in that + * scope. For example, when you assign a policy to a resource group that policy + * applies to all resources in the group. Policy assignment IDs have this + * format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param {string} policyAssignmentId The ID of the policy assignment to + * create. Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param {object} parameters Parameters for policy assignment. + * + * @param {string} [parameters.displayName] The display name of the policy + * assignment. + * + * @param {string} [parameters.policyDefinitionId] The ID of the policy + * definition or policy set definition being assigned. + * + * @param {string} [parameters.scope] The scope for the policy assignment. + * + * @param {array} [parameters.notScopes] The policy's excluded scopes. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} [parameters.description] This message will be part of + * response in case of policy violation. + * + * @param {object} [parameters.metadata] The policy assignment metadata. + * + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. + * + * @param {string} parameters.sku.name The name of the policy sku. Possible + * values are A0 and A1. + * + * @param {string} [parameters.sku.tier] The policy sku tier. Possible values + * are Free and Standard. + * + * @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 PolicyAssignment} 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 _createById(policyAssignmentId, parameters, 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 (policyAssignmentId === null || policyAssignmentId === undefined || typeof policyAssignmentId.valueOf() !== 'string') { + throw new Error('policyAssignmentId cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.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('/') ? '' : '/') + '{policyAssignmentId}'; + requestUrl = requestUrl.replace('{policyAssignmentId}', policyAssignmentId); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PolicyAssignment']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignment']().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 Retrieves the policy assignment with the given ID. + * + * The operation retrieves the policy assignment with the given ID. Policy + * assignment IDs have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param {string} policyAssignmentId The ID of the policy assignment to get. + * Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @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 PolicyAssignment} 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 _getById(policyAssignmentId, 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 (policyAssignmentId === null || policyAssignmentId === undefined || typeof policyAssignmentId.valueOf() !== 'string') { + throw new Error('policyAssignmentId 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('/') ? '' : '/') + '{policyAssignmentId}'; + requestUrl = requestUrl.replace('{policyAssignmentId}', policyAssignmentId); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignment']().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 Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignmentListResult} 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 _listForResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignmentListResult']().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 Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignmentListResult} 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 _listForResourceNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignmentListResult']().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 Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyAssignmentListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyAssignmentListResult']().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 PolicyAssignments. */ +class PolicyAssignments { + /** + * Create a PolicyAssignments. + * @param {PolicyClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._create = _create; + this._get = _get; + this._listForResourceGroup = _listForResourceGroup; + this._listForResource = _listForResource; + this._list = _list; + this._deleteById = _deleteById; + this._createById = _createById; + this._getById = _getById; + this._listForResourceGroupNext = _listForResourceGroupNext; + this._listForResourceNext = _listForResourceNext; + this._listNext = _listNext; + } + + /** + * @summary Deletes a policy assignment. + * + * This operation deletes a policy assignment, given its name and the scope it + * was created in. The scope of a policy assignment is the part of its ID + * preceding + * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment to + * delete. + * + * @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(scope, policyAssignmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(scope, policyAssignmentName, 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 policy assignment. + * + * This operation deletes a policy assignment, given its name and the scope it + * was created in. The scope of a policy assignment is the part of its ID + * preceding + * '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment to + * delete. + * + * @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 {PolicyAssignment} - 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 PolicyAssignment} 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. + */ + deleteMethod(scope, policyAssignmentName, 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(scope, policyAssignmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(scope, policyAssignmentName, options, optionalCallback); + } + } + + /** + * @summary Creates or updates a policy assignment. + * + * This operation creates or updates a policy assignment with the given scope + * and name. Policy assignments apply to all resources contained within their + * scope. For example, when you assign a policy at resource group scope, that + * policy applies to all resources in the group. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment. + * + * @param {object} parameters Parameters for the policy assignment. + * + * @param {string} [parameters.displayName] The display name of the policy + * assignment. + * + * @param {string} [parameters.policyDefinitionId] The ID of the policy + * definition or policy set definition being assigned. + * + * @param {string} [parameters.scope] The scope for the policy assignment. + * + * @param {array} [parameters.notScopes] The policy's excluded scopes. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} [parameters.description] This message will be part of + * response in case of policy violation. + * + * @param {object} [parameters.metadata] The policy assignment metadata. + * + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. + * + * @param {string} parameters.sku.name The name of the policy sku. Possible + * values are A0 and A1. + * + * @param {string} [parameters.sku.tier] The policy sku tier. Possible values + * are Free and Standard. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createWithHttpOperationResponse(scope, policyAssignmentName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(scope, policyAssignmentName, parameters, 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 policy assignment. + * + * This operation creates or updates a policy assignment with the given scope + * and name. Policy assignments apply to all resources contained within their + * scope. For example, when you assign a policy at resource group scope, that + * policy applies to all resources in the group. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment. + * + * @param {object} parameters Parameters for the policy assignment. + * + * @param {string} [parameters.displayName] The display name of the policy + * assignment. + * + * @param {string} [parameters.policyDefinitionId] The ID of the policy + * definition or policy set definition being assigned. + * + * @param {string} [parameters.scope] The scope for the policy assignment. + * + * @param {array} [parameters.notScopes] The policy's excluded scopes. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} [parameters.description] This message will be part of + * response in case of policy violation. + * + * @param {object} [parameters.metadata] The policy assignment metadata. + * + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. + * + * @param {string} parameters.sku.name The name of the policy sku. Possible + * values are A0 and A1. + * + * @param {string} [parameters.sku.tier] The policy sku tier. Possible values + * are Free and Standard. + * + * @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 {PolicyAssignment} - 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 PolicyAssignment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + create(scope, policyAssignmentName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(scope, policyAssignmentName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(scope, policyAssignmentName, parameters, options, optionalCallback); + } + } + + /** + * @summary Retrieves a policy assignment. + * + * This operation retrieves a single policy assignment, given its name and the + * scope it was created at. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment to + * get. + * + * @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(scope, policyAssignmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(scope, policyAssignmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves a policy assignment. + * + * This operation retrieves a single policy assignment, given its name and the + * scope it was created at. + * + * @param {string} scope The scope of the policy assignment. Valid scopes are: + * management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * + * @param {string} policyAssignmentName The name of the policy assignment to + * get. + * + * @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 {PolicyAssignment} - 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 PolicyAssignment} 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(scope, policyAssignmentName, 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(scope, policyAssignmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(scope, policyAssignmentName, options, optionalCallback); + } + } + + /** + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. + * + * @param {string} resourceGroupName The name of the resource group that + * contains policy assignments. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * + * @param {object} [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. + */ + listForResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listForResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. + * + * @param {string} resourceGroupName The name of the resource group that + * contains policy assignments. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * + * @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 {PolicyAssignmentListResult} - 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 PolicyAssignmentListResult} 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. + */ + listForResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listForResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listForResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param {string} resourceGroupName The name of the resource group containing + * the resource. + * + * @param {string} resourceProviderNamespace The namespace of the resource + * provider. For example, the namespace of a virtual machine is + * Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * + * @param {string} parentResourcePath The parent resource path. Use empty + * string if there is none. + * + * @param {string} resourceType The resource type name. For example the type + * name of a web app is 'sites' (from Microsoft.Web/sites). + * + * @param {string} resourceName The name of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * + * @param {object} [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. + */ + listForResourceWithHttpOperationResponse(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param {string} resourceGroupName The name of the resource group containing + * the resource. + * + * @param {string} resourceProviderNamespace The namespace of the resource + * provider. For example, the namespace of a virtual machine is + * Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * + * @param {string} parentResourcePath The parent resource path. Use empty + * string if there is none. + * + * @param {string} resourceType The resource type name. For example the type + * name of a web app is 'sites' (from Microsoft.Web/sites). + * + * @param {string} resourceName The name of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * + * @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 {PolicyAssignmentListResult} - 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 PolicyAssignmentListResult} 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. + */ + listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, 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._listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options, optionalCallback); + } + } + + /** + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. Valid + * values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, no filtering is performed. + * + * @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 {PolicyAssignmentListResult} - 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 PolicyAssignmentListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * @summary Deletes a policy assignment. + * + * This operation deletes the policy with the given ID. Policy assignment IDs + * have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid formats for {scope} are: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}' + * (management group), '/subscriptions/{subscriptionId}' (subscription), + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + * (resource group), or + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * (resource). + * + * @param {string} policyAssignmentId The ID of the policy assignment to + * delete. Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @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. + */ + deleteByIdWithHttpOperationResponse(policyAssignmentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteById(policyAssignmentId, 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 policy assignment. + * + * This operation deletes the policy with the given ID. Policy assignment IDs + * have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid formats for {scope} are: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}' + * (management group), '/subscriptions/{subscriptionId}' (subscription), + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + * (resource group), or + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * (resource). + * + * @param {string} policyAssignmentId The ID of the policy assignment to + * delete. Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @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 {PolicyAssignment} - 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 PolicyAssignment} 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. + */ + deleteById(policyAssignmentId, 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._deleteById(policyAssignmentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteById(policyAssignmentId, options, optionalCallback); + } + } + + /** + * @summary Creates or updates a policy assignment. + * + * This operation creates or updates the policy assignment with the given ID. + * Policy assignments made on a scope apply to all resources contained in that + * scope. For example, when you assign a policy to a resource group that policy + * applies to all resources in the group. Policy assignment IDs have this + * format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param {string} policyAssignmentId The ID of the policy assignment to + * create. Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param {object} parameters Parameters for policy assignment. + * + * @param {string} [parameters.displayName] The display name of the policy + * assignment. + * + * @param {string} [parameters.policyDefinitionId] The ID of the policy + * definition or policy set definition being assigned. + * + * @param {string} [parameters.scope] The scope for the policy assignment. + * + * @param {array} [parameters.notScopes] The policy's excluded scopes. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} [parameters.description] This message will be part of + * response in case of policy violation. + * + * @param {object} [parameters.metadata] The policy assignment metadata. + * + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. + * + * @param {string} parameters.sku.name The name of the policy sku. Possible + * values are A0 and A1. + * + * @param {string} [parameters.sku.tier] The policy sku tier. Possible values + * are Free and Standard. + * + * @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. + */ + createByIdWithHttpOperationResponse(policyAssignmentId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createById(policyAssignmentId, parameters, 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 policy assignment. + * + * This operation creates or updates the policy assignment with the given ID. + * Policy assignments made on a scope apply to all resources contained in that + * scope. For example, when you assign a policy to a resource group that policy + * applies to all resources in the group. Policy assignment IDs have this + * format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param {string} policyAssignmentId The ID of the policy assignment to + * create. Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param {object} parameters Parameters for policy assignment. + * + * @param {string} [parameters.displayName] The display name of the policy + * assignment. + * + * @param {string} [parameters.policyDefinitionId] The ID of the policy + * definition or policy set definition being assigned. + * + * @param {string} [parameters.scope] The scope for the policy assignment. + * + * @param {array} [parameters.notScopes] The policy's excluded scopes. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} [parameters.description] This message will be part of + * response in case of policy violation. + * + * @param {object} [parameters.metadata] The policy assignment metadata. + * + * @param {object} [parameters.sku] The policy sku. This property is optional, + * obsolete, and will be ignored. + * + * @param {string} parameters.sku.name The name of the policy sku. Possible + * values are A0 and A1. + * + * @param {string} [parameters.sku.tier] The policy sku tier. Possible values + * are Free and Standard. + * + * @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 {PolicyAssignment} - 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 PolicyAssignment} 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. + */ + createById(policyAssignmentId, parameters, 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._createById(policyAssignmentId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createById(policyAssignmentId, parameters, options, optionalCallback); + } + } + + /** + * @summary Retrieves the policy assignment with the given ID. + * + * The operation retrieves the policy assignment with the given ID. Policy + * assignment IDs have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param {string} policyAssignmentId The ID of the policy assignment to get. + * Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @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. + */ + getByIdWithHttpOperationResponse(policyAssignmentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getById(policyAssignmentId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves the policy assignment with the given ID. + * + * The operation retrieves the policy assignment with the given ID. Policy + * assignment IDs have this format: + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * Valid scopes are: management group (format: + * '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + * subscription (format: '/subscriptions/{subscriptionId}'), resource group + * (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or + * resource (format: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param {string} policyAssignmentId The ID of the policy assignment to get. + * Use the format + * '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @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 {PolicyAssignment} - 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 PolicyAssignment} 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. + */ + getById(policyAssignmentId, 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._getById(policyAssignmentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getById(policyAssignmentId, options, optionalCallback); + } + } + + /** + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listForResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listForResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves all policy assignments that apply to a resource group. + * + * This operation retrieves the list of all policy assignments associated with + * the given resource group in the given subscription that match the optional + * given $filter. Valid values for $filter are: 'atScope()' or + * 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the resource + * group, including those that apply directly or apply from containing scopes, + * as well as any applied to resources contained within the resource group. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource group, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource group. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * group and assign the policy definition whose id is {value}. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PolicyAssignmentListResult} - 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 PolicyAssignmentListResult} 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. + */ + listForResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listForResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listForResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listForResourceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listForResourceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves all policy assignments that apply to a resource. + * + * This operation retrieves the list of all policy assignments associated with + * the specified resource in the given resource group and subscription that + * match the optional given $filter. Valid values for $filter are: 'atScope()' + * or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + * unfiltered list includes all policy assignments associated with the + * resource, including those that apply directly or from all containing scopes, + * as well as any applied to resources contained within the resource. If + * $filter=atScope() is provided, the returned list includes all policy + * assignments that apply to the resource, which is everything in the + * unfiltered list except those applied to resources contained within the + * resource. If $filter=policyDefinitionId eq '{value}' is provided, the + * returned list includes only policy assignments that apply to the resource + * and assign the policy definition whose id is {value}. Three parameters plus + * the resource name are used to identify a specific resource. If the resource + * is not part of a parent resource (the more common case), the parent resource + * path should not be provided (or provided as ''). For example a web app could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Web', + * {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == + * 'MyWebApp'). If the resource is part of a parent resource, then all + * parameters should be provided. For example a virtual machine DNS name could + * be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', + * {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} + * == 'domainNames', {resourceName} == 'MyComputerName'). A convenient + * alternative to providing the namespace and type name separately is to + * provide both in the {resourceType} parameter, format: + * ({resourceProviderNamespace} == '', {parentResourcePath} == '', + * {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PolicyAssignmentListResult} - 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 PolicyAssignmentListResult} 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. + */ + listForResourceNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listForResourceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listForResourceNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves all policy assignments that apply to a subscription. + * + * This operation retrieves the list of all policy assignments associated with + * the given subscription that match the optional given $filter. Valid values + * for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If + * $filter is not provided, the unfiltered list includes all policy assignments + * associated with the subscription, including those that apply directly or + * from management groups that contain the given subscription, as well as any + * applied to objects contained within the subscription. If $filter=atScope() + * is provided, the returned list includes all policy assignments that apply to + * the subscription, which is everything in the unfiltered list except those + * applied to objects contained within the subscription. If + * $filter=policyDefinitionId eq '{value}' is provided, the returned list + * includes only policy assignments that apply to the subscription and assign + * the policy definition whose id is {value}. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PolicyAssignmentListResult} - 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 PolicyAssignmentListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = PolicyAssignments; diff --git a/lib/services/resourceManagement/lib/operations/policyDefinitions.js b/lib/services/resourceManagement/lib/operations/policyDefinitions.js new file mode 100644 index 0000000000..f032586168 --- /dev/null +++ b/lib/services/resourceManagement/lib/operations/policyDefinitions.js @@ -0,0 +1,3140 @@ +/* + * 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 policy definition in a subscription. + * + * This operation creates or updates a policy definition in the given + * subscription with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * create. + * + * @param {object} parameters The policy definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy + * definition. + * + * @param {string} [parameters.description] The policy definition description. + * + * @param {object} [parameters.policyRule] The policy rule. + * + * @param {object} [parameters.metadata] The policy definition metadata. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @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 PolicyDefinition} 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(policyDefinitionName, parameters, 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 (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { + throw new Error('policyDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.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.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.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.Authorization/policyDefinitions/{policyDefinitionName}'; + requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PolicyDefinition']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 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['PolicyDefinition']().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 policy definition in a subscription. + * + * This operation deletes the policy definition in the given subscription with + * the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * delete. + * + * @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(policyDefinitionName, 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 (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { + throw new Error('policyDefinitionName 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.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.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.Authorization/policyDefinitions/{policyDefinitionName}'; + requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); + 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 = '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 Retrieves a policy definition in a subscription. + * + * This operation retrieves the policy definition in the given subscription + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * get. + * + * @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 PolicyDefinition} 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(policyDefinitionName, 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 (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { + throw new Error('policyDefinitionName 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.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.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.Authorization/policyDefinitions/{policyDefinitionName}'; + requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); + 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 = new client.models['PolicyDefinition']().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 Retrieves a built-in policy definition. + * + * This operation retrieves the built-in policy definition with the given name. + * + * @param {string} policyDefinitionName The name of the built-in policy + * definition to get. + * + * @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 PolicyDefinition} 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 _getBuiltIn(policyDefinitionName, 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 (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { + throw new Error('policyDefinitionName 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('/') ? '' : '/') + 'providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'; + requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); + 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['PolicyDefinition']().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 policy definition in a management group. + * + * This operation creates or updates a policy definition in the given + * management group with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * create. + * + * @param {object} parameters The policy definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy + * definition. + * + * @param {string} [parameters.description] The policy definition description. + * + * @param {object} [parameters.policyRule] The policy rule. + * + * @param {object} [parameters.metadata] The policy definition metadata. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 PolicyDefinition} 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 _createOrUpdateAtManagementGroup(policyDefinitionName, parameters, managementGroupId, 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 (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { + throw new Error('policyDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { + throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'; + requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); + requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PolicyDefinition']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 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['PolicyDefinition']().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 policy definition in a management group. + * + * This operation deletes the policy definition in the given management group + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * delete. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 _deleteAtManagementGroup(policyDefinitionName, managementGroupId, 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 (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { + throw new Error('policyDefinitionName 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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { + throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'; + requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); + requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); + 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 Retrieve a policy definition in a management group. + * + * This operation retrieves the policy definition in the given management group + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * get. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 PolicyDefinition} 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 _getAtManagementGroup(policyDefinitionName, managementGroupId, 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 (policyDefinitionName === null || policyDefinitionName === undefined || typeof policyDefinitionName.valueOf() !== 'string') { + throw new Error('policyDefinitionName 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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { + throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'; + requestUrl = requestUrl.replace('{policyDefinitionName}', encodeURIComponent(policyDefinitionName)); + requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); + 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['PolicyDefinition']().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 Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. + * + * @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 PolicyDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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.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.Authorization/policyDefinitions'; + 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 = new client.models['PolicyDefinitionListResult']().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 Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. + * + * @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 PolicyDefinitionListResult} 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 _listBuiltIn(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Authorization/policyDefinitions'; + 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['PolicyDefinitionListResult']().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 Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 PolicyDefinitionListResult} 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 _listByManagementGroup(managementGroupId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { + throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions'; + requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); + 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['PolicyDefinitionListResult']().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 Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyDefinitionListResult']().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 Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} 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 _listBuiltInNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyDefinitionListResult']().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 Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PolicyDefinitionListResult} 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 _listByManagementGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicyDefinitionListResult']().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 PolicyDefinitions. */ +class PolicyDefinitions { + /** + * Create a PolicyDefinitions. + * @param {PolicyClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._getBuiltIn = _getBuiltIn; + this._createOrUpdateAtManagementGroup = _createOrUpdateAtManagementGroup; + this._deleteAtManagementGroup = _deleteAtManagementGroup; + this._getAtManagementGroup = _getAtManagementGroup; + this._list = _list; + this._listBuiltIn = _listBuiltIn; + this._listByManagementGroup = _listByManagementGroup; + this._listNext = _listNext; + this._listBuiltInNext = _listBuiltInNext; + this._listByManagementGroupNext = _listByManagementGroupNext; + } + + /** + * @summary Creates or updates a policy definition in a subscription. + * + * This operation creates or updates a policy definition in the given + * subscription with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * create. + * + * @param {object} parameters The policy definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy + * definition. + * + * @param {string} [parameters.description] The policy definition description. + * + * @param {object} [parameters.policyRule] The policy rule. + * + * @param {object} [parameters.metadata] The policy definition metadata. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @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(policyDefinitionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(policyDefinitionName, parameters, 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 policy definition in a subscription. + * + * This operation creates or updates a policy definition in the given + * subscription with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * create. + * + * @param {object} parameters The policy definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy + * definition. + * + * @param {string} [parameters.description] The policy definition description. + * + * @param {object} [parameters.policyRule] The policy rule. + * + * @param {object} [parameters.metadata] The policy definition metadata. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @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 {PolicyDefinition} - 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 PolicyDefinition} 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(policyDefinitionName, parameters, 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(policyDefinitionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(policyDefinitionName, parameters, options, optionalCallback); + } + } + + /** + * @summary Deletes a policy definition in a subscription. + * + * This operation deletes the policy definition in the given subscription with + * the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * delete. + * + * @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(policyDefinitionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(policyDefinitionName, 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 policy definition in a subscription. + * + * This operation deletes the policy definition in the given subscription with + * the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * delete. + * + * @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(policyDefinitionName, 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(policyDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(policyDefinitionName, options, optionalCallback); + } + } + + /** + * @summary Retrieves a policy definition in a subscription. + * + * This operation retrieves the policy definition in the given subscription + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * get. + * + * @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(policyDefinitionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(policyDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves a policy definition in a subscription. + * + * This operation retrieves the policy definition in the given subscription + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * get. + * + * @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 {PolicyDefinition} - 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 PolicyDefinition} 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(policyDefinitionName, 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(policyDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(policyDefinitionName, options, optionalCallback); + } + } + + /** + * @summary Retrieves a built-in policy definition. + * + * This operation retrieves the built-in policy definition with the given name. + * + * @param {string} policyDefinitionName The name of the built-in policy + * definition to get. + * + * @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. + */ + getBuiltInWithHttpOperationResponse(policyDefinitionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getBuiltIn(policyDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves a built-in policy definition. + * + * This operation retrieves the built-in policy definition with the given name. + * + * @param {string} policyDefinitionName The name of the built-in policy + * definition to get. + * + * @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 {PolicyDefinition} - 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 PolicyDefinition} 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. + */ + getBuiltIn(policyDefinitionName, 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._getBuiltIn(policyDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getBuiltIn(policyDefinitionName, options, optionalCallback); + } + } + + /** + * @summary Creates or updates a policy definition in a management group. + * + * This operation creates or updates a policy definition in the given + * management group with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * create. + * + * @param {object} parameters The policy definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy + * definition. + * + * @param {string} [parameters.description] The policy definition description. + * + * @param {object} [parameters.policyRule] The policy rule. + * + * @param {object} [parameters.metadata] The policy definition metadata. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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. + */ + createOrUpdateAtManagementGroupWithHttpOperationResponse(policyDefinitionName, parameters, managementGroupId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdateAtManagementGroup(policyDefinitionName, parameters, managementGroupId, 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 policy definition in a management group. + * + * This operation creates or updates a policy definition in the given + * management group with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * create. + * + * @param {object} parameters The policy definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.mode] The policy definition mode. Possible + * values are NotSpecified, Indexed, and All. Possible values include: + * 'NotSpecified', 'Indexed', 'All' + * + * @param {string} [parameters.displayName] The display name of the policy + * definition. + * + * @param {string} [parameters.description] The policy definition description. + * + * @param {object} [parameters.policyRule] The policy rule. + * + * @param {object} [parameters.metadata] The policy definition metadata. + * + * @param {object} [parameters.parameters] Required if a parameter is used in + * policy rule. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 {PolicyDefinition} - 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 PolicyDefinition} 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. + */ + createOrUpdateAtManagementGroup(policyDefinitionName, parameters, managementGroupId, 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._createOrUpdateAtManagementGroup(policyDefinitionName, parameters, managementGroupId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdateAtManagementGroup(policyDefinitionName, parameters, managementGroupId, options, optionalCallback); + } + } + + /** + * @summary Deletes a policy definition in a management group. + * + * This operation deletes the policy definition in the given management group + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * delete. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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. + */ + deleteAtManagementGroupWithHttpOperationResponse(policyDefinitionName, managementGroupId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteAtManagementGroup(policyDefinitionName, managementGroupId, 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 policy definition in a management group. + * + * This operation deletes the policy definition in the given management group + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * delete. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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. + */ + deleteAtManagementGroup(policyDefinitionName, managementGroupId, 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._deleteAtManagementGroup(policyDefinitionName, managementGroupId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteAtManagementGroup(policyDefinitionName, managementGroupId, options, optionalCallback); + } + } + + /** + * @summary Retrieve a policy definition in a management group. + * + * This operation retrieves the policy definition in the given management group + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * get. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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. + */ + getAtManagementGroupWithHttpOperationResponse(policyDefinitionName, managementGroupId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getAtManagementGroup(policyDefinitionName, managementGroupId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieve a policy definition in a management group. + * + * This operation retrieves the policy definition in the given management group + * with the given name. + * + * @param {string} policyDefinitionName The name of the policy definition to + * get. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 {PolicyDefinition} - 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 PolicyDefinition} 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. + */ + getAtManagementGroup(policyDefinitionName, managementGroupId, 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._getAtManagementGroup(policyDefinitionName, managementGroupId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getAtManagementGroup(policyDefinitionName, managementGroupId, options, optionalCallback); + } + } + + /** + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. + * + * @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 {PolicyDefinitionListResult} - 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 PolicyDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. + * + * @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. + */ + listBuiltInWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBuiltIn(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. + * + * @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 {PolicyDefinitionListResult} - 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 PolicyDefinitionListResult} 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. + */ + listBuiltIn(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._listBuiltIn(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBuiltIn(options, optionalCallback); + } + } + + /** + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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. + */ + listByManagementGroupWithHttpOperationResponse(managementGroupId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByManagementGroup(managementGroupId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 {PolicyDefinitionListResult} - 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 PolicyDefinitionListResult} 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. + */ + listByManagementGroup(managementGroupId, 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._listByManagementGroup(managementGroupId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByManagementGroup(managementGroupId, options, optionalCallback); + } + } + + /** + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves policy definitions in a subscription + * + * This operation retrieves a list of all the policy definitions in a given + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PolicyDefinitionListResult} - 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 PolicyDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBuiltInNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBuiltInNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieve built-in policy definitions + * + * This operation retrieves a list of all the built-in policy definitions. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PolicyDefinitionListResult} - 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 PolicyDefinitionListResult} 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. + */ + listBuiltInNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBuiltInNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBuiltInNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByManagementGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByManagementGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieve policy definitions in a management group + * + * This operation retrieves a list of all the policy definitions in a given + * management group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PolicyDefinitionListResult} - 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 PolicyDefinitionListResult} 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. + */ + listByManagementGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByManagementGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByManagementGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = PolicyDefinitions; diff --git a/lib/services/resourceManagement/lib/operations/policySetDefinitions.js b/lib/services/resourceManagement/lib/operations/policySetDefinitions.js new file mode 100644 index 0000000000..8e6ffd0fd9 --- /dev/null +++ b/lib/services/resourceManagement/lib/operations/policySetDefinitions.js @@ -0,0 +1,3178 @@ +/* + * 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 policy set definition. + * + * This operation creates or updates a policy set definition in the given + * subscription with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. + * + * @param {object} parameters The policy set definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.displayName] The display name of the policy set + * definition. + * + * @param {string} [parameters.description] The policy set definition + * description. + * + * @param {object} [parameters.metadata] The policy set definition metadata. + * + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. + * + * @param {array} parameters.policyDefinitions An array of policy definition + * references. + * + * @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 PolicySetDefinition} 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(policySetDefinitionName, parameters, 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 (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { + throw new Error('policySetDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.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.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.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.Authorization/policySetDefinitions/{policySetDefinitionName}'; + requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PolicySetDefinition']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinition']().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); + } + } + // 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['PolicySetDefinition']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given subscription + * with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. + * + * @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(policySetDefinitionName, 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 (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { + throw new Error('policySetDefinitionName 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.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.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.Authorization/policySetDefinitions/{policySetDefinitionName}'; + requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); + 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 = '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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given subscription + * with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @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 PolicySetDefinition} 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(policySetDefinitionName, 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 (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { + throw new Error('policySetDefinitionName 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.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.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.Authorization/policySetDefinitions/{policySetDefinitionName}'; + requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinition']().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 Retrieves a built in policy set definition. + * + * This operation retrieves the built-in policy set definition with the given + * name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @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 PolicySetDefinition} 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 _getBuiltIn(policySetDefinitionName, 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 (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { + throw new Error('policySetDefinitionName 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('/') ? '' : '/') + 'providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'; + requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinition']().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 Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. + * + * @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 PolicySetDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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.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.Authorization/policySetDefinitions'; + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinitionListResult']().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 Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. + * + * @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 PolicySetDefinitionListResult} 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 _listBuiltIn(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Authorization/policySetDefinitions'; + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinitionListResult']().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 policy set definition. + * + * This operation creates or updates a policy set definition in the given + * management group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. + * + * @param {object} parameters The policy set definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.displayName] The display name of the policy set + * definition. + * + * @param {string} [parameters.description] The policy set definition + * description. + * + * @param {object} [parameters.metadata] The policy set definition metadata. + * + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. + * + * @param {array} parameters.policyDefinitions An array of policy definition + * references. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 PolicySetDefinition} 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 _createOrUpdateAtManagementGroup(policySetDefinitionName, parameters, managementGroupId, 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 (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { + throw new Error('policySetDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { + throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'; + requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); + requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PolicySetDefinition']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinition']().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); + } + } + // 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['PolicySetDefinition']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given management + * group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 _deleteAtManagementGroup(policySetDefinitionName, managementGroupId, 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 (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { + throw new Error('policySetDefinitionName 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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { + throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'; + requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); + requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given management + * group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 PolicySetDefinition} 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 _getAtManagementGroup(policySetDefinitionName, managementGroupId, 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 (policySetDefinitionName === null || policySetDefinitionName === undefined || typeof policySetDefinitionName.valueOf() !== 'string') { + throw new Error('policySetDefinitionName 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 (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { + throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'; + requestUrl = requestUrl.replace('{policySetDefinitionName}', encodeURIComponent(policySetDefinitionName)); + requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinition']().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 Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 PolicySetDefinitionListResult} 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 _listByManagementGroup(managementGroupId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (managementGroupId === null || managementGroupId === undefined || typeof managementGroupId.valueOf() !== 'string') { + throw new Error('managementGroupId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions'; + requestUrl = requestUrl.replace('{managementGroupId}', encodeURIComponent(managementGroupId)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinitionListResult']().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 Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinitionListResult']().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 Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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 _listBuiltInNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinitionListResult']().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 Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PolicySetDefinitionListResult} 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 _listByManagementGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PolicySetDefinitionListResult']().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 PolicySetDefinitions. */ +class PolicySetDefinitions { + /** + * Create a PolicySetDefinitions. + * @param {PolicyClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._getBuiltIn = _getBuiltIn; + this._list = _list; + this._listBuiltIn = _listBuiltIn; + this._createOrUpdateAtManagementGroup = _createOrUpdateAtManagementGroup; + this._deleteAtManagementGroup = _deleteAtManagementGroup; + this._getAtManagementGroup = _getAtManagementGroup; + this._listByManagementGroup = _listByManagementGroup; + this._listNext = _listNext; + this._listBuiltInNext = _listBuiltInNext; + this._listByManagementGroupNext = _listByManagementGroupNext; + } + + /** + * @summary Creates or updates a policy set definition. + * + * This operation creates or updates a policy set definition in the given + * subscription with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. + * + * @param {object} parameters The policy set definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.displayName] The display name of the policy set + * definition. + * + * @param {string} [parameters.description] The policy set definition + * description. + * + * @param {object} [parameters.metadata] The policy set definition metadata. + * + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. + * + * @param {array} parameters.policyDefinitions An array of policy definition + * references. + * + * @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(policySetDefinitionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(policySetDefinitionName, parameters, 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 policy set definition. + * + * This operation creates or updates a policy set definition in the given + * subscription with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. + * + * @param {object} parameters The policy set definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.displayName] The display name of the policy set + * definition. + * + * @param {string} [parameters.description] The policy set definition + * description. + * + * @param {object} [parameters.metadata] The policy set definition metadata. + * + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. + * + * @param {array} parameters.policyDefinitions An array of policy definition + * references. + * + * @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 {PolicySetDefinition} - 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 PolicySetDefinition} 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(policySetDefinitionName, parameters, 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(policySetDefinitionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(policySetDefinitionName, parameters, options, optionalCallback); + } + } + + /** + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given subscription + * with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. + * + * @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(policySetDefinitionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(policySetDefinitionName, 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 policy set definition. + * + * This operation deletes the policy set definition in the given subscription + * with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. + * + * @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(policySetDefinitionName, 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(policySetDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(policySetDefinitionName, options, optionalCallback); + } + } + + /** + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given subscription + * with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @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(policySetDefinitionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(policySetDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given subscription + * with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @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 {PolicySetDefinition} - 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 PolicySetDefinition} 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(policySetDefinitionName, 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(policySetDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(policySetDefinitionName, options, optionalCallback); + } + } + + /** + * @summary Retrieves a built in policy set definition. + * + * This operation retrieves the built-in policy set definition with the given + * name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @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. + */ + getBuiltInWithHttpOperationResponse(policySetDefinitionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getBuiltIn(policySetDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves a built in policy set definition. + * + * This operation retrieves the built-in policy set definition with the given + * name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @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 {PolicySetDefinition} - 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 PolicySetDefinition} 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. + */ + getBuiltIn(policySetDefinitionName, 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._getBuiltIn(policySetDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getBuiltIn(policySetDefinitionName, options, optionalCallback); + } + } + + /** + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. + * + * @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 {PolicySetDefinitionListResult} - 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 PolicySetDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. + * + * @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. + */ + listBuiltInWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBuiltIn(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. + * + * @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 {PolicySetDefinitionListResult} - 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 PolicySetDefinitionListResult} 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. + */ + listBuiltIn(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._listBuiltIn(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBuiltIn(options, optionalCallback); + } + } + + /** + * @summary Creates or updates a policy set definition. + * + * This operation creates or updates a policy set definition in the given + * management group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. + * + * @param {object} parameters The policy set definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.displayName] The display name of the policy set + * definition. + * + * @param {string} [parameters.description] The policy set definition + * description. + * + * @param {object} [parameters.metadata] The policy set definition metadata. + * + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. + * + * @param {array} parameters.policyDefinitions An array of policy definition + * references. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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. + */ + createOrUpdateAtManagementGroupWithHttpOperationResponse(policySetDefinitionName, parameters, managementGroupId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdateAtManagementGroup(policySetDefinitionName, parameters, managementGroupId, 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 policy set definition. + * + * This operation creates or updates a policy set definition in the given + * management group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to create. + * + * @param {object} parameters The policy set definition properties. + * + * @param {string} [parameters.policyType] The type of policy definition. + * Possible values are NotSpecified, BuiltIn, and Custom. Possible values + * include: 'NotSpecified', 'BuiltIn', 'Custom' + * + * @param {string} [parameters.displayName] The display name of the policy set + * definition. + * + * @param {string} [parameters.description] The policy set definition + * description. + * + * @param {object} [parameters.metadata] The policy set definition metadata. + * + * @param {object} [parameters.parameters] The policy set definition parameters + * that can be used in policy definition references. + * + * @param {array} parameters.policyDefinitions An array of policy definition + * references. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 {PolicySetDefinition} - 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 PolicySetDefinition} 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. + */ + createOrUpdateAtManagementGroup(policySetDefinitionName, parameters, managementGroupId, 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._createOrUpdateAtManagementGroup(policySetDefinitionName, parameters, managementGroupId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdateAtManagementGroup(policySetDefinitionName, parameters, managementGroupId, options, optionalCallback); + } + } + + /** + * @summary Deletes a policy set definition. + * + * This operation deletes the policy set definition in the given management + * group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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. + */ + deleteAtManagementGroupWithHttpOperationResponse(policySetDefinitionName, managementGroupId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteAtManagementGroup(policySetDefinitionName, managementGroupId, 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 policy set definition. + * + * This operation deletes the policy set definition in the given management + * group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to delete. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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. + */ + deleteAtManagementGroup(policySetDefinitionName, managementGroupId, 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._deleteAtManagementGroup(policySetDefinitionName, managementGroupId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteAtManagementGroup(policySetDefinitionName, managementGroupId, options, optionalCallback); + } + } + + /** + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given management + * group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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. + */ + getAtManagementGroupWithHttpOperationResponse(policySetDefinitionName, managementGroupId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getAtManagementGroup(policySetDefinitionName, managementGroupId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves a policy set definition. + * + * This operation retrieves the policy set definition in the given management + * group with the given name. + * + * @param {string} policySetDefinitionName The name of the policy set + * definition to get. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 {PolicySetDefinition} - 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 PolicySetDefinition} 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. + */ + getAtManagementGroup(policySetDefinitionName, managementGroupId, 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._getAtManagementGroup(policySetDefinitionName, managementGroupId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getAtManagementGroup(policySetDefinitionName, managementGroupId, options, optionalCallback); + } + } + + /** + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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. + */ + listByManagementGroupWithHttpOperationResponse(managementGroupId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByManagementGroup(managementGroupId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. + * + * @param {string} managementGroupId The ID of the management group. + * + * @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 {PolicySetDefinitionListResult} - 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 PolicySetDefinitionListResult} 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. + */ + listByManagementGroup(managementGroupId, 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._listByManagementGroup(managementGroupId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByManagementGroup(managementGroupId, options, optionalCallback); + } + } + + /** + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves the policy set definitions for a subscription. + * + * This operation retrieves a list of all the policy set definitions in the + * given subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PolicySetDefinitionListResult} - 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 PolicySetDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBuiltInNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBuiltInNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves built-in policy set definitions. + * + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PolicySetDefinitionListResult} - 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 PolicySetDefinitionListResult} 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. + */ + listBuiltInNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBuiltInNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBuiltInNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByManagementGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByManagementGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves all policy set definitions in management group. + * + * This operation retrieves a list of all the a policy set definition in the + * given management group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PolicySetDefinitionListResult} - 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 PolicySetDefinitionListResult} 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. + */ + listByManagementGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByManagementGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByManagementGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = PolicySetDefinitions; diff --git a/lib/services/resourceManagement/lib/policyClient.d.ts b/lib/services/resourceManagement/lib/policyClient.d.ts new file mode 100644 index 0000000000..2b1b11dcf8 --- /dev/null +++ b/lib/services/resourceManagement/lib/policyClient.d.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class PolicyClient extends AzureServiceClient { + /** + * Initializes a new instance of the PolicyClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The ID of the target subscription. + * + * @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 + policyAssignments: operations.PolicyAssignments; + policyDefinitions: operations.PolicyDefinitions; + policySetDefinitions: operations.PolicySetDefinitions; +} + +export { PolicyClient, models as PolicyModels }; diff --git a/lib/services/resourceManagement/lib/policyClient.js b/lib/services/resourceManagement/lib/policyClient.js new file mode 100644 index 0000000000..cbb1768e2c --- /dev/null +++ b/lib/services/resourceManagement/lib/policyClient.js @@ -0,0 +1,87 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a PolicyClient. */ +class PolicyClient extends ServiceClient { + /** + * Create a PolicyClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The ID of the target subscription. + * @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-03-01'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.policyAssignments = new operations.PolicyAssignments(this); + this.policyDefinitions = new operations.PolicyDefinitions(this); + this.policySetDefinitions = new operations.PolicySetDefinitions(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = PolicyClient; +module.exports['default'] = PolicyClient; +module.exports.PolicyClient = PolicyClient; +module.exports.PolicyModels = models; From 8d61507c4d2dc751e4e36b674fec275a3dd35219 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Wed, 18 Jul 2018 16:34:55 -0700 Subject: [PATCH 4/4] Update package.json --- lib/services/resourceManagement/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/resourceManagement/package.json b/lib/services/resourceManagement/package.json index 4f568523bd..b0648a040c 100644 --- a/lib/services/resourceManagement/package.json +++ b/lib/services/resourceManagement/package.json @@ -6,7 +6,7 @@ "Zavery, Amar ", "Srinivasan, Vivek " ], - "version": "3.2.1-preview", + "version": "4.0.0", "description": "Microsoft Azure Resource Management Client Library for node", "tags": [ "azure",