diff --git a/lib/services/keyVaultManagement/lib/LICENSE.txt b/lib/services/keyVaultManagement/lib/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/keyVaultManagement/lib/lib/keyVaultManagementClient.d.ts b/lib/services/keyVaultManagement/lib/lib/keyVaultManagementClient.d.ts new file mode 100644 index 0000000000..7910345414 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/keyVaultManagementClient.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 KeyVaultManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the KeyVaultManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - 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. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + apiVersion: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + vaults: operations.Vaults; + operations: operations.Operations; +} + +export { KeyVaultManagementClient, models as KeyVaultManagementModels }; diff --git a/lib/services/keyVaultManagement/lib/lib/keyVaultManagementClient.js b/lib/services/keyVaultManagement/lib/lib/keyVaultManagementClient.js new file mode 100644 index 0000000000..ee4fa8338d --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/keyVaultManagementClient.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 KeyVaultManagementClient. */ +class KeyVaultManagementClient extends ServiceClient { + /** + * Create a KeyVaultManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - 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. + */ + 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-02-14-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.vaults = new operations.Vaults(this); + this.operations = new operations.Operations(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = KeyVaultManagementClient; +module.exports['default'] = KeyVaultManagementClient; +module.exports.KeyVaultManagementClient = KeyVaultManagementClient; +module.exports.KeyVaultManagementModels = models; diff --git a/lib/services/keyVaultManagement/lib/lib/models/accessPolicyEntry.js b/lib/services/keyVaultManagement/lib/lib/models/accessPolicyEntry.js new file mode 100644 index 0000000000..9ad15cc456 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/accessPolicyEntry.js @@ -0,0 +1,89 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An identity that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + */ +class AccessPolicyEntry { + /** + * Create a AccessPolicyEntry. + * @member {uuid} tenantId The Azure Active Directory tenant ID that should + * be used for authenticating requests to the key vault. + * @member {string} objectId The object ID of a user, service principal or + * security group in the Azure Active Directory tenant for the vault. The + * object ID must be unique for the list of access policies. + * @member {uuid} [applicationId] Application ID of the client making request + * on behalf of a principal + * @member {object} permissions Permissions the identity has for keys, + * secrets and certificates. + * @member {array} [permissions.keys] Permissions to keys + * @member {array} [permissions.secrets] Permissions to secrets + * @member {array} [permissions.certificates] Permissions to certificates + * @member {array} [permissions.storage] Permissions to storage accounts + */ + constructor() { + } + + /** + * Defines the metadata of AccessPolicyEntry + * + * @returns {object} metadata of AccessPolicyEntry + * + */ + mapper() { + return { + required: false, + serializedName: 'AccessPolicyEntry', + type: { + name: 'Composite', + className: 'AccessPolicyEntry', + modelProperties: { + tenantId: { + required: true, + serializedName: 'tenantId', + type: { + name: 'String' + } + }, + objectId: { + required: true, + serializedName: 'objectId', + type: { + name: 'String' + } + }, + applicationId: { + required: false, + serializedName: 'applicationId', + type: { + name: 'String' + } + }, + permissions: { + required: true, + serializedName: 'permissions', + type: { + name: 'Composite', + className: 'Permissions' + } + } + } + } + }; + } +} + +module.exports = AccessPolicyEntry; diff --git a/lib/services/keyVaultManagement/lib/lib/models/checkNameAvailabilityResult.js b/lib/services/keyVaultManagement/lib/lib/models/checkNameAvailabilityResult.js new file mode 100644 index 0000000000..f6b1d65f94 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/checkNameAvailabilityResult.js @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The CheckNameAvailability operation response. + * + */ +class CheckNameAvailabilityResult { + /** + * Create a CheckNameAvailabilityResult. + * @member {boolean} [nameAvailable] A boolean value that indicates whether + * the name is available for you to use. If true, the name is available. If + * false, the name has already been taken or is invalid and cannot be used. + * @member {string} [reason] The reason that a vault name could not be used. + * The Reason element is only returned if NameAvailable is false. Possible + * values include: 'AccountNameInvalid', 'AlreadyExists' + * @member {string} [message] An error message explaining the Reason value in + * more detail. + */ + constructor() { + } + + /** + * Defines the metadata of CheckNameAvailabilityResult + * + * @returns {object} metadata of CheckNameAvailabilityResult + * + */ + mapper() { + return { + required: false, + serializedName: 'CheckNameAvailabilityResult', + type: { + name: 'Composite', + className: 'CheckNameAvailabilityResult', + modelProperties: { + nameAvailable: { + required: false, + readOnly: true, + serializedName: 'nameAvailable', + type: { + name: 'Boolean' + } + }, + reason: { + required: false, + readOnly: true, + serializedName: 'reason', + type: { + name: 'Enum', + allowedValues: [ 'AccountNameInvalid', 'AlreadyExists' ] + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CheckNameAvailabilityResult; diff --git a/lib/services/keyVaultManagement/lib/lib/models/deletedVault.js b/lib/services/keyVaultManagement/lib/lib/models/deletedVault.js new file mode 100644 index 0000000000..4f982aa6eb --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/deletedVault.js @@ -0,0 +1,88 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Deleted vault information with extended details. + * + */ +class DeletedVault { + /** + * Create a DeletedVault. + * @member {string} [id] The resource ID for the deleted key vault. + * @member {string} [name] The name of the key vault. + * @member {string} [type] The resource type of the key vault. + * @member {object} [properties] Properties of the vault + * @member {string} [properties.vaultId] The resource id of the original + * vault. + * @member {string} [properties.location] The location of the original vault. + * @member {date} [properties.deletionDate] The deleted date. + * @member {date} [properties.scheduledPurgeDate] The scheduled purged date. + * @member {object} [properties.tags] Tags of the original vault. + */ + constructor() { + } + + /** + * Defines the metadata of DeletedVault + * + * @returns {object} metadata of DeletedVault + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedVault', + type: { + name: 'Composite', + className: 'DeletedVault', + 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' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Composite', + className: 'DeletedVaultProperties' + } + } + } + } + }; + } +} + +module.exports = DeletedVault; diff --git a/lib/services/keyVaultManagement/lib/lib/models/deletedVaultListResult.js b/lib/services/keyVaultManagement/lib/lib/models/deletedVaultListResult.js new file mode 100644 index 0000000000..42b5c4092e --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/deletedVaultListResult.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * List of vaults + */ +class DeletedVaultListResult extends Array { + /** + * Create a DeletedVaultListResult. + * @member {string} [nextLink] The URL to get the next set of deleted vaults. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedVaultListResult + * + * @returns {object} metadata of DeletedVaultListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedVaultListResult', + type: { + name: 'Composite', + className: 'DeletedVaultListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DeletedVaultElementType', + type: { + name: 'Composite', + className: 'DeletedVault' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DeletedVaultListResult; diff --git a/lib/services/keyVaultManagement/lib/lib/models/deletedVaultProperties.js b/lib/services/keyVaultManagement/lib/lib/models/deletedVaultProperties.js new file mode 100644 index 0000000000..7dab4539e4 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/deletedVaultProperties.js @@ -0,0 +1,96 @@ +/* + * 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'; + +/** + * Properties of the deleted vault. + * + */ +class DeletedVaultProperties { + /** + * Create a DeletedVaultProperties. + * @member {string} [vaultId] The resource id of the original vault. + * @member {string} [location] The location of the original vault. + * @member {date} [deletionDate] The deleted date. + * @member {date} [scheduledPurgeDate] The scheduled purged date. + * @member {object} [tags] Tags of the original vault. + */ + constructor() { + } + + /** + * Defines the metadata of DeletedVaultProperties + * + * @returns {object} metadata of DeletedVaultProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedVaultProperties', + type: { + name: 'Composite', + className: 'DeletedVaultProperties', + modelProperties: { + vaultId: { + required: false, + readOnly: true, + serializedName: 'vaultId', + type: { + name: 'String' + } + }, + location: { + required: false, + readOnly: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + deletionDate: { + required: false, + readOnly: true, + serializedName: 'deletionDate', + type: { + name: 'DateTime' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'DateTime' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DeletedVaultProperties; diff --git a/lib/services/keyVaultManagement/lib/lib/models/iPRule.js b/lib/services/keyVaultManagement/lib/lib/models/iPRule.js new file mode 100644 index 0000000000..892a6046b1 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/iPRule.js @@ -0,0 +1,55 @@ +/* + * 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'; + +/** + * A rule governing the accesibility of a vault from a specific ip address or + * ip range. + * + */ +class IPRule { + /** + * Create a IPRule. + * @member {string} value An IPv4 address range in CIDR notation, such as + * '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that + * start with 124.56.78). + */ + constructor() { + } + + /** + * Defines the metadata of IPRule + * + * @returns {object} metadata of IPRule + * + */ + mapper() { + return { + required: false, + serializedName: 'IPRule', + type: { + name: 'Composite', + className: 'IPRule', + modelProperties: { + value: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IPRule; diff --git a/lib/services/keyVaultManagement/lib/lib/models/index.d.ts b/lib/services/keyVaultManagement/lib/lib/models/index.d.ts new file mode 100644 index 0000000000..85719e36e8 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/index.d.ts @@ -0,0 +1,694 @@ +/* + * 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 Sku class. + * @constructor + * SKU details + * + * @member {string} name SKU name to specify whether the key vault is a + * standard vault or a premium vault. Possible values include: 'standard', + * 'premium' + */ +export interface Sku { + name: string; +} + +/** + * @class + * Initializes a new instance of the Permissions class. + * @constructor + * Permissions the identity has for keys, secrets, certificates and storage. + * + * @member {array} [keys] Permissions to keys + * @member {array} [secrets] Permissions to secrets + * @member {array} [certificates] Permissions to certificates + * @member {array} [storage] Permissions to storage accounts + */ +export interface Permissions { + keys?: string[]; + secrets?: string[]; + certificates?: string[]; + storage?: string[]; +} + +/** + * @class + * Initializes a new instance of the AccessPolicyEntry class. + * @constructor + * An identity that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @member {uuid} tenantId The Azure Active Directory tenant ID that should be + * used for authenticating requests to the key vault. + * @member {string} objectId The object ID of a user, service principal or + * security group in the Azure Active Directory tenant for the vault. The + * object ID must be unique for the list of access policies. + * @member {uuid} [applicationId] Application ID of the client making request + * on behalf of a principal + * @member {object} permissions Permissions the identity has for keys, secrets + * and certificates. + * @member {array} [permissions.keys] Permissions to keys + * @member {array} [permissions.secrets] Permissions to secrets + * @member {array} [permissions.certificates] Permissions to certificates + * @member {array} [permissions.storage] Permissions to storage accounts + */ +export interface AccessPolicyEntry { + tenantId: string; + objectId: string; + applicationId?: string; + permissions: Permissions; +} + +/** + * @class + * Initializes a new instance of the IPRule class. + * @constructor + * A rule governing the accesibility of a vault from a specific ip address or + * ip range. + * + * @member {string} value An IPv4 address range in CIDR notation, such as + * '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that + * start with 124.56.78). + */ +export interface IPRule { + value: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkRule class. + * @constructor + * A rule governing the accesibility of a vault from a specific virtual + * network. + * + * @member {string} id Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + */ +export interface VirtualNetworkRule { + id: string; +} + +/** + * @class + * Initializes a new instance of the NetworkRuleSet class. + * @constructor + * A set of rules governing the network accessibility of a vault. + * + * @member {string} [bypass] Tells what traffic can bypass network rules. This + * can be 'AzureServices' or 'None'. If not specified the default is + * 'AzureServices'. Possible values include: 'AzureServices', 'None' + * @member {string} [defaultAction] The default action when no rule from + * ipRules and from virtualNetworkRules match. This is only used after the + * bypass property has been evaluated. Possible values include: 'Allow', 'Deny' + * @member {array} [ipRules] The list of IP address rules. + * @member {array} [virtualNetworkRules] The list of virtual network rules. + */ +export interface NetworkRuleSet { + bypass?: string; + defaultAction?: string; + ipRules?: IPRule[]; + virtualNetworkRules?: VirtualNetworkRule[]; +} + +/** + * @class + * Initializes a new instance of the VaultProperties class. + * @constructor + * Properties of the vault + * + * @member {uuid} tenantId The Azure Active Directory tenant ID that should be + * used for authenticating requests to the key vault. + * @member {object} sku SKU details + * @member {string} [sku.name] SKU name to specify whether the key vault is a + * standard vault or a premium vault. Possible values include: 'standard', + * 'premium' + * @member {array} [accessPolicies] An array of 0 to 16 identities that have + * access to the key vault. All identities in the array must use the same + * tenant ID as the key vault's tenant ID. + * @member {string} [vaultUri] The URI of the vault for performing operations + * on keys and secrets. + * @member {boolean} [enabledForDeployment] Property to specify whether Azure + * Virtual Machines are permitted to retrieve certificates stored as secrets + * from the key vault. + * @member {boolean} [enabledForDiskEncryption] Property to specify whether + * Azure Disk Encryption is permitted to retrieve secrets from the vault and + * unwrap keys. + * @member {boolean} [enabledForTemplateDeployment] Property to specify whether + * Azure Resource Manager is permitted to retrieve secrets from the key vault. + * @member {boolean} [enableSoftDelete] Property to specify whether the 'soft + * delete' functionality is enabled for this key vault. It does not accept + * false value. + * @member {string} [createMode] The vault's create mode to indicate whether + * the vault need to be recovered or not. Possible values include: 'recover', + * 'default' + * @member {boolean} [enablePurgeProtection] Property specifying whether + * protection against purge is enabled for this vault. Setting this property to + * true activates protection against purge for this vault and its content - + * only the Key Vault service may initiate a hard, irrecoverable deletion. The + * setting is effective only if soft delete is also enabled. Enabling this + * functionality is irreversible - that is, the property does not accept false + * as its value. + * @member {object} [networkAcls] A collection of rules governing the + * accessibility of the vault from specific network locations. + * @member {string} [networkAcls.bypass] Tells what traffic can bypass network + * rules. This can be 'AzureServices' or 'None'. If not specified the default + * is 'AzureServices'. Possible values include: 'AzureServices', 'None' + * @member {string} [networkAcls.defaultAction] The default action when no rule + * from ipRules and from virtualNetworkRules match. This is only used after the + * bypass property has been evaluated. Possible values include: 'Allow', 'Deny' + * @member {array} [networkAcls.ipRules] The list of IP address rules. + * @member {array} [networkAcls.virtualNetworkRules] The list of virtual + * network rules. + */ +export interface VaultProperties { + tenantId: string; + sku: Sku; + accessPolicies?: AccessPolicyEntry[]; + vaultUri?: string; + enabledForDeployment?: boolean; + enabledForDiskEncryption?: boolean; + enabledForTemplateDeployment?: boolean; + enableSoftDelete?: boolean; + createMode?: string; + enablePurgeProtection?: boolean; + networkAcls?: NetworkRuleSet; +} + +/** + * @class + * Initializes a new instance of the VaultPatchProperties class. + * @constructor + * Properties of the vault + * + * @member {uuid} [tenantId] The Azure Active Directory tenant ID that should + * be used for authenticating requests to the key vault. + * @member {object} [sku] SKU details + * @member {string} [sku.name] SKU name to specify whether the key vault is a + * standard vault or a premium vault. Possible values include: 'standard', + * 'premium' + * @member {array} [accessPolicies] An array of 0 to 16 identities that have + * access to the key vault. All identities in the array must use the same + * tenant ID as the key vault's tenant ID. + * @member {boolean} [enabledForDeployment] Property to specify whether Azure + * Virtual Machines are permitted to retrieve certificates stored as secrets + * from the key vault. + * @member {boolean} [enabledForDiskEncryption] Property to specify whether + * Azure Disk Encryption is permitted to retrieve secrets from the vault and + * unwrap keys. + * @member {boolean} [enabledForTemplateDeployment] Property to specify whether + * Azure Resource Manager is permitted to retrieve secrets from the key vault. + * @member {boolean} [enableSoftDelete] Property to specify whether the 'soft + * delete' functionality is enabled for this key vault. It does not accept + * false value. + * @member {string} [createMode] The vault's create mode to indicate whether + * the vault need to be recovered or not. Possible values include: 'recover', + * 'default' + * @member {boolean} [enablePurgeProtection] Property specifying whether + * protection against purge is enabled for this vault. Setting this property to + * true activates protection against purge for this vault and its content - + * only the Key Vault service may initiate a hard, irrecoverable deletion. The + * setting is effective only if soft delete is also enabled. Enabling this + * functionality is irreversible - that is, the property does not accept false + * as its value. + * @member {object} [networkAcls] A collection of rules governing the + * accessibility of the vault from specific network locations. + * @member {string} [networkAcls.bypass] Tells what traffic can bypass network + * rules. This can be 'AzureServices' or 'None'. If not specified the default + * is 'AzureServices'. Possible values include: 'AzureServices', 'None' + * @member {string} [networkAcls.defaultAction] The default action when no rule + * from ipRules and from virtualNetworkRules match. This is only used after the + * bypass property has been evaluated. Possible values include: 'Allow', 'Deny' + * @member {array} [networkAcls.ipRules] The list of IP address rules. + * @member {array} [networkAcls.virtualNetworkRules] The list of virtual + * network rules. + */ +export interface VaultPatchProperties { + tenantId?: string; + sku?: Sku; + accessPolicies?: AccessPolicyEntry[]; + enabledForDeployment?: boolean; + enabledForDiskEncryption?: boolean; + enabledForTemplateDeployment?: boolean; + enableSoftDelete?: boolean; + createMode?: string; + enablePurgeProtection?: boolean; + networkAcls?: NetworkRuleSet; +} + +/** + * @class + * Initializes a new instance of the VaultAccessPolicyProperties class. + * @constructor + * Properties of the vault access policy + * + * @member {array} accessPolicies An array of 0 to 16 identities that have + * access to the key vault. All identities in the array must use the same + * tenant ID as the key vault's tenant ID. + */ +export interface VaultAccessPolicyProperties { + accessPolicies: AccessPolicyEntry[]; +} + +/** + * @class + * Initializes a new instance of the DeletedVaultProperties class. + * @constructor + * Properties of the deleted vault. + * + * @member {string} [vaultId] The resource id of the original vault. + * @member {string} [location] The location of the original vault. + * @member {date} [deletionDate] The deleted date. + * @member {date} [scheduledPurgeDate] The scheduled purged date. + * @member {object} [tags] Tags of the original vault. + */ +export interface DeletedVaultProperties { + readonly vaultId?: string; + readonly location?: string; + readonly deletionDate?: Date; + readonly scheduledPurgeDate?: Date; + readonly tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the VaultCreateOrUpdateParameters class. + * @constructor + * Parameters for creating or updating a vault + * + * @member {string} location The supported Azure location where the key vault + * should be created. + * @member {object} [tags] The tags that will be assigned to the key vault. + * @member {object} properties Properties of the vault + * @member {uuid} [properties.tenantId] The Azure Active Directory tenant ID + * that should be used for authenticating requests to the key vault. + * @member {object} [properties.sku] SKU details + * @member {string} [properties.sku.name] SKU name to specify whether the key + * vault is a standard vault or a premium vault. Possible values include: + * 'standard', 'premium' + * @member {array} [properties.accessPolicies] An array of 0 to 16 identities + * that have access to the key vault. All identities in the array must use the + * same tenant ID as the key vault's tenant ID. + * @member {string} [properties.vaultUri] The URI of the vault for performing + * operations on keys and secrets. + * @member {boolean} [properties.enabledForDeployment] Property to specify + * whether Azure Virtual Machines are permitted to retrieve certificates stored + * as secrets from the key vault. + * @member {boolean} [properties.enabledForDiskEncryption] Property to specify + * whether Azure Disk Encryption is permitted to retrieve secrets from the + * vault and unwrap keys. + * @member {boolean} [properties.enabledForTemplateDeployment] Property to + * specify whether Azure Resource Manager is permitted to retrieve secrets from + * the key vault. + * @member {boolean} [properties.enableSoftDelete] Property to specify whether + * the 'soft delete' functionality is enabled for this key vault. It does not + * accept false value. + * @member {string} [properties.createMode] The vault's create mode to indicate + * whether the vault need to be recovered or not. Possible values include: + * 'recover', 'default' + * @member {boolean} [properties.enablePurgeProtection] Property specifying + * whether protection against purge is enabled for this vault. Setting this + * property to true activates protection against purge for this vault and its + * content - only the Key Vault service may initiate a hard, irrecoverable + * deletion. The setting is effective only if soft delete is also enabled. + * Enabling this functionality is irreversible - that is, the property does not + * accept false as its value. + * @member {object} [properties.networkAcls] A collection of rules governing + * the accessibility of the vault from specific network locations. + * @member {string} [properties.networkAcls.bypass] Tells what traffic can + * bypass network rules. This can be 'AzureServices' or 'None'. If not + * specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * @member {string} [properties.networkAcls.defaultAction] The default action + * when no rule from ipRules and from virtualNetworkRules match. This is only + * used after the bypass property has been evaluated. Possible values include: + * 'Allow', 'Deny' + * @member {array} [properties.networkAcls.ipRules] The list of IP address + * rules. + * @member {array} [properties.networkAcls.virtualNetworkRules] The list of + * virtual network rules. + */ +export interface VaultCreateOrUpdateParameters extends BaseResource { + location: string; + tags?: { [propertyName: string]: string }; + properties: VaultProperties; +} + +/** + * @class + * Initializes a new instance of the VaultPatchParameters class. + * @constructor + * Parameters for creating or updating a vault + * + * @member {object} [tags] The tags that will be assigned to the key vault. + * @member {object} [properties] Properties of the vault + * @member {uuid} [properties.tenantId] The Azure Active Directory tenant ID + * that should be used for authenticating requests to the key vault. + * @member {object} [properties.sku] SKU details + * @member {string} [properties.sku.name] SKU name to specify whether the key + * vault is a standard vault or a premium vault. Possible values include: + * 'standard', 'premium' + * @member {array} [properties.accessPolicies] An array of 0 to 16 identities + * that have access to the key vault. All identities in the array must use the + * same tenant ID as the key vault's tenant ID. + * @member {boolean} [properties.enabledForDeployment] Property to specify + * whether Azure Virtual Machines are permitted to retrieve certificates stored + * as secrets from the key vault. + * @member {boolean} [properties.enabledForDiskEncryption] Property to specify + * whether Azure Disk Encryption is permitted to retrieve secrets from the + * vault and unwrap keys. + * @member {boolean} [properties.enabledForTemplateDeployment] Property to + * specify whether Azure Resource Manager is permitted to retrieve secrets from + * the key vault. + * @member {boolean} [properties.enableSoftDelete] Property to specify whether + * the 'soft delete' functionality is enabled for this key vault. It does not + * accept false value. + * @member {string} [properties.createMode] The vault's create mode to indicate + * whether the vault need to be recovered or not. Possible values include: + * 'recover', 'default' + * @member {boolean} [properties.enablePurgeProtection] Property specifying + * whether protection against purge is enabled for this vault. Setting this + * property to true activates protection against purge for this vault and its + * content - only the Key Vault service may initiate a hard, irrecoverable + * deletion. The setting is effective only if soft delete is also enabled. + * Enabling this functionality is irreversible - that is, the property does not + * accept false as its value. + * @member {object} [properties.networkAcls] A collection of rules governing + * the accessibility of the vault from specific network locations. + * @member {string} [properties.networkAcls.bypass] Tells what traffic can + * bypass network rules. This can be 'AzureServices' or 'None'. If not + * specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * @member {string} [properties.networkAcls.defaultAction] The default action + * when no rule from ipRules and from virtualNetworkRules match. This is only + * used after the bypass property has been evaluated. Possible values include: + * 'Allow', 'Deny' + * @member {array} [properties.networkAcls.ipRules] The list of IP address + * rules. + * @member {array} [properties.networkAcls.virtualNetworkRules] The list of + * virtual network rules. + */ +export interface VaultPatchParameters extends BaseResource { + tags?: { [propertyName: string]: string }; + properties?: VaultPatchProperties; +} + +/** + * @class + * Initializes a new instance of the VaultAccessPolicyParameters class. + * @constructor + * Parameters for updating the access policy in a vault + * + * @member {string} [id] The resource id of the access policy. + * @member {string} [name] The resource name of the access policy. + * @member {string} [type] The resource name of the access policy. + * @member {string} [location] The resource type of the the access policy. + * @member {object} properties Properties of the access policy + * @member {array} [properties.accessPolicies] An array of 0 to 16 identities + * that have access to the key vault. All identities in the array must use the + * same tenant ID as the key vault's tenant ID. + */ +export interface VaultAccessPolicyParameters extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + readonly location?: string; + properties: VaultAccessPolicyProperties; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * Key Vault resource + * + * @member {string} [id] The Azure Resource Manager resource ID for the key + * vault. + * @member {string} [name] The name of the key vault. + * @member {string} [type] The resource type of the key vault. + * @member {string} location The supported Azure location where the key vault + * should be created. + * @member {object} [tags] The tags that will be assigned to the key vault. + */ +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 Vault class. + * @constructor + * Resource information with extended details. + * + * @member {object} properties Properties of the vault + * @member {uuid} [properties.tenantId] The Azure Active Directory tenant ID + * that should be used for authenticating requests to the key vault. + * @member {object} [properties.sku] SKU details + * @member {string} [properties.sku.name] SKU name to specify whether the key + * vault is a standard vault or a premium vault. Possible values include: + * 'standard', 'premium' + * @member {array} [properties.accessPolicies] An array of 0 to 16 identities + * that have access to the key vault. All identities in the array must use the + * same tenant ID as the key vault's tenant ID. + * @member {string} [properties.vaultUri] The URI of the vault for performing + * operations on keys and secrets. + * @member {boolean} [properties.enabledForDeployment] Property to specify + * whether Azure Virtual Machines are permitted to retrieve certificates stored + * as secrets from the key vault. + * @member {boolean} [properties.enabledForDiskEncryption] Property to specify + * whether Azure Disk Encryption is permitted to retrieve secrets from the + * vault and unwrap keys. + * @member {boolean} [properties.enabledForTemplateDeployment] Property to + * specify whether Azure Resource Manager is permitted to retrieve secrets from + * the key vault. + * @member {boolean} [properties.enableSoftDelete] Property to specify whether + * the 'soft delete' functionality is enabled for this key vault. It does not + * accept false value. + * @member {string} [properties.createMode] The vault's create mode to indicate + * whether the vault need to be recovered or not. Possible values include: + * 'recover', 'default' + * @member {boolean} [properties.enablePurgeProtection] Property specifying + * whether protection against purge is enabled for this vault. Setting this + * property to true activates protection against purge for this vault and its + * content - only the Key Vault service may initiate a hard, irrecoverable + * deletion. The setting is effective only if soft delete is also enabled. + * Enabling this functionality is irreversible - that is, the property does not + * accept false as its value. + * @member {object} [properties.networkAcls] A collection of rules governing + * the accessibility of the vault from specific network locations. + * @member {string} [properties.networkAcls.bypass] Tells what traffic can + * bypass network rules. This can be 'AzureServices' or 'None'. If not + * specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * @member {string} [properties.networkAcls.defaultAction] The default action + * when no rule from ipRules and from virtualNetworkRules match. This is only + * used after the bypass property has been evaluated. Possible values include: + * 'Allow', 'Deny' + * @member {array} [properties.networkAcls.ipRules] The list of IP address + * rules. + * @member {array} [properties.networkAcls.virtualNetworkRules] The list of + * virtual network rules. + */ +export interface Vault extends Resource { + properties: VaultProperties; +} + +/** + * @class + * Initializes a new instance of the DeletedVault class. + * @constructor + * Deleted vault information with extended details. + * + * @member {string} [id] The resource ID for the deleted key vault. + * @member {string} [name] The name of the key vault. + * @member {string} [type] The resource type of the key vault. + * @member {object} [properties] Properties of the vault + * @member {string} [properties.vaultId] The resource id of the original vault. + * @member {string} [properties.location] The location of the original vault. + * @member {date} [properties.deletionDate] The deleted date. + * @member {date} [properties.scheduledPurgeDate] The scheduled purged date. + * @member {object} [properties.tags] Tags of the original vault. + */ +export interface DeletedVault { + readonly id?: string; + readonly name?: string; + readonly type?: string; + properties?: DeletedVaultProperties; +} + +/** + * @class + * Initializes a new instance of the VaultCheckNameAvailabilityParameters class. + * @constructor + * The parameters used to check the availabity of the vault name. + * + * @member {string} name The vault name. + */ +export interface VaultCheckNameAvailabilityParameters { + name: string; +} + +/** + * @class + * Initializes a new instance of the CheckNameAvailabilityResult class. + * @constructor + * The CheckNameAvailability operation response. + * + * @member {boolean} [nameAvailable] A boolean value that indicates whether the + * name is available for you to use. If true, the name is available. If false, + * the name has already been taken or is invalid and cannot be used. + * @member {string} [reason] The reason that a vault name could not be used. + * The Reason element is only returned if NameAvailable is false. Possible + * values include: 'AccountNameInvalid', 'AlreadyExists' + * @member {string} [message] An error message explaining the Reason value in + * more detail. + */ +export interface CheckNameAvailabilityResult { + readonly nameAvailable?: boolean; + readonly reason?: string; + readonly message?: string; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * Display metadata associated with the operation. + * + * @member {string} [provider] Service provider: Microsoft Key Vault. + * @member {string} [resource] Resource on which the operation is performed + * etc. + * @member {string} [operation] Type of operation: get, read, delete, etc. + * @member {string} [description] Decription of operation. + */ +export interface OperationDisplay { + provider?: string; + resource?: string; + operation?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the LogSpecification class. + * @constructor + * Log specification of operation. + * + * @member {string} [name] Name of log specification. + * @member {string} [displayName] Display name of log specification. + * @member {string} [blobDuration] Blob duration of specification. + */ +export interface LogSpecification { + name?: string; + displayName?: string; + blobDuration?: string; +} + +/** + * @class + * Initializes a new instance of the ServiceSpecification class. + * @constructor + * One property of operation, include log specifications. + * + * @member {array} [logSpecifications] Log specifications of operation. + */ +export interface ServiceSpecification { + logSpecifications?: LogSpecification[]; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * Key Vault REST API operation definition. + * + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] Display metadata associated with the operation. + * @member {string} [display.provider] Service provider: Microsoft Key Vault. + * @member {string} [display.resource] Resource on which the operation is + * performed etc. + * @member {string} [display.operation] Type of operation: get, read, delete, + * etc. + * @member {string} [display.description] Decription of operation. + * @member {string} [origin] The origin of operations. + * @member {object} [serviceSpecification] One property of operation, include + * metric specifications. + * @member {array} [serviceSpecification.logSpecifications] Log specifications + * of operation. + */ +export interface Operation { + name?: string; + display?: OperationDisplay; + origin?: string; + serviceSpecification?: ServiceSpecification; +} + + +/** + * @class + * Initializes a new instance of the VaultListResult class. + * @constructor + * List of vaults + * + * @member {string} [nextLink] The URL to get the next set of vaults. + */ +export interface VaultListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DeletedVaultListResult class. + * @constructor + * List of vaults + * + * @member {string} [nextLink] The URL to get the next set of deleted vaults. + */ +export interface DeletedVaultListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ResourceListResult class. + * @constructor + * List of vault resources. + * + * @member {string} [nextLink] The URL to get the next set of vault resources. + */ +export interface ResourceListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the OperationListResult class. + * @constructor + * Result of the request to list Storage operations. It contains a list of + * operations and a URL link to get the next set of results. + * + * @member {string} [nextLink] The URL to get the next set of operations. + */ +export interface OperationListResult extends Array { + nextLink?: string; +} diff --git a/lib/services/keyVaultManagement/lib/lib/models/index.js b/lib/services/keyVaultManagement/lib/lib/models/index.js new file mode 100644 index 0000000000..060c341b60 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/index.js @@ -0,0 +1,46 @@ +/* + * 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.Sku = require('./sku'); +exports.Permissions = require('./permissions'); +exports.AccessPolicyEntry = require('./accessPolicyEntry'); +exports.IPRule = require('./iPRule'); +exports.VirtualNetworkRule = require('./virtualNetworkRule'); +exports.NetworkRuleSet = require('./networkRuleSet'); +exports.VaultProperties = require('./vaultProperties'); +exports.VaultPatchProperties = require('./vaultPatchProperties'); +exports.VaultAccessPolicyProperties = require('./vaultAccessPolicyProperties'); +exports.DeletedVaultProperties = require('./deletedVaultProperties'); +exports.VaultCreateOrUpdateParameters = require('./vaultCreateOrUpdateParameters'); +exports.VaultPatchParameters = require('./vaultPatchParameters'); +exports.VaultAccessPolicyParameters = require('./vaultAccessPolicyParameters'); +exports.Resource = require('./resource'); +exports.Vault = require('./vault'); +exports.DeletedVault = require('./deletedVault'); +exports.VaultCheckNameAvailabilityParameters = require('./vaultCheckNameAvailabilityParameters'); +exports.CheckNameAvailabilityResult = require('./checkNameAvailabilityResult'); +exports.OperationDisplay = require('./operationDisplay'); +exports.LogSpecification = require('./logSpecification'); +exports.ServiceSpecification = require('./serviceSpecification'); +exports.Operation = require('./operation'); +exports.VaultListResult = require('./vaultListResult'); +exports.DeletedVaultListResult = require('./deletedVaultListResult'); +exports.ResourceListResult = require('./resourceListResult'); +exports.OperationListResult = require('./operationListResult'); diff --git a/lib/services/keyVaultManagement/lib/lib/models/logSpecification.js b/lib/services/keyVaultManagement/lib/lib/models/logSpecification.js new file mode 100644 index 0000000000..fbf78a7c07 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/logSpecification.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'; + +/** + * Log specification of operation. + * + */ +class LogSpecification { + /** + * Create a LogSpecification. + * @member {string} [name] Name of log specification. + * @member {string} [displayName] Display name of log specification. + * @member {string} [blobDuration] Blob duration of specification. + */ + constructor() { + } + + /** + * Defines the metadata of LogSpecification + * + * @returns {object} metadata of LogSpecification + * + */ + mapper() { + return { + required: false, + serializedName: 'LogSpecification', + type: { + name: 'Composite', + className: 'LogSpecification', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + blobDuration: { + required: false, + serializedName: 'blobDuration', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LogSpecification; diff --git a/lib/services/keyVaultManagement/lib/lib/models/networkRuleSet.js b/lib/services/keyVaultManagement/lib/lib/models/networkRuleSet.js new file mode 100644 index 0000000000..1bbe4bb15d --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/networkRuleSet.js @@ -0,0 +1,99 @@ +/* + * 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'); + +/** + * A set of rules governing the network accessibility of a vault. + * + */ +class NetworkRuleSet { + /** + * Create a NetworkRuleSet. + * @member {string} [bypass] Tells what traffic can bypass network rules. + * This can be 'AzureServices' or 'None'. If not specified the default is + * 'AzureServices'. Possible values include: 'AzureServices', 'None' + * @member {string} [defaultAction] The default action when no rule from + * ipRules and from virtualNetworkRules match. This is only used after the + * bypass property has been evaluated. Possible values include: 'Allow', + * 'Deny' + * @member {array} [ipRules] The list of IP address rules. + * @member {array} [virtualNetworkRules] The list of virtual network rules. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkRuleSet + * + * @returns {object} metadata of NetworkRuleSet + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkRuleSet', + type: { + name: 'Composite', + className: 'NetworkRuleSet', + modelProperties: { + bypass: { + required: false, + serializedName: 'bypass', + type: { + name: 'String' + } + }, + defaultAction: { + required: false, + serializedName: 'defaultAction', + type: { + name: 'String' + } + }, + ipRules: { + required: false, + serializedName: 'ipRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IPRuleElementType', + type: { + name: 'Composite', + className: 'IPRule' + } + } + } + }, + virtualNetworkRules: { + required: false, + serializedName: 'virtualNetworkRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkRuleElementType', + type: { + name: 'Composite', + className: 'VirtualNetworkRule' + } + } + } + } + } + } + }; + } +} + +module.exports = NetworkRuleSet; diff --git a/lib/services/keyVaultManagement/lib/lib/models/operation.js b/lib/services/keyVaultManagement/lib/lib/models/operation.js new file mode 100644 index 0000000000..7497ee110b --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/operation.js @@ -0,0 +1,89 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Key Vault REST API operation definition. + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] Display metadata associated with the operation. + * @member {string} [display.provider] Service provider: Microsoft Key Vault. + * @member {string} [display.resource] Resource on which the operation is + * performed etc. + * @member {string} [display.operation] Type of operation: get, read, delete, + * etc. + * @member {string} [display.description] Decription of operation. + * @member {string} [origin] The origin of operations. + * @member {object} [serviceSpecification] One property of operation, include + * metric specifications. + * @member {array} [serviceSpecification.logSpecifications] Log + * specifications of operation. + */ + constructor() { + } + + /** + * Defines the metadata of Operation + * + * @returns {object} metadata of Operation + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation', + type: { + name: 'Composite', + className: 'Operation', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + }, + origin: { + required: false, + serializedName: 'origin', + type: { + name: 'String' + } + }, + serviceSpecification: { + required: false, + serializedName: 'properties.serviceSpecification', + type: { + name: 'Composite', + className: 'ServiceSpecification' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/keyVaultManagement/lib/lib/models/operationDisplay.js b/lib/services/keyVaultManagement/lib/lib/models/operationDisplay.js new file mode 100644 index 0000000000..8cab4a170d --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/operationDisplay.js @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Display metadata associated with the operation. + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @member {string} [provider] Service provider: Microsoft Key Vault. + * @member {string} [resource] Resource on which the operation is performed + * etc. + * @member {string} [operation] Type of operation: get, read, delete, etc. + * @member {string} [description] Decription of operation. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplay + * + * @returns {object} metadata of OperationDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation_display', + type: { + name: 'Composite', + className: 'OperationDisplay', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplay; diff --git a/lib/services/keyVaultManagement/lib/lib/models/operationListResult.js b/lib/services/keyVaultManagement/lib/lib/models/operationListResult.js new file mode 100644 index 0000000000..f6662b8f6a --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/operationListResult.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'; + +/** + * Result of the request to list Storage operations. It contains a list of + * operations and a URL link to get the next set of results. + */ +class OperationListResult extends Array { + /** + * Create a OperationListResult. + * @member {string} [nextLink] The URL to get the next set of operations. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OperationListResult + * + * @returns {object} metadata of OperationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationListResult', + type: { + name: 'Composite', + className: 'OperationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationListResult; diff --git a/lib/services/keyVaultManagement/lib/lib/models/permissions.js b/lib/services/keyVaultManagement/lib/lib/models/permissions.js new file mode 100644 index 0000000000..2ee7a6a30a --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/permissions.js @@ -0,0 +1,104 @@ +/* + * 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'; + +/** + * Permissions the identity has for keys, secrets, certificates and storage. + * + */ +class Permissions { + /** + * Create a Permissions. + * @member {array} [keys] Permissions to keys + * @member {array} [secrets] Permissions to secrets + * @member {array} [certificates] Permissions to certificates + * @member {array} [storage] Permissions to storage accounts + */ + constructor() { + } + + /** + * Defines the metadata of Permissions + * + * @returns {object} metadata of Permissions + * + */ + mapper() { + return { + required: false, + serializedName: 'Permissions', + type: { + name: 'Composite', + className: 'Permissions', + modelProperties: { + keys: { + required: false, + serializedName: 'keys', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + secrets: { + required: false, + serializedName: 'secrets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + certificates: { + required: false, + serializedName: 'certificates', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + storage: { + required: false, + serializedName: 'storage', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Permissions; diff --git a/lib/services/keyVaultManagement/lib/lib/models/resource.js b/lib/services/keyVaultManagement/lib/lib/models/resource.js new file mode 100644 index 0000000000..e23aafe21b --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/resource.js @@ -0,0 +1,100 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Key Vault resource + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] The Azure Resource Manager resource ID for the key + * vault. + * @member {string} [name] The name of the key vault. + * @member {string} [type] The resource type of the key vault. + * @member {string} location The supported Azure location where the key vault + * should be created. + * @member {object} [tags] The tags that will be assigned to the key vault. + */ + 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: true, + 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/keyVaultManagement/lib/lib/models/resourceListResult.js b/lib/services/keyVaultManagement/lib/lib/models/resourceListResult.js new file mode 100644 index 0000000000..9d094338fb --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/resourceListResult.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 vault resources. + */ +class ResourceListResult extends Array { + /** + * Create a ResourceListResult. + * @member {string} [nextLink] The URL to get the next set of vault + * resources. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResourceListResult + * + * @returns {object} metadata of ResourceListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceListResult', + type: { + name: 'Composite', + className: 'ResourceListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ResourceElementType', + type: { + name: 'Composite', + className: 'Resource' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResourceListResult; diff --git a/lib/services/keyVaultManagement/lib/lib/models/serviceSpecification.js b/lib/services/keyVaultManagement/lib/lib/models/serviceSpecification.js new file mode 100644 index 0000000000..185445842d --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/serviceSpecification.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'; + +const models = require('./index'); + +/** + * One property of operation, include log specifications. + * + */ +class ServiceSpecification { + /** + * Create a ServiceSpecification. + * @member {array} [logSpecifications] Log specifications of operation. + */ + constructor() { + } + + /** + * Defines the metadata of ServiceSpecification + * + * @returns {object} metadata of ServiceSpecification + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceSpecification', + type: { + name: 'Composite', + className: 'ServiceSpecification', + modelProperties: { + logSpecifications: { + required: false, + serializedName: 'logSpecifications', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LogSpecificationElementType', + type: { + name: 'Composite', + className: 'LogSpecification' + } + } + } + } + } + } + }; + } +} + +module.exports = ServiceSpecification; diff --git a/lib/services/keyVaultManagement/lib/lib/models/sku.js b/lib/services/keyVaultManagement/lib/lib/models/sku.js new file mode 100644 index 0000000000..d9c3bffb35 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/sku.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * SKU details + * + */ +class Sku { + /** + * Create a Sku. + * @member {string} name SKU name to specify whether the key vault is a + * standard vault or a premium vault. Possible values include: 'standard', + * 'premium' + */ + constructor() { + } + + /** + * Defines the metadata of Sku + * + * @returns {object} metadata of Sku + * + */ + mapper() { + return { + required: false, + serializedName: 'Sku', + type: { + name: 'Composite', + className: 'Sku', + modelProperties: { + family: { + required: true, + isConstant: true, + serializedName: 'family', + defaultValue: 'A', + type: { + name: 'String' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'Enum', + allowedValues: [ 'standard', 'premium' ] + } + } + } + } + }; + } +} + +module.exports = Sku; diff --git a/lib/services/keyVaultManagement/lib/lib/models/vault.js b/lib/services/keyVaultManagement/lib/lib/models/vault.js new file mode 100644 index 0000000000..fab6833dc9 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/vault.js @@ -0,0 +1,150 @@ +/* + * 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 with extended details. + * + * @extends models['Resource'] + */ +class Vault extends models['Resource'] { + /** + * Create a Vault. + * @member {object} properties Properties of the vault + * @member {uuid} [properties.tenantId] The Azure Active Directory tenant ID + * that should be used for authenticating requests to the key vault. + * @member {object} [properties.sku] SKU details + * @member {string} [properties.sku.name] SKU name to specify whether the key + * vault is a standard vault or a premium vault. Possible values include: + * 'standard', 'premium' + * @member {array} [properties.accessPolicies] An array of 0 to 16 identities + * that have access to the key vault. All identities in the array must use + * the same tenant ID as the key vault's tenant ID. + * @member {string} [properties.vaultUri] The URI of the vault for performing + * operations on keys and secrets. + * @member {boolean} [properties.enabledForDeployment] Property to specify + * whether Azure Virtual Machines are permitted to retrieve certificates + * stored as secrets from the key vault. + * @member {boolean} [properties.enabledForDiskEncryption] Property to + * specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * @member {boolean} [properties.enabledForTemplateDeployment] Property to + * specify whether Azure Resource Manager is permitted to retrieve secrets + * from the key vault. + * @member {boolean} [properties.enableSoftDelete] Property to specify + * whether the 'soft delete' functionality is enabled for this key vault. It + * does not accept false value. + * @member {string} [properties.createMode] The vault's create mode to + * indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * @member {boolean} [properties.enablePurgeProtection] Property specifying + * whether protection against purge is enabled for this vault. Setting this + * property to true activates protection against purge for this vault and its + * content - only the Key Vault service may initiate a hard, irrecoverable + * deletion. The setting is effective only if soft delete is also enabled. + * Enabling this functionality is irreversible - that is, the property does + * not accept false as its value. + * @member {object} [properties.networkAcls] A collection of rules governing + * the accessibility of the vault from specific network locations. + * @member {string} [properties.networkAcls.bypass] Tells what traffic can + * bypass network rules. This can be 'AzureServices' or 'None'. If not + * specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * @member {string} [properties.networkAcls.defaultAction] The default action + * when no rule from ipRules and from virtualNetworkRules match. This is only + * used after the bypass property has been evaluated. Possible values + * include: 'Allow', 'Deny' + * @member {array} [properties.networkAcls.ipRules] The list of IP address + * rules. + * @member {array} [properties.networkAcls.virtualNetworkRules] The list of + * virtual network rules. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Vault + * + * @returns {object} metadata of Vault + * + */ + mapper() { + return { + required: false, + serializedName: 'Vault', + type: { + name: 'Composite', + className: 'Vault', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + properties: { + required: true, + serializedName: 'properties', + defaultValue: {}, + type: { + name: 'Composite', + className: 'VaultProperties' + } + } + } + } + }; + } +} + +module.exports = Vault; diff --git a/lib/services/keyVaultManagement/lib/lib/models/vaultAccessPolicyParameters.js b/lib/services/keyVaultManagement/lib/lib/models/vaultAccessPolicyParameters.js new file mode 100644 index 0000000000..ab1f52c76e --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/vaultAccessPolicyParameters.js @@ -0,0 +1,96 @@ +/* + * 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'); + +/** + * Parameters for updating the access policy in a vault + * + * @extends models['BaseResource'] + */ +class VaultAccessPolicyParameters extends models['BaseResource'] { + /** + * Create a VaultAccessPolicyParameters. + * @member {string} [id] The resource id of the access policy. + * @member {string} [name] The resource name of the access policy. + * @member {string} [type] The resource name of the access policy. + * @member {string} [location] The resource type of the the access policy. + * @member {object} properties Properties of the access policy + * @member {array} [properties.accessPolicies] An array of 0 to 16 identities + * that have access to the key vault. All identities in the array must use + * the same tenant ID as the key vault's tenant ID. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VaultAccessPolicyParameters + * + * @returns {object} metadata of VaultAccessPolicyParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'VaultAccessPolicyParameters', + type: { + name: 'Composite', + className: 'VaultAccessPolicyParameters', + 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, + readOnly: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + properties: { + required: true, + serializedName: 'properties', + type: { + name: 'Composite', + className: 'VaultAccessPolicyProperties' + } + } + } + } + }; + } +} + +module.exports = VaultAccessPolicyParameters; diff --git a/lib/services/keyVaultManagement/lib/lib/models/vaultAccessPolicyProperties.js b/lib/services/keyVaultManagement/lib/lib/models/vaultAccessPolicyProperties.js new file mode 100644 index 0000000000..7250127fd6 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/vaultAccessPolicyProperties.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Properties of the vault access policy + * + */ +class VaultAccessPolicyProperties { + /** + * Create a VaultAccessPolicyProperties. + * @member {array} accessPolicies An array of 0 to 16 identities that have + * access to the key vault. All identities in the array must use the same + * tenant ID as the key vault's tenant ID. + */ + constructor() { + } + + /** + * Defines the metadata of VaultAccessPolicyProperties + * + * @returns {object} metadata of VaultAccessPolicyProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'VaultAccessPolicyProperties', + type: { + name: 'Composite', + className: 'VaultAccessPolicyProperties', + modelProperties: { + accessPolicies: { + required: true, + serializedName: 'accessPolicies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AccessPolicyEntryElementType', + type: { + name: 'Composite', + className: 'AccessPolicyEntry' + } + } + } + } + } + } + }; + } +} + +module.exports = VaultAccessPolicyProperties; diff --git a/lib/services/keyVaultManagement/lib/lib/models/vaultCheckNameAvailabilityParameters.js b/lib/services/keyVaultManagement/lib/lib/models/vaultCheckNameAvailabilityParameters.js new file mode 100644 index 0000000000..e8aaa893d7 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/vaultCheckNameAvailabilityParameters.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'; + +/** + * The parameters used to check the availabity of the vault name. + * + */ +class VaultCheckNameAvailabilityParameters { + /** + * Create a VaultCheckNameAvailabilityParameters. + * @member {string} name The vault name. + */ + constructor() { + } + + /** + * Defines the metadata of VaultCheckNameAvailabilityParameters + * + * @returns {object} metadata of VaultCheckNameAvailabilityParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'VaultCheckNameAvailabilityParameters', + type: { + name: 'Composite', + className: 'VaultCheckNameAvailabilityParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: true, + isConstant: true, + serializedName: 'type', + defaultValue: 'Microsoft.KeyVault/vaults', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VaultCheckNameAvailabilityParameters; diff --git a/lib/services/keyVaultManagement/lib/lib/models/vaultCreateOrUpdateParameters.js b/lib/services/keyVaultManagement/lib/lib/models/vaultCreateOrUpdateParameters.js new file mode 100644 index 0000000000..bf7b71e85b --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/vaultCreateOrUpdateParameters.js @@ -0,0 +1,129 @@ +/* + * 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'); + +/** + * Parameters for creating or updating a vault + * + * @extends models['BaseResource'] + */ +class VaultCreateOrUpdateParameters extends models['BaseResource'] { + /** + * Create a VaultCreateOrUpdateParameters. + * @member {string} location The supported Azure location where the key vault + * should be created. + * @member {object} [tags] The tags that will be assigned to the key vault. + * @member {object} properties Properties of the vault + * @member {uuid} [properties.tenantId] The Azure Active Directory tenant ID + * that should be used for authenticating requests to the key vault. + * @member {object} [properties.sku] SKU details + * @member {string} [properties.sku.name] SKU name to specify whether the key + * vault is a standard vault or a premium vault. Possible values include: + * 'standard', 'premium' + * @member {array} [properties.accessPolicies] An array of 0 to 16 identities + * that have access to the key vault. All identities in the array must use + * the same tenant ID as the key vault's tenant ID. + * @member {string} [properties.vaultUri] The URI of the vault for performing + * operations on keys and secrets. + * @member {boolean} [properties.enabledForDeployment] Property to specify + * whether Azure Virtual Machines are permitted to retrieve certificates + * stored as secrets from the key vault. + * @member {boolean} [properties.enabledForDiskEncryption] Property to + * specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * @member {boolean} [properties.enabledForTemplateDeployment] Property to + * specify whether Azure Resource Manager is permitted to retrieve secrets + * from the key vault. + * @member {boolean} [properties.enableSoftDelete] Property to specify + * whether the 'soft delete' functionality is enabled for this key vault. It + * does not accept false value. + * @member {string} [properties.createMode] The vault's create mode to + * indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * @member {boolean} [properties.enablePurgeProtection] Property specifying + * whether protection against purge is enabled for this vault. Setting this + * property to true activates protection against purge for this vault and its + * content - only the Key Vault service may initiate a hard, irrecoverable + * deletion. The setting is effective only if soft delete is also enabled. + * Enabling this functionality is irreversible - that is, the property does + * not accept false as its value. + * @member {object} [properties.networkAcls] A collection of rules governing + * the accessibility of the vault from specific network locations. + * @member {string} [properties.networkAcls.bypass] Tells what traffic can + * bypass network rules. This can be 'AzureServices' or 'None'. If not + * specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * @member {string} [properties.networkAcls.defaultAction] The default action + * when no rule from ipRules and from virtualNetworkRules match. This is only + * used after the bypass property has been evaluated. Possible values + * include: 'Allow', 'Deny' + * @member {array} [properties.networkAcls.ipRules] The list of IP address + * rules. + * @member {array} [properties.networkAcls.virtualNetworkRules] The list of + * virtual network rules. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VaultCreateOrUpdateParameters + * + * @returns {object} metadata of VaultCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'VaultCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'VaultCreateOrUpdateParameters', + modelProperties: { + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + properties: { + required: true, + serializedName: 'properties', + defaultValue: {}, + type: { + name: 'Composite', + className: 'VaultProperties' + } + } + } + } + }; + } +} + +module.exports = VaultCreateOrUpdateParameters; diff --git a/lib/services/keyVaultManagement/lib/lib/models/vaultListResult.js b/lib/services/keyVaultManagement/lib/lib/models/vaultListResult.js new file mode 100644 index 0000000000..00ded6fd06 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/vaultListResult.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * List of vaults + */ +class VaultListResult extends Array { + /** + * Create a VaultListResult. + * @member {string} [nextLink] The URL to get the next set of vaults. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VaultListResult + * + * @returns {object} metadata of VaultListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'VaultListResult', + type: { + name: 'Composite', + className: 'VaultListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VaultElementType', + type: { + name: 'Composite', + className: 'Vault' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VaultListResult; diff --git a/lib/services/keyVaultManagement/lib/lib/models/vaultPatchParameters.js b/lib/services/keyVaultManagement/lib/lib/models/vaultPatchParameters.js new file mode 100644 index 0000000000..15d8a39f5f --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/vaultPatchParameters.js @@ -0,0 +1,117 @@ +/* + * 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'); + +/** + * Parameters for creating or updating a vault + * + * @extends models['BaseResource'] + */ +class VaultPatchParameters extends models['BaseResource'] { + /** + * Create a VaultPatchParameters. + * @member {object} [tags] The tags that will be assigned to the key vault. + * @member {object} [properties] Properties of the vault + * @member {uuid} [properties.tenantId] The Azure Active Directory tenant ID + * that should be used for authenticating requests to the key vault. + * @member {object} [properties.sku] SKU details + * @member {string} [properties.sku.name] SKU name to specify whether the key + * vault is a standard vault or a premium vault. Possible values include: + * 'standard', 'premium' + * @member {array} [properties.accessPolicies] An array of 0 to 16 identities + * that have access to the key vault. All identities in the array must use + * the same tenant ID as the key vault's tenant ID. + * @member {boolean} [properties.enabledForDeployment] Property to specify + * whether Azure Virtual Machines are permitted to retrieve certificates + * stored as secrets from the key vault. + * @member {boolean} [properties.enabledForDiskEncryption] Property to + * specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * @member {boolean} [properties.enabledForTemplateDeployment] Property to + * specify whether Azure Resource Manager is permitted to retrieve secrets + * from the key vault. + * @member {boolean} [properties.enableSoftDelete] Property to specify + * whether the 'soft delete' functionality is enabled for this key vault. It + * does not accept false value. + * @member {string} [properties.createMode] The vault's create mode to + * indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * @member {boolean} [properties.enablePurgeProtection] Property specifying + * whether protection against purge is enabled for this vault. Setting this + * property to true activates protection against purge for this vault and its + * content - only the Key Vault service may initiate a hard, irrecoverable + * deletion. The setting is effective only if soft delete is also enabled. + * Enabling this functionality is irreversible - that is, the property does + * not accept false as its value. + * @member {object} [properties.networkAcls] A collection of rules governing + * the accessibility of the vault from specific network locations. + * @member {string} [properties.networkAcls.bypass] Tells what traffic can + * bypass network rules. This can be 'AzureServices' or 'None'. If not + * specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * @member {string} [properties.networkAcls.defaultAction] The default action + * when no rule from ipRules and from virtualNetworkRules match. This is only + * used after the bypass property has been evaluated. Possible values + * include: 'Allow', 'Deny' + * @member {array} [properties.networkAcls.ipRules] The list of IP address + * rules. + * @member {array} [properties.networkAcls.virtualNetworkRules] The list of + * virtual network rules. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VaultPatchParameters + * + * @returns {object} metadata of VaultPatchParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'VaultPatchParameters', + type: { + name: 'Composite', + className: 'VaultPatchParameters', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Composite', + className: 'VaultPatchProperties' + } + } + } + } + }; + } +} + +module.exports = VaultPatchParameters; diff --git a/lib/services/keyVaultManagement/lib/lib/models/vaultPatchProperties.js b/lib/services/keyVaultManagement/lib/lib/models/vaultPatchProperties.js new file mode 100644 index 0000000000..de87985a3b --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/vaultPatchProperties.js @@ -0,0 +1,171 @@ +/* + * 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'); + +/** + * Properties of the vault + * + */ +class VaultPatchProperties { + /** + * Create a VaultPatchProperties. + * @member {uuid} [tenantId] The Azure Active Directory tenant ID that should + * be used for authenticating requests to the key vault. + * @member {object} [sku] SKU details + * @member {string} [sku.name] SKU name to specify whether the key vault is a + * standard vault or a premium vault. Possible values include: 'standard', + * 'premium' + * @member {array} [accessPolicies] An array of 0 to 16 identities that have + * access to the key vault. All identities in the array must use the same + * tenant ID as the key vault's tenant ID. + * @member {boolean} [enabledForDeployment] Property to specify whether Azure + * Virtual Machines are permitted to retrieve certificates stored as secrets + * from the key vault. + * @member {boolean} [enabledForDiskEncryption] Property to specify whether + * Azure Disk Encryption is permitted to retrieve secrets from the vault and + * unwrap keys. + * @member {boolean} [enabledForTemplateDeployment] Property to specify + * whether Azure Resource Manager is permitted to retrieve secrets from the + * key vault. + * @member {boolean} [enableSoftDelete] Property to specify whether the 'soft + * delete' functionality is enabled for this key vault. It does not accept + * false value. + * @member {string} [createMode] The vault's create mode to indicate whether + * the vault need to be recovered or not. Possible values include: 'recover', + * 'default' + * @member {boolean} [enablePurgeProtection] Property specifying whether + * protection against purge is enabled for this vault. Setting this property + * to true activates protection against purge for this vault and its content + * - only the Key Vault service may initiate a hard, irrecoverable deletion. + * The setting is effective only if soft delete is also enabled. Enabling + * this functionality is irreversible - that is, the property does not accept + * false as its value. + * @member {object} [networkAcls] A collection of rules governing the + * accessibility of the vault from specific network locations. + * @member {string} [networkAcls.bypass] Tells what traffic can bypass + * network rules. This can be 'AzureServices' or 'None'. If not specified + * the default is 'AzureServices'. Possible values include: 'AzureServices', + * 'None' + * @member {string} [networkAcls.defaultAction] The default action when no + * rule from ipRules and from virtualNetworkRules match. This is only used + * after the bypass property has been evaluated. Possible values include: + * 'Allow', 'Deny' + * @member {array} [networkAcls.ipRules] The list of IP address rules. + * @member {array} [networkAcls.virtualNetworkRules] The list of virtual + * network rules. + */ + constructor() { + } + + /** + * Defines the metadata of VaultPatchProperties + * + * @returns {object} metadata of VaultPatchProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'VaultPatchProperties', + type: { + name: 'Composite', + className: 'VaultPatchProperties', + modelProperties: { + tenantId: { + required: false, + serializedName: 'tenantId', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + accessPolicies: { + required: false, + serializedName: 'accessPolicies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AccessPolicyEntryElementType', + type: { + name: 'Composite', + className: 'AccessPolicyEntry' + } + } + } + }, + enabledForDeployment: { + required: false, + serializedName: 'enabledForDeployment', + type: { + name: 'Boolean' + } + }, + enabledForDiskEncryption: { + required: false, + serializedName: 'enabledForDiskEncryption', + type: { + name: 'Boolean' + } + }, + enabledForTemplateDeployment: { + required: false, + serializedName: 'enabledForTemplateDeployment', + type: { + name: 'Boolean' + } + }, + enableSoftDelete: { + required: false, + serializedName: 'enableSoftDelete', + type: { + name: 'Boolean' + } + }, + createMode: { + required: false, + serializedName: 'createMode', + type: { + name: 'Enum', + allowedValues: [ 'recover', 'default' ] + } + }, + enablePurgeProtection: { + required: false, + serializedName: 'enablePurgeProtection', + type: { + name: 'Boolean' + } + }, + networkAcls: { + required: false, + serializedName: 'networkAcls', + type: { + name: 'Composite', + className: 'NetworkRuleSet' + } + } + } + } + }; + } +} + +module.exports = VaultPatchProperties; diff --git a/lib/services/keyVaultManagement/lib/lib/models/vaultProperties.js b/lib/services/keyVaultManagement/lib/lib/models/vaultProperties.js new file mode 100644 index 0000000000..30adc3f7a5 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/vaultProperties.js @@ -0,0 +1,181 @@ +/* + * 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'); + +/** + * Properties of the vault + * + */ +class VaultProperties { + /** + * Create a VaultProperties. + * @member {uuid} tenantId The Azure Active Directory tenant ID that should + * be used for authenticating requests to the key vault. + * @member {object} sku SKU details + * @member {string} [sku.name] SKU name to specify whether the key vault is a + * standard vault or a premium vault. Possible values include: 'standard', + * 'premium' + * @member {array} [accessPolicies] An array of 0 to 16 identities that have + * access to the key vault. All identities in the array must use the same + * tenant ID as the key vault's tenant ID. + * @member {string} [vaultUri] The URI of the vault for performing operations + * on keys and secrets. + * @member {boolean} [enabledForDeployment] Property to specify whether Azure + * Virtual Machines are permitted to retrieve certificates stored as secrets + * from the key vault. + * @member {boolean} [enabledForDiskEncryption] Property to specify whether + * Azure Disk Encryption is permitted to retrieve secrets from the vault and + * unwrap keys. + * @member {boolean} [enabledForTemplateDeployment] Property to specify + * whether Azure Resource Manager is permitted to retrieve secrets from the + * key vault. + * @member {boolean} [enableSoftDelete] Property to specify whether the 'soft + * delete' functionality is enabled for this key vault. It does not accept + * false value. + * @member {string} [createMode] The vault's create mode to indicate whether + * the vault need to be recovered or not. Possible values include: 'recover', + * 'default' + * @member {boolean} [enablePurgeProtection] Property specifying whether + * protection against purge is enabled for this vault. Setting this property + * to true activates protection against purge for this vault and its content + * - only the Key Vault service may initiate a hard, irrecoverable deletion. + * The setting is effective only if soft delete is also enabled. Enabling + * this functionality is irreversible - that is, the property does not accept + * false as its value. + * @member {object} [networkAcls] A collection of rules governing the + * accessibility of the vault from specific network locations. + * @member {string} [networkAcls.bypass] Tells what traffic can bypass + * network rules. This can be 'AzureServices' or 'None'. If not specified + * the default is 'AzureServices'. Possible values include: 'AzureServices', + * 'None' + * @member {string} [networkAcls.defaultAction] The default action when no + * rule from ipRules and from virtualNetworkRules match. This is only used + * after the bypass property has been evaluated. Possible values include: + * 'Allow', 'Deny' + * @member {array} [networkAcls.ipRules] The list of IP address rules. + * @member {array} [networkAcls.virtualNetworkRules] The list of virtual + * network rules. + */ + constructor() { + } + + /** + * Defines the metadata of VaultProperties + * + * @returns {object} metadata of VaultProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'VaultProperties', + type: { + name: 'Composite', + className: 'VaultProperties', + modelProperties: { + tenantId: { + required: true, + serializedName: 'tenantId', + type: { + name: 'String' + } + }, + sku: { + required: true, + serializedName: 'sku', + defaultValue: {}, + type: { + name: 'Composite', + className: 'Sku' + } + }, + accessPolicies: { + required: false, + serializedName: 'accessPolicies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AccessPolicyEntryElementType', + type: { + name: 'Composite', + className: 'AccessPolicyEntry' + } + } + } + }, + vaultUri: { + required: false, + serializedName: 'vaultUri', + type: { + name: 'String' + } + }, + enabledForDeployment: { + required: false, + serializedName: 'enabledForDeployment', + type: { + name: 'Boolean' + } + }, + enabledForDiskEncryption: { + required: false, + serializedName: 'enabledForDiskEncryption', + type: { + name: 'Boolean' + } + }, + enabledForTemplateDeployment: { + required: false, + serializedName: 'enabledForTemplateDeployment', + type: { + name: 'Boolean' + } + }, + enableSoftDelete: { + required: false, + serializedName: 'enableSoftDelete', + type: { + name: 'Boolean' + } + }, + createMode: { + required: false, + serializedName: 'createMode', + type: { + name: 'Enum', + allowedValues: [ 'recover', 'default' ] + } + }, + enablePurgeProtection: { + required: false, + serializedName: 'enablePurgeProtection', + type: { + name: 'Boolean' + } + }, + networkAcls: { + required: false, + serializedName: 'networkAcls', + type: { + name: 'Composite', + className: 'NetworkRuleSet' + } + } + } + } + }; + } +} + +module.exports = VaultProperties; diff --git a/lib/services/keyVaultManagement/lib/lib/models/virtualNetworkRule.js b/lib/services/keyVaultManagement/lib/lib/models/virtualNetworkRule.js new file mode 100644 index 0000000000..9a7f5967a3 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/models/virtualNetworkRule.js @@ -0,0 +1,54 @@ +/* + * 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'; + +/** + * A rule governing the accesibility of a vault from a specific virtual + * network. + * + */ +class VirtualNetworkRule { + /** + * Create a VirtualNetworkRule. + * @member {string} id Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + */ + constructor() { + } + + /** + * Defines the metadata of VirtualNetworkRule + * + * @returns {object} metadata of VirtualNetworkRule + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkRule', + type: { + name: 'Composite', + className: 'VirtualNetworkRule', + modelProperties: { + id: { + required: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkRule; diff --git a/lib/services/keyVaultManagement/lib/lib/operations/index.d.ts b/lib/services/keyVaultManagement/lib/lib/operations/index.d.ts new file mode 100644 index 0000000000..e74f821406 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/operations/index.d.ts @@ -0,0 +1,1656 @@ +/* + * 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 + * Vaults + * __NOTE__: An instance of this class is automatically created for an + * instance of the KeyVaultManagementClient. + */ +export interface Vaults { + + + /** + * Create or update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to create or update the vault + * + * @param {string} parameters.location The supported Azure location where the + * key vault should be created. + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} parameters.properties Properties of the vault + * + * @param {uuid} parameters.properties.tenantId The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} parameters.properties.sku SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {string} [parameters.properties.vaultUri] The URI of the vault for + * performing operations on keys and secrets. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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, vaultName: string, parameters: models.VaultCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to create or update the vault + * + * @param {string} parameters.location The supported Azure location where the + * key vault should be created. + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} parameters.properties Properties of the vault + * + * @param {uuid} parameters.properties.tenantId The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} parameters.properties.sku SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {string} [parameters.properties.vaultUri] The URI of the vault for + * performing operations on keys and secrets. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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 {Vault} - 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. + * + * {Vault} [result] - The deserialized result object if an error did not occur. + * See {@link Vault} 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, vaultName: string, parameters: models.VaultCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, vaultName: string, parameters: models.VaultCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, vaultName: string, parameters: models.VaultCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to patch the vault + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} [parameters.properties] Properties of the vault + * + * @param {uuid} [parameters.properties.tenantId] The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} [parameters.properties.sku] SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, vaultName: string, parameters: models.VaultPatchParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to patch the vault + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} [parameters.properties] Properties of the vault + * + * @param {uuid} [parameters.properties.tenantId] The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} [parameters.properties.sku] SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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 {Vault} - 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. + * + * {Vault} [result] - The deserialized result object if an error did not occur. + * See {@link Vault} 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, vaultName: string, parameters: models.VaultPatchParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, vaultName: string, parameters: models.VaultPatchParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, vaultName: string, parameters: models.VaultPatchParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified Azure key vault. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName The name of the vault 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, vaultName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified Azure key vault. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName The name of the vault 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, vaultName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, vaultName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, vaultName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified Azure key vault. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName The name of the vault. + * + * @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, vaultName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified Azure key vault. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName The name of the vault. + * + * @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 {Vault} - 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. + * + * {Vault} [result] - The deserialized result object if an error did not occur. + * See {@link Vault} 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, vaultName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, vaultName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, vaultName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {string} operationKind Name of the operation. Possible values + * include: 'add', 'replace', 'remove' + * + * @param {object} parameters Access policy to merge into the vault + * + * @param {object} parameters.properties Properties of the access policy + * + * @param {array} parameters.properties.accessPolicies An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @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. + */ + updateAccessPolicyWithHttpOperationResponse(resourceGroupName: string, vaultName: string, operationKind: string, parameters: models.VaultAccessPolicyParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {string} operationKind Name of the operation. Possible values + * include: 'add', 'replace', 'remove' + * + * @param {object} parameters Access policy to merge into the vault + * + * @param {object} parameters.properties Properties of the access policy + * + * @param {array} parameters.properties.accessPolicies An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @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 {VaultAccessPolicyParameters} - 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. + * + * {VaultAccessPolicyParameters} [result] - The deserialized result object if an error did not occur. + * See {@link VaultAccessPolicyParameters} 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. + */ + updateAccessPolicy(resourceGroupName: string, vaultName: string, operationKind: string, parameters: models.VaultAccessPolicyParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateAccessPolicy(resourceGroupName: string, vaultName: string, operationKind: string, parameters: models.VaultAccessPolicyParameters, callback: ServiceCallback): void; + updateAccessPolicy(resourceGroupName: string, vaultName: string, operationKind: string, parameters: models.VaultAccessPolicyParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The List operation gets information about the vaults associated with the + * subscription and within the specified resource group. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The List operation gets information about the vaults associated with the + * subscription and within the specified resource group. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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 {VaultListResult} - 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. + * + * {VaultListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VaultListResult} 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?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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. + */ + listBySubscriptionWithHttpOperationResponse(options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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 {VaultListResult} - 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. + * + * {VaultListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VaultListResult} 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?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about the deleted vaults in 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. + */ + listDeletedWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about the deleted vaults in 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 {DeletedVaultListResult} - 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. + * + * {DeletedVaultListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedVaultListResult} 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. + */ + listDeleted(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listDeleted(callback: ServiceCallback): void; + listDeleted(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the deleted Azure key vault. + * + * @param {string} vaultName The name of the vault. + * + * @param {string} location The location of the deleted vault. + * + * @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. + */ + getDeletedWithHttpOperationResponse(vaultName: string, location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the deleted Azure key vault. + * + * @param {string} vaultName The name of the vault. + * + * @param {string} location The location of the deleted vault. + * + * @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 {DeletedVault} - 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. + * + * {DeletedVault} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedVault} 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. + */ + getDeleted(vaultName: string, location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeleted(vaultName: string, location: string, callback: ServiceCallback): void; + getDeleted(vaultName: string, location: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. + * + * @param {string} vaultName The name of the soft-deleted vault. + * + * @param {string} location The location of the soft-deleted vault. + * + * @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. + */ + purgeDeletedWithHttpOperationResponse(vaultName: string, location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. + * + * @param {string} vaultName The name of the soft-deleted vault. + * + * @param {string} location The location of the soft-deleted vault. + * + * @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. + */ + purgeDeleted(vaultName: string, location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + purgeDeleted(vaultName: string, location: string, callback: ServiceCallback): void; + purgeDeleted(vaultName: string, location: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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. + */ + listWithHttpOperationResponse(options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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 {ResourceListResult} - 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. + * + * {ResourceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ResourceListResult} 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?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param {object} vaultName The name of the vault. + * + * @param {string} vaultName.name The vault 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. + */ + checkNameAvailabilityWithHttpOperationResponse(vaultName: models.VaultCheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param {object} vaultName The name of the vault. + * + * @param {string} vaultName.name The vault 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 {CheckNameAvailabilityResult} - 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. + * + * {CheckNameAvailabilityResult} [result] - The deserialized result object if an error did not occur. + * See {@link CheckNameAvailabilityResult} 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. + */ + checkNameAvailability(vaultName: models.VaultCheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkNameAvailability(vaultName: models.VaultCheckNameAvailabilityParameters, callback: ServiceCallback): void; + checkNameAvailability(vaultName: models.VaultCheckNameAvailabilityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to create or update the vault + * + * @param {string} parameters.location The supported Azure location where the + * key vault should be created. + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} parameters.properties Properties of the vault + * + * @param {uuid} parameters.properties.tenantId The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} parameters.properties.sku SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {string} [parameters.properties.vaultUri] The URI of the vault for + * performing operations on keys and secrets. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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, vaultName: string, parameters: models.VaultCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to create or update the vault + * + * @param {string} parameters.location The supported Azure location where the + * key vault should be created. + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} parameters.properties Properties of the vault + * + * @param {uuid} parameters.properties.tenantId The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} parameters.properties.sku SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {string} [parameters.properties.vaultUri] The URI of the vault for + * performing operations on keys and secrets. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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 {Vault} - 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. + * + * {Vault} [result] - The deserialized result object if an error did not occur. + * See {@link Vault} 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, vaultName: string, parameters: models.VaultCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, vaultName: string, parameters: models.VaultCreateOrUpdateParameters, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, vaultName: string, parameters: models.VaultCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. + * + * @param {string} vaultName The name of the soft-deleted vault. + * + * @param {string} location The location of the soft-deleted vault. + * + * @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. + */ + beginPurgeDeletedWithHttpOperationResponse(vaultName: string, location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. + * + * @param {string} vaultName The name of the soft-deleted vault. + * + * @param {string} location The location of the soft-deleted vault. + * + * @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. + */ + beginPurgeDeleted(vaultName: string, location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPurgeDeleted(vaultName: string, location: string, callback: ServiceCallback): void; + beginPurgeDeleted(vaultName: string, location: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The List operation gets information about the vaults associated with the + * subscription and within the specified 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>; + + /** + * The List operation gets information about the vaults associated with the + * subscription and within the specified 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 {VaultListResult} - 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. + * + * {VaultListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VaultListResult} 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; + + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VaultListResult} - 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. + * + * {VaultListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VaultListResult} 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; + + + /** + * Gets information about the deleted vaults in 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. + */ + listDeletedNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about the deleted vaults in 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 {DeletedVaultListResult} - 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. + * + * {DeletedVaultListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedVaultListResult} 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. + */ + listDeletedNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listDeletedNext(nextPageLink: string, callback: ServiceCallback): void; + listDeletedNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResourceListResult} - 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. + * + * {ResourceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ResourceListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the KeyVaultManagementClient. + */ +export interface Operations { + + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationListResult} - 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. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} 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; + + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationListResult} - 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. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} 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; +} diff --git a/lib/services/keyVaultManagement/lib/lib/operations/index.js b/lib/services/keyVaultManagement/lib/lib/operations/index.js new file mode 100644 index 0000000000..d279f112bb --- /dev/null +++ b/lib/services/keyVaultManagement/lib/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.Vaults = require('./vaults'); +exports.Operations = require('./operations'); diff --git a/lib/services/keyVaultManagement/lib/lib/operations/operations.js b/lib/services/keyVaultManagement/lib/lib/operations/operations.js new file mode 100644 index 0000000000..dd417b2efa --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/operations/operations.js @@ -0,0 +1,449 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Lists all of the available Key Vault Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.KeyVault/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all of the available Key Vault Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} 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['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Operations. */ +class Operations { + /** + * Create a Operations. + * @param {KeyVaultManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationListResult} - 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 OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationListResult} - 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 OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/keyVaultManagement/lib/lib/operations/vaults.js b/lib/services/keyVaultManagement/lib/lib/operations/vaults.js new file mode 100644 index 0000000000..c45da5efe7 --- /dev/null +++ b/lib/services/keyVaultManagement/lib/lib/operations/vaults.js @@ -0,0 +1,4781 @@ +/* + * 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; + + +/** + * Create or update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to create or update the vault + * + * @param {string} parameters.location The supported Azure location where the + * key vault should be created. + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} parameters.properties Properties of the vault + * + * @param {uuid} parameters.properties.tenantId The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} parameters.properties.sku SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {string} [parameters.properties.vaultUri] The URI of the vault for + * performing operations on keys and secrets. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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 Vault} 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, vaultName, 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, vaultName, 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['Vault']().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); + }); + }); +} + +/** + * Update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to patch the vault + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} [parameters.properties] Properties of the vault + * + * @param {uuid} [parameters.properties.tenantId] The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} [parameters.properties.sku] SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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 Vault} 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, vaultName, 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.'); + } + if (parameters === null || parameters === undefined) + { + parameters = {}; + } + // 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 (vaultName === null || vaultName === undefined || typeof vaultName.valueOf() !== 'string') { + throw new Error('vaultName cannot be null or undefined and it must be of type string.'); + } + if (vaultName !== null && vaultName !== undefined) { + if (vaultName.match(/^[a-zA-Z0-9-]{3,24}$/) === null) + { + throw new Error('"vaultName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9-]{3,24}$/'); + } + } + 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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (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.KeyVault/vaults/{vaultName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{vaultName}', encodeURIComponent(vaultName)); + 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['VaultPatchParameters']().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['Vault']().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['Vault']().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 specified Azure key vault. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName The name of the vault 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, vaultName, 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 (vaultName === null || vaultName === undefined || typeof vaultName.valueOf() !== 'string') { + throw new Error('vaultName 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{vaultName}', encodeURIComponent(vaultName)); + 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) { + 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); + }); +} + +/** + * Gets the specified Azure key vault. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName The name of the vault. + * + * @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 Vault} 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, vaultName, 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 (vaultName === null || vaultName === undefined || typeof vaultName.valueOf() !== 'string') { + throw new Error('vaultName 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{vaultName}', encodeURIComponent(vaultName)); + 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['Vault']().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); + }); +} + +/** + * Update access policies in a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {string} operationKind Name of the operation. Possible values + * include: 'add', 'replace', 'remove' + * + * @param {object} parameters Access policy to merge into the vault + * + * @param {object} parameters.properties Properties of the access policy + * + * @param {array} parameters.properties.accessPolicies An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @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 VaultAccessPolicyParameters} 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 _updateAccessPolicy(resourceGroupName, vaultName, operationKind, 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 (vaultName === null || vaultName === undefined || typeof vaultName.valueOf() !== 'string') { + throw new Error('vaultName cannot be null or undefined and it must be of type string.'); + } + if (vaultName !== null && vaultName !== undefined) { + if (vaultName.match(/^[a-zA-Z0-9-]{3,24}$/) === null) + { + throw new Error('"vaultName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9-]{3,24}$/'); + } + } + if (operationKind) { + let allowedValues = [ 'add', 'replace', 'remove' ]; + if (!allowedValues.some( function(item) { return item === operationKind; })) { + throw new Error(operationKind + ' is not a valid value. The valid values are: ' + allowedValues); + } + } else { + throw new Error('operationKind 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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (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.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{vaultName}', encodeURIComponent(vaultName)); + requestUrl = requestUrl.replace('{operationKind}', encodeURIComponent(operationKind)); + 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['VaultAccessPolicyParameters']().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['VaultAccessPolicyParameters']().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['VaultAccessPolicyParameters']().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); + }); +} + +/** + * The List operation gets information about the vaults associated with the + * subscription and within the specified resource group. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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 VaultListResult} 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 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 (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.KeyVault/vaults'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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['VaultListResult']().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); + }); +} + +/** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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 VaultListResult} 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.'); + } + let top = (options && options.top !== undefined) ? options.top : undefined; + // Validate + try { + 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}/providers/Microsoft.KeyVault/vaults'; + 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['VaultListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets information about the deleted vaults in 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 DeletedVaultListResult} 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 _listDeleted(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.KeyVault/deletedVaults'; + 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['DeletedVaultListResult']().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 deleted Azure key vault. + * + * @param {string} vaultName The name of the vault. + * + * @param {string} location The location of the deleted vault. + * + * @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 DeletedVault} 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 _getDeleted(vaultName, location, 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 (vaultName === null || vaultName === undefined || typeof vaultName.valueOf() !== 'string') { + throw new Error('vaultName cannot be null or undefined and it must be of type string.'); + } + if (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (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.KeyVault/locations/{location}/deletedVaults/{vaultName}'; + requestUrl = requestUrl.replace('{vaultName}', encodeURIComponent(vaultName)); + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + 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['DeletedVault']().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); + }); +} + + +/** + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. + * + * @param {string} vaultName The name of the soft-deleted vault. + * + * @param {string} location The location of the soft-deleted vault. + * + * @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 _purgeDeleted(vaultName, location, 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.beginPurgeDeleted(vaultName, location, 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); + }); + }); +} + +/** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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 ResourceListResult} 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 top = (options && options.top !== undefined) ? options.top : undefined; + let filter = 'resourceType eq \'Microsoft.KeyVault/vaults\''; + let apiVersion = '2015-11-01'; + // Validate + try { + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + 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}/resources'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('$filter=' + encodeURIComponent(filter)); + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(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['ResourceListResult']().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); + }); +} + +/** + * Checks that the vault name is valid and is not already in use. + * + * @param {object} vaultName The name of the vault. + * + * @param {string} vaultName.name The vault 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 CheckNameAvailabilityResult} 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 _checkNameAvailability(vaultName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + if (vaultName === null || vaultName === undefined) + { + vaultName = {}; + } + // Validate + try { + if (vaultName === null || vaultName === undefined) { + throw new Error('vaultName 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.KeyVault/checkNameAvailability'; + 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 (vaultName !== null && vaultName !== undefined) { + let requestModelMapper = new client.models['VaultCheckNameAvailabilityParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, vaultName, 'vaultName'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(vaultName, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['CheckNameAvailabilityResult']().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); + }); +} + +/** + * Create or update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to create or update the vault + * + * @param {string} parameters.location The supported Azure location where the + * key vault should be created. + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} parameters.properties Properties of the vault + * + * @param {uuid} parameters.properties.tenantId The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} parameters.properties.sku SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {string} [parameters.properties.vaultUri] The URI of the vault for + * performing operations on keys and secrets. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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 Vault} 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, vaultName, 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.'); + } + if (parameters === null || parameters === undefined) + { + parameters = {}; + } + // 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 (vaultName === null || vaultName === undefined || typeof vaultName.valueOf() !== 'string') { + throw new Error('vaultName cannot be null or undefined and it must be of type string.'); + } + if (vaultName !== null && vaultName !== undefined) { + if (vaultName.match(/^[a-zA-Z0-9-]{3,24}$/) === null) + { + throw new Error('"vaultName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9-]{3,24}$/'); + } + } + 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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (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.KeyVault/vaults/{vaultName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{vaultName}', encodeURIComponent(vaultName)); + 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['VaultCreateOrUpdateParameters']().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['Vault']().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['Vault']().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); + }); +} + +/** + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. + * + * @param {string} vaultName The name of the soft-deleted vault. + * + * @param {string} location The location of the soft-deleted vault. + * + * @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 _beginPurgeDeleted(vaultName, location, 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 (vaultName === null || vaultName === undefined || typeof vaultName.valueOf() !== 'string') { + throw new Error('vaultName cannot be null or undefined and it must be of type string.'); + } + if (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (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.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'; + requestUrl = requestUrl.replace('{vaultName}', encodeURIComponent(vaultName)); + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + 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 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * The List operation gets information about the vaults associated with the + * subscription and within the specified 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 VaultListResult} 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['VaultListResult']().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); + }); +} + +/** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VaultListResult} 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) { + 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['VaultListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets information about the deleted vaults in 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 DeletedVaultListResult} 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 _listDeletedNext(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['DeletedVaultListResult']().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); + }); +} + +/** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResourceListResult} 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['ResourceListResult']().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 Vaults. */ +class Vaults { + /** + * Create a Vaults. + * @param {KeyVaultManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._updateAccessPolicy = _updateAccessPolicy; + this._listByResourceGroup = _listByResourceGroup; + this._listBySubscription = _listBySubscription; + this._listDeleted = _listDeleted; + this._getDeleted = _getDeleted; + this._purgeDeleted = _purgeDeleted; + this._list = _list; + this._checkNameAvailability = _checkNameAvailability; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginPurgeDeleted = _beginPurgeDeleted; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listBySubscriptionNext = _listBySubscriptionNext; + this._listDeletedNext = _listDeletedNext; + this._listNext = _listNext; + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to create or update the vault + * + * @param {string} parameters.location The supported Azure location where the + * key vault should be created. + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} parameters.properties Properties of the vault + * + * @param {uuid} parameters.properties.tenantId The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} parameters.properties.sku SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {string} [parameters.properties.vaultUri] The URI of the vault for + * performing operations on keys and secrets. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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, vaultName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, vaultName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to create or update the vault + * + * @param {string} parameters.location The supported Azure location where the + * key vault should be created. + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} parameters.properties Properties of the vault + * + * @param {uuid} parameters.properties.tenantId The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} parameters.properties.sku SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {string} [parameters.properties.vaultUri] The URI of the vault for + * performing operations on keys and secrets. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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 {Vault} - 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 Vault} 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, vaultName, 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, vaultName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, vaultName, parameters, options, optionalCallback); + } + } + + /** + * Update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to patch the vault + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} [parameters.properties] Properties of the vault + * + * @param {uuid} [parameters.properties.tenantId] The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} [parameters.properties.sku] SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, vaultName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, vaultName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to patch the vault + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} [parameters.properties] Properties of the vault + * + * @param {uuid} [parameters.properties.tenantId] The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} [parameters.properties.sku] SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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 {Vault} - 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 Vault} 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, vaultName, 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._update(resourceGroupName, vaultName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, vaultName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified Azure key vault. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName The name of the vault 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, vaultName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, vaultName, 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 specified Azure key vault. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName The name of the vault 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, vaultName, 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, vaultName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, vaultName, options, optionalCallback); + } + } + + /** + * Gets the specified Azure key vault. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName The name of the vault. + * + * @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, vaultName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, vaultName, 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 specified Azure key vault. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName The name of the vault. + * + * @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 {Vault} - 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 Vault} 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, vaultName, 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, vaultName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, vaultName, options, optionalCallback); + } + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {string} operationKind Name of the operation. Possible values + * include: 'add', 'replace', 'remove' + * + * @param {object} parameters Access policy to merge into the vault + * + * @param {object} parameters.properties Properties of the access policy + * + * @param {array} parameters.properties.accessPolicies An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @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. + */ + updateAccessPolicyWithHttpOperationResponse(resourceGroupName, vaultName, operationKind, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateAccessPolicy(resourceGroupName, vaultName, operationKind, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {string} operationKind Name of the operation. Possible values + * include: 'add', 'replace', 'remove' + * + * @param {object} parameters Access policy to merge into the vault + * + * @param {object} parameters.properties Properties of the access policy + * + * @param {array} parameters.properties.accessPolicies An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @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 {VaultAccessPolicyParameters} - 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 VaultAccessPolicyParameters} 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. + */ + updateAccessPolicy(resourceGroupName, vaultName, operationKind, 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._updateAccessPolicy(resourceGroupName, vaultName, operationKind, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateAccessPolicy(resourceGroupName, vaultName, operationKind, parameters, options, optionalCallback); + } + } + + /** + * The List operation gets information about the vaults associated with the + * subscription and within the specified resource group. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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. + */ + 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; + }); + }); + } + + /** + * The List operation gets information about the vaults associated with the + * subscription and within the specified resource group. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the vault belongs. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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 {VaultListResult} - 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 VaultListResult} 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); + } + } + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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. + */ + 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; + }); + }); + } + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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 {VaultListResult} - 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 VaultListResult} 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 information about the deleted vaults in 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. + */ + listDeletedWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listDeleted(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about the deleted vaults in 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 {DeletedVaultListResult} - 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 DeletedVaultListResult} 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. + */ + listDeleted(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._listDeleted(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listDeleted(options, optionalCallback); + } + } + + /** + * Gets the deleted Azure key vault. + * + * @param {string} vaultName The name of the vault. + * + * @param {string} location The location of the deleted vault. + * + * @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. + */ + getDeletedWithHttpOperationResponse(vaultName, location, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getDeleted(vaultName, location, 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 deleted Azure key vault. + * + * @param {string} vaultName The name of the vault. + * + * @param {string} location The location of the deleted vault. + * + * @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 {DeletedVault} - 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 DeletedVault} 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. + */ + getDeleted(vaultName, location, 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._getDeleted(vaultName, location, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeleted(vaultName, location, options, optionalCallback); + } + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. + * + * @param {string} vaultName The name of the soft-deleted vault. + * + * @param {string} location The location of the soft-deleted vault. + * + * @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. + */ + purgeDeletedWithHttpOperationResponse(vaultName, location, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._purgeDeleted(vaultName, location, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. + * + * @param {string} vaultName The name of the soft-deleted vault. + * + * @param {string} location The location of the soft-deleted vault. + * + * @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. + */ + purgeDeleted(vaultName, location, 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._purgeDeleted(vaultName, location, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._purgeDeleted(vaultName, location, options, optionalCallback); + } + } + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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. + */ + 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; + }); + }); + } + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] Maximum 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 {ResourceListResult} - 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 ResourceListResult} 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); + } + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param {object} vaultName The name of the vault. + * + * @param {string} vaultName.name The vault 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. + */ + checkNameAvailabilityWithHttpOperationResponse(vaultName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._checkNameAvailability(vaultName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param {object} vaultName The name of the vault. + * + * @param {string} vaultName.name The vault 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 {CheckNameAvailabilityResult} - 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 CheckNameAvailabilityResult} 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. + */ + checkNameAvailability(vaultName, 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._checkNameAvailability(vaultName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkNameAvailability(vaultName, options, optionalCallback); + } + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to create or update the vault + * + * @param {string} parameters.location The supported Azure location where the + * key vault should be created. + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} parameters.properties Properties of the vault + * + * @param {uuid} parameters.properties.tenantId The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} parameters.properties.sku SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {string} [parameters.properties.vaultUri] The URI of the vault for + * performing operations on keys and secrets. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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, vaultName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, vaultName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param {string} resourceGroupName The name of the Resource Group to which + * the server belongs. + * + * @param {string} vaultName Name of the vault + * + * @param {object} parameters Parameters to create or update the vault + * + * @param {string} parameters.location The supported Azure location where the + * key vault should be created. + * + * @param {object} [parameters.tags] The tags that will be assigned to the key + * vault. + * + * @param {object} parameters.properties Properties of the vault + * + * @param {uuid} parameters.properties.tenantId The Azure Active Directory + * tenant ID that should be used for authenticating requests to the key vault. + * + * @param {object} parameters.properties.sku SKU details + * + * @param {string} parameters.properties.sku.name SKU name to specify whether + * the key vault is a standard vault or a premium vault. Possible values + * include: 'standard', 'premium' + * + * @param {array} [parameters.properties.accessPolicies] An array of 0 to 16 + * identities that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + * + * @param {string} [parameters.properties.vaultUri] The URI of the vault for + * performing operations on keys and secrets. + * + * @param {boolean} [parameters.properties.enabledForDeployment] Property to + * specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * + * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property + * to specify whether Azure Disk Encryption is permitted to retrieve secrets + * from the vault and unwrap keys. + * + * @param {boolean} [parameters.properties.enabledForTemplateDeployment] + * Property to specify whether Azure Resource Manager is permitted to retrieve + * secrets from the key vault. + * + * @param {boolean} [parameters.properties.enableSoftDelete] Property to + * specify whether the 'soft delete' functionality is enabled for this key + * vault. It does not accept false value. + * + * @param {string} [parameters.properties.createMode] The vault's create mode + * to indicate whether the vault need to be recovered or not. Possible values + * include: 'recover', 'default' + * + * @param {boolean} [parameters.properties.enablePurgeProtection] Property + * specifying whether protection against purge is enabled for this vault. + * Setting this property to true activates protection against purge for this + * vault and its content - only the Key Vault service may initiate a hard, + * irrecoverable deletion. The setting is effective only if soft delete is also + * enabled. Enabling this functionality is irreversible - that is, the property + * does not accept false as its value. + * + * @param {object} [parameters.properties.networkAcls] A collection of rules + * governing the accessibility of the vault from specific network locations. + * + * @param {string} [parameters.properties.networkAcls.bypass] Tells what + * traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. Possible values include: + * 'AzureServices', 'None' + * + * @param {string} [parameters.properties.networkAcls.defaultAction] The + * default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. Possible + * values include: 'Allow', 'Deny' + * + * @param {array} [parameters.properties.networkAcls.ipRules] The list of IP + * address rules. + * + * @param {array} [parameters.properties.networkAcls.virtualNetworkRules] The + * list of virtual network rules. + * + * @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 {Vault} - 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 Vault} 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, vaultName, 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, vaultName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, vaultName, parameters, options, optionalCallback); + } + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. + * + * @param {string} vaultName The name of the soft-deleted vault. + * + * @param {string} location The location of the soft-deleted vault. + * + * @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. + */ + beginPurgeDeletedWithHttpOperationResponse(vaultName, location, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginPurgeDeleted(vaultName, location, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. + * + * @param {string} vaultName The name of the soft-deleted vault. + * + * @param {string} location The location of the soft-deleted vault. + * + * @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. + */ + beginPurgeDeleted(vaultName, location, 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._beginPurgeDeleted(vaultName, location, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginPurgeDeleted(vaultName, location, options, optionalCallback); + } + } + + /** + * The List operation gets information about the vaults associated with the + * subscription and within the specified 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; + }); + }); + } + + /** + * The List operation gets information about the vaults associated with the + * subscription and within the specified 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 {VaultListResult} - 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 VaultListResult} 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); + } + } + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + 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; + }); + }); + } + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VaultListResult} - 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 VaultListResult} 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); + } + } + + /** + * Gets information about the deleted vaults in 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. + */ + listDeletedNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listDeletedNext(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 information about the deleted vaults in 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 {DeletedVaultListResult} - 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 DeletedVaultListResult} 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. + */ + listDeletedNext(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._listDeletedNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listDeletedNext(nextPageLink, options, optionalCallback); + } + } + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The List operation gets information about the vaults associated with the + * subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResourceListResult} - 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 ResourceListResult} 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 = Vaults; diff --git a/lib/services/keyVaultManagement/lib/package.json b/lib/services/keyVaultManagement/lib/package.json new file mode 100644 index 0000000000..6b9b26cedf --- /dev/null +++ b/lib/services/keyVaultManagement/lib/package.json @@ -0,0 +1,22 @@ +{ + "name": "azure-arm-keyvault", + "author": "Microsoft Corporation", + "description": "KeyVaultManagementClient Library with typescript type definitions for node", + "version": "", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ "node", "azure" ], + "license": "MIT", + "main": "./lib/keyVaultManagementClient.js", + "types": "./lib/keyVaultManagementClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "http://github.com/Azure/azure-sdk-for-node/issues" + } +}