diff --git a/lib/services/keyVaultManagement/LICENSE.txt b/lib/services/keyVaultManagement/LICENSE.txt index 0313a903d7..5431ba98b9 100644 --- a/lib/services/keyVaultManagement/LICENSE.txt +++ b/lib/services/keyVaultManagement/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2017 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. \ No newline at end of file +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/keyVaultManagementClient.d.ts b/lib/services/keyVaultManagement/lib/keyVaultManagementClient.d.ts index c3375aa9ff..7910345414 100755 --- a/lib/services/keyVaultManagement/lib/keyVaultManagementClient.d.ts +++ b/lib/services/keyVaultManagement/lib/keyVaultManagementClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class KeyVaultManagementClient extends AzureServiceClient { +export default class KeyVaultManagementClient extends AzureServiceClient { /** * Initializes a new instance of the KeyVaultManagementClient class. * @constructor @@ -20,7 +21,7 @@ declare class KeyVaultManagementClient extends AzureServiceClient { * @class * @param {credentials} credentials - Credentials needed for the client to connect to Azure. * - * @param {string} subscriptionId - Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * @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. * @@ -56,6 +57,7 @@ declare class KeyVaultManagementClient extends AzureServiceClient { // Operation groups vaults: operations.Vaults; + operations: operations.Operations; } -export = KeyVaultManagementClient; +export { KeyVaultManagementClient, models as KeyVaultManagementModels }; diff --git a/lib/services/keyVaultManagement/lib/keyVaultManagementClient.js b/lib/services/keyVaultManagement/lib/keyVaultManagementClient.js index 648e8c0410..1e61b8ec43 100755 --- a/lib/services/keyVaultManagement/lib/keyVaultManagementClient.js +++ b/lib/services/keyVaultManagement/lib/keyVaultManagementClient.js @@ -27,7 +27,7 @@ class KeyVaultManagementClient extends ServiceClient { /** * Create a KeyVaultManagementClient. * @param {credentials} credentials - Credentials needed for the client to connect to Azure. - * @param {string} subscriptionId - Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * @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 @@ -50,7 +50,7 @@ class KeyVaultManagementClient extends ServiceClient { super(credentials, options); - this.apiVersion = '2016-10-01'; + this.apiVersion = '2018-02-14'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -73,6 +73,7 @@ class KeyVaultManagementClient extends ServiceClient { this.generateClientRequestId = options.generateClientRequestId; } this.vaults = new operations.Vaults(this); + this.operations = new operations.Operations(this); this.models = models; msRest.addSerializationMixin(this); } @@ -80,3 +81,6 @@ class KeyVaultManagementClient extends ServiceClient { } module.exports = KeyVaultManagementClient; +module.exports['default'] = KeyVaultManagementClient; +module.exports.KeyVaultManagementClient = KeyVaultManagementClient; +module.exports.KeyVaultManagementModels = models; diff --git a/lib/services/keyVaultManagement/lib/models/checkNameAvailabilityResult.js b/lib/services/keyVaultManagement/lib/models/checkNameAvailabilityResult.js new file mode 100644 index 0000000000..f6b1d65f94 --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/iPRule.js b/lib/services/keyVaultManagement/lib/models/iPRule.js new file mode 100644 index 0000000000..892a6046b1 --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/index.d.ts b/lib/services/keyVaultManagement/lib/models/index.d.ts index 6324de8886..85719e36e8 100755 --- a/lib/services/keyVaultManagement/lib/models/index.d.ts +++ b/lib/services/keyVaultManagement/lib/models/index.d.ts @@ -76,6 +76,57 @@ export interface AccessPolicyEntry { 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. @@ -107,6 +158,24 @@ export interface AccessPolicyEntry { * @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; @@ -118,6 +187,83 @@ export interface VaultProperties { 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[]; } /** @@ -176,6 +322,27 @@ export interface DeletedVaultProperties { * @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; @@ -183,6 +350,88 @@ export interface VaultCreateOrUpdateParameters extends BaseResource { 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. @@ -191,7 +440,7 @@ export interface VaultCreateOrUpdateParameters extends BaseResource { * * @member {string} [id] The Azure Resource Manager resource ID for the key * vault. - * @member {string} name The name of 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. @@ -199,7 +448,7 @@ export interface VaultCreateOrUpdateParameters extends BaseResource { */ export interface Resource extends BaseResource { readonly id?: string; - name: string; + readonly name?: string; readonly type?: string; location: string; tags?: { [propertyName: string]: string }; @@ -238,6 +487,27 @@ export interface Resource extends BaseResource { * @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; @@ -266,6 +536,113 @@ export interface DeletedVault { 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 @@ -273,8 +650,7 @@ export interface DeletedVault { * @constructor * List of vaults * - * @member {string} [nextLink] Gets or sets the URL to get the next set of - * vaults. + * @member {string} [nextLink] The URL to get the next set of vaults. */ export interface VaultListResult extends Array { nextLink?: string; @@ -298,9 +674,21 @@ export interface DeletedVaultListResult extends Array { * @constructor * List of vault resources. * - * @member {string} [nextLink] Gets the URL to get the next set 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/models/index.js b/lib/services/keyVaultManagement/lib/models/index.js index 3fd41a88f9..060c341b60 100755 --- a/lib/services/keyVaultManagement/lib/models/index.js +++ b/lib/services/keyVaultManagement/lib/models/index.js @@ -21,12 +21,26 @@ 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/models/logSpecification.js b/lib/services/keyVaultManagement/lib/models/logSpecification.js new file mode 100644 index 0000000000..fbf78a7c07 --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/networkRuleSet.js b/lib/services/keyVaultManagement/lib/models/networkRuleSet.js new file mode 100644 index 0000000000..1bbe4bb15d --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/operation.js b/lib/services/keyVaultManagement/lib/models/operation.js new file mode 100644 index 0000000000..7497ee110b --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/operationDisplay.js b/lib/services/keyVaultManagement/lib/models/operationDisplay.js new file mode 100644 index 0000000000..8cab4a170d --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/operationListResult.js b/lib/services/keyVaultManagement/lib/models/operationListResult.js new file mode 100644 index 0000000000..f6662b8f6a --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/resource.js b/lib/services/keyVaultManagement/lib/models/resource.js index a52bd431b5..e23aafe21b 100755 --- a/lib/services/keyVaultManagement/lib/models/resource.js +++ b/lib/services/keyVaultManagement/lib/models/resource.js @@ -22,7 +22,7 @@ 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} [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. @@ -55,7 +55,8 @@ class Resource extends models['BaseResource'] { } }, name: { - required: true, + required: false, + readOnly: true, serializedName: 'name', type: { name: 'String' diff --git a/lib/services/keyVaultManagement/lib/models/resourceListResult.js b/lib/services/keyVaultManagement/lib/models/resourceListResult.js index e2654f559e..9d094338fb 100755 --- a/lib/services/keyVaultManagement/lib/models/resourceListResult.js +++ b/lib/services/keyVaultManagement/lib/models/resourceListResult.js @@ -16,7 +16,7 @@ class ResourceListResult extends Array { /** * Create a ResourceListResult. - * @member {string} [nextLink] Gets the URL to get the next set of vault + * @member {string} [nextLink] The URL to get the next set of vault * resources. */ constructor() { diff --git a/lib/services/keyVaultManagement/lib/models/serviceSpecification.js b/lib/services/keyVaultManagement/lib/models/serviceSpecification.js new file mode 100644 index 0000000000..185445842d --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/vault.js b/lib/services/keyVaultManagement/lib/models/vault.js index aabc17d1c5..fab6833dc9 100755 --- a/lib/services/keyVaultManagement/lib/models/vault.js +++ b/lib/services/keyVaultManagement/lib/models/vault.js @@ -47,6 +47,27 @@ class Vault extends models['Resource'] { * @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(); @@ -75,7 +96,8 @@ class Vault extends models['Resource'] { } }, name: { - required: true, + required: false, + readOnly: true, serializedName: 'name', type: { name: 'String' diff --git a/lib/services/keyVaultManagement/lib/models/vaultAccessPolicyParameters.js b/lib/services/keyVaultManagement/lib/models/vaultAccessPolicyParameters.js new file mode 100644 index 0000000000..ab1f52c76e --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/vaultAccessPolicyProperties.js b/lib/services/keyVaultManagement/lib/models/vaultAccessPolicyProperties.js new file mode 100644 index 0000000000..7250127fd6 --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/vaultCheckNameAvailabilityParameters.js b/lib/services/keyVaultManagement/lib/models/vaultCheckNameAvailabilityParameters.js new file mode 100644 index 0000000000..e8aaa893d7 --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/vaultCreateOrUpdateParameters.js b/lib/services/keyVaultManagement/lib/models/vaultCreateOrUpdateParameters.js index 9873640528..bf7b71e85b 100755 --- a/lib/services/keyVaultManagement/lib/models/vaultCreateOrUpdateParameters.js +++ b/lib/services/keyVaultManagement/lib/models/vaultCreateOrUpdateParameters.js @@ -50,6 +50,27 @@ class VaultCreateOrUpdateParameters extends models['BaseResource'] { * @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(); diff --git a/lib/services/keyVaultManagement/lib/models/vaultListResult.js b/lib/services/keyVaultManagement/lib/models/vaultListResult.js index 3fed784ff3..00ded6fd06 100755 --- a/lib/services/keyVaultManagement/lib/models/vaultListResult.js +++ b/lib/services/keyVaultManagement/lib/models/vaultListResult.js @@ -16,8 +16,7 @@ class VaultListResult extends Array { /** * Create a VaultListResult. - * @member {string} [nextLink] Gets or sets the URL to get the next set of - * vaults. + * @member {string} [nextLink] The URL to get the next set of vaults. */ constructor() { super(); diff --git a/lib/services/keyVaultManagement/lib/models/vaultPatchParameters.js b/lib/services/keyVaultManagement/lib/models/vaultPatchParameters.js new file mode 100644 index 0000000000..15d8a39f5f --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/vaultPatchProperties.js b/lib/services/keyVaultManagement/lib/models/vaultPatchProperties.js new file mode 100644 index 0000000000..de87985a3b --- /dev/null +++ b/lib/services/keyVaultManagement/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/models/vaultProperties.js b/lib/services/keyVaultManagement/lib/models/vaultProperties.js index f03e4c0fa2..30adc3f7a5 100755 --- a/lib/services/keyVaultManagement/lib/models/vaultProperties.js +++ b/lib/services/keyVaultManagement/lib/models/vaultProperties.js @@ -45,6 +45,26 @@ class VaultProperties { * @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() { } @@ -82,9 +102,6 @@ class VaultProperties { accessPolicies: { required: false, serializedName: 'accessPolicies', - constraints: { - MaxItems: 16 - }, type: { name: 'Sequence', element: { @@ -139,6 +156,21 @@ class VaultProperties { name: 'Enum', allowedValues: [ 'recover', 'default' ] } + }, + enablePurgeProtection: { + required: false, + serializedName: 'enablePurgeProtection', + type: { + name: 'Boolean' + } + }, + networkAcls: { + required: false, + serializedName: 'networkAcls', + type: { + name: 'Composite', + className: 'NetworkRuleSet' + } } } } diff --git a/lib/services/keyVaultManagement/lib/models/virtualNetworkRule.js b/lib/services/keyVaultManagement/lib/models/virtualNetworkRule.js new file mode 100644 index 0000000000..9a7f5967a3 --- /dev/null +++ b/lib/services/keyVaultManagement/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/operations/index.d.ts b/lib/services/keyVaultManagement/lib/operations/index.d.ts index af0820e409..e74f821406 100755 --- a/lib/services/keyVaultManagement/lib/operations/index.d.ts +++ b/lib/services/keyVaultManagement/lib/operations/index.d.ts @@ -75,6 +75,33 @@ export interface Vaults { * 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 @@ -142,6 +169,33 @@ export interface Vaults { * 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 @@ -174,6 +228,201 @@ export interface Vaults { 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. * @@ -296,37 +545,57 @@ export interface Vaults { /** - * The List operation gets information about the vaults associated with the - * subscription and within the specified resource group. + * 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 {object} [options] Optional Parameters. + * @param {string} vaultName Name of the vault * - * @param {number} [options.top] Maximum number of results to return. + * @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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + updateAccessPolicyWithHttpOperationResponse(resourceGroupName: string, vaultName: string, operationKind: string, parameters: models.VaultAccessPolicyParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * The List operation gets information about the vaults associated with the - * subscription and within the specified resource group. + * 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 {object} [options] Optional Parameters. + * @param {string} vaultName Name of the vault * - * @param {number} [options.top] Maximum number of results to return. + * @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 @@ -338,7 +607,7 @@ export interface Vaults { * * {Promise} A promise is returned. * - * @resolve {VaultListResult} - The deserialized result object. + * @resolve {VaultAccessPolicyParameters} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -346,39 +615,52 @@ export interface Vaults { * * {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. + * {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. */ - 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; + 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; /** - * Gets information about the deleted vaults in a subscription. + * 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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listDeletedWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets information about the deleted vaults in a subscription. + * 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 * @@ -389,7 +671,7 @@ export interface Vaults { * * {Promise} A promise is returned. * - * @resolve {DeletedVaultListResult} - The deserialized result object. + * @resolve {VaultListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -397,48 +679,45 @@ export interface Vaults { * * {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. + * {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. */ - listDeleted(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listDeleted(callback: ServiceCallback): void; - listDeleted(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + 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; /** - * Gets the deleted Azure key vault. - * - * @param {string} vaultName The name of the vault. - * - * @param {string} location The location of the deleted vault. + * 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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getDeletedWithHttpOperationResponse(vaultName: string, location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBySubscriptionWithHttpOperationResponse(options?: { top? : number, 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. + * 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 * @@ -449,7 +728,7 @@ export interface Vaults { * * {Promise} A promise is returned. * - * @resolve {DeletedVault} - The deserialized result object. + * @resolve {VaultListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -457,25 +736,20 @@ export interface Vaults { * * {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. + * {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. */ - 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; + listBySubscription(options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { top? : number, 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. + * Gets information about the deleted vaults in a subscription. * * @param {object} [options] Optional Parameters. * @@ -484,7 +758,123 @@ export interface Vaults { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @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. */ @@ -586,6 +976,273 @@ export interface Vaults { 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. @@ -705,6 +1362,65 @@ export interface Vaults { 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. * @@ -821,3 +1537,120 @@ export interface Vaults { 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/operations/index.js b/lib/services/keyVaultManagement/lib/operations/index.js index 63640a1f27..d279f112bb 100755 --- a/lib/services/keyVaultManagement/lib/operations/index.js +++ b/lib/services/keyVaultManagement/lib/operations/index.js @@ -15,3 +15,4 @@ 'use strict'; exports.Vaults = require('./vaults'); +exports.Operations = require('./operations'); diff --git a/lib/services/keyVaultManagement/lib/operations/operations.js b/lib/services/keyVaultManagement/lib/operations/operations.js new file mode 100644 index 0000000000..dd417b2efa --- /dev/null +++ b/lib/services/keyVaultManagement/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/operations/vaults.js b/lib/services/keyVaultManagement/lib/operations/vaults.js index f89d9f468f..c45da5efe7 100755 --- a/lib/services/keyVaultManagement/lib/operations/vaults.js +++ b/lib/services/keyVaultManagement/lib/operations/vaults.js @@ -14,6 +14,7 @@ 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. * @@ -68,6 +69,33 @@ const WebResource = msRest.WebResource; * 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 @@ -93,6 +121,151 @@ function _createOrUpdate(resourceGroupName, vaultName, parameters, options, call 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.'); } @@ -144,7 +317,7 @@ function _createOrUpdate(resourceGroupName, vaultName, parameters, options, call // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'PATCH'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -167,7 +340,7 @@ function _createOrUpdate(resourceGroupName, vaultName, parameters, options, call let requestModel = null; try { if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['VaultCreateOrUpdateParameters']().mapper(); + let requestModelMapper = new client.models['VaultPatchParameters']().mapper(); requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); requestContent = JSON.stringify(requestModel); } @@ -183,7 +356,7 @@ function _createOrUpdate(resourceGroupName, vaultName, parameters, options, call return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 201 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -212,7 +385,7 @@ function _createOrUpdate(resourceGroupName, vaultName, parameters, options, call let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -229,7 +402,7 @@ function _createOrUpdate(resourceGroupName, vaultName, parameters, options, call } } // Deserialize Response - if (statusCode === 200) { + if (statusCode === 201) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -525,15 +698,25 @@ function _get(resourceGroupName, vaultName, options, callback) { } /** - * The List operation gets information about the vaults associated with the - * subscription and within the specified resource group. + * 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 {object} [options] Optional Parameters. + * @param {string} vaultName Name of the vault * - * @param {number} [options.top] Maximum number of results to return. + * @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 @@ -545,13 +728,14 @@ function _get(resourceGroupName, vaultName, options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link VaultListResult} for more information. + * 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 _listByResourceGroup(resourceGroupName, options, callback) { +function _updateAccessPolicy(resourceGroupName, vaultName, operationKind, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -561,18 +745,34 @@ function _listByResourceGroup(resourceGroupName, options, callback) { 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 (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.'); } @@ -585,13 +785,12 @@ function _listByResourceGroup(resourceGroupName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'; + 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 = []; - 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('&'); @@ -599,7 +798,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'GET'; + httpRequest.method = 'PUT'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -617,14 +816,28 @@ function _listByResourceGroup(resourceGroupName, options, callback) { } } } - httpRequest.body = null; + // 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) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -659,7 +872,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['VaultListResult']().mapper(); + let resultMapper = new client.models['VaultAccessPolicyParameters']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -669,16 +882,39 @@ function _listByResourceGroup(resourceGroupName, options, callback) { 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); }); } /** - * Gets information about the deleted vaults in a subscription. + * 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 * @@ -689,14 +925,13 @@ function _listByResourceGroup(resourceGroupName, options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DeletedVaultListResult} for more - * information. + * 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 _listDeleted(options, callback) { +function _listByResourceGroup(resourceGroupName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -706,8 +941,15 @@ function _listDeleted(options, callback) { 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.'); } @@ -723,9 +965,13 @@ function _listDeleted(options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'; + 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('&'); @@ -793,7 +1039,7 @@ function _listDeleted(options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['DeletedVaultListResult']().mapper(); + let resultMapper = new client.models['VaultListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -809,14 +1055,13 @@ function _listDeleted(options, callback) { } /** - * Gets the deleted Azure key vault. - * - * @param {string} vaultName The name of the vault. - * - * @param {string} location The location of the deleted vault. + * 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 * @@ -827,13 +1072,13 @@ function _listDeleted(options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DeletedVault} for more information. + * 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 _getDeleted(vaultName, location, options, callback) { +function _listBySubscription(options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -843,13 +1088,11 @@ function _getDeleted(vaultName, location, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let top = (options && options.top !== undefined) ? options.top : undefined; // 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 (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.'); @@ -866,11 +1109,12 @@ function _getDeleted(vaultName, location, options, callback) { // 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)); + 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('&'); @@ -938,7 +1182,7 @@ function _getDeleted(vaultName, location, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['DeletedVault']().mapper(); + let resultMapper = new client.models['VaultListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -953,78 +1197,11 @@ function _getDeleted(vaultName, location, options, callback) { }); } - -/** - * 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. + * Gets information about the deleted vaults in a 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 * @@ -1035,13 +1212,14 @@ function _purgeDeleted(vaultName, location, options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ResourceListResult} for more information. + * 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 _list(options, callback) { +function _listDeleted(options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1051,13 +1229,10 @@ function _list(options, callback) { 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.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.'); @@ -1071,14 +1246,10 @@ function _list(options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resources'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'; 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)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1145,7 +1316,7 @@ function _list(options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['ResourceListResult']().mapper(); + let resultMapper = new client.models['DeletedVaultListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1161,12 +1332,11 @@ function _list(options, callback) { } /** - * Permanently deletes the specified vault. aka Purges the deleted Azure key - * vault. + * Gets the deleted Azure key vault. * - * @param {string} vaultName The name of the soft-deleted vault. + * @param {string} vaultName The name of the vault. * - * @param {string} location The location of the soft-deleted vault. + * @param {string} location The location of the deleted vault. * * @param {object} [options] Optional Parameters. * @@ -1179,13 +1349,14 @@ function _list(options, callback) { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {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 _beginPurgeDeleted(vaultName, location, options, callback) { +function _getDeleted(vaultName, location, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1218,7 +1389,7 @@ function _beginPurgeDeleted(vaultName, location, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'; + 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)); @@ -1230,7 +1401,7 @@ function _beginPurgeDeleted(vaultName, location, options, callback) { // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'POST'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1255,7 +1426,7 @@ function _beginPurgeDeleted(vaultName, location, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1283,20 +1454,100 @@ function _beginPurgeDeleted(vaultName, location, options, callback) { // Create Result let result = null; if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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); }); } + /** - * The List operation gets information about the vaults associated with the - * subscription and within the specified resource group. + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @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 * @@ -1307,13 +1558,13 @@ function _beginPurgeDeleted(vaultName, location, options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link VaultListResult} for more information. + * 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 _listByResourceGroupNext(nextPageLink, options, callback) { +function _list(options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1323,10 +1574,16 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { 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 (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 (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.'); @@ -1336,8 +1593,18 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { } // Construct URL - let requestUrl = '{nextLink}'; - requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/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(); @@ -1401,7 +1668,7 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['VaultListResult']().mapper(); + let resultMapper = new client.models['ResourceListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1417,10 +1684,11 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { } /** - * Gets information about the deleted vaults in a subscription. + * Checks that the vault name is valid and is not already in use. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {object} vaultName The name of the vault. + * + * @param {string} vaultName.name The vault name. * * @param {object} [options] Optional Parameters. * @@ -1434,14 +1702,14 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DeletedVaultListResult} for more + * 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 _listDeletedNext(nextPageLink, options, callback) { +function _checkNameAvailability(vaultName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1451,10 +1719,20 @@ function _listDeletedNext(nextPageLink, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + if (vaultName === null || vaultName === undefined) + { + vaultName = {}; + } // 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 (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.'); @@ -1464,12 +1742,18 @@ function _listDeletedNext(nextPageLink, options, callback) { } // Construct URL - let requestUrl = '{nextLink}'; - requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/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 = 'GET'; + httpRequest.method = 'POST'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1487,7 +1771,21 @@ function _listDeletedNext(nextPageLink, options, callback) { } } } - httpRequest.body = null; + // 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) { @@ -1529,7 +1827,7 @@ function _listDeletedNext(nextPageLink, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['DeletedVaultListResult']().mapper(); + let resultMapper = new client.models['CheckNameAvailabilityResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1545,11 +1843,85 @@ function _listDeletedNext(nextPageLink, options, callback) { } /** - * The List operation gets information about the vaults associated with the - * subscription. + * Create or update a key vault in the specified subscription. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @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. * @@ -1563,13 +1935,13 @@ function _listDeletedNext(nextPageLink, options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ResourceListResult} for more information. + * 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 _listNext(nextPageLink, options, callback) { +function _beginCreateOrUpdate(resourceGroupName, vaultName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1579,10 +1951,32 @@ function _listNext(nextPageLink, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + if (parameters === null || parameters === undefined) + { + parameters = {}; + } // Validate try { - if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { - throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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.'); @@ -1592,12 +1986,20 @@ function _listNext(nextPageLink, options, callback) { } // Construct URL - let requestUrl = '{nextLink}'; - requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/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.method = 'PUT'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1615,14 +2017,28 @@ function _listNext(nextPageLink, options, callback) { } } } - httpRequest.body = null; + // 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) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1657,7 +2073,7 @@ function _listNext(nextPageLink, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['ResourceListResult']().mapper(); + let resultMapper = new client.models['Vault']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1667,103 +2083,1463 @@ function _listNext(nextPageLink, options, callback) { 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); }); } -/** 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._deleteMethod = _deleteMethod; - this._get = _get; - this._listByResourceGroup = _listByResourceGroup; - this._listDeleted = _listDeleted; - this._getDeleted = _getDeleted; - this._purgeDeleted = _purgeDeleted; - this._list = _list; - this._beginPurgeDeleted = _beginPurgeDeleted; - this._listByResourceGroupNext = _listByResourceGroupNext; - this._listDeletedNext = _listDeletedNext; - this._listNext = _listNext; +/** + * 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); } - /** - * 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 + // 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 {string} [parameters.properties.vaultUri] The URI of the vault for - * performing operations on keys and secrets. + * @param {object} [options] Optional Parameters. * - * @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 {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property - * to specify whether Azure Disk Encryption is permitted to retrieve secrets - * from the vault and unwrap keys. + * @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. * - * @param {boolean} [parameters.properties.enabledForTemplateDeployment] - * Property to specify whether Azure Resource Manager is permitted to retrieve - * secrets from the key vault. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VaultAccessPolicyParameters} for more + * information. * - * @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. + * {object} [request] - The HTTP Request object if an error did not occur. * - * @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' + * {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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName, vaultName, parameters, options) { + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, vaultName, parameters, options, (err, result, request, response) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1774,61 +3550,100 @@ class Vaults { } /** - * Create or update a key vault in the specified subscription. + * 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 server belongs. + * the vault belongs. * - * @param {string} vaultName Name of the vault + * @param {object} [options] Optional Parameters. * - * @param {object} parameters Parameters to create or update the vault + * @param {number} [options.top] Maximum number of results to return. * - * @param {string} parameters.location The supported Azure location where the - * key vault should be created. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} [parameters.tags] The tags that will be assigned to the key - * vault. + * @param {function} [optionalCallback] - The optional callback. * - * @param {object} parameters.properties Properties of the vault + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. * - * @param {uuid} parameters.properties.tenantId The Azure Active Directory - * tenant ID that should be used for authenticating requests to the key vault. + * {Promise} A promise is returned * - * @param {object} parameters.properties.sku SKU details + * @resolve {VaultListResult} - The deserialized result object. * - * @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' + * @reject {Error} - The error object. * - * @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. + * {function} optionalCallback(err, result, request, response) * - * @param {string} [parameters.properties.vaultUri] The URI of the vault for - * performing operations on keys and secrets. + * {Error} err - The Error object if an error occurred, null otherwise. * - * @param {boolean} [parameters.properties.enabledForDeployment] Property to - * specify whether Azure Virtual Machines are permitted to retrieve - * certificates stored as secrets from the key vault. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VaultListResult} for more information. * - * @param {boolean} [parameters.properties.enabledForDiskEncryption] Property - * to specify whether Azure Disk Encryption is permitted to retrieve secrets - * from the vault and unwrap keys. + * {object} [request] - The HTTP Request object if an error did not occur. * - * @param {boolean} [parameters.properties.enabledForTemplateDeployment] - * Property to specify whether Azure Resource Manager is permitted to retrieve - * secrets from the key vault. + * {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 {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 {object} [options] Optional Parameters. * - * @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 {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 * @@ -1839,7 +3654,7 @@ class Vaults { * * {Promise} A promise is returned * - * @resolve {Vault} - The deserialized result object. + * @resolve {VaultListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1848,13 +3663,13 @@ class Vaults { * {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. + * 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. */ - createOrUpdate(resourceGroupName, vaultName, parameters, options, optionalCallback) { + listBySubscription(options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1863,24 +3678,19 @@ class Vaults { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, vaultName, parameters, options, (err, result, request, response) => { + self._listBySubscription(options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._createOrUpdate(resourceGroupName, vaultName, parameters, options, optionalCallback); + return self._listBySubscription(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 + * Gets information about the deleted vaults in a subscription. * * @param {object} [options] Optional Parameters. * @@ -1889,15 +3699,15 @@ class Vaults { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName, vaultName, options) { + listDeletedWithHttpOperationResponse(options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, vaultName, options, (err, result, request, response) => { + self._listDeleted(options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1908,12 +3718,7 @@ class Vaults { } /** - * 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 + * Gets information about the deleted vaults in a subscription. * * @param {object} [options] Optional Parameters. * @@ -1927,7 +3732,7 @@ class Vaults { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {DeletedVaultListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1935,13 +3740,15 @@ class Vaults { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {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. */ - deleteMethod(resourceGroupName, vaultName, options, optionalCallback) { + listDeleted(options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1950,25 +3757,24 @@ class Vaults { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, vaultName, options, (err, result, request, response) => { + self._listDeleted(options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._deleteMethod(resourceGroupName, vaultName, options, optionalCallback); + return self._listDeleted(options, optionalCallback); } } /** - * Gets the specified Azure key vault. - * - * @param {string} resourceGroupName The name of the Resource Group to which - * the vault belongs. + * 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 @@ -1976,15 +3782,15 @@ class Vaults { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getWithHttpOperationResponse(resourceGroupName, vaultName, options) { + getDeletedWithHttpOperationResponse(vaultName, location, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._get(resourceGroupName, vaultName, options, (err, result, request, response) => { + self._getDeleted(vaultName, location, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1995,13 +3801,12 @@ class Vaults { } /** - * Gets the specified Azure key vault. - * - * @param {string} resourceGroupName The name of the Resource Group to which - * the vault belongs. + * 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 @@ -2014,7 +3819,7 @@ class Vaults { * * {Promise} A promise is returned * - * @resolve {Vault} - The deserialized result object. + * @resolve {DeletedVault} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2023,13 +3828,13 @@ class Vaults { * {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. + * 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. */ - get(resourceGroupName, vaultName, options, optionalCallback) { + getDeleted(vaultName, location, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2038,42 +3843,41 @@ class Vaults { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._get(resourceGroupName, vaultName, options, (err, result, request, response) => { + self._getDeleted(vaultName, location, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._get(resourceGroupName, vaultName, options, optionalCallback); + return self._getDeleted(vaultName, location, options, optionalCallback); } } /** - * The List operation gets information about the vaults associated with the - * subscription and within the specified resource group. + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. * - * @param {string} resourceGroupName The name of the Resource Group to which - * the vault belongs. + * @param {string} vaultName The name of the soft-deleted vault. * - * @param {object} [options] Optional Parameters. + * @param {string} location The location of the soft-deleted vault. * - * @param {number} [options.top] Maximum number of results to return. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + purgeDeletedWithHttpOperationResponse(vaultName, location, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + self._purgeDeleted(vaultName, location, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2084,15 +3888,14 @@ class Vaults { } /** - * The List operation gets information about the vaults associated with the - * subscription and within the specified resource group. + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. * - * @param {string} resourceGroupName The name of the Resource Group to which - * the vault belongs. + * @param {string} vaultName The name of the soft-deleted vault. * - * @param {object} [options] Optional Parameters. + * @param {string} location The location of the soft-deleted vault. * - * @param {number} [options.top] Maximum number of results to return. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2104,7 +3907,7 @@ class Vaults { * * {Promise} A promise is returned * - * @resolve {VaultListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2112,14 +3915,13 @@ class Vaults { * * {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. + * {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. */ - listByResourceGroup(resourceGroupName, options, optionalCallback) { + purgeDeleted(vaultName, location, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2128,36 +3930,39 @@ class Vaults { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + self._purgeDeleted(vaultName, location, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + return self._purgeDeleted(vaultName, location, options, optionalCallback); } } /** - * Gets information about the deleted vaults in a subscription. + * 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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listDeletedWithHttpOperationResponse(options) { + listWithHttpOperationResponse(options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listDeleted(options, (err, result, request, response) => { + self._list(options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2168,10 +3973,13 @@ class Vaults { } /** - * Gets information about the deleted vaults in a subscription. + * 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 * @@ -2182,7 +3990,7 @@ class Vaults { * * {Promise} A promise is returned * - * @resolve {DeletedVaultListResult} - The deserialized result object. + * @resolve {ResourceListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2191,14 +3999,13 @@ class Vaults { * {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. + * 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. */ - listDeleted(options, optionalCallback) { + list(options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2207,23 +4014,23 @@ class Vaults { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listDeleted(options, (err, result, request, response) => { + self._list(options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listDeleted(options, optionalCallback); + return self._list(options, optionalCallback); } } /** - * Gets the deleted Azure key vault. + * Checks that the vault name is valid and is not already in use. * - * @param {string} vaultName The name of the vault. + * @param {object} vaultName The name of the vault. * - * @param {string} location The location of the deleted vault. + * @param {string} vaultName.name The vault name. * * @param {object} [options] Optional Parameters. * @@ -2232,15 +4039,15 @@ class Vaults { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getDeletedWithHttpOperationResponse(vaultName, location, options) { + checkNameAvailabilityWithHttpOperationResponse(vaultName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._getDeleted(vaultName, location, options, (err, result, request, response) => { + self._checkNameAvailability(vaultName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2251,11 +4058,11 @@ class Vaults { } /** - * Gets the deleted Azure key vault. + * Checks that the vault name is valid and is not already in use. * - * @param {string} vaultName The name of the vault. + * @param {object} vaultName The name of the vault. * - * @param {string} location The location of the deleted vault. + * @param {string} vaultName.name The vault name. * * @param {object} [options] Optional Parameters. * @@ -2269,7 +4076,7 @@ class Vaults { * * {Promise} A promise is returned * - * @resolve {DeletedVault} - The deserialized result object. + * @resolve {CheckNameAvailabilityResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2278,13 +4085,14 @@ class Vaults { * {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. + * 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. */ - getDeleted(vaultName, location, options, optionalCallback) { + checkNameAvailability(vaultName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2293,24 +4101,97 @@ class Vaults { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getDeleted(vaultName, location, options, (err, result, request, response) => { + self._checkNameAvailability(vaultName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._getDeleted(vaultName, location, options, optionalCallback); + return self._checkNameAvailability(vaultName, options, optionalCallback); } } /** - * Permanently deletes the specified vault. aka Purges the deleted Azure key + * 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 {string} vaultName The name of the soft-deleted vault. + * @param {object} parameters.properties Properties of the vault * - * @param {string} location The location of the soft-deleted 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. * @@ -2319,15 +4200,15 @@ class Vaults { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - purgeDeletedWithHttpOperationResponse(vaultName, location, options) { + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, vaultName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._purgeDeleted(vaultName, location, options, (err, result, request, response) => { + self._beginCreateOrUpdate(resourceGroupName, vaultName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2338,12 +4219,85 @@ class Vaults { } /** - * Permanently deletes the specified vault. aka Purges the deleted Azure key + * 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 {string} vaultName The name of the soft-deleted vault. + * @param {object} parameters.properties Properties of the vault * - * @param {string} location The location of the soft-deleted 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. * @@ -2357,7 +4311,7 @@ class Vaults { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {Vault} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2365,13 +4319,14 @@ class Vaults { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {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. */ - purgeDeleted(vaultName, location, options, optionalCallback) { + beginCreateOrUpdate(resourceGroupName, vaultName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2380,39 +4335,41 @@ class Vaults { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._purgeDeleted(vaultName, location, options, (err, result, request, response) => { + self._beginCreateOrUpdate(resourceGroupName, vaultName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._purgeDeleted(vaultName, location, options, optionalCallback); + return self._beginCreateOrUpdate(resourceGroupName, vaultName, parameters, options, optionalCallback); } } /** - * The List operation gets information about the vaults associated with the - * subscription. + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. * - * @param {object} [options] Optional Parameters. + * @param {string} vaultName The name of the soft-deleted vault. * - * @param {number} [options.top] Maximum number of results to return. + * @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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listWithHttpOperationResponse(options) { + beginPurgeDeletedWithHttpOperationResponse(vaultName, location, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { + self._beginPurgeDeleted(vaultName, location, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2423,12 +4380,14 @@ class Vaults { } /** - * The List operation gets information about the vaults associated with the - * subscription. + * Permanently deletes the specified vault. aka Purges the deleted Azure key + * vault. * - * @param {object} [options] Optional Parameters. + * @param {string} vaultName The name of the soft-deleted vault. * - * @param {number} [options.top] Maximum number of results to return. + * @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 @@ -2440,7 +4399,7 @@ class Vaults { * * {Promise} A promise is returned * - * @resolve {ResourceListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2448,14 +4407,13 @@ class Vaults { * * {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. + * {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. */ - list(options, optionalCallback) { + beginPurgeDeleted(vaultName, location, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2464,24 +4422,23 @@ class Vaults { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { + self._beginPurgeDeleted(vaultName, location, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._list(options, optionalCallback); + return self._beginPurgeDeleted(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. + * The List operation gets information about the vaults associated with the + * subscription and within the specified resource group. * - * @param {string} location The location of the soft-deleted vault. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2490,15 +4447,15 @@ class Vaults { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - beginPurgeDeletedWithHttpOperationResponse(vaultName, location, options) { + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginPurgeDeleted(vaultName, location, options, (err, result, request, response) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2509,12 +4466,11 @@ class Vaults { } /** - * Permanently deletes the specified vault. aka Purges the deleted Azure key - * vault. - * - * @param {string} vaultName The name of the soft-deleted vault. + * The List operation gets information about the vaults associated with the + * subscription and within the specified resource group. * - * @param {string} location The location of the soft-deleted vault. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2528,7 +4484,7 @@ class Vaults { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {VaultListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2536,13 +4492,14 @@ class Vaults { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {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. */ - beginPurgeDeleted(vaultName, location, options, optionalCallback) { + listByResourceGroupNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2551,20 +4508,20 @@ class Vaults { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginPurgeDeleted(vaultName, location, options, (err, result, request, response) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginPurgeDeleted(vaultName, location, options, optionalCallback); + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); } } /** * The List operation gets information about the vaults associated with the - * subscription and within the specified resource group. + * subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2580,11 +4537,11 @@ class Vaults { * * @reject {Error} - The error object. */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + listBySubscriptionNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2596,7 +4553,7 @@ class Vaults { /** * The List operation gets information about the vaults associated with the - * subscription and within the specified resource group. + * subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -2628,7 +4585,7 @@ class Vaults { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroupNext(nextPageLink, options, optionalCallback) { + listBySubscriptionNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2637,14 +4594,14 @@ class Vaults { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + return self._listBySubscriptionNext(nextPageLink, options, optionalCallback); } } diff --git a/lib/services/keyVaultManagement/package.json b/lib/services/keyVaultManagement/package.json index d0ff627768..23f134cb43 100644 --- a/lib/services/keyVaultManagement/package.json +++ b/lib/services/keyVaultManagement/package.json @@ -1,42 +1,25 @@ { "name": "azure-arm-keyvault", "author": "Microsoft Corporation", - "contributors": [ - "Colombo, Fernando ", - "Gupta, Divya ", - "Kostal, Greg ", - "Mortazavi, Pooneh ", - "Wilson, Hervey ", - "Zavery, Amar ", - "Wang, Yugang " - ], - "version": "1.1.0-preview", - "description": "Microsoft Azure Key Vault Management Client Library for node", - "tags": [ - "azure", - "sdk" - ], + "description": "KeyVaultManagementClient Library with typescript type definitions for node", + "version": "1.1.1", + "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", - "license": "MIT", - "dependencies": { - "ms-rest": "^2.2.2", - "ms-rest-azure": "^2.3.3", - "underscore": "^1.8.3" - }, - "homepage": "http://github.com/Azure/azure-sdk-for-node", + "homepage": "http://github.com/azure/azure-sdk-for-node", "repository": { "type": "git", - "url": "git@github.com:Azure/azure-sdk-for-node.git" + "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { "url": "http://github.com/Azure/azure-sdk-for-node/issues" - }, - "scripts": { - "test": "npm -s run-script jshint" } -} \ No newline at end of file +} diff --git a/lib/services/keyvault/package.json b/lib/services/keyvault/package.json index cfb25fea47..c707a7f9fb 100644 --- a/lib/services/keyvault/package.json +++ b/lib/services/keyvault/package.json @@ -2,7 +2,7 @@ "name": "azure-keyvault", "author": "Microsoft Corporation", "description": "KeyVaultClient Library with typescript type definitions for node", - "version": "3.0.4-preview", + "version": "3.0.4", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5"