diff --git a/lib/services/keyvault/LICENSE.txt b/lib/services/keyvault/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/keyvault/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/keyvault/lib/keyVaultClient.d.ts b/lib/services/keyvault/lib/keyVaultClient.d.ts new file mode 100644 index 0000000000..5cc74e132b --- /dev/null +++ b/lib/services/keyvault/lib/keyVaultClient.d.ts @@ -0,0 +1,7972 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClient, ServiceClientOptions, ServiceCallback, HttpOperationResponse, ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; + +export default class KeyVaultClient extends AzureServiceClient { + /** + * Initializes a new instance of the KeyVaultClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + apiVersion: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + + + /** + * @summary Creates a new key, stores it, then returns key parameters and + * attributes to the client. + * + * The create key operation can be used to create any key type in Azure Key + * Vault. If the named key already exists, Azure Key Vault creates a new + * version of the key. It requires the keys/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name for the new key. The system will generate + * the version name for the new key. + * + * @param {string} kty The type of key to create. For valid values, see + * JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', + * 'oct' + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.keySize] The key size in bits. For example: 2048, + * 3072, or 4096 for RSA. + * + * @param {array} [options.keyOps] + * + * @param {object} [options.keyAttributes] + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @param {string} [options.curve] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * + * @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. + */ + createKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, kty: string, options?: { keySize? : number, keyOps? : string[], keyAttributes? : models.KeyAttributes, tags? : { [propertyName: string]: string }, curve? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates a new key, stores it, then returns key parameters and + * attributes to the client. + * + * The create key operation can be used to create any key type in Azure Key + * Vault. If the named key already exists, Azure Key Vault creates a new + * version of the key. It requires the keys/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name for the new key. The system will generate + * the version name for the new key. + * + * @param {string} kty The type of key to create. For valid values, see + * JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', + * 'oct' + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.keySize] The key size in bits. For example: 2048, + * 3072, or 4096 for RSA. + * + * @param {array} [options.keyOps] + * + * @param {object} [options.keyAttributes] + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @param {string} [options.curve] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * + * @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 {KeyBundle} - 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. + * + * {KeyBundle} [result] - The deserialized result object if an error did not occur. + * See {@link KeyBundle} 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. + */ + createKey(vaultBaseUrl: string, keyName: string, kty: string, options?: { keySize? : number, keyOps? : string[], keyAttributes? : models.KeyAttributes, tags? : { [propertyName: string]: string }, curve? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + createKey(vaultBaseUrl: string, keyName: string, kty: string, callback: ServiceCallback): void; + createKey(vaultBaseUrl: string, keyName: string, kty: string, options: { keySize? : number, keyOps? : string[], keyAttributes? : models.KeyAttributes, tags? : { [propertyName: string]: string }, curve? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Imports an externally created key, stores it, and returns key + * parameters and attributes to the client. + * + * The import key operation may be used to import any key type into an Azure + * Key Vault. If the named key already exists, Azure Key Vault creates a new + * version of the key. This operation requires the keys/import permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName Name for the imported key. + * + * @param {object} key The Json web key + * + * @param {string} [key.kid] Key identifier. + * + * @param {string} [key.kty] JsonWebKey Key Type (kty), as defined in + * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Possible + * values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {array} [key.keyOps] + * + * @param {buffer} [key.n] RSA modulus. + * + * @param {buffer} [key.e] RSA public exponent. + * + * @param {buffer} [key.d] RSA private exponent, or the D component of an EC + * private key. + * + * @param {buffer} [key.dp] RSA private key parameter. + * + * @param {buffer} [key.dq] RSA private key parameter. + * + * @param {buffer} [key.qi] RSA private key parameter. + * + * @param {buffer} [key.p] RSA secret prime. + * + * @param {buffer} [key.q] RSA secret prime, with p < q. + * + * @param {buffer} [key.k] Symmetric key. + * + * @param {buffer} [key.t] HSM Token, used with 'Bring Your Own Key'. + * + * @param {string} [key.crv] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * + * @param {buffer} [key.x] X component of an EC public key. + * + * @param {buffer} [key.y] Y component of an EC public key. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.hsm] Whether to import as a hardware key (HSM) or + * software key. + * + * @param {object} [options.keyAttributes] The key management attributes. + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + importKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, key: models.JsonWebKey, options?: { hsm? : boolean, keyAttributes? : models.KeyAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Imports an externally created key, stores it, and returns key + * parameters and attributes to the client. + * + * The import key operation may be used to import any key type into an Azure + * Key Vault. If the named key already exists, Azure Key Vault creates a new + * version of the key. This operation requires the keys/import permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName Name for the imported key. + * + * @param {object} key The Json web key + * + * @param {string} [key.kid] Key identifier. + * + * @param {string} [key.kty] JsonWebKey Key Type (kty), as defined in + * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Possible + * values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {array} [key.keyOps] + * + * @param {buffer} [key.n] RSA modulus. + * + * @param {buffer} [key.e] RSA public exponent. + * + * @param {buffer} [key.d] RSA private exponent, or the D component of an EC + * private key. + * + * @param {buffer} [key.dp] RSA private key parameter. + * + * @param {buffer} [key.dq] RSA private key parameter. + * + * @param {buffer} [key.qi] RSA private key parameter. + * + * @param {buffer} [key.p] RSA secret prime. + * + * @param {buffer} [key.q] RSA secret prime, with p < q. + * + * @param {buffer} [key.k] Symmetric key. + * + * @param {buffer} [key.t] HSM Token, used with 'Bring Your Own Key'. + * + * @param {string} [key.crv] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * + * @param {buffer} [key.x] X component of an EC public key. + * + * @param {buffer} [key.y] Y component of an EC public key. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.hsm] Whether to import as a hardware key (HSM) or + * software key. + * + * @param {object} [options.keyAttributes] The key management attributes. + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {KeyBundle} - 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. + * + * {KeyBundle} [result] - The deserialized result object if an error did not occur. + * See {@link KeyBundle} 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. + */ + importKey(vaultBaseUrl: string, keyName: string, key: models.JsonWebKey, options?: { hsm? : boolean, keyAttributes? : models.KeyAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + importKey(vaultBaseUrl: string, keyName: string, key: models.JsonWebKey, callback: ServiceCallback): void; + importKey(vaultBaseUrl: string, keyName: string, key: models.JsonWebKey, options: { hsm? : boolean, keyAttributes? : models.KeyAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a key of any type from storage in Azure Key Vault. + * + * The delete key operation cannot be used to remove individual versions of a + * key. This operation removes the cryptographic material associated with the + * key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or + * Encrypt/Decrypt operations. This operation requires the keys/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a key of any type from storage in Azure Key Vault. + * + * The delete key operation cannot be used to remove individual versions of a + * key. This operation removes the cryptographic material associated with the + * key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or + * Encrypt/Decrypt operations. This operation requires the keys/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DeletedKeyBundle} - 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. + * + * {DeletedKeyBundle} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedKeyBundle} 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. + */ + deleteKey(vaultBaseUrl: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteKey(vaultBaseUrl: string, keyName: string, callback: ServiceCallback): void; + deleteKey(vaultBaseUrl: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary The update key operation changes specified attributes of a stored + * key and can be applied to any key type and key version stored in Azure Key + * Vault. + * + * In order to perform this operation, the key must already exist in the Key + * Vault. Note: The cryptographic material of a key itself cannot be changed. + * This operation requires the keys/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of key to update. + * + * @param {string} keyVersion The version of the key to update. + * + * @param {object} [options] Optional Parameters. + * + * @param {array} [options.keyOps] Json web key operations. For more + * information on possible key operations, see JsonWebKeyOperation. + * + * @param {object} [options.keyAttributes] + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + updateKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, keyVersion: string, options?: { keyOps? : string[], keyAttributes? : models.KeyAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary The update key operation changes specified attributes of a stored + * key and can be applied to any key type and key version stored in Azure Key + * Vault. + * + * In order to perform this operation, the key must already exist in the Key + * Vault. Note: The cryptographic material of a key itself cannot be changed. + * This operation requires the keys/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of key to update. + * + * @param {string} keyVersion The version of the key to update. + * + * @param {object} [options] Optional Parameters. + * + * @param {array} [options.keyOps] Json web key operations. For more + * information on possible key operations, see JsonWebKeyOperation. + * + * @param {object} [options.keyAttributes] + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {KeyBundle} - 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. + * + * {KeyBundle} [result] - The deserialized result object if an error did not occur. + * See {@link KeyBundle} 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. + */ + updateKey(vaultBaseUrl: string, keyName: string, keyVersion: string, options?: { keyOps? : string[], keyAttributes? : models.KeyAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + updateKey(vaultBaseUrl: string, keyName: string, keyVersion: string, callback: ServiceCallback): void; + updateKey(vaultBaseUrl: string, keyName: string, keyVersion: string, options: { keyOps? : string[], keyAttributes? : models.KeyAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets the public part of a stored key. + * + * The get key operation is applicable to all key types. If the requested key + * is symmetric, then no key material is released in the response. This + * operation requires the keys/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key to get. + * + * @param {string} keyVersion Adding the version parameter retrieves a specific + * version of a key. + * + * @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. + */ + getKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, keyVersion: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the public part of a stored key. + * + * The get key operation is applicable to all key types. If the requested key + * is symmetric, then no key material is released in the response. This + * operation requires the keys/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key to get. + * + * @param {string} keyVersion Adding the version parameter retrieves a specific + * version of a key. + * + * @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 {KeyBundle} - 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. + * + * {KeyBundle} [result] - The deserialized result object if an error did not occur. + * See {@link KeyBundle} 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. + */ + getKey(vaultBaseUrl: string, keyName: string, keyVersion: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getKey(vaultBaseUrl: string, keyName: string, keyVersion: string, callback: ServiceCallback): void; + getKey(vaultBaseUrl: string, keyName: string, keyVersion: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieves a list of individual key versions with the same key name. + * + * The full key identifier, attributes, and tags are provided in the response. + * This operation requires the keys/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getKeyVersionsWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Retrieves a list of individual key versions with the same key name. + * + * The full key identifier, attributes, and tags are provided in the response. + * This operation requires the keys/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {KeyListResult} - 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. + * + * {KeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyListResult} 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. + */ + getKeyVersions(vaultBaseUrl: string, keyName: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getKeyVersions(vaultBaseUrl: string, keyName: string, callback: ServiceCallback): void; + getKeyVersions(vaultBaseUrl: string, keyName: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a stored key. The LIST operation is + * applicable to all key types, however only the base key identifier, + * attributes, and tags are provided in the response. Individual versions of a + * key are not listed in the response. This operation requires the keys/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getKeysWithHttpOperationResponse(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a stored key. The LIST operation is + * applicable to all key types, however only the base key identifier, + * attributes, and tags are provided in the response. Individual versions of a + * key are not listed in the response. This operation requires the keys/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {KeyListResult} - 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. + * + * {KeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyListResult} 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. + */ + getKeys(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getKeys(vaultBaseUrl: string, callback: ServiceCallback): void; + getKeys(vaultBaseUrl: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Requests that a backup of the specified key be downloaded to the + * client. + * + * The Key Backup operation exports a key from Azure Key Vault in a protected + * form. Note that this operation does NOT return key material in a form that + * can be used outside the Azure Key Vault system, the returned key material is + * either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The + * intent of this operation is to allow a client to GENERATE a key in one Azure + * Key Vault instance, BACKUP the key, and then RESTORE it into another Azure + * Key Vault instance. The BACKUP operation may be used to export, in protected + * form, any key type from Azure Key Vault. Individual versions of a key cannot + * be backed up. BACKUP / RESTORE can be performed within geographical + * boundaries only; meaning that a BACKUP from one geographical area cannot be + * restored to another geographical area. For example, a backup from the US + * geographical area cannot be restored in an EU geographical area. This + * operation requires the key/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @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. + */ + backupKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Requests that a backup of the specified key be downloaded to the + * client. + * + * The Key Backup operation exports a key from Azure Key Vault in a protected + * form. Note that this operation does NOT return key material in a form that + * can be used outside the Azure Key Vault system, the returned key material is + * either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The + * intent of this operation is to allow a client to GENERATE a key in one Azure + * Key Vault instance, BACKUP the key, and then RESTORE it into another Azure + * Key Vault instance. The BACKUP operation may be used to export, in protected + * form, any key type from Azure Key Vault. Individual versions of a key cannot + * be backed up. BACKUP / RESTORE can be performed within geographical + * boundaries only; meaning that a BACKUP from one geographical area cannot be + * restored to another geographical area. For example, a backup from the US + * geographical area cannot be restored in an EU geographical area. This + * operation requires the key/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @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 {BackupKeyResult} - 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. + * + * {BackupKeyResult} [result] - The deserialized result object if an error did not occur. + * See {@link BackupKeyResult} 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. + */ + backupKey(vaultBaseUrl: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + backupKey(vaultBaseUrl: string, keyName: string, callback: ServiceCallback): void; + backupKey(vaultBaseUrl: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Restores a backed up key to a vault. + * + * Imports a previously backed up key into Azure Key Vault, restoring the key, + * its key identifier, attributes and access control policies. The RESTORE + * operation may be used to import a previously backed up key. Individual + * versions of a key cannot be restored. The key is restored in its entirety + * with the same key name as it had when it was backed up. If the key name is + * not available in the target Key Vault, the RESTORE operation will be + * rejected. While the key name is retained during restore, the final key + * identifier will change if the key is restored to a different vault. Restore + * will restore all versions and preserve version identifiers. The RESTORE + * operation is subject to security constraints: The target Key Vault must be + * owned by the same Microsoft Azure Subscription as the source Key Vault The + * user must have RESTORE permission in the target Key Vault. This operation + * requires the keys/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} keyBundleBackup The backup blob associated with a key + * bundle. + * + * @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. + */ + restoreKeyWithHttpOperationResponse(vaultBaseUrl: string, keyBundleBackup: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Restores a backed up key to a vault. + * + * Imports a previously backed up key into Azure Key Vault, restoring the key, + * its key identifier, attributes and access control policies. The RESTORE + * operation may be used to import a previously backed up key. Individual + * versions of a key cannot be restored. The key is restored in its entirety + * with the same key name as it had when it was backed up. If the key name is + * not available in the target Key Vault, the RESTORE operation will be + * rejected. While the key name is retained during restore, the final key + * identifier will change if the key is restored to a different vault. Restore + * will restore all versions and preserve version identifiers. The RESTORE + * operation is subject to security constraints: The target Key Vault must be + * owned by the same Microsoft Azure Subscription as the source Key Vault The + * user must have RESTORE permission in the target Key Vault. This operation + * requires the keys/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} keyBundleBackup The backup blob associated with a key + * bundle. + * + * @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 {KeyBundle} - 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. + * + * {KeyBundle} [result] - The deserialized result object if an error did not occur. + * See {@link KeyBundle} 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. + */ + restoreKey(vaultBaseUrl: string, keyBundleBackup: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + restoreKey(vaultBaseUrl: string, keyBundleBackup: Buffer, callback: ServiceCallback): void; + restoreKey(vaultBaseUrl: string, keyBundleBackup: Buffer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Encrypts an arbitrary sequence of bytes using an encryption key + * that is stored in a key vault. + * + * The ENCRYPT operation encrypts an arbitrary sequence of bytes using an + * encryption key that is stored in Azure Key Vault. Note that the ENCRYPT + * operation only supports a single block of data, the size of which is + * dependent on the target key and the encryption algorithm to be used. The + * ENCRYPT operation is only strictly necessary for symmetric keys stored in + * Azure Key Vault since protection with an asymmetric key can be performed + * using public portion of the key. This operation is supported for asymmetric + * keys as a convenience for callers that have a key-reference but do not have + * access to the public key material. This operation requires the keys/encrypt + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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. + */ + encryptWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Encrypts an arbitrary sequence of bytes using an encryption key + * that is stored in a key vault. + * + * The ENCRYPT operation encrypts an arbitrary sequence of bytes using an + * encryption key that is stored in Azure Key Vault. Note that the ENCRYPT + * operation only supports a single block of data, the size of which is + * dependent on the target key and the encryption algorithm to be used. The + * ENCRYPT operation is only strictly necessary for symmetric keys stored in + * Azure Key Vault since protection with an asymmetric key can be performed + * using public portion of the key. This operation is supported for asymmetric + * keys as a convenience for callers that have a key-reference but do not have + * access to the public key material. This operation requires the keys/encrypt + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 {KeyOperationResult} - 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. + * + * {KeyOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyOperationResult} 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. + */ + encrypt(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + encrypt(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, callback: ServiceCallback): void; + encrypt(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Decrypts a single block of encrypted data. + * + * The DECRYPT operation decrypts a well-formed block of ciphertext using the + * target encryption key and specified algorithm. This operation is the reverse + * of the ENCRYPT operation; only a single block of data may be decrypted, the + * size of this block is dependent on the target key and the algorithm to be + * used. The DECRYPT operation applies to asymmetric and symmetric keys stored + * in Azure Key Vault since it uses the private portion of the key. This + * operation requires the keys/decrypt permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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. + */ + decryptWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Decrypts a single block of encrypted data. + * + * The DECRYPT operation decrypts a well-formed block of ciphertext using the + * target encryption key and specified algorithm. This operation is the reverse + * of the ENCRYPT operation; only a single block of data may be decrypted, the + * size of this block is dependent on the target key and the algorithm to be + * used. The DECRYPT operation applies to asymmetric and symmetric keys stored + * in Azure Key Vault since it uses the private portion of the key. This + * operation requires the keys/decrypt permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 {KeyOperationResult} - 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. + * + * {KeyOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyOperationResult} 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. + */ + decrypt(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + decrypt(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, callback: ServiceCallback): void; + decrypt(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Creates a signature from a digest using the specified key. + * + * The SIGN operation is applicable to asymmetric and symmetric keys stored in + * Azure Key Vault since this operation uses the private portion of the key. + * This operation requires the keys/sign permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm The signing/verification algorithm identifier. For + * more information on possible algorithm types, see + * JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', + * 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', + * 'ES256K' + * + * @param {buffer} value + * + * @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. + */ + signWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates a signature from a digest using the specified key. + * + * The SIGN operation is applicable to asymmetric and symmetric keys stored in + * Azure Key Vault since this operation uses the private portion of the key. + * This operation requires the keys/sign permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm The signing/verification algorithm identifier. For + * more information on possible algorithm types, see + * JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', + * 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', + * 'ES256K' + * + * @param {buffer} value + * + * @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 {KeyOperationResult} - 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. + * + * {KeyOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyOperationResult} 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. + */ + sign(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + sign(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, callback: ServiceCallback): void; + sign(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Verifies a signature using a specified key. + * + * The VERIFY operation is applicable to symmetric keys stored in Azure Key + * Vault. VERIFY is not strictly necessary for asymmetric keys stored in Azure + * Key Vault since signature verification can be performed using the public + * portion of the key but this operation is supported as a convenience for + * callers that only have a key-reference and not the public portion of the + * key. This operation requires the keys/verify permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm The signing/verification algorithm. For more + * information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + * Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', + * 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' + * + * @param {buffer} digest The digest used for signing. + * + * @param {buffer} signature The signature to be verified. + * + * @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. + */ + verifyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, digest: Buffer, signature: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Verifies a signature using a specified key. + * + * The VERIFY operation is applicable to symmetric keys stored in Azure Key + * Vault. VERIFY is not strictly necessary for asymmetric keys stored in Azure + * Key Vault since signature verification can be performed using the public + * portion of the key but this operation is supported as a convenience for + * callers that only have a key-reference and not the public portion of the + * key. This operation requires the keys/verify permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm The signing/verification algorithm. For more + * information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + * Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', + * 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' + * + * @param {buffer} digest The digest used for signing. + * + * @param {buffer} signature The signature to be verified. + * + * @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 {KeyVerifyResult} - 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. + * + * {KeyVerifyResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyVerifyResult} 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. + */ + verify(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, digest: Buffer, signature: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + verify(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, digest: Buffer, signature: Buffer, callback: ServiceCallback): void; + verify(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, digest: Buffer, signature: Buffer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Wraps a symmetric key using a specified key. + * + * The WRAP operation supports encryption of a symmetric key using a key + * encryption key that has previously been stored in an Azure Key Vault. The + * WRAP operation is only strictly necessary for symmetric keys stored in Azure + * Key Vault since protection with an asymmetric key can be performed using the + * public portion of the key. This operation is supported for asymmetric keys + * as a convenience for callers that have a key-reference but do not have + * access to the public key material. This operation requires the keys/wrapKey + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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. + */ + wrapKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Wraps a symmetric key using a specified key. + * + * The WRAP operation supports encryption of a symmetric key using a key + * encryption key that has previously been stored in an Azure Key Vault. The + * WRAP operation is only strictly necessary for symmetric keys stored in Azure + * Key Vault since protection with an asymmetric key can be performed using the + * public portion of the key. This operation is supported for asymmetric keys + * as a convenience for callers that have a key-reference but do not have + * access to the public key material. This operation requires the keys/wrapKey + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 {KeyOperationResult} - 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. + * + * {KeyOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyOperationResult} 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. + */ + wrapKey(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + wrapKey(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, callback: ServiceCallback): void; + wrapKey(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Unwraps a symmetric key using the specified key that was initially + * used for wrapping that key. + * + * The UNWRAP operation supports decryption of a symmetric key using the target + * key encryption key. This operation is the reverse of the WRAP operation. The + * UNWRAP operation applies to asymmetric and symmetric keys stored in Azure + * Key Vault since it uses the private portion of the key. This operation + * requires the keys/unwrapKey permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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. + */ + unwrapKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Unwraps a symmetric key using the specified key that was initially + * used for wrapping that key. + * + * The UNWRAP operation supports decryption of a symmetric key using the target + * key encryption key. This operation is the reverse of the WRAP operation. The + * UNWRAP operation applies to asymmetric and symmetric keys stored in Azure + * Key Vault since it uses the private portion of the key. This operation + * requires the keys/unwrapKey permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 {KeyOperationResult} - 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. + * + * {KeyOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyOperationResult} 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. + */ + unwrapKey(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + unwrapKey(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, callback: ServiceCallback): void; + unwrapKey(vaultBaseUrl: string, keyName: string, keyVersion: string, algorithm: string, value: Buffer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists the deleted keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a deleted key. This operation includes + * deletion-specific information. The Get Deleted Keys operation is applicable + * for vaults enabled for soft-delete. While the operation can be invoked on + * any vault, it will return an error if invoked on a non soft-delete enabled + * vault. This operation requires the keys/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getDeletedKeysWithHttpOperationResponse(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists the deleted keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a deleted key. This operation includes + * deletion-specific information. The Get Deleted Keys operation is applicable + * for vaults enabled for soft-delete. While the operation can be invoked on + * any vault, it will return an error if invoked on a non soft-delete enabled + * vault. This operation requires the keys/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {DeletedKeyListResult} - 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. + * + * {DeletedKeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedKeyListResult} 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. + */ + getDeletedKeys(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedKeys(vaultBaseUrl: string, callback: ServiceCallback): void; + getDeletedKeys(vaultBaseUrl: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets the public part of a deleted key. + * + * The Get Deleted Key operation is applicable for soft-delete enabled vaults. + * While the operation can be invoked on any vault, it will return an error if + * invoked on a non soft-delete enabled vault. This operation requires the + * keys/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @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. + */ + getDeletedKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the public part of a deleted key. + * + * The Get Deleted Key operation is applicable for soft-delete enabled vaults. + * While the operation can be invoked on any vault, it will return an error if + * invoked on a non soft-delete enabled vault. This operation requires the + * keys/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @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 {DeletedKeyBundle} - 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. + * + * {DeletedKeyBundle} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedKeyBundle} 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. + */ + getDeletedKey(vaultBaseUrl: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedKey(vaultBaseUrl: string, keyName: string, callback: ServiceCallback): void; + getDeletedKey(vaultBaseUrl: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Permanently deletes the specified key. + * + * The Purge Deleted Key operation is applicable for soft-delete enabled + * vaults. While the operation can be invoked on any vault, it will return an + * error if invoked on a non soft-delete enabled vault. This operation requires + * the keys/purge permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key + * + * @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. + */ + purgeDeletedKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Permanently deletes the specified key. + * + * The Purge Deleted Key operation is applicable for soft-delete enabled + * vaults. While the operation can be invoked on any vault, it will return an + * error if invoked on a non soft-delete enabled vault. This operation requires + * the keys/purge permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + purgeDeletedKey(vaultBaseUrl: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + purgeDeletedKey(vaultBaseUrl: string, keyName: string, callback: ServiceCallback): void; + purgeDeletedKey(vaultBaseUrl: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Recovers the deleted key to its latest version. + * + * The Recover Deleted Key operation is applicable for deleted keys in + * soft-delete enabled vaults. It recovers the deleted key back to its latest + * version under /keys. An attempt to recover an non-deleted key will return an + * error. Consider this the inverse of the delete operation on soft-delete + * enabled vaults. This operation requires the keys/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the deleted key. + * + * @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. + */ + recoverDeletedKeyWithHttpOperationResponse(vaultBaseUrl: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Recovers the deleted key to its latest version. + * + * The Recover Deleted Key operation is applicable for deleted keys in + * soft-delete enabled vaults. It recovers the deleted key back to its latest + * version under /keys. An attempt to recover an non-deleted key will return an + * error. Consider this the inverse of the delete operation on soft-delete + * enabled vaults. This operation requires the keys/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the deleted key. + * + * @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 {KeyBundle} - 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. + * + * {KeyBundle} [result] - The deserialized result object if an error did not occur. + * See {@link KeyBundle} 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. + */ + recoverDeletedKey(vaultBaseUrl: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + recoverDeletedKey(vaultBaseUrl: string, keyName: string, callback: ServiceCallback): void; + recoverDeletedKey(vaultBaseUrl: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Sets a secret in a specified key vault. + * + * The SET operation adds a secret to the Azure Key Vault. If the named secret + * already exists, Azure Key Vault creates a new version of that secret. This + * operation requires the secrets/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} value The value of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @param {string} [options.contentType] Type of the secret value such as a + * password. + * + * @param {object} [options.secretAttributes] The secret management attributes. + * + * @param {boolean} [options.secretAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.secretAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.secretAttributes.expires] Expiry date in UTC. + * + * @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. + */ + setSecretWithHttpOperationResponse(vaultBaseUrl: string, secretName: string, value: string, options?: { tags? : { [propertyName: string]: string }, contentType? : string, secretAttributes? : models.SecretAttributes, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Sets a secret in a specified key vault. + * + * The SET operation adds a secret to the Azure Key Vault. If the named secret + * already exists, Azure Key Vault creates a new version of that secret. This + * operation requires the secrets/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} value The value of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @param {string} [options.contentType] Type of the secret value such as a + * password. + * + * @param {object} [options.secretAttributes] The secret management attributes. + * + * @param {boolean} [options.secretAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.secretAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.secretAttributes.expires] Expiry date in UTC. + * + * @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 {SecretBundle} - 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. + * + * {SecretBundle} [result] - The deserialized result object if an error did not occur. + * See {@link SecretBundle} 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. + */ + setSecret(vaultBaseUrl: string, secretName: string, value: string, options?: { tags? : { [propertyName: string]: string }, contentType? : string, secretAttributes? : models.SecretAttributes, customHeaders? : { [headerName: string]: string; } }): Promise; + setSecret(vaultBaseUrl: string, secretName: string, value: string, callback: ServiceCallback): void; + setSecret(vaultBaseUrl: string, secretName: string, value: string, options: { tags? : { [propertyName: string]: string }, contentType? : string, secretAttributes? : models.SecretAttributes, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a secret from a specified key vault. + * + * The DELETE operation applies to any secret stored in Azure Key Vault. DELETE + * cannot be applied to an individual version of a secret. This operation + * requires the secrets/delete permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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. + */ + deleteSecretWithHttpOperationResponse(vaultBaseUrl: string, secretName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a secret from a specified key vault. + * + * The DELETE operation applies to any secret stored in Azure Key Vault. DELETE + * cannot be applied to an individual version of a secret. This operation + * requires the secrets/delete permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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 {DeletedSecretBundle} - 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. + * + * {DeletedSecretBundle} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedSecretBundle} 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. + */ + deleteSecret(vaultBaseUrl: string, secretName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteSecret(vaultBaseUrl: string, secretName: string, callback: ServiceCallback): void; + deleteSecret(vaultBaseUrl: string, secretName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Updates the attributes associated with a specified secret in a + * given key vault. + * + * The UPDATE operation changes specified attributes of an existing stored + * secret. Attributes that are not specified in the request are left unchanged. + * The value of a secret itself cannot be changed. This operation requires the + * secrets/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} secretVersion The version of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.contentType] Type of the secret value such as a + * password. + * + * @param {object} [options.secretAttributes] The secret management attributes. + * + * @param {boolean} [options.secretAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.secretAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.secretAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + updateSecretWithHttpOperationResponse(vaultBaseUrl: string, secretName: string, secretVersion: string, options?: { contentType? : string, secretAttributes? : models.SecretAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Updates the attributes associated with a specified secret in a + * given key vault. + * + * The UPDATE operation changes specified attributes of an existing stored + * secret. Attributes that are not specified in the request are left unchanged. + * The value of a secret itself cannot be changed. This operation requires the + * secrets/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} secretVersion The version of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.contentType] Type of the secret value such as a + * password. + * + * @param {object} [options.secretAttributes] The secret management attributes. + * + * @param {boolean} [options.secretAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.secretAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.secretAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {SecretBundle} - 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. + * + * {SecretBundle} [result] - The deserialized result object if an error did not occur. + * See {@link SecretBundle} 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. + */ + updateSecret(vaultBaseUrl: string, secretName: string, secretVersion: string, options?: { contentType? : string, secretAttributes? : models.SecretAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + updateSecret(vaultBaseUrl: string, secretName: string, secretVersion: string, callback: ServiceCallback): void; + updateSecret(vaultBaseUrl: string, secretName: string, secretVersion: string, options: { contentType? : string, secretAttributes? : models.SecretAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Get a specified secret from a given key vault. + * + * The GET operation is applicable to any secret stored in Azure Key Vault. + * This operation requires the secrets/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} secretVersion The version of the secret. + * + * @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. + */ + getSecretWithHttpOperationResponse(vaultBaseUrl: string, secretName: string, secretVersion: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Get a specified secret from a given key vault. + * + * The GET operation is applicable to any secret stored in Azure Key Vault. + * This operation requires the secrets/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} secretVersion The version of the secret. + * + * @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 {SecretBundle} - 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. + * + * {SecretBundle} [result] - The deserialized result object if an error did not occur. + * See {@link SecretBundle} 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. + */ + getSecret(vaultBaseUrl: string, secretName: string, secretVersion: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getSecret(vaultBaseUrl: string, secretName: string, secretVersion: string, callback: ServiceCallback): void; + getSecret(vaultBaseUrl: string, secretName: string, secretVersion: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List secrets in a specified key vault. + * + * The Get Secrets operation is applicable to the entire vault. However, only + * the base secret identifier and its attributes are provided in the response. + * Individual secret versions are not listed in the response. This operation + * requires the secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified, the service will return up to 25 results. + * + * @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. + */ + getSecretsWithHttpOperationResponse(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List secrets in a specified key vault. + * + * The Get Secrets operation is applicable to the entire vault. However, only + * the base secret identifier and its attributes are provided in the response. + * Individual secret versions are not listed in the response. This operation + * requires the secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified, the service will return up to 25 results. + * + * @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 {SecretListResult} - 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. + * + * {SecretListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SecretListResult} 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. + */ + getSecrets(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getSecrets(vaultBaseUrl: string, callback: ServiceCallback): void; + getSecrets(vaultBaseUrl: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List all versions of the specified secret. + * + * The full secret identifier and attributes are provided in the response. No + * values are returned for the secrets. This operations requires the + * secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified, the service will return up to 25 results. + * + * @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. + */ + getSecretVersionsWithHttpOperationResponse(vaultBaseUrl: string, secretName: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List all versions of the specified secret. + * + * The full secret identifier and attributes are provided in the response. No + * values are returned for the secrets. This operations requires the + * secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified, the service will return up to 25 results. + * + * @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 {SecretListResult} - 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. + * + * {SecretListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SecretListResult} 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. + */ + getSecretVersions(vaultBaseUrl: string, secretName: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getSecretVersions(vaultBaseUrl: string, secretName: string, callback: ServiceCallback): void; + getSecretVersions(vaultBaseUrl: string, secretName: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists deleted secrets for the specified vault. + * + * The Get Deleted Secrets operation returns the secrets that have been deleted + * for a vault enabled for soft-delete. This operation requires the + * secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getDeletedSecretsWithHttpOperationResponse(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists deleted secrets for the specified vault. + * + * The Get Deleted Secrets operation returns the secrets that have been deleted + * for a vault enabled for soft-delete. This operation requires the + * secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {DeletedSecretListResult} - 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. + * + * {DeletedSecretListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedSecretListResult} 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. + */ + getDeletedSecrets(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedSecrets(vaultBaseUrl: string, callback: ServiceCallback): void; + getDeletedSecrets(vaultBaseUrl: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets the specified deleted secret. + * + * The Get Deleted Secret operation returns the specified deleted secret along + * with its attributes. This operation requires the secrets/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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. + */ + getDeletedSecretWithHttpOperationResponse(vaultBaseUrl: string, secretName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the specified deleted secret. + * + * The Get Deleted Secret operation returns the specified deleted secret along + * with its attributes. This operation requires the secrets/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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 {DeletedSecretBundle} - 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. + * + * {DeletedSecretBundle} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedSecretBundle} 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. + */ + getDeletedSecret(vaultBaseUrl: string, secretName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedSecret(vaultBaseUrl: string, secretName: string, callback: ServiceCallback): void; + getDeletedSecret(vaultBaseUrl: string, secretName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Permanently deletes the specified secret. + * + * The purge deleted secret operation removes the secret permanently, without + * the possibility of recovery. This operation can only be enabled on a + * soft-delete enabled vault. This operation requires the secrets/purge + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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. + */ + purgeDeletedSecretWithHttpOperationResponse(vaultBaseUrl: string, secretName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Permanently deletes the specified secret. + * + * The purge deleted secret operation removes the secret permanently, without + * the possibility of recovery. This operation can only be enabled on a + * soft-delete enabled vault. This operation requires the secrets/purge + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + purgeDeletedSecret(vaultBaseUrl: string, secretName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + purgeDeletedSecret(vaultBaseUrl: string, secretName: string, callback: ServiceCallback): void; + purgeDeletedSecret(vaultBaseUrl: string, secretName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Recovers the deleted secret to the latest version. + * + * Recovers the deleted secret in the specified vault. This operation can only + * be performed on a soft-delete enabled vault. This operation requires the + * secrets/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the deleted secret. + * + * @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. + */ + recoverDeletedSecretWithHttpOperationResponse(vaultBaseUrl: string, secretName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Recovers the deleted secret to the latest version. + * + * Recovers the deleted secret in the specified vault. This operation can only + * be performed on a soft-delete enabled vault. This operation requires the + * secrets/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the deleted secret. + * + * @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 {SecretBundle} - 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. + * + * {SecretBundle} [result] - The deserialized result object if an error did not occur. + * See {@link SecretBundle} 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. + */ + recoverDeletedSecret(vaultBaseUrl: string, secretName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + recoverDeletedSecret(vaultBaseUrl: string, secretName: string, callback: ServiceCallback): void; + recoverDeletedSecret(vaultBaseUrl: string, secretName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Backs up the specified secret. + * + * Requests that a backup of the specified secret be downloaded to the client. + * All versions of the secret will be downloaded. This operation requires the + * secrets/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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. + */ + backupSecretWithHttpOperationResponse(vaultBaseUrl: string, secretName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Backs up the specified secret. + * + * Requests that a backup of the specified secret be downloaded to the client. + * All versions of the secret will be downloaded. This operation requires the + * secrets/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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 {BackupSecretResult} - 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. + * + * {BackupSecretResult} [result] - The deserialized result object if an error did not occur. + * See {@link BackupSecretResult} 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. + */ + backupSecret(vaultBaseUrl: string, secretName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + backupSecret(vaultBaseUrl: string, secretName: string, callback: ServiceCallback): void; + backupSecret(vaultBaseUrl: string, secretName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Restores a backed up secret to a vault. + * + * Restores a backed up secret, and all its versions, to a vault. This + * operation requires the secrets/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} secretBundleBackup The backup blob associated with a secret + * bundle. + * + * @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. + */ + restoreSecretWithHttpOperationResponse(vaultBaseUrl: string, secretBundleBackup: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Restores a backed up secret to a vault. + * + * Restores a backed up secret, and all its versions, to a vault. This + * operation requires the secrets/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} secretBundleBackup The backup blob associated with a secret + * bundle. + * + * @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 {SecretBundle} - 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. + * + * {SecretBundle} [result] - The deserialized result object if an error did not occur. + * See {@link SecretBundle} 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. + */ + restoreSecret(vaultBaseUrl: string, secretBundleBackup: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + restoreSecret(vaultBaseUrl: string, secretBundleBackup: Buffer, callback: ServiceCallback): void; + restoreSecret(vaultBaseUrl: string, secretBundleBackup: Buffer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List certificates in a specified key vault + * + * The GetCertificates operation returns the set of certificates resources in + * the specified key vault. This operation requires the certificates/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @param {boolean} [options.includePending] Specifies whether to include + * certificates which are not completely provisioned. + * + * @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. + */ + getCertificatesWithHttpOperationResponse(vaultBaseUrl: string, options?: { maxresults? : number, includePending? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List certificates in a specified key vault + * + * The GetCertificates operation returns the set of certificates resources in + * the specified key vault. This operation requires the certificates/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @param {boolean} [options.includePending] Specifies whether to include + * certificates which are not completely provisioned. + * + * @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 {CertificateListResult} - 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. + * + * {CertificateListResult} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateListResult} 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. + */ + getCertificates(vaultBaseUrl: string, options?: { maxresults? : number, includePending? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificates(vaultBaseUrl: string, callback: ServiceCallback): void; + getCertificates(vaultBaseUrl: string, options: { maxresults? : number, includePending? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes a certificate from a specified key vault. + * + * Deletes all versions of a certificate object along with its associated + * policy. Delete certificate cannot be used to remove individual versions of a + * certificate object. This operation requires the certificates/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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. + */ + deleteCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes a certificate from a specified key vault. + * + * Deletes all versions of a certificate object along with its associated + * policy. Delete certificate cannot be used to remove individual versions of a + * certificate object. This operation requires the certificates/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 {DeletedCertificateBundle} - 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. + * + * {DeletedCertificateBundle} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedCertificateBundle} 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. + */ + deleteCertificate(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteCertificate(vaultBaseUrl: string, certificateName: string, callback: ServiceCallback): void; + deleteCertificate(vaultBaseUrl: string, certificateName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Sets the certificate contacts for the specified key vault. + * + * Sets the certificate contacts for the specified key vault. This operation + * requires the certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} contacts The contacts for the key vault certificate. + * + * @param {array} [contacts.contactList] The contact list for the vault + * certificates. + * + * @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. + */ + setCertificateContactsWithHttpOperationResponse(vaultBaseUrl: string, contacts: models.Contacts, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Sets the certificate contacts for the specified key vault. + * + * Sets the certificate contacts for the specified key vault. This operation + * requires the certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} contacts The contacts for the key vault certificate. + * + * @param {array} [contacts.contactList] The contact list for the vault + * certificates. + * + * @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 {Contacts} - 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. + * + * {Contacts} [result] - The deserialized result object if an error did not occur. + * See {@link Contacts} 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. + */ + setCertificateContacts(vaultBaseUrl: string, contacts: models.Contacts, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + setCertificateContacts(vaultBaseUrl: string, contacts: models.Contacts, callback: ServiceCallback): void; + setCertificateContacts(vaultBaseUrl: string, contacts: models.Contacts, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists the certificate contacts for a specified key vault. + * + * The GetCertificateContacts operation returns the set of certificate contact + * resources in the specified key vault. This operation requires the + * certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @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. + */ + getCertificateContactsWithHttpOperationResponse(vaultBaseUrl: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists the certificate contacts for a specified key vault. + * + * The GetCertificateContacts operation returns the set of certificate contact + * resources in the specified key vault. This operation requires the + * certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @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 {Contacts} - 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. + * + * {Contacts} [result] - The deserialized result object if an error did not occur. + * See {@link Contacts} 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. + */ + getCertificateContacts(vaultBaseUrl: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificateContacts(vaultBaseUrl: string, callback: ServiceCallback): void; + getCertificateContacts(vaultBaseUrl: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes the certificate contacts for a specified key vault. + * + * Deletes the certificate contacts for a specified key vault certificate. This + * operation requires the certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @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. + */ + deleteCertificateContactsWithHttpOperationResponse(vaultBaseUrl: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes the certificate contacts for a specified key vault. + * + * Deletes the certificate contacts for a specified key vault certificate. This + * operation requires the certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @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 {Contacts} - 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. + * + * {Contacts} [result] - The deserialized result object if an error did not occur. + * See {@link Contacts} 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. + */ + deleteCertificateContacts(vaultBaseUrl: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteCertificateContacts(vaultBaseUrl: string, callback: ServiceCallback): void; + deleteCertificateContacts(vaultBaseUrl: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List certificate issuers for a specified key vault. + * + * The GetCertificateIssuers operation returns the set of certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getCertificateIssuersWithHttpOperationResponse(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List certificate issuers for a specified key vault. + * + * The GetCertificateIssuers operation returns the set of certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {CertificateIssuerListResult} - 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. + * + * {CertificateIssuerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateIssuerListResult} 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. + */ + getCertificateIssuers(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificateIssuers(vaultBaseUrl: string, callback: ServiceCallback): void; + getCertificateIssuers(vaultBaseUrl: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Sets the specified certificate issuer. + * + * The SetCertificateIssuer operation adds or updates the specified certificate + * issuer. This operation requires the certificates/setissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @param {string} provider The issuer provider. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.credentials] The credentials to be used for the + * issuer. + * + * @param {string} [options.credentials.accountId] The user name/account + * name/account id. + * + * @param {string} [options.credentials.password] The password/secret/account + * key. + * + * @param {object} [options.organizationDetails] Details of the organization as + * provided to the issuer. + * + * @param {string} [options.organizationDetails.id] Id of the organization. + * + * @param {array} [options.organizationDetails.adminDetails] Details of the + * organization administrator. + * + * @param {object} [options.attributes] Attributes of the issuer object. + * + * @param {boolean} [options.attributes.enabled] Determines whether the issuer + * is enabled. + * + * @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. + */ + setCertificateIssuerWithHttpOperationResponse(vaultBaseUrl: string, issuerName: string, provider: string, options?: { credentials? : models.IssuerCredentials, organizationDetails? : models.OrganizationDetails, attributes? : models.IssuerAttributes, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Sets the specified certificate issuer. + * + * The SetCertificateIssuer operation adds or updates the specified certificate + * issuer. This operation requires the certificates/setissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @param {string} provider The issuer provider. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.credentials] The credentials to be used for the + * issuer. + * + * @param {string} [options.credentials.accountId] The user name/account + * name/account id. + * + * @param {string} [options.credentials.password] The password/secret/account + * key. + * + * @param {object} [options.organizationDetails] Details of the organization as + * provided to the issuer. + * + * @param {string} [options.organizationDetails.id] Id of the organization. + * + * @param {array} [options.organizationDetails.adminDetails] Details of the + * organization administrator. + * + * @param {object} [options.attributes] Attributes of the issuer object. + * + * @param {boolean} [options.attributes.enabled] Determines whether the issuer + * is enabled. + * + * @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 {IssuerBundle} - 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. + * + * {IssuerBundle} [result] - The deserialized result object if an error did not occur. + * See {@link IssuerBundle} 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. + */ + setCertificateIssuer(vaultBaseUrl: string, issuerName: string, provider: string, options?: { credentials? : models.IssuerCredentials, organizationDetails? : models.OrganizationDetails, attributes? : models.IssuerAttributes, customHeaders? : { [headerName: string]: string; } }): Promise; + setCertificateIssuer(vaultBaseUrl: string, issuerName: string, provider: string, callback: ServiceCallback): void; + setCertificateIssuer(vaultBaseUrl: string, issuerName: string, provider: string, options: { credentials? : models.IssuerCredentials, organizationDetails? : models.OrganizationDetails, attributes? : models.IssuerAttributes, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Updates the specified certificate issuer. + * + * The UpdateCertificateIssuer operation performs an update on the specified + * certificate issuer entity. This operation requires the + * certificates/setissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.provider] The issuer provider. + * + * @param {object} [options.credentials] The credentials to be used for the + * issuer. + * + * @param {string} [options.credentials.accountId] The user name/account + * name/account id. + * + * @param {string} [options.credentials.password] The password/secret/account + * key. + * + * @param {object} [options.organizationDetails] Details of the organization as + * provided to the issuer. + * + * @param {string} [options.organizationDetails.id] Id of the organization. + * + * @param {array} [options.organizationDetails.adminDetails] Details of the + * organization administrator. + * + * @param {object} [options.attributes] Attributes of the issuer object. + * + * @param {boolean} [options.attributes.enabled] Determines whether the issuer + * is enabled. + * + * @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. + */ + updateCertificateIssuerWithHttpOperationResponse(vaultBaseUrl: string, issuerName: string, options?: { provider? : string, credentials? : models.IssuerCredentials, organizationDetails? : models.OrganizationDetails, attributes? : models.IssuerAttributes, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Updates the specified certificate issuer. + * + * The UpdateCertificateIssuer operation performs an update on the specified + * certificate issuer entity. This operation requires the + * certificates/setissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.provider] The issuer provider. + * + * @param {object} [options.credentials] The credentials to be used for the + * issuer. + * + * @param {string} [options.credentials.accountId] The user name/account + * name/account id. + * + * @param {string} [options.credentials.password] The password/secret/account + * key. + * + * @param {object} [options.organizationDetails] Details of the organization as + * provided to the issuer. + * + * @param {string} [options.organizationDetails.id] Id of the organization. + * + * @param {array} [options.organizationDetails.adminDetails] Details of the + * organization administrator. + * + * @param {object} [options.attributes] Attributes of the issuer object. + * + * @param {boolean} [options.attributes.enabled] Determines whether the issuer + * is enabled. + * + * @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 {IssuerBundle} - 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. + * + * {IssuerBundle} [result] - The deserialized result object if an error did not occur. + * See {@link IssuerBundle} 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. + */ + updateCertificateIssuer(vaultBaseUrl: string, issuerName: string, options?: { provider? : string, credentials? : models.IssuerCredentials, organizationDetails? : models.OrganizationDetails, attributes? : models.IssuerAttributes, customHeaders? : { [headerName: string]: string; } }): Promise; + updateCertificateIssuer(vaultBaseUrl: string, issuerName: string, callback: ServiceCallback): void; + updateCertificateIssuer(vaultBaseUrl: string, issuerName: string, options: { provider? : string, credentials? : models.IssuerCredentials, organizationDetails? : models.OrganizationDetails, attributes? : models.IssuerAttributes, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists the specified certificate issuer. + * + * The GetCertificateIssuer operation returns the specified certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @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. + */ + getCertificateIssuerWithHttpOperationResponse(vaultBaseUrl: string, issuerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists the specified certificate issuer. + * + * The GetCertificateIssuer operation returns the specified certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @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 {IssuerBundle} - 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. + * + * {IssuerBundle} [result] - The deserialized result object if an error did not occur. + * See {@link IssuerBundle} 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. + */ + getCertificateIssuer(vaultBaseUrl: string, issuerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificateIssuer(vaultBaseUrl: string, issuerName: string, callback: ServiceCallback): void; + getCertificateIssuer(vaultBaseUrl: string, issuerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes the specified certificate issuer. + * + * The DeleteCertificateIssuer operation permanently removes the specified + * certificate issuer from the vault. This operation requires the + * certificates/manageissuers/deleteissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @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. + */ + deleteCertificateIssuerWithHttpOperationResponse(vaultBaseUrl: string, issuerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes the specified certificate issuer. + * + * The DeleteCertificateIssuer operation permanently removes the specified + * certificate issuer from the vault. This operation requires the + * certificates/manageissuers/deleteissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @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 {IssuerBundle} - 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. + * + * {IssuerBundle} [result] - The deserialized result object if an error did not occur. + * See {@link IssuerBundle} 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. + */ + deleteCertificateIssuer(vaultBaseUrl: string, issuerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteCertificateIssuer(vaultBaseUrl: string, issuerName: string, callback: ServiceCallback): void; + deleteCertificateIssuer(vaultBaseUrl: string, issuerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Creates a new certificate. + * + * If this is the first version, the certificate resource is created. This + * operation requires the certificates/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + createCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, options?: { certificatePolicy? : models.CertificatePolicy, certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates a new certificate. + * + * If this is the first version, the certificate resource is created. This + * operation requires the certificates/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {CertificateOperation} - 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. + * + * {CertificateOperation} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateOperation} 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. + */ + createCertificate(vaultBaseUrl: string, certificateName: string, options?: { certificatePolicy? : models.CertificatePolicy, certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + createCertificate(vaultBaseUrl: string, certificateName: string, callback: ServiceCallback): void; + createCertificate(vaultBaseUrl: string, certificateName: string, options: { certificatePolicy? : models.CertificatePolicy, certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Imports a certificate into a specified key vault. + * + * Imports an existing valid certificate, containing a private key, into Azure + * Key Vault. The certificate to be imported can be in either PFX or PEM + * format. If the certificate is in PEM format the PEM file must contain the + * key as well as x509 certificates. This operation requires the + * certificates/import permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {string} base64EncodedCertificate Base64 encoded representation of + * the certificate object to import. This certificate needs to contain the + * private key. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.password] If the private key in + * base64EncodedCertificate is encrypted, the password used for encryption. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + importCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, base64EncodedCertificate: string, options?: { password? : string, certificatePolicy? : models.CertificatePolicy, certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Imports a certificate into a specified key vault. + * + * Imports an existing valid certificate, containing a private key, into Azure + * Key Vault. The certificate to be imported can be in either PFX or PEM + * format. If the certificate is in PEM format the PEM file must contain the + * key as well as x509 certificates. This operation requires the + * certificates/import permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {string} base64EncodedCertificate Base64 encoded representation of + * the certificate object to import. This certificate needs to contain the + * private key. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.password] If the private key in + * base64EncodedCertificate is encrypted, the password used for encryption. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {CertificateBundle} - 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. + * + * {CertificateBundle} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateBundle} 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. + */ + importCertificate(vaultBaseUrl: string, certificateName: string, base64EncodedCertificate: string, options?: { password? : string, certificatePolicy? : models.CertificatePolicy, certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + importCertificate(vaultBaseUrl: string, certificateName: string, base64EncodedCertificate: string, callback: ServiceCallback): void; + importCertificate(vaultBaseUrl: string, certificateName: string, base64EncodedCertificate: string, options: { password? : string, certificatePolicy? : models.CertificatePolicy, certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List the versions of a certificate. + * + * The GetCertificateVersions operation returns the versions of a certificate + * in the specified key vault. This operation requires the certificates/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getCertificateVersionsWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List the versions of a certificate. + * + * The GetCertificateVersions operation returns the versions of a certificate + * in the specified key vault. This operation requires the certificates/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {CertificateListResult} - 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. + * + * {CertificateListResult} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateListResult} 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. + */ + getCertificateVersions(vaultBaseUrl: string, certificateName: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificateVersions(vaultBaseUrl: string, certificateName: string, callback: ServiceCallback): void; + getCertificateVersions(vaultBaseUrl: string, certificateName: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists the policy for a certificate. + * + * The GetCertificatePolicy operation returns the specified certificate policy + * resources in the specified key vault. This operation requires the + * certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in a given key + * 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. + */ + getCertificatePolicyWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists the policy for a certificate. + * + * The GetCertificatePolicy operation returns the specified certificate policy + * resources in the specified key vault. This operation requires the + * certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in a given key + * 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 {CertificatePolicy} - 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. + * + * {CertificatePolicy} [result] - The deserialized result object if an error did not occur. + * See {@link CertificatePolicy} 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. + */ + getCertificatePolicy(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificatePolicy(vaultBaseUrl: string, certificateName: string, callback: ServiceCallback): void; + getCertificatePolicy(vaultBaseUrl: string, certificateName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Updates the policy for a certificate. + * + * Set specified members in the certificate policy. Leave others as null. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given + * vault. + * + * @param {object} certificatePolicy The policy for the certificate. + * + * @param {object} [certificatePolicy.keyProperties] Properties of the key + * backing a certificate. + * + * @param {boolean} [certificatePolicy.keyProperties.exportable] Indicates if + * the private key can be exported. + * + * @param {string} [certificatePolicy.keyProperties.keyType] The type of key + * pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [certificatePolicy.keyProperties.keySize] The key size in + * bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [certificatePolicy.keyProperties.reuseKey] Indicates if the + * same key pair will be used on certificate renewal. + * + * @param {string} [certificatePolicy.keyProperties.curve] Elliptic curve name. + * For valid values, see JsonWebKeyCurveName. Possible values include: 'P-256', + * 'P-384', 'P-521', 'P-256K' + * + * @param {object} [certificatePolicy.secretProperties] Properties of the + * secret backing a certificate. + * + * @param {string} [certificatePolicy.secretProperties.contentType] The media + * type (MIME type). + * + * @param {object} [certificatePolicy.x509CertificateProperties] Properties of + * the X509 component of a certificate. + * + * @param {string} [certificatePolicy.x509CertificateProperties.subject] The + * subject name. Should be a valid X509 distinguished Name. + * + * @param {array} [certificatePolicy.x509CertificateProperties.ekus] The + * enhanced key usage. + * + * @param {object} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames] The + * subject alternative names. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} [certificatePolicy.x509CertificateProperties.keyUsage] List + * of key usages. + * + * @param {number} + * [certificatePolicy.x509CertificateProperties.validityInMonths] The duration + * that the certificate is valid in months. + * + * @param {array} [certificatePolicy.lifetimeActions] Actions that will be + * performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [certificatePolicy.issuerParameters] Parameters for the + * issuer of the X509 component of a certificate. + * + * @param {string} [certificatePolicy.issuerParameters.name] Name of the + * referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [certificatePolicy.issuerParameters.certificateType] Type of + * certificate to be requested from the issuer provider. + * + * @param {boolean} + * [certificatePolicy.issuerParameters.certificateTransparency] Indicates if + * the certificates generated under this policy should be published to + * certificate transparency logs. + * + * @param {object} [certificatePolicy.attributes] The certificate attributes. + * + * @param {boolean} [certificatePolicy.attributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [certificatePolicy.attributes.notBefore] Not before date in + * UTC. + * + * @param {date} [certificatePolicy.attributes.expires] Expiry date in UTC. + * + * @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. + */ + updateCertificatePolicyWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, certificatePolicy: models.CertificatePolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Updates the policy for a certificate. + * + * Set specified members in the certificate policy. Leave others as null. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given + * vault. + * + * @param {object} certificatePolicy The policy for the certificate. + * + * @param {object} [certificatePolicy.keyProperties] Properties of the key + * backing a certificate. + * + * @param {boolean} [certificatePolicy.keyProperties.exportable] Indicates if + * the private key can be exported. + * + * @param {string} [certificatePolicy.keyProperties.keyType] The type of key + * pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [certificatePolicy.keyProperties.keySize] The key size in + * bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [certificatePolicy.keyProperties.reuseKey] Indicates if the + * same key pair will be used on certificate renewal. + * + * @param {string} [certificatePolicy.keyProperties.curve] Elliptic curve name. + * For valid values, see JsonWebKeyCurveName. Possible values include: 'P-256', + * 'P-384', 'P-521', 'P-256K' + * + * @param {object} [certificatePolicy.secretProperties] Properties of the + * secret backing a certificate. + * + * @param {string} [certificatePolicy.secretProperties.contentType] The media + * type (MIME type). + * + * @param {object} [certificatePolicy.x509CertificateProperties] Properties of + * the X509 component of a certificate. + * + * @param {string} [certificatePolicy.x509CertificateProperties.subject] The + * subject name. Should be a valid X509 distinguished Name. + * + * @param {array} [certificatePolicy.x509CertificateProperties.ekus] The + * enhanced key usage. + * + * @param {object} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames] The + * subject alternative names. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} [certificatePolicy.x509CertificateProperties.keyUsage] List + * of key usages. + * + * @param {number} + * [certificatePolicy.x509CertificateProperties.validityInMonths] The duration + * that the certificate is valid in months. + * + * @param {array} [certificatePolicy.lifetimeActions] Actions that will be + * performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [certificatePolicy.issuerParameters] Parameters for the + * issuer of the X509 component of a certificate. + * + * @param {string} [certificatePolicy.issuerParameters.name] Name of the + * referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [certificatePolicy.issuerParameters.certificateType] Type of + * certificate to be requested from the issuer provider. + * + * @param {boolean} + * [certificatePolicy.issuerParameters.certificateTransparency] Indicates if + * the certificates generated under this policy should be published to + * certificate transparency logs. + * + * @param {object} [certificatePolicy.attributes] The certificate attributes. + * + * @param {boolean} [certificatePolicy.attributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [certificatePolicy.attributes.notBefore] Not before date in + * UTC. + * + * @param {date} [certificatePolicy.attributes.expires] Expiry date in UTC. + * + * @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 {CertificatePolicy} - 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. + * + * {CertificatePolicy} [result] - The deserialized result object if an error did not occur. + * See {@link CertificatePolicy} 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. + */ + updateCertificatePolicy(vaultBaseUrl: string, certificateName: string, certificatePolicy: models.CertificatePolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateCertificatePolicy(vaultBaseUrl: string, certificateName: string, certificatePolicy: models.CertificatePolicy, callback: ServiceCallback): void; + updateCertificatePolicy(vaultBaseUrl: string, certificateName: string, certificatePolicy: models.CertificatePolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Updates the specified attributes associated with the given + * certificate. + * + * The UpdateCertificate operation applies the specified update on the given + * certificate; the only elements updated are the certificate's attributes. + * This operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given key + * vault. + * + * @param {string} certificateVersion The version of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + updateCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, certificateVersion: string, options?: { certificatePolicy? : models.CertificatePolicy, certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Updates the specified attributes associated with the given + * certificate. + * + * The UpdateCertificate operation applies the specified update on the given + * certificate; the only elements updated are the certificate's attributes. + * This operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given key + * vault. + * + * @param {string} certificateVersion The version of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {CertificateBundle} - 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. + * + * {CertificateBundle} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateBundle} 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. + */ + updateCertificate(vaultBaseUrl: string, certificateName: string, certificateVersion: string, options?: { certificatePolicy? : models.CertificatePolicy, certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + updateCertificate(vaultBaseUrl: string, certificateName: string, certificateVersion: string, callback: ServiceCallback): void; + updateCertificate(vaultBaseUrl: string, certificateName: string, certificateVersion: string, options: { certificatePolicy? : models.CertificatePolicy, certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets information about a certificate. + * + * Gets information about a specific certificate. This operation requires the + * certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given + * vault. + * + * @param {string} certificateVersion The version of the certificate. + * + * @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. + */ + getCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, certificateVersion: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets information about a certificate. + * + * Gets information about a specific certificate. This operation requires the + * certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given + * vault. + * + * @param {string} certificateVersion The version of the certificate. + * + * @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 {CertificateBundle} - 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. + * + * {CertificateBundle} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateBundle} 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. + */ + getCertificate(vaultBaseUrl: string, certificateName: string, certificateVersion: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificate(vaultBaseUrl: string, certificateName: string, certificateVersion: string, callback: ServiceCallback): void; + getCertificate(vaultBaseUrl: string, certificateName: string, certificateVersion: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Updates a certificate operation. + * + * Updates a certificate creation operation that is already in progress. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {boolean} cancellationRequested Indicates if cancellation was + * requested on the certificate 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. + */ + updateCertificateOperationWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, cancellationRequested: boolean, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Updates a certificate operation. + * + * Updates a certificate creation operation that is already in progress. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {boolean} cancellationRequested Indicates if cancellation was + * requested on the certificate 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 {CertificateOperation} - 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. + * + * {CertificateOperation} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateOperation} 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. + */ + updateCertificateOperation(vaultBaseUrl: string, certificateName: string, cancellationRequested: boolean, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateCertificateOperation(vaultBaseUrl: string, certificateName: string, cancellationRequested: boolean, callback: ServiceCallback): void; + updateCertificateOperation(vaultBaseUrl: string, certificateName: string, cancellationRequested: boolean, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets the creation operation of a certificate. + * + * Gets the creation operation associated with a specified certificate. This + * operation requires the certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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. + */ + getCertificateOperationWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the creation operation of a certificate. + * + * Gets the creation operation associated with a specified certificate. This + * operation requires the certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 {CertificateOperation} - 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. + * + * {CertificateOperation} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateOperation} 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. + */ + getCertificateOperation(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificateOperation(vaultBaseUrl: string, certificateName: string, callback: ServiceCallback): void; + getCertificateOperation(vaultBaseUrl: string, certificateName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes the creation operation for a specific certificate. + * + * Deletes the creation operation for a specified certificate that is in the + * process of being created. The certificate is no longer created. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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. + */ + deleteCertificateOperationWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes the creation operation for a specific certificate. + * + * Deletes the creation operation for a specified certificate that is in the + * process of being created. The certificate is no longer created. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 {CertificateOperation} - 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. + * + * {CertificateOperation} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateOperation} 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. + */ + deleteCertificateOperation(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteCertificateOperation(vaultBaseUrl: string, certificateName: string, callback: ServiceCallback): void; + deleteCertificateOperation(vaultBaseUrl: string, certificateName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Merges a certificate or a certificate chain with a key pair + * existing on the server. + * + * The MergeCertificate operation performs the merging of a certificate or + * certificate chain with a key pair currently available in the service. This + * operation requires the certificates/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {array} x509Certificates The certificate or the certificate chain to + * merge. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + mergeCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, x509Certificates: Buffer[], options?: { certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Merges a certificate or a certificate chain with a key pair + * existing on the server. + * + * The MergeCertificate operation performs the merging of a certificate or + * certificate chain with a key pair currently available in the service. This + * operation requires the certificates/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {array} x509Certificates The certificate or the certificate chain to + * merge. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {CertificateBundle} - 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. + * + * {CertificateBundle} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateBundle} 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. + */ + mergeCertificate(vaultBaseUrl: string, certificateName: string, x509Certificates: Buffer[], options?: { certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + mergeCertificate(vaultBaseUrl: string, certificateName: string, x509Certificates: Buffer[], callback: ServiceCallback): void; + mergeCertificate(vaultBaseUrl: string, certificateName: string, x509Certificates: Buffer[], options: { certificateAttributes? : models.CertificateAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Backs up the specified certificate. + * + * Requests that a backup of the specified certificate be downloaded to the + * client. All versions of the certificate will be downloaded. This operation + * requires the certificates/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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. + */ + backupCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Backs up the specified certificate. + * + * Requests that a backup of the specified certificate be downloaded to the + * client. All versions of the certificate will be downloaded. This operation + * requires the certificates/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 {BackupCertificateResult} - 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. + * + * {BackupCertificateResult} [result] - The deserialized result object if an error did not occur. + * See {@link BackupCertificateResult} 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. + */ + backupCertificate(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + backupCertificate(vaultBaseUrl: string, certificateName: string, callback: ServiceCallback): void; + backupCertificate(vaultBaseUrl: string, certificateName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Restores a backed up certificate to a vault. + * + * Restores a backed up certificate, and all its versions, to a vault. This + * operation requires the certificates/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} certificateBundleBackup The backup blob associated with a + * certificate bundle. + * + * @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. + */ + restoreCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateBundleBackup: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Restores a backed up certificate to a vault. + * + * Restores a backed up certificate, and all its versions, to a vault. This + * operation requires the certificates/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} certificateBundleBackup The backup blob associated with a + * certificate bundle. + * + * @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 {CertificateBundle} - 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. + * + * {CertificateBundle} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateBundle} 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. + */ + restoreCertificate(vaultBaseUrl: string, certificateBundleBackup: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + restoreCertificate(vaultBaseUrl: string, certificateBundleBackup: Buffer, callback: ServiceCallback): void; + restoreCertificate(vaultBaseUrl: string, certificateBundleBackup: Buffer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists the deleted certificates in the specified vault currently + * available for recovery. + * + * The GetDeletedCertificates operation retrieves the certificates in the + * current vault which are in a deleted state and ready for recovery or + * purging. This operation includes deletion-specific information. This + * operation requires the certificates/get/list permission. This operation can + * only be enabled on soft-delete enabled vaults. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @param {boolean} [options.includePending] Specifies whether to include + * certificates which are not completely provisioned. + * + * @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. + */ + getDeletedCertificatesWithHttpOperationResponse(vaultBaseUrl: string, options?: { maxresults? : number, includePending? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists the deleted certificates in the specified vault currently + * available for recovery. + * + * The GetDeletedCertificates operation retrieves the certificates in the + * current vault which are in a deleted state and ready for recovery or + * purging. This operation includes deletion-specific information. This + * operation requires the certificates/get/list permission. This operation can + * only be enabled on soft-delete enabled vaults. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @param {boolean} [options.includePending] Specifies whether to include + * certificates which are not completely provisioned. + * + * @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 {DeletedCertificateListResult} - 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. + * + * {DeletedCertificateListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedCertificateListResult} 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. + */ + getDeletedCertificates(vaultBaseUrl: string, options?: { maxresults? : number, includePending? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedCertificates(vaultBaseUrl: string, callback: ServiceCallback): void; + getDeletedCertificates(vaultBaseUrl: string, options: { maxresults? : number, includePending? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieves information about the specified deleted certificate. + * + * The GetDeletedCertificate operation retrieves the deleted certificate + * information plus its attributes, such as retention interval, scheduled + * permanent deletion and the current deletion recovery level. This operation + * requires the certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate + * + * @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. + */ + getDeletedCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Retrieves information about the specified deleted certificate. + * + * The GetDeletedCertificate operation retrieves the deleted certificate + * information plus its attributes, such as retention interval, scheduled + * permanent deletion and the current deletion recovery level. This operation + * requires the certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate + * + * @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 {DeletedCertificateBundle} - 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. + * + * {DeletedCertificateBundle} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedCertificateBundle} 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. + */ + getDeletedCertificate(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedCertificate(vaultBaseUrl: string, certificateName: string, callback: ServiceCallback): void; + getDeletedCertificate(vaultBaseUrl: string, certificateName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Permanently deletes the specified deleted certificate. + * + * The PurgeDeletedCertificate operation performs an irreversible deletion of + * the specified certificate, without possibility for recovery. The operation + * is not available if the recovery level does not specify 'Purgeable'. This + * operation requires the certificate/purge permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate + * + * @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. + */ + purgeDeletedCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Permanently deletes the specified deleted certificate. + * + * The PurgeDeletedCertificate operation performs an irreversible deletion of + * the specified certificate, without possibility for recovery. The operation + * is not available if the recovery level does not specify 'Purgeable'. This + * operation requires the certificate/purge permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + purgeDeletedCertificate(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + purgeDeletedCertificate(vaultBaseUrl: string, certificateName: string, callback: ServiceCallback): void; + purgeDeletedCertificate(vaultBaseUrl: string, certificateName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Recovers the deleted certificate back to its current version under + * /certificates. + * + * The RecoverDeletedCertificate operation performs the reversal of the Delete + * operation. The operation is applicable in vaults enabled for soft-delete, + * and must be issued during the retention interval (available in the deleted + * certificate's attributes). This operation requires the certificates/recover + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the deleted certificate + * + * @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. + */ + recoverDeletedCertificateWithHttpOperationResponse(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Recovers the deleted certificate back to its current version under + * /certificates. + * + * The RecoverDeletedCertificate operation performs the reversal of the Delete + * operation. The operation is applicable in vaults enabled for soft-delete, + * and must be issued during the retention interval (available in the deleted + * certificate's attributes). This operation requires the certificates/recover + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the deleted certificate + * + * @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 {CertificateBundle} - 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. + * + * {CertificateBundle} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateBundle} 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. + */ + recoverDeletedCertificate(vaultBaseUrl: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + recoverDeletedCertificate(vaultBaseUrl: string, certificateName: string, callback: ServiceCallback): void; + recoverDeletedCertificate(vaultBaseUrl: string, certificateName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List storage accounts managed by the specified key vault. This operation + * requires the storage/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getStorageAccountsWithHttpOperationResponse(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List storage accounts managed by the specified key vault. This operation + * requires the storage/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {StorageListResult} - 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. + * + * {StorageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link StorageListResult} 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. + */ + getStorageAccounts(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getStorageAccounts(vaultBaseUrl: string, callback: ServiceCallback): void; + getStorageAccounts(vaultBaseUrl: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists deleted storage accounts for the specified vault. + * + * The Get Deleted Storage Accounts operation returns the storage accounts that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getDeletedStorageAccountsWithHttpOperationResponse(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists deleted storage accounts for the specified vault. + * + * The Get Deleted Storage Accounts operation returns the storage accounts that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {DeletedStorageListResult} - 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. + * + * {DeletedStorageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedStorageListResult} 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. + */ + getDeletedStorageAccounts(vaultBaseUrl: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedStorageAccounts(vaultBaseUrl: string, callback: ServiceCallback): void; + getDeletedStorageAccounts(vaultBaseUrl: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets the specified deleted storage account. + * + * The Get Deleted Storage Account operation returns the specified deleted + * storage account along with its attributes. This operation requires the + * storage/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + getDeletedStorageAccountWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the specified deleted storage account. + * + * The Get Deleted Storage Account operation returns the specified deleted + * storage account along with its attributes. This operation requires the + * storage/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 {DeletedStorageBundle} - 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. + * + * {DeletedStorageBundle} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedStorageBundle} 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. + */ + getDeletedStorageAccount(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedStorageAccount(vaultBaseUrl: string, storageAccountName: string, callback: ServiceCallback): void; + getDeletedStorageAccount(vaultBaseUrl: string, storageAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Permanently deletes the specified storage account. + * + * The purge deleted storage account operation removes the secret permanently, + * without the possibility of recovery. This operation can only be performed on + * a soft-delete enabled vault. This operation requires the storage/purge + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + purgeDeletedStorageAccountWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Permanently deletes the specified storage account. + * + * The purge deleted storage account operation removes the secret permanently, + * without the possibility of recovery. This operation can only be performed on + * a soft-delete enabled vault. This operation requires the storage/purge + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + purgeDeletedStorageAccount(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + purgeDeletedStorageAccount(vaultBaseUrl: string, storageAccountName: string, callback: ServiceCallback): void; + purgeDeletedStorageAccount(vaultBaseUrl: string, storageAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Recovers the deleted storage account. + * + * Recovers the deleted storage account in the specified vault. This operation + * can only be performed on a soft-delete enabled vault. This operation + * requires the storage/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + recoverDeletedStorageAccountWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Recovers the deleted storage account. + * + * Recovers the deleted storage account in the specified vault. This operation + * can only be performed on a soft-delete enabled vault. This operation + * requires the storage/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 {StorageBundle} - 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. + * + * {StorageBundle} [result] - The deserialized result object if an error did not occur. + * See {@link StorageBundle} 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. + */ + recoverDeletedStorageAccount(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + recoverDeletedStorageAccount(vaultBaseUrl: string, storageAccountName: string, callback: ServiceCallback): void; + recoverDeletedStorageAccount(vaultBaseUrl: string, storageAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Backs up the specified storage account. + * + * Requests that a backup of the specified storage account be downloaded to the + * client. This operation requires the storage/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + backupStorageAccountWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Backs up the specified storage account. + * + * Requests that a backup of the specified storage account be downloaded to the + * client. This operation requires the storage/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 {BackupStorageResult} - 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. + * + * {BackupStorageResult} [result] - The deserialized result object if an error did not occur. + * See {@link BackupStorageResult} 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. + */ + backupStorageAccount(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + backupStorageAccount(vaultBaseUrl: string, storageAccountName: string, callback: ServiceCallback): void; + backupStorageAccount(vaultBaseUrl: string, storageAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Restores a backed up storage account to a vault. + * + * Restores a backed up storage account to a vault. This operation requires the + * storage/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} storageBundleBackup The backup blob associated with a + * storage account. + * + * @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. + */ + restoreStorageAccountWithHttpOperationResponse(vaultBaseUrl: string, storageBundleBackup: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Restores a backed up storage account to a vault. + * + * Restores a backed up storage account to a vault. This operation requires the + * storage/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} storageBundleBackup The backup blob associated with a + * storage account. + * + * @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 {StorageBundle} - 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. + * + * {StorageBundle} [result] - The deserialized result object if an error did not occur. + * See {@link StorageBundle} 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. + */ + restoreStorageAccount(vaultBaseUrl: string, storageBundleBackup: Buffer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + restoreStorageAccount(vaultBaseUrl: string, storageBundleBackup: Buffer, callback: ServiceCallback): void; + restoreStorageAccount(vaultBaseUrl: string, storageBundleBackup: Buffer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a storage account. This operation requires the storage/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + deleteStorageAccountWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a storage account. This operation requires the storage/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 {DeletedStorageBundle} - 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. + * + * {DeletedStorageBundle} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedStorageBundle} 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. + */ + deleteStorageAccount(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteStorageAccount(vaultBaseUrl: string, storageAccountName: string, callback: ServiceCallback): void; + deleteStorageAccount(vaultBaseUrl: string, storageAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about a specified storage account. This operation requires + * the storage/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + getStorageAccountWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about a specified storage account. This operation requires + * the storage/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 {StorageBundle} - 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. + * + * {StorageBundle} [result] - The deserialized result object if an error did not occur. + * See {@link StorageBundle} 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. + */ + getStorageAccount(vaultBaseUrl: string, storageAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getStorageAccount(vaultBaseUrl: string, storageAccountName: string, callback: ServiceCallback): void; + getStorageAccount(vaultBaseUrl: string, storageAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a new storage account. This operation requires the + * storage/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} resourceId Storage account resource id. + * + * @param {string} activeKeyName Current active storage account key name. + * + * @param {boolean} autoRegenerateKey whether keyvault should manage the + * storage account for the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.regenerationPeriod] The key regeneration time + * duration specified in ISO-8601 format. + * + * @param {object} [options.storageAccountAttributes] The attributes of the + * storage account. + * + * @param {boolean} [options.storageAccountAttributes.enabled] the enabled + * state of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + setStorageAccountWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, resourceId: string, activeKeyName: string, autoRegenerateKey: boolean, options?: { regenerationPeriod? : string, storageAccountAttributes? : models.StorageAccountAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a new storage account. This operation requires the + * storage/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} resourceId Storage account resource id. + * + * @param {string} activeKeyName Current active storage account key name. + * + * @param {boolean} autoRegenerateKey whether keyvault should manage the + * storage account for the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.regenerationPeriod] The key regeneration time + * duration specified in ISO-8601 format. + * + * @param {object} [options.storageAccountAttributes] The attributes of the + * storage account. + * + * @param {boolean} [options.storageAccountAttributes.enabled] the enabled + * state of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {StorageBundle} - 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. + * + * {StorageBundle} [result] - The deserialized result object if an error did not occur. + * See {@link StorageBundle} 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. + */ + setStorageAccount(vaultBaseUrl: string, storageAccountName: string, resourceId: string, activeKeyName: string, autoRegenerateKey: boolean, options?: { regenerationPeriod? : string, storageAccountAttributes? : models.StorageAccountAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + setStorageAccount(vaultBaseUrl: string, storageAccountName: string, resourceId: string, activeKeyName: string, autoRegenerateKey: boolean, callback: ServiceCallback): void; + setStorageAccount(vaultBaseUrl: string, storageAccountName: string, resourceId: string, activeKeyName: string, autoRegenerateKey: boolean, options: { regenerationPeriod? : string, storageAccountAttributes? : models.StorageAccountAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates the specified attributes associated with the given storage account. + * This operation requires the storage/set/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.activeKeyName] The current active storage account + * key name. + * + * @param {boolean} [options.autoRegenerateKey] whether keyvault should manage + * the storage account for the user. + * + * @param {string} [options.regenerationPeriod] The key regeneration time + * duration specified in ISO-8601 format. + * + * @param {object} [options.storageAccountAttributes] The attributes of the + * storage account. + * + * @param {boolean} [options.storageAccountAttributes.enabled] the enabled + * state of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + updateStorageAccountWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, options?: { activeKeyName? : string, autoRegenerateKey? : boolean, regenerationPeriod? : string, storageAccountAttributes? : models.StorageAccountAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates the specified attributes associated with the given storage account. + * This operation requires the storage/set/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.activeKeyName] The current active storage account + * key name. + * + * @param {boolean} [options.autoRegenerateKey] whether keyvault should manage + * the storage account for the user. + * + * @param {string} [options.regenerationPeriod] The key regeneration time + * duration specified in ISO-8601 format. + * + * @param {object} [options.storageAccountAttributes] The attributes of the + * storage account. + * + * @param {boolean} [options.storageAccountAttributes.enabled] the enabled + * state of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {StorageBundle} - 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. + * + * {StorageBundle} [result] - The deserialized result object if an error did not occur. + * See {@link StorageBundle} 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. + */ + updateStorageAccount(vaultBaseUrl: string, storageAccountName: string, options?: { activeKeyName? : string, autoRegenerateKey? : boolean, regenerationPeriod? : string, storageAccountAttributes? : models.StorageAccountAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + updateStorageAccount(vaultBaseUrl: string, storageAccountName: string, callback: ServiceCallback): void; + updateStorageAccount(vaultBaseUrl: string, storageAccountName: string, options: { activeKeyName? : string, autoRegenerateKey? : boolean, regenerationPeriod? : string, storageAccountAttributes? : models.StorageAccountAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Regenerates the specified key value for the given storage account. This + * operation requires the storage/regeneratekey permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} keyName The storage account key 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. + */ + regenerateStorageAccountKeyWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Regenerates the specified key value for the given storage account. This + * operation requires the storage/regeneratekey permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} keyName The storage account key 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 {StorageBundle} - 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. + * + * {StorageBundle} [result] - The deserialized result object if an error did not occur. + * See {@link StorageBundle} 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. + */ + regenerateStorageAccountKey(vaultBaseUrl: string, storageAccountName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + regenerateStorageAccountKey(vaultBaseUrl: string, storageAccountName: string, keyName: string, callback: ServiceCallback): void; + regenerateStorageAccountKey(vaultBaseUrl: string, storageAccountName: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List storage SAS definitions for the given storage account. This operation + * requires the storage/listsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getSasDefinitionsWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List storage SAS definitions for the given storage account. This operation + * requires the storage/listsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {SasDefinitionListResult} - 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. + * + * {SasDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SasDefinitionListResult} 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. + */ + getSasDefinitions(vaultBaseUrl: string, storageAccountName: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getSasDefinitions(vaultBaseUrl: string, storageAccountName: string, callback: ServiceCallback): void; + getSasDefinitions(vaultBaseUrl: string, storageAccountName: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists deleted SAS definitions for the specified vault and storage + * account. + * + * The Get Deleted Sas Definitions operation returns the SAS definitions that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/listsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getDeletedSasDefinitionsWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists deleted SAS definitions for the specified vault and storage + * account. + * + * The Get Deleted Sas Definitions operation returns the SAS definitions that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/listsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {DeletedSasDefinitionListResult} - 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. + * + * {DeletedSasDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedSasDefinitionListResult} 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. + */ + getDeletedSasDefinitions(vaultBaseUrl: string, storageAccountName: string, options?: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedSasDefinitions(vaultBaseUrl: string, storageAccountName: string, callback: ServiceCallback): void; + getDeletedSasDefinitions(vaultBaseUrl: string, storageAccountName: string, options: { maxresults? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets the specified deleted sas definition. + * + * The Get Deleted SAS Definition operation returns the specified deleted SAS + * definition along with its attributes. This operation requires the + * storage/getsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getDeletedSasDefinitionWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the specified deleted sas definition. + * + * The Get Deleted SAS Definition operation returns the specified deleted SAS + * definition along with its attributes. This operation requires the + * storage/getsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DeletedSasDefinitionBundle} - 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. + * + * {DeletedSasDefinitionBundle} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedSasDefinitionBundle} 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. + */ + getDeletedSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, callback: ServiceCallback): void; + getDeletedSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Recovers the deleted SAS definition. + * + * Recovers the deleted SAS definition for the specified storage account. This + * operation can only be performed on a soft-delete enabled vault. This + * operation requires the storage/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + recoverDeletedSasDefinitionWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Recovers the deleted SAS definition. + * + * Recovers the deleted SAS definition for the specified storage account. This + * operation can only be performed on a soft-delete enabled vault. This + * operation requires the storage/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SasDefinitionBundle} - 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. + * + * {SasDefinitionBundle} [result] - The deserialized result object if an error did not occur. + * See {@link SasDefinitionBundle} 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. + */ + recoverDeletedSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + recoverDeletedSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, callback: ServiceCallback): void; + recoverDeletedSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a SAS definition from a specified storage account. This operation + * requires the storage/deletesas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteSasDefinitionWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a SAS definition from a specified storage account. This operation + * requires the storage/deletesas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DeletedSasDefinitionBundle} - 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. + * + * {DeletedSasDefinitionBundle} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedSasDefinitionBundle} 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. + */ + deleteSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, callback: ServiceCallback): void; + deleteSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about a SAS definition for the specified storage account. + * This operation requires the storage/getsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getSasDefinitionWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about a SAS definition for the specified storage account. + * This operation requires the storage/getsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SasDefinitionBundle} - 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. + * + * {SasDefinitionBundle} [result] - The deserialized result object if an error did not occur. + * See {@link SasDefinitionBundle} 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. + */ + getSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, callback: ServiceCallback): void; + getSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a new SAS definition for the specified storage account. + * This operation requires the storage/setsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {string} templateUri The SAS definition token template signed with an + * arbitrary key. Tokens created according to the SAS definition will have the + * same properties as the template. + * + * @param {string} sasType The type of SAS token the SAS definition will + * create. Possible values include: 'account', 'service' + * + * @param {string} validityPeriod The validity period of SAS tokens created + * according to the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.sasDefinitionAttributes] The attributes of the SAS + * definition. + * + * @param {boolean} [options.sasDefinitionAttributes.enabled] the enabled state + * of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + setSasDefinitionWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, templateUri: string, sasType: string, validityPeriod: string, options?: { sasDefinitionAttributes? : models.SasDefinitionAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a new SAS definition for the specified storage account. + * This operation requires the storage/setsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {string} templateUri The SAS definition token template signed with an + * arbitrary key. Tokens created according to the SAS definition will have the + * same properties as the template. + * + * @param {string} sasType The type of SAS token the SAS definition will + * create. Possible values include: 'account', 'service' + * + * @param {string} validityPeriod The validity period of SAS tokens created + * according to the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.sasDefinitionAttributes] The attributes of the SAS + * definition. + * + * @param {boolean} [options.sasDefinitionAttributes.enabled] the enabled state + * of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {SasDefinitionBundle} - 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. + * + * {SasDefinitionBundle} [result] - The deserialized result object if an error did not occur. + * See {@link SasDefinitionBundle} 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. + */ + setSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, templateUri: string, sasType: string, validityPeriod: string, options?: { sasDefinitionAttributes? : models.SasDefinitionAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + setSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, templateUri: string, sasType: string, validityPeriod: string, callback: ServiceCallback): void; + setSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, templateUri: string, sasType: string, validityPeriod: string, options: { sasDefinitionAttributes? : models.SasDefinitionAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates the specified attributes associated with the given SAS definition. + * This operation requires the storage/setsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.templateUri] The SAS definition token template + * signed with an arbitrary key. Tokens created according to the SAS + * definition will have the same properties as the template. + * + * @param {string} [options.sasType] The type of SAS token the SAS definition + * will create. Possible values include: 'account', 'service' + * + * @param {string} [options.validityPeriod] The validity period of SAS tokens + * created according to the SAS definition. + * + * @param {object} [options.sasDefinitionAttributes] The attributes of the SAS + * definition. + * + * @param {boolean} [options.sasDefinitionAttributes.enabled] the enabled state + * of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + updateSasDefinitionWithHttpOperationResponse(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options?: { templateUri? : string, sasType? : string, validityPeriod? : string, sasDefinitionAttributes? : models.SasDefinitionAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates the specified attributes associated with the given SAS definition. + * This operation requires the storage/setsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.templateUri] The SAS definition token template + * signed with an arbitrary key. Tokens created according to the SAS + * definition will have the same properties as the template. + * + * @param {string} [options.sasType] The type of SAS token the SAS definition + * will create. Possible values include: 'account', 'service' + * + * @param {string} [options.validityPeriod] The validity period of SAS tokens + * created according to the SAS definition. + * + * @param {object} [options.sasDefinitionAttributes] The attributes of the SAS + * definition. + * + * @param {boolean} [options.sasDefinitionAttributes.enabled] the enabled state + * of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {SasDefinitionBundle} - 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. + * + * {SasDefinitionBundle} [result] - The deserialized result object if an error did not occur. + * See {@link SasDefinitionBundle} 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. + */ + updateSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options?: { templateUri? : string, sasType? : string, validityPeriod? : string, sasDefinitionAttributes? : models.SasDefinitionAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }): Promise; + updateSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, callback: ServiceCallback): void; + updateSasDefinition(vaultBaseUrl: string, storageAccountName: string, sasDefinitionName: string, options: { templateUri? : string, sasType? : string, validityPeriod? : string, sasDefinitionAttributes? : models.SasDefinitionAttributes, tags? : { [propertyName: string]: string }, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Retrieves a list of individual key versions with the same key name. + * + * The full key identifier, attributes, and tags are provided in the response. + * This operation requires the keys/list permission. + * + * @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. + */ + getKeyVersionsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Retrieves a list of individual key versions with the same key name. + * + * The full key identifier, attributes, and tags are provided in the response. + * This operation requires the keys/list permission. + * + * @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 {KeyListResult} - 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. + * + * {KeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyListResult} 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. + */ + getKeyVersionsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getKeyVersionsNext(nextPageLink: string, callback: ServiceCallback): void; + getKeyVersionsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a stored key. The LIST operation is + * applicable to all key types, however only the base key identifier, + * attributes, and tags are provided in the response. Individual versions of a + * key are not listed in the response. This operation requires the keys/list + * permission. + * + * @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. + */ + getKeysNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a stored key. The LIST operation is + * applicable to all key types, however only the base key identifier, + * attributes, and tags are provided in the response. Individual versions of a + * key are not listed in the response. This operation requires the keys/list + * permission. + * + * @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 {KeyListResult} - 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. + * + * {KeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyListResult} 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. + */ + getKeysNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getKeysNext(nextPageLink: string, callback: ServiceCallback): void; + getKeysNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists the deleted keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a deleted key. This operation includes + * deletion-specific information. The Get Deleted Keys operation is applicable + * for vaults enabled for soft-delete. While the operation can be invoked on + * any vault, it will return an error if invoked on a non soft-delete enabled + * vault. This operation requires the keys/list permission. + * + * @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. + */ + getDeletedKeysNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists the deleted keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a deleted key. This operation includes + * deletion-specific information. The Get Deleted Keys operation is applicable + * for vaults enabled for soft-delete. While the operation can be invoked on + * any vault, it will return an error if invoked on a non soft-delete enabled + * vault. This operation requires the keys/list permission. + * + * @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 {DeletedKeyListResult} - 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. + * + * {DeletedKeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedKeyListResult} 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. + */ + getDeletedKeysNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedKeysNext(nextPageLink: string, callback: ServiceCallback): void; + getDeletedKeysNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List secrets in a specified key vault. + * + * The Get Secrets operation is applicable to the entire vault. However, only + * the base secret identifier and its attributes are provided in the response. + * Individual secret versions are not listed in the response. This operation + * requires the secrets/list permission. + * + * @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. + */ + getSecretsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List secrets in a specified key vault. + * + * The Get Secrets operation is applicable to the entire vault. However, only + * the base secret identifier and its attributes are provided in the response. + * Individual secret versions are not listed in the response. This operation + * requires the secrets/list permission. + * + * @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 {SecretListResult} - 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. + * + * {SecretListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SecretListResult} 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. + */ + getSecretsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getSecretsNext(nextPageLink: string, callback: ServiceCallback): void; + getSecretsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List all versions of the specified secret. + * + * The full secret identifier and attributes are provided in the response. No + * values are returned for the secrets. This operations requires the + * secrets/list permission. + * + * @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. + */ + getSecretVersionsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List all versions of the specified secret. + * + * The full secret identifier and attributes are provided in the response. No + * values are returned for the secrets. This operations requires the + * secrets/list permission. + * + * @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 {SecretListResult} - 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. + * + * {SecretListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SecretListResult} 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. + */ + getSecretVersionsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getSecretVersionsNext(nextPageLink: string, callback: ServiceCallback): void; + getSecretVersionsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists deleted secrets for the specified vault. + * + * The Get Deleted Secrets operation returns the secrets that have been deleted + * for a vault enabled for soft-delete. This operation requires the + * secrets/list permission. + * + * @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. + */ + getDeletedSecretsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists deleted secrets for the specified vault. + * + * The Get Deleted Secrets operation returns the secrets that have been deleted + * for a vault enabled for soft-delete. This operation requires the + * secrets/list permission. + * + * @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 {DeletedSecretListResult} - 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. + * + * {DeletedSecretListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedSecretListResult} 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. + */ + getDeletedSecretsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedSecretsNext(nextPageLink: string, callback: ServiceCallback): void; + getDeletedSecretsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List certificates in a specified key vault + * + * The GetCertificates operation returns the set of certificates resources in + * the specified key vault. This operation requires the certificates/list + * permission. + * + * @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. + */ + getCertificatesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List certificates in a specified key vault + * + * The GetCertificates operation returns the set of certificates resources in + * the specified key vault. This operation requires the certificates/list + * permission. + * + * @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 {CertificateListResult} - 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. + * + * {CertificateListResult} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateListResult} 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. + */ + getCertificatesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificatesNext(nextPageLink: string, callback: ServiceCallback): void; + getCertificatesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List certificate issuers for a specified key vault. + * + * The GetCertificateIssuers operation returns the set of certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @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. + */ + getCertificateIssuersNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List certificate issuers for a specified key vault. + * + * The GetCertificateIssuers operation returns the set of certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @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 {CertificateIssuerListResult} - 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. + * + * {CertificateIssuerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateIssuerListResult} 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. + */ + getCertificateIssuersNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificateIssuersNext(nextPageLink: string, callback: ServiceCallback): void; + getCertificateIssuersNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List the versions of a certificate. + * + * The GetCertificateVersions operation returns the versions of a certificate + * in the specified key vault. This operation requires the certificates/list + * permission. + * + * @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. + */ + getCertificateVersionsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List the versions of a certificate. + * + * The GetCertificateVersions operation returns the versions of a certificate + * in the specified key vault. This operation requires the certificates/list + * permission. + * + * @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 {CertificateListResult} - 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. + * + * {CertificateListResult} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateListResult} 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. + */ + getCertificateVersionsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getCertificateVersionsNext(nextPageLink: string, callback: ServiceCallback): void; + getCertificateVersionsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists the deleted certificates in the specified vault currently + * available for recovery. + * + * The GetDeletedCertificates operation retrieves the certificates in the + * current vault which are in a deleted state and ready for recovery or + * purging. This operation includes deletion-specific information. This + * operation requires the certificates/get/list permission. This operation can + * only be enabled on soft-delete enabled vaults. + * + * @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. + */ + getDeletedCertificatesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists the deleted certificates in the specified vault currently + * available for recovery. + * + * The GetDeletedCertificates operation retrieves the certificates in the + * current vault which are in a deleted state and ready for recovery or + * purging. This operation includes deletion-specific information. This + * operation requires the certificates/get/list permission. This operation can + * only be enabled on soft-delete enabled vaults. + * + * @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 {DeletedCertificateListResult} - 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. + * + * {DeletedCertificateListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedCertificateListResult} 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. + */ + getDeletedCertificatesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedCertificatesNext(nextPageLink: string, callback: ServiceCallback): void; + getDeletedCertificatesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List storage accounts managed by the specified key vault. This operation + * requires the storage/list permission. + * + * @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. + */ + getStorageAccountsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List storage accounts managed by the specified key vault. This operation + * requires the storage/list permission. + * + * @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 {StorageListResult} - 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. + * + * {StorageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link StorageListResult} 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. + */ + getStorageAccountsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getStorageAccountsNext(nextPageLink: string, callback: ServiceCallback): void; + getStorageAccountsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists deleted storage accounts for the specified vault. + * + * The Get Deleted Storage Accounts operation returns the storage accounts that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/list permission. + * + * @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. + */ + getDeletedStorageAccountsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists deleted storage accounts for the specified vault. + * + * The Get Deleted Storage Accounts operation returns the storage accounts that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/list permission. + * + * @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 {DeletedStorageListResult} - 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. + * + * {DeletedStorageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedStorageListResult} 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. + */ + getDeletedStorageAccountsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedStorageAccountsNext(nextPageLink: string, callback: ServiceCallback): void; + getDeletedStorageAccountsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List storage SAS definitions for the given storage account. This operation + * requires the storage/listsas permission. + * + * @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. + */ + getSasDefinitionsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List storage SAS definitions for the given storage account. This operation + * requires the storage/listsas permission. + * + * @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 {SasDefinitionListResult} - 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. + * + * {SasDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SasDefinitionListResult} 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. + */ + getSasDefinitionsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getSasDefinitionsNext(nextPageLink: string, callback: ServiceCallback): void; + getSasDefinitionsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Lists deleted SAS definitions for the specified vault and storage + * account. + * + * The Get Deleted Sas Definitions operation returns the SAS definitions that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/listsas permission. + * + * @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. + */ + getDeletedSasDefinitionsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists deleted SAS definitions for the specified vault and storage + * account. + * + * The Get Deleted Sas Definitions operation returns the SAS definitions that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/listsas permission. + * + * @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 {DeletedSasDefinitionListResult} - 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. + * + * {DeletedSasDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedSasDefinitionListResult} 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. + */ + getDeletedSasDefinitionsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDeletedSasDefinitionsNext(nextPageLink: string, callback: ServiceCallback): void; + getDeletedSasDefinitionsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +export { KeyVaultClient, models as KeyVaultModels }; diff --git a/lib/services/keyvault/lib/keyVaultClient.js b/lib/services/keyvault/lib/keyVaultClient.js new file mode 100644 index 0000000000..785ddc74ca --- /dev/null +++ b/lib/services/keyvault/lib/keyVaultClient.js @@ -0,0 +1,25998 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; +const WebResource = msRest.WebResource; + +const models = require('./models'); + + +/** + * @summary Creates a new key, stores it, then returns key parameters and + * attributes to the client. + * + * The create key operation can be used to create any key type in Azure Key + * Vault. If the named key already exists, Azure Key Vault creates a new + * version of the key. It requires the keys/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name for the new key. The system will generate + * the version name for the new key. + * + * @param {string} kty The type of key to create. For valid values, see + * JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', + * 'oct' + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.keySize] The key size in bits. For example: 2048, + * 3072, or 4096 for RSA. + * + * @param {array} [options.keyOps] + * + * @param {object} [options.keyAttributes] + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @param {string} [options.curve] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * + * @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 KeyBundle} 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 _createKey(vaultBaseUrl, keyName, kty, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let keySize = (options && options.keySize !== undefined) ? options.keySize : undefined; + let keyOps = (options && options.keyOps !== undefined) ? options.keyOps : undefined; + let keyAttributes = (options && options.keyAttributes !== undefined) ? options.keyAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + let curve = (options && options.curve !== undefined) ? options.curve : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (keyName !== null && keyName !== undefined) { + if (keyName.match(/^[0-9a-zA-Z-]+$/) === null) + { + throw new Error('"keyName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z-]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (kty === null || kty === undefined || typeof kty.valueOf() !== 'string') { + throw new Error('kty cannot be null or undefined and it must be of type string.'); + } + if (kty !== null && kty !== undefined) { + if (kty.length < 1) + { + throw new Error('"kty" should satisfy the constraint - "MinLength": 1'); + } + } + if (keySize !== null && keySize !== undefined && typeof keySize !== 'number') { + throw new Error('keySize must be of type number.'); + } + if (Array.isArray(keyOps)) { + for (let i = 0; i < keyOps.length; i++) { + if (keyOps[i] !== null && keyOps[i] !== undefined && typeof keyOps[i].valueOf() !== 'string') { + throw new Error('keyOps[i] must be of type string.'); + } + } + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (curve !== null && curve !== undefined && typeof curve.valueOf() !== 'string') { + throw new Error('curve must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((kty !== null && kty !== undefined) || (keySize !== null && keySize !== undefined) || (keyOps !== null && keyOps !== undefined) || (keyAttributes !== null && keyAttributes !== undefined) || (tags !== null && tags !== undefined) || (curve !== null && curve !== undefined)) { + parameters = new client.models['KeyCreateParameters'](); + parameters.kty = kty; + parameters.keySize = keySize; + parameters.keyOps = keyOps; + parameters.keyAttributes = keyAttributes; + parameters.tags = tags; + parameters.curve = curve; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/create'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['KeyCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Imports an externally created key, stores it, and returns key + * parameters and attributes to the client. + * + * The import key operation may be used to import any key type into an Azure + * Key Vault. If the named key already exists, Azure Key Vault creates a new + * version of the key. This operation requires the keys/import permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName Name for the imported key. + * + * @param {object} key The Json web key + * + * @param {string} [key.kid] Key identifier. + * + * @param {string} [key.kty] JsonWebKey Key Type (kty), as defined in + * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Possible + * values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {array} [key.keyOps] + * + * @param {buffer} [key.n] RSA modulus. + * + * @param {buffer} [key.e] RSA public exponent. + * + * @param {buffer} [key.d] RSA private exponent, or the D component of an EC + * private key. + * + * @param {buffer} [key.dp] RSA private key parameter. + * + * @param {buffer} [key.dq] RSA private key parameter. + * + * @param {buffer} [key.qi] RSA private key parameter. + * + * @param {buffer} [key.p] RSA secret prime. + * + * @param {buffer} [key.q] RSA secret prime, with p < q. + * + * @param {buffer} [key.k] Symmetric key. + * + * @param {buffer} [key.t] HSM Token, used with 'Bring Your Own Key'. + * + * @param {string} [key.crv] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * + * @param {buffer} [key.x] X component of an EC public key. + * + * @param {buffer} [key.y] Y component of an EC public key. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.hsm] Whether to import as a hardware key (HSM) or + * software key. + * + * @param {object} [options.keyAttributes] The key management attributes. + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 KeyBundle} 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 _importKey(vaultBaseUrl, keyName, key, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let hsm = (options && options.hsm !== undefined) ? options.hsm : undefined; + let keyAttributes = (options && options.keyAttributes !== undefined) ? options.keyAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (keyName !== null && keyName !== undefined) { + if (keyName.match(/^[0-9a-zA-Z-]+$/) === null) + { + throw new Error('"keyName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z-]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (hsm !== null && hsm !== undefined && typeof hsm !== 'boolean') { + throw new Error('hsm must be of type boolean.'); + } + if (key === null || key === undefined) { + throw new Error('key cannot be null or undefined.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((hsm !== null && hsm !== undefined) || (key !== null && key !== undefined) || (keyAttributes !== null && keyAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['KeyImportParameters'](); + parameters.hsm = hsm; + parameters.key = key; + parameters.keyAttributes = keyAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['KeyImportParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a key of any type from storage in Azure Key Vault. + * + * The delete key operation cannot be used to remove individual versions of a + * key. This operation removes the cryptographic material associated with the + * key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or + * Encrypt/Decrypt operations. This operation requires the keys/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedKeyBundle} 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 _deleteKey(vaultBaseUrl, keyName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedKeyBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary The update key operation changes specified attributes of a stored + * key and can be applied to any key type and key version stored in Azure Key + * Vault. + * + * In order to perform this operation, the key must already exist in the Key + * Vault. Note: The cryptographic material of a key itself cannot be changed. + * This operation requires the keys/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of key to update. + * + * @param {string} keyVersion The version of the key to update. + * + * @param {object} [options] Optional Parameters. + * + * @param {array} [options.keyOps] Json web key operations. For more + * information on possible key operations, see JsonWebKeyOperation. + * + * @param {object} [options.keyAttributes] + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 KeyBundle} 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 _updateKey(vaultBaseUrl, keyName, keyVersion, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let keyOps = (options && options.keyOps !== undefined) ? options.keyOps : undefined; + let keyAttributes = (options && options.keyAttributes !== undefined) ? options.keyAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (keyVersion === null || keyVersion === undefined || typeof keyVersion.valueOf() !== 'string') { + throw new Error('keyVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (Array.isArray(keyOps)) { + for (let i = 0; i < keyOps.length; i++) { + if (keyOps[i] !== null && keyOps[i] !== undefined && typeof keyOps[i].valueOf() !== 'string') { + throw new Error('keyOps[i] must be of type string.'); + } + } + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((keyOps !== null && keyOps !== undefined) || (keyAttributes !== null && keyAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['KeyUpdateParameters'](); + parameters.keyOps = keyOps; + parameters.keyAttributes = keyAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/{key-version}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + requestUrl = requestUrl.replace('{key-version}', encodeURIComponent(keyVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['KeyUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets the public part of a stored key. + * + * The get key operation is applicable to all key types. If the requested key + * is symmetric, then no key material is released in the response. This + * operation requires the keys/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key to get. + * + * @param {string} keyVersion Adding the version parameter retrieves a specific + * version of a key. + * + * @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 KeyBundle} 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 _getKey(vaultBaseUrl, keyName, keyVersion, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (keyVersion === null || keyVersion === undefined || typeof keyVersion.valueOf() !== 'string') { + throw new Error('keyVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/{key-version}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + requestUrl = requestUrl.replace('{key-version}', encodeURIComponent(keyVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Retrieves a list of individual key versions with the same key name. + * + * The full key identifier, attributes, and tags are provided in the response. + * This operation requires the keys/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 KeyListResult} 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 _getKeyVersions(vaultBaseUrl, keyName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/versions'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a stored key. The LIST operation is + * applicable to all key types, however only the base key identifier, + * attributes, and tags are provided in the response. Individual versions of a + * key are not listed in the response. This operation requires the keys/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 KeyListResult} 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 _getKeys(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Requests that a backup of the specified key be downloaded to the + * client. + * + * The Key Backup operation exports a key from Azure Key Vault in a protected + * form. Note that this operation does NOT return key material in a form that + * can be used outside the Azure Key Vault system, the returned key material is + * either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The + * intent of this operation is to allow a client to GENERATE a key in one Azure + * Key Vault instance, BACKUP the key, and then RESTORE it into another Azure + * Key Vault instance. The BACKUP operation may be used to export, in protected + * form, any key type from Azure Key Vault. Individual versions of a key cannot + * be backed up. BACKUP / RESTORE can be performed within geographical + * boundaries only; meaning that a BACKUP from one geographical area cannot be + * restored to another geographical area. For example, a backup from the US + * geographical area cannot be restored in an EU geographical area. This + * operation requires the key/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @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 BackupKeyResult} 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 _backupKey(vaultBaseUrl, keyName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/backup'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['BackupKeyResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Restores a backed up key to a vault. + * + * Imports a previously backed up key into Azure Key Vault, restoring the key, + * its key identifier, attributes and access control policies. The RESTORE + * operation may be used to import a previously backed up key. Individual + * versions of a key cannot be restored. The key is restored in its entirety + * with the same key name as it had when it was backed up. If the key name is + * not available in the target Key Vault, the RESTORE operation will be + * rejected. While the key name is retained during restore, the final key + * identifier will change if the key is restored to a different vault. Restore + * will restore all versions and preserve version identifiers. The RESTORE + * operation is subject to security constraints: The target Key Vault must be + * owned by the same Microsoft Azure Subscription as the source Key Vault The + * user must have RESTORE permission in the target Key Vault. This operation + * requires the keys/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} keyBundleBackup The backup blob associated with a key + * bundle. + * + * @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 KeyBundle} 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 _restoreKey(vaultBaseUrl, keyBundleBackup, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (!Buffer.isBuffer(keyBundleBackup)) { + throw new Error('keyBundleBackup cannot be null or undefined and it must be of type buffer.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if (keyBundleBackup !== null && keyBundleBackup !== undefined) { + parameters = new client.models['KeyRestoreParameters'](); + parameters.keyBundleBackup = keyBundleBackup; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/restore'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['KeyRestoreParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Encrypts an arbitrary sequence of bytes using an encryption key + * that is stored in a key vault. + * + * The ENCRYPT operation encrypts an arbitrary sequence of bytes using an + * encryption key that is stored in Azure Key Vault. Note that the ENCRYPT + * operation only supports a single block of data, the size of which is + * dependent on the target key and the encryption algorithm to be used. The + * ENCRYPT operation is only strictly necessary for symmetric keys stored in + * Azure Key Vault since protection with an asymmetric key can be performed + * using public portion of the key. This operation is supported for asymmetric + * keys as a convenience for callers that have a key-reference but do not have + * access to the public key material. This operation requires the keys/encrypt + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 KeyOperationResult} 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 _encrypt(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (keyVersion === null || keyVersion === undefined || typeof keyVersion.valueOf() !== 'string') { + throw new Error('keyVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (algorithm === null || algorithm === undefined || typeof algorithm.valueOf() !== 'string') { + throw new Error('algorithm cannot be null or undefined and it must be of type string.'); + } + if (algorithm !== null && algorithm !== undefined) { + if (algorithm.length < 1) + { + throw new Error('"algorithm" should satisfy the constraint - "MinLength": 1'); + } + } + if (!Buffer.isBuffer(value)) { + throw new Error('value cannot be null or undefined and it must be of type buffer.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((algorithm !== null && algorithm !== undefined) || (value !== null && value !== undefined)) { + parameters = new client.models['KeyOperationsParameters'](); + parameters.algorithm = algorithm; + parameters.value = value; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/{key-version}/encrypt'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + requestUrl = requestUrl.replace('{key-version}', encodeURIComponent(keyVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['KeyOperationsParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Decrypts a single block of encrypted data. + * + * The DECRYPT operation decrypts a well-formed block of ciphertext using the + * target encryption key and specified algorithm. This operation is the reverse + * of the ENCRYPT operation; only a single block of data may be decrypted, the + * size of this block is dependent on the target key and the algorithm to be + * used. The DECRYPT operation applies to asymmetric and symmetric keys stored + * in Azure Key Vault since it uses the private portion of the key. This + * operation requires the keys/decrypt permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 KeyOperationResult} 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 _decrypt(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (keyVersion === null || keyVersion === undefined || typeof keyVersion.valueOf() !== 'string') { + throw new Error('keyVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (algorithm === null || algorithm === undefined || typeof algorithm.valueOf() !== 'string') { + throw new Error('algorithm cannot be null or undefined and it must be of type string.'); + } + if (algorithm !== null && algorithm !== undefined) { + if (algorithm.length < 1) + { + throw new Error('"algorithm" should satisfy the constraint - "MinLength": 1'); + } + } + if (!Buffer.isBuffer(value)) { + throw new Error('value cannot be null or undefined and it must be of type buffer.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((algorithm !== null && algorithm !== undefined) || (value !== null && value !== undefined)) { + parameters = new client.models['KeyOperationsParameters'](); + parameters.algorithm = algorithm; + parameters.value = value; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/{key-version}/decrypt'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + requestUrl = requestUrl.replace('{key-version}', encodeURIComponent(keyVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['KeyOperationsParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Creates a signature from a digest using the specified key. + * + * The SIGN operation is applicable to asymmetric and symmetric keys stored in + * Azure Key Vault since this operation uses the private portion of the key. + * This operation requires the keys/sign permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm The signing/verification algorithm identifier. For + * more information on possible algorithm types, see + * JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', + * 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', + * 'ES256K' + * + * @param {buffer} value + * + * @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 KeyOperationResult} 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 _sign(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (keyVersion === null || keyVersion === undefined || typeof keyVersion.valueOf() !== 'string') { + throw new Error('keyVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (algorithm === null || algorithm === undefined || typeof algorithm.valueOf() !== 'string') { + throw new Error('algorithm cannot be null or undefined and it must be of type string.'); + } + if (algorithm !== null && algorithm !== undefined) { + if (algorithm.length < 1) + { + throw new Error('"algorithm" should satisfy the constraint - "MinLength": 1'); + } + } + if (!Buffer.isBuffer(value)) { + throw new Error('value cannot be null or undefined and it must be of type buffer.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((algorithm !== null && algorithm !== undefined) || (value !== null && value !== undefined)) { + parameters = new client.models['KeySignParameters'](); + parameters.algorithm = algorithm; + parameters.value = value; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/{key-version}/sign'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + requestUrl = requestUrl.replace('{key-version}', encodeURIComponent(keyVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['KeySignParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Verifies a signature using a specified key. + * + * The VERIFY operation is applicable to symmetric keys stored in Azure Key + * Vault. VERIFY is not strictly necessary for asymmetric keys stored in Azure + * Key Vault since signature verification can be performed using the public + * portion of the key but this operation is supported as a convenience for + * callers that only have a key-reference and not the public portion of the + * key. This operation requires the keys/verify permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm The signing/verification algorithm. For more + * information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + * Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', + * 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' + * + * @param {buffer} digest The digest used for signing. + * + * @param {buffer} signature The signature to be verified. + * + * @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 KeyVerifyResult} 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 _verify(vaultBaseUrl, keyName, keyVersion, algorithm, digest, signature, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (keyVersion === null || keyVersion === undefined || typeof keyVersion.valueOf() !== 'string') { + throw new Error('keyVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (algorithm === null || algorithm === undefined || typeof algorithm.valueOf() !== 'string') { + throw new Error('algorithm cannot be null or undefined and it must be of type string.'); + } + if (algorithm !== null && algorithm !== undefined) { + if (algorithm.length < 1) + { + throw new Error('"algorithm" should satisfy the constraint - "MinLength": 1'); + } + } + if (!Buffer.isBuffer(digest)) { + throw new Error('digest cannot be null or undefined and it must be of type buffer.'); + } + if (!Buffer.isBuffer(signature)) { + throw new Error('signature cannot be null or undefined and it must be of type buffer.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((algorithm !== null && algorithm !== undefined) || (digest !== null && digest !== undefined) || (signature !== null && signature !== undefined)) { + parameters = new client.models['KeyVerifyParameters'](); + parameters.algorithm = algorithm; + parameters.digest = digest; + parameters.signature = signature; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/{key-version}/verify'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + requestUrl = requestUrl.replace('{key-version}', encodeURIComponent(keyVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['KeyVerifyParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyVerifyResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Wraps a symmetric key using a specified key. + * + * The WRAP operation supports encryption of a symmetric key using a key + * encryption key that has previously been stored in an Azure Key Vault. The + * WRAP operation is only strictly necessary for symmetric keys stored in Azure + * Key Vault since protection with an asymmetric key can be performed using the + * public portion of the key. This operation is supported for asymmetric keys + * as a convenience for callers that have a key-reference but do not have + * access to the public key material. This operation requires the keys/wrapKey + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 KeyOperationResult} 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 _wrapKey(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (keyVersion === null || keyVersion === undefined || typeof keyVersion.valueOf() !== 'string') { + throw new Error('keyVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (algorithm === null || algorithm === undefined || typeof algorithm.valueOf() !== 'string') { + throw new Error('algorithm cannot be null or undefined and it must be of type string.'); + } + if (algorithm !== null && algorithm !== undefined) { + if (algorithm.length < 1) + { + throw new Error('"algorithm" should satisfy the constraint - "MinLength": 1'); + } + } + if (!Buffer.isBuffer(value)) { + throw new Error('value cannot be null or undefined and it must be of type buffer.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((algorithm !== null && algorithm !== undefined) || (value !== null && value !== undefined)) { + parameters = new client.models['KeyOperationsParameters'](); + parameters.algorithm = algorithm; + parameters.value = value; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/{key-version}/wrapkey'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + requestUrl = requestUrl.replace('{key-version}', encodeURIComponent(keyVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['KeyOperationsParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Unwraps a symmetric key using the specified key that was initially + * used for wrapping that key. + * + * The UNWRAP operation supports decryption of a symmetric key using the target + * key encryption key. This operation is the reverse of the WRAP operation. The + * UNWRAP operation applies to asymmetric and symmetric keys stored in Azure + * Key Vault since it uses the private portion of the key. This operation + * requires the keys/unwrapKey permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 KeyOperationResult} 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 _unwrapKey(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (keyVersion === null || keyVersion === undefined || typeof keyVersion.valueOf() !== 'string') { + throw new Error('keyVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (algorithm === null || algorithm === undefined || typeof algorithm.valueOf() !== 'string') { + throw new Error('algorithm cannot be null or undefined and it must be of type string.'); + } + if (algorithm !== null && algorithm !== undefined) { + if (algorithm.length < 1) + { + throw new Error('"algorithm" should satisfy the constraint - "MinLength": 1'); + } + } + if (!Buffer.isBuffer(value)) { + throw new Error('value cannot be null or undefined and it must be of type buffer.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((algorithm !== null && algorithm !== undefined) || (value !== null && value !== undefined)) { + parameters = new client.models['KeyOperationsParameters'](); + parameters.algorithm = algorithm; + parameters.value = value; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'keys/{key-name}/{key-version}/unwrapkey'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + requestUrl = requestUrl.replace('{key-version}', encodeURIComponent(keyVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['KeyOperationsParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists the deleted keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a deleted key. This operation includes + * deletion-specific information. The Get Deleted Keys operation is applicable + * for vaults enabled for soft-delete. While the operation can be invoked on + * any vault, it will return an error if invoked on a non soft-delete enabled + * vault. This operation requires the keys/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 DeletedKeyListResult} 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 _getDeletedKeys(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedkeys'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedKeyListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets the public part of a deleted key. + * + * The Get Deleted Key operation is applicable for soft-delete enabled vaults. + * While the operation can be invoked on any vault, it will return an error if + * invoked on a non soft-delete enabled vault. This operation requires the + * keys/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @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 DeletedKeyBundle} 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 _getDeletedKey(vaultBaseUrl, keyName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedkeys/{key-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedKeyBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Permanently deletes the specified key. + * + * The Purge Deleted Key operation is applicable for soft-delete enabled + * vaults. While the operation can be invoked on any vault, it will return an + * error if invoked on a non soft-delete enabled vault. This operation requires + * the keys/purge permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key + * + * @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 _purgeDeletedKey(vaultBaseUrl, keyName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedkeys/{key-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.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 !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Recovers the deleted key to its latest version. + * + * The Recover Deleted Key operation is applicable for deleted keys in + * soft-delete enabled vaults. It recovers the deleted key back to its latest + * version under /keys. An attempt to recover an non-deleted key will return an + * error. Consider this the inverse of the delete operation on soft-delete + * enabled vaults. This operation requires the keys/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the deleted key. + * + * @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 KeyBundle} 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 _recoverDeletedKey(vaultBaseUrl, keyName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedkeys/{key-name}/recover'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{key-name}', encodeURIComponent(keyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Sets a secret in a specified key vault. + * + * The SET operation adds a secret to the Azure Key Vault. If the named secret + * already exists, Azure Key Vault creates a new version of that secret. This + * operation requires the secrets/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} value The value of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @param {string} [options.contentType] Type of the secret value such as a + * password. + * + * @param {object} [options.secretAttributes] The secret management attributes. + * + * @param {boolean} [options.secretAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.secretAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.secretAttributes.expires] Expiry date in UTC. + * + * @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 SecretBundle} 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 _setSecret(vaultBaseUrl, secretName, value, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + let contentType = (options && options.contentType !== undefined) ? options.contentType : undefined; + let secretAttributes = (options && options.secretAttributes !== undefined) ? options.secretAttributes : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (secretName === null || secretName === undefined || typeof secretName.valueOf() !== 'string') { + throw new Error('secretName cannot be null or undefined and it must be of type string.'); + } + if (secretName !== null && secretName !== undefined) { + if (secretName.match(/^[0-9a-zA-Z-]+$/) === null) + { + throw new Error('"secretName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z-]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (value === null || value === undefined || typeof value.valueOf() !== 'string') { + throw new Error('value cannot be null or undefined and it must be of type string.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (contentType !== null && contentType !== undefined && typeof contentType.valueOf() !== 'string') { + throw new Error('contentType must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((value !== null && value !== undefined) || (tags !== null && tags !== undefined) || (contentType !== null && contentType !== undefined) || (secretAttributes !== null && secretAttributes !== undefined)) { + parameters = new client.models['SecretSetParameters'](); + parameters.value = value; + parameters.tags = tags; + parameters.contentType = contentType; + parameters.secretAttributes = secretAttributes; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'secrets/{secret-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{secret-name}', encodeURIComponent(secretName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SecretSetParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SecretBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a secret from a specified key vault. + * + * The DELETE operation applies to any secret stored in Azure Key Vault. DELETE + * cannot be applied to an individual version of a secret. This operation + * requires the secrets/delete permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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 DeletedSecretBundle} 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 _deleteSecret(vaultBaseUrl, secretName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (secretName === null || secretName === undefined || typeof secretName.valueOf() !== 'string') { + throw new Error('secretName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'secrets/{secret-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{secret-name}', encodeURIComponent(secretName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedSecretBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Updates the attributes associated with a specified secret in a + * given key vault. + * + * The UPDATE operation changes specified attributes of an existing stored + * secret. Attributes that are not specified in the request are left unchanged. + * The value of a secret itself cannot be changed. This operation requires the + * secrets/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} secretVersion The version of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.contentType] Type of the secret value such as a + * password. + * + * @param {object} [options.secretAttributes] The secret management attributes. + * + * @param {boolean} [options.secretAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.secretAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.secretAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 SecretBundle} 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 _updateSecret(vaultBaseUrl, secretName, secretVersion, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let contentType = (options && options.contentType !== undefined) ? options.contentType : undefined; + let secretAttributes = (options && options.secretAttributes !== undefined) ? options.secretAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (secretName === null || secretName === undefined || typeof secretName.valueOf() !== 'string') { + throw new Error('secretName cannot be null or undefined and it must be of type string.'); + } + if (secretVersion === null || secretVersion === undefined || typeof secretVersion.valueOf() !== 'string') { + throw new Error('secretVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (contentType !== null && contentType !== undefined && typeof contentType.valueOf() !== 'string') { + throw new Error('contentType must be of type string.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((contentType !== null && contentType !== undefined) || (secretAttributes !== null && secretAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['SecretUpdateParameters'](); + parameters.contentType = contentType; + parameters.secretAttributes = secretAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'secrets/{secret-name}/{secret-version}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{secret-name}', encodeURIComponent(secretName)); + requestUrl = requestUrl.replace('{secret-version}', encodeURIComponent(secretVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SecretUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SecretBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Get a specified secret from a given key vault. + * + * The GET operation is applicable to any secret stored in Azure Key Vault. + * This operation requires the secrets/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} secretVersion The version of the secret. + * + * @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 SecretBundle} 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 _getSecret(vaultBaseUrl, secretName, secretVersion, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (secretName === null || secretName === undefined || typeof secretName.valueOf() !== 'string') { + throw new Error('secretName cannot be null or undefined and it must be of type string.'); + } + if (secretVersion === null || secretVersion === undefined || typeof secretVersion.valueOf() !== 'string') { + throw new Error('secretVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'secrets/{secret-name}/{secret-version}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{secret-name}', encodeURIComponent(secretName)); + requestUrl = requestUrl.replace('{secret-version}', encodeURIComponent(secretVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SecretBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List secrets in a specified key vault. + * + * The Get Secrets operation is applicable to the entire vault. However, only + * the base secret identifier and its attributes are provided in the response. + * Individual secret versions are not listed in the response. This operation + * requires the secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified, the service will return up to 25 results. + * + * @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 SecretListResult} 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 _getSecrets(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'secrets'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SecretListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List all versions of the specified secret. + * + * The full secret identifier and attributes are provided in the response. No + * values are returned for the secrets. This operations requires the + * secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified, the service will return up to 25 results. + * + * @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 SecretListResult} 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 _getSecretVersions(vaultBaseUrl, secretName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (secretName === null || secretName === undefined || typeof secretName.valueOf() !== 'string') { + throw new Error('secretName cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'secrets/{secret-name}/versions'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{secret-name}', encodeURIComponent(secretName)); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SecretListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists deleted secrets for the specified vault. + * + * The Get Deleted Secrets operation returns the secrets that have been deleted + * for a vault enabled for soft-delete. This operation requires the + * secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 DeletedSecretListResult} 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 _getDeletedSecrets(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedsecrets'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedSecretListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets the specified deleted secret. + * + * The Get Deleted Secret operation returns the specified deleted secret along + * with its attributes. This operation requires the secrets/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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 DeletedSecretBundle} 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 _getDeletedSecret(vaultBaseUrl, secretName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (secretName === null || secretName === undefined || typeof secretName.valueOf() !== 'string') { + throw new Error('secretName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedsecrets/{secret-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{secret-name}', encodeURIComponent(secretName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedSecretBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Permanently deletes the specified secret. + * + * The purge deleted secret operation removes the secret permanently, without + * the possibility of recovery. This operation can only be enabled on a + * soft-delete enabled vault. This operation requires the secrets/purge + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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 _purgeDeletedSecret(vaultBaseUrl, secretName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (secretName === null || secretName === undefined || typeof secretName.valueOf() !== 'string') { + throw new Error('secretName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedsecrets/{secret-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{secret-name}', encodeURIComponent(secretName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.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 !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Recovers the deleted secret to the latest version. + * + * Recovers the deleted secret in the specified vault. This operation can only + * be performed on a soft-delete enabled vault. This operation requires the + * secrets/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the deleted secret. + * + * @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 SecretBundle} 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 _recoverDeletedSecret(vaultBaseUrl, secretName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (secretName === null || secretName === undefined || typeof secretName.valueOf() !== 'string') { + throw new Error('secretName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedsecrets/{secret-name}/recover'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{secret-name}', encodeURIComponent(secretName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SecretBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Backs up the specified secret. + * + * Requests that a backup of the specified secret be downloaded to the client. + * All versions of the secret will be downloaded. This operation requires the + * secrets/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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 BackupSecretResult} 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 _backupSecret(vaultBaseUrl, secretName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (secretName === null || secretName === undefined || typeof secretName.valueOf() !== 'string') { + throw new Error('secretName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'secrets/{secret-name}/backup'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{secret-name}', encodeURIComponent(secretName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['BackupSecretResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Restores a backed up secret to a vault. + * + * Restores a backed up secret, and all its versions, to a vault. This + * operation requires the secrets/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} secretBundleBackup The backup blob associated with a secret + * bundle. + * + * @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 SecretBundle} 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 _restoreSecret(vaultBaseUrl, secretBundleBackup, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (!Buffer.isBuffer(secretBundleBackup)) { + throw new Error('secretBundleBackup cannot be null or undefined and it must be of type buffer.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if (secretBundleBackup !== null && secretBundleBackup !== undefined) { + parameters = new client.models['SecretRestoreParameters'](); + parameters.secretBundleBackup = secretBundleBackup; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'secrets/restore'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SecretRestoreParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SecretBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List certificates in a specified key vault + * + * The GetCertificates operation returns the set of certificates resources in + * the specified key vault. This operation requires the certificates/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @param {boolean} [options.includePending] Specifies whether to include + * certificates which are not completely provisioned. + * + * @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 CertificateListResult} 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 _getCertificates(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + let includePending = (options && options.includePending !== undefined) ? options.includePending : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (includePending !== null && includePending !== undefined && typeof includePending !== 'boolean') { + throw new Error('includePending must be of type boolean.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + if (includePending !== null && includePending !== undefined) { + queryParameters.push('includePending=' + encodeURIComponent(includePending.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes a certificate from a specified key vault. + * + * Deletes all versions of a certificate object along with its associated + * policy. Delete certificate cannot be used to remove individual versions of a + * certificate object. This operation requires the certificates/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 DeletedCertificateBundle} 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 _deleteCertificate(vaultBaseUrl, certificateName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedCertificateBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Sets the certificate contacts for the specified key vault. + * + * Sets the certificate contacts for the specified key vault. This operation + * requires the certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} contacts The contacts for the key vault certificate. + * + * @param {array} [contacts.contactList] The contact list for the vault + * certificates. + * + * @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 Contacts} 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 _setCertificateContacts(vaultBaseUrl, contacts, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (contacts === null || contacts === undefined) { + throw new Error('contacts cannot be null or undefined.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/contacts'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (contacts !== null && contacts !== undefined) { + let requestModelMapper = new client.models['Contacts']().mapper(); + requestModel = client.serialize(requestModelMapper, contacts, 'contacts'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(contacts, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['Contacts']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists the certificate contacts for a specified key vault. + * + * The GetCertificateContacts operation returns the set of certificate contact + * resources in the specified key vault. This operation requires the + * certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @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 Contacts} 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 _getCertificateContacts(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/contacts'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['Contacts']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes the certificate contacts for a specified key vault. + * + * Deletes the certificate contacts for a specified key vault certificate. This + * operation requires the certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @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 Contacts} 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 _deleteCertificateContacts(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/contacts'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['Contacts']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List certificate issuers for a specified key vault. + * + * The GetCertificateIssuers operation returns the set of certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 CertificateIssuerListResult} 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 _getCertificateIssuers(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/issuers'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateIssuerListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Sets the specified certificate issuer. + * + * The SetCertificateIssuer operation adds or updates the specified certificate + * issuer. This operation requires the certificates/setissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @param {string} provider The issuer provider. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.credentials] The credentials to be used for the + * issuer. + * + * @param {string} [options.credentials.accountId] The user name/account + * name/account id. + * + * @param {string} [options.credentials.password] The password/secret/account + * key. + * + * @param {object} [options.organizationDetails] Details of the organization as + * provided to the issuer. + * + * @param {string} [options.organizationDetails.id] Id of the organization. + * + * @param {array} [options.organizationDetails.adminDetails] Details of the + * organization administrator. + * + * @param {object} [options.attributes] Attributes of the issuer object. + * + * @param {boolean} [options.attributes.enabled] Determines whether the issuer + * is enabled. + * + * @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 IssuerBundle} 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 _setCertificateIssuer(vaultBaseUrl, issuerName, provider, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let credentials = (options && options.credentials !== undefined) ? options.credentials : undefined; + let organizationDetails = (options && options.organizationDetails !== undefined) ? options.organizationDetails : undefined; + let attributes = (options && options.attributes !== undefined) ? options.attributes : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (issuerName === null || issuerName === undefined || typeof issuerName.valueOf() !== 'string') { + throw new Error('issuerName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (provider === null || provider === undefined || typeof provider.valueOf() !== 'string') { + throw new Error('provider cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameter; + if ((provider !== null && provider !== undefined) || (credentials !== null && credentials !== undefined) || (organizationDetails !== null && organizationDetails !== undefined) || (attributes !== null && attributes !== undefined)) { + parameter = new client.models['CertificateIssuerSetParameters'](); + parameter.provider = provider; + parameter.credentials = credentials; + parameter.organizationDetails = organizationDetails; + parameter.attributes = attributes; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/issuers/{issuer-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{issuer-name}', encodeURIComponent(issuerName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameter !== null && parameter !== undefined) { + let requestModelMapper = new client.models['CertificateIssuerSetParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameter, 'parameter'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameter, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['IssuerBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Updates the specified certificate issuer. + * + * The UpdateCertificateIssuer operation performs an update on the specified + * certificate issuer entity. This operation requires the + * certificates/setissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.provider] The issuer provider. + * + * @param {object} [options.credentials] The credentials to be used for the + * issuer. + * + * @param {string} [options.credentials.accountId] The user name/account + * name/account id. + * + * @param {string} [options.credentials.password] The password/secret/account + * key. + * + * @param {object} [options.organizationDetails] Details of the organization as + * provided to the issuer. + * + * @param {string} [options.organizationDetails.id] Id of the organization. + * + * @param {array} [options.organizationDetails.adminDetails] Details of the + * organization administrator. + * + * @param {object} [options.attributes] Attributes of the issuer object. + * + * @param {boolean} [options.attributes.enabled] Determines whether the issuer + * is enabled. + * + * @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 IssuerBundle} 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 _updateCertificateIssuer(vaultBaseUrl, issuerName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let provider = (options && options.provider !== undefined) ? options.provider : undefined; + let credentials = (options && options.credentials !== undefined) ? options.credentials : undefined; + let organizationDetails = (options && options.organizationDetails !== undefined) ? options.organizationDetails : undefined; + let attributes = (options && options.attributes !== undefined) ? options.attributes : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (issuerName === null || issuerName === undefined || typeof issuerName.valueOf() !== 'string') { + throw new Error('issuerName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (provider !== null && provider !== undefined && typeof provider.valueOf() !== 'string') { + throw new Error('provider must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameter; + if ((provider !== null && provider !== undefined) || (credentials !== null && credentials !== undefined) || (organizationDetails !== null && organizationDetails !== undefined) || (attributes !== null && attributes !== undefined)) { + parameter = new client.models['CertificateIssuerUpdateParameters'](); + parameter.provider = provider; + parameter.credentials = credentials; + parameter.organizationDetails = organizationDetails; + parameter.attributes = attributes; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/issuers/{issuer-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{issuer-name}', encodeURIComponent(issuerName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameter !== null && parameter !== undefined) { + let requestModelMapper = new client.models['CertificateIssuerUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameter, 'parameter'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameter, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['IssuerBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists the specified certificate issuer. + * + * The GetCertificateIssuer operation returns the specified certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @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 IssuerBundle} 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 _getCertificateIssuer(vaultBaseUrl, issuerName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (issuerName === null || issuerName === undefined || typeof issuerName.valueOf() !== 'string') { + throw new Error('issuerName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/issuers/{issuer-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{issuer-name}', encodeURIComponent(issuerName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['IssuerBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes the specified certificate issuer. + * + * The DeleteCertificateIssuer operation permanently removes the specified + * certificate issuer from the vault. This operation requires the + * certificates/manageissuers/deleteissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @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 IssuerBundle} 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 _deleteCertificateIssuer(vaultBaseUrl, issuerName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (issuerName === null || issuerName === undefined || typeof issuerName.valueOf() !== 'string') { + throw new Error('issuerName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/issuers/{issuer-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{issuer-name}', encodeURIComponent(issuerName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['IssuerBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Creates a new certificate. + * + * If this is the first version, the certificate resource is created. This + * operation requires the certificates/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 CertificateOperation} 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 _createCertificate(vaultBaseUrl, certificateName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let certificatePolicy = (options && options.certificatePolicy !== undefined) ? options.certificatePolicy : undefined; + let certificateAttributes = (options && options.certificateAttributes !== undefined) ? options.certificateAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (certificateName !== null && certificateName !== undefined) { + if (certificateName.match(/^[0-9a-zA-Z-]+$/) === null) + { + throw new Error('"certificateName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z-]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((certificatePolicy !== null && certificatePolicy !== undefined) || (certificateAttributes !== null && certificateAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['CertificateCreateParameters'](); + parameters.certificatePolicy = certificatePolicy; + parameters.certificateAttributes = certificateAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/create'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CertificateCreateParameters']().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 !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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 === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['CertificateOperation']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Imports a certificate into a specified key vault. + * + * Imports an existing valid certificate, containing a private key, into Azure + * Key Vault. The certificate to be imported can be in either PFX or PEM + * format. If the certificate is in PEM format the PEM file must contain the + * key as well as x509 certificates. This operation requires the + * certificates/import permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {string} base64EncodedCertificate Base64 encoded representation of + * the certificate object to import. This certificate needs to contain the + * private key. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.password] If the private key in + * base64EncodedCertificate is encrypted, the password used for encryption. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 CertificateBundle} 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 _importCertificate(vaultBaseUrl, certificateName, base64EncodedCertificate, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let password = (options && options.password !== undefined) ? options.password : undefined; + let certificatePolicy = (options && options.certificatePolicy !== undefined) ? options.certificatePolicy : undefined; + let certificateAttributes = (options && options.certificateAttributes !== undefined) ? options.certificateAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (certificateName !== null && certificateName !== undefined) { + if (certificateName.match(/^[0-9a-zA-Z-]+$/) === null) + { + throw new Error('"certificateName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z-]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (base64EncodedCertificate === null || base64EncodedCertificate === undefined || typeof base64EncodedCertificate.valueOf() !== 'string') { + throw new Error('base64EncodedCertificate cannot be null or undefined and it must be of type string.'); + } + if (password !== null && password !== undefined && typeof password.valueOf() !== 'string') { + throw new Error('password must be of type string.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((base64EncodedCertificate !== null && base64EncodedCertificate !== undefined) || (password !== null && password !== undefined) || (certificatePolicy !== null && certificatePolicy !== undefined) || (certificateAttributes !== null && certificateAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['CertificateImportParameters'](); + parameters.base64EncodedCertificate = base64EncodedCertificate; + parameters.password = password; + parameters.certificatePolicy = certificatePolicy; + parameters.certificateAttributes = certificateAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/import'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CertificateImportParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List the versions of a certificate. + * + * The GetCertificateVersions operation returns the versions of a certificate + * in the specified key vault. This operation requires the certificates/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 CertificateListResult} 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 _getCertificateVersions(vaultBaseUrl, certificateName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/versions'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists the policy for a certificate. + * + * The GetCertificatePolicy operation returns the specified certificate policy + * resources in the specified key vault. This operation requires the + * certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in a given key + * vault. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link CertificatePolicy} 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 _getCertificatePolicy(vaultBaseUrl, certificateName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/policy'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificatePolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Updates the policy for a certificate. + * + * Set specified members in the certificate policy. Leave others as null. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given + * vault. + * + * @param {object} certificatePolicy The policy for the certificate. + * + * @param {object} [certificatePolicy.keyProperties] Properties of the key + * backing a certificate. + * + * @param {boolean} [certificatePolicy.keyProperties.exportable] Indicates if + * the private key can be exported. + * + * @param {string} [certificatePolicy.keyProperties.keyType] The type of key + * pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [certificatePolicy.keyProperties.keySize] The key size in + * bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [certificatePolicy.keyProperties.reuseKey] Indicates if the + * same key pair will be used on certificate renewal. + * + * @param {string} [certificatePolicy.keyProperties.curve] Elliptic curve name. + * For valid values, see JsonWebKeyCurveName. Possible values include: 'P-256', + * 'P-384', 'P-521', 'P-256K' + * + * @param {object} [certificatePolicy.secretProperties] Properties of the + * secret backing a certificate. + * + * @param {string} [certificatePolicy.secretProperties.contentType] The media + * type (MIME type). + * + * @param {object} [certificatePolicy.x509CertificateProperties] Properties of + * the X509 component of a certificate. + * + * @param {string} [certificatePolicy.x509CertificateProperties.subject] The + * subject name. Should be a valid X509 distinguished Name. + * + * @param {array} [certificatePolicy.x509CertificateProperties.ekus] The + * enhanced key usage. + * + * @param {object} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames] The + * subject alternative names. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} [certificatePolicy.x509CertificateProperties.keyUsage] List + * of key usages. + * + * @param {number} + * [certificatePolicy.x509CertificateProperties.validityInMonths] The duration + * that the certificate is valid in months. + * + * @param {array} [certificatePolicy.lifetimeActions] Actions that will be + * performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [certificatePolicy.issuerParameters] Parameters for the + * issuer of the X509 component of a certificate. + * + * @param {string} [certificatePolicy.issuerParameters.name] Name of the + * referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [certificatePolicy.issuerParameters.certificateType] Type of + * certificate to be requested from the issuer provider. + * + * @param {boolean} + * [certificatePolicy.issuerParameters.certificateTransparency] Indicates if + * the certificates generated under this policy should be published to + * certificate transparency logs. + * + * @param {object} [certificatePolicy.attributes] The certificate attributes. + * + * @param {boolean} [certificatePolicy.attributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [certificatePolicy.attributes.notBefore] Not before date in + * UTC. + * + * @param {date} [certificatePolicy.attributes.expires] Expiry date in UTC. + * + * @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 CertificatePolicy} 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 _updateCertificatePolicy(vaultBaseUrl, certificateName, certificatePolicy, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (certificatePolicy === null || certificatePolicy === undefined) { + throw new Error('certificatePolicy cannot be null or undefined.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/policy'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (certificatePolicy !== null && certificatePolicy !== undefined) { + let requestModelMapper = new client.models['CertificatePolicy']().mapper(); + requestModel = client.serialize(requestModelMapper, certificatePolicy, 'certificatePolicy'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(certificatePolicy, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificatePolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Updates the specified attributes associated with the given + * certificate. + * + * The UpdateCertificate operation applies the specified update on the given + * certificate; the only elements updated are the certificate's attributes. + * This operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given key + * vault. + * + * @param {string} certificateVersion The version of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 CertificateBundle} 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 _updateCertificate(vaultBaseUrl, certificateName, certificateVersion, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let certificatePolicy = (options && options.certificatePolicy !== undefined) ? options.certificatePolicy : undefined; + let certificateAttributes = (options && options.certificateAttributes !== undefined) ? options.certificateAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (certificateVersion === null || certificateVersion === undefined || typeof certificateVersion.valueOf() !== 'string') { + throw new Error('certificateVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((certificatePolicy !== null && certificatePolicy !== undefined) || (certificateAttributes !== null && certificateAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['CertificateUpdateParameters'](); + parameters.certificatePolicy = certificatePolicy; + parameters.certificateAttributes = certificateAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/{certificate-version}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + requestUrl = requestUrl.replace('{certificate-version}', encodeURIComponent(certificateVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CertificateUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets information about a certificate. + * + * Gets information about a specific certificate. This operation requires the + * certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given + * vault. + * + * @param {string} certificateVersion The version of the certificate. + * + * @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 CertificateBundle} 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 _getCertificate(vaultBaseUrl, certificateName, certificateVersion, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (certificateVersion === null || certificateVersion === undefined || typeof certificateVersion.valueOf() !== 'string') { + throw new Error('certificateVersion cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/{certificate-version}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + requestUrl = requestUrl.replace('{certificate-version}', encodeURIComponent(certificateVersion)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Updates a certificate operation. + * + * Updates a certificate creation operation that is already in progress. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {boolean} cancellationRequested Indicates if cancellation was + * requested on the certificate 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 CertificateOperation} 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 _updateCertificateOperation(vaultBaseUrl, certificateName, cancellationRequested, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (cancellationRequested === null || cancellationRequested === undefined || typeof cancellationRequested !== 'boolean') { + throw new Error('cancellationRequested cannot be null or undefined and it must be of type boolean.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let certificateOperation; + if (cancellationRequested !== null && cancellationRequested !== undefined) { + certificateOperation = new client.models['CertificateOperationUpdateParameter'](); + certificateOperation.cancellationRequested = cancellationRequested; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/pending'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (certificateOperation !== null && certificateOperation !== undefined) { + let requestModelMapper = new client.models['CertificateOperationUpdateParameter']().mapper(); + requestModel = client.serialize(requestModelMapper, certificateOperation, 'certificateOperation'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(certificateOperation, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateOperation']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets the creation operation of a certificate. + * + * Gets the creation operation associated with a specified certificate. This + * operation requires the certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 CertificateOperation} 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 _getCertificateOperation(vaultBaseUrl, certificateName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/pending'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateOperation']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Deletes the creation operation for a specific certificate. + * + * Deletes the creation operation for a specified certificate that is in the + * process of being created. The certificate is no longer created. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 CertificateOperation} 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 _deleteCertificateOperation(vaultBaseUrl, certificateName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/pending'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateOperation']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Merges a certificate or a certificate chain with a key pair + * existing on the server. + * + * The MergeCertificate operation performs the merging of a certificate or + * certificate chain with a key pair currently available in the service. This + * operation requires the certificates/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {array} x509Certificates The certificate or the certificate chain to + * merge. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 CertificateBundle} 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 _mergeCertificate(vaultBaseUrl, certificateName, x509Certificates, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let certificateAttributes = (options && options.certificateAttributes !== undefined) ? options.certificateAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (!Array.isArray(x509Certificates)) { + throw new Error('x509Certificates cannot be null or undefined and it must be of type array.'); + } + for (let i = 0; i < x509Certificates.length; i++) { + if (x509Certificates[i] && !Buffer.isBuffer(x509Certificates[i])) { + throw new Error('x509Certificates[i] must be of type buffer.'); + } + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((x509Certificates !== null && x509Certificates !== undefined) || (certificateAttributes !== null && certificateAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['CertificateMergeParameters'](); + parameters.x509Certificates = x509Certificates; + parameters.certificateAttributes = certificateAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/pending/merge'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CertificateMergeParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['CertificateBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Backs up the specified certificate. + * + * Requests that a backup of the specified certificate be downloaded to the + * client. All versions of the certificate will be downloaded. This operation + * requires the certificates/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 BackupCertificateResult} 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 _backupCertificate(vaultBaseUrl, certificateName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/{certificate-name}/backup'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['BackupCertificateResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Restores a backed up certificate to a vault. + * + * Restores a backed up certificate, and all its versions, to a vault. This + * operation requires the certificates/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} certificateBundleBackup The backup blob associated with a + * certificate bundle. + * + * @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 CertificateBundle} 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 _restoreCertificate(vaultBaseUrl, certificateBundleBackup, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (!Buffer.isBuffer(certificateBundleBackup)) { + throw new Error('certificateBundleBackup cannot be null or undefined and it must be of type buffer.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if (certificateBundleBackup !== null && certificateBundleBackup !== undefined) { + parameters = new client.models['CertificateRestoreParameters'](); + parameters.certificateBundleBackup = certificateBundleBackup; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'certificates/restore'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CertificateRestoreParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists the deleted certificates in the specified vault currently + * available for recovery. + * + * The GetDeletedCertificates operation retrieves the certificates in the + * current vault which are in a deleted state and ready for recovery or + * purging. This operation includes deletion-specific information. This + * operation requires the certificates/get/list permission. This operation can + * only be enabled on soft-delete enabled vaults. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @param {boolean} [options.includePending] Specifies whether to include + * certificates which are not completely provisioned. + * + * @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 DeletedCertificateListResult} 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 _getDeletedCertificates(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + let includePending = (options && options.includePending !== undefined) ? options.includePending : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (includePending !== null && includePending !== undefined && typeof includePending !== 'boolean') { + throw new Error('includePending must be of type boolean.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedcertificates'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + if (includePending !== null && includePending !== undefined) { + queryParameters.push('includePending=' + encodeURIComponent(includePending.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedCertificateListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Retrieves information about the specified deleted certificate. + * + * The GetDeletedCertificate operation retrieves the deleted certificate + * information plus its attributes, such as retention interval, scheduled + * permanent deletion and the current deletion recovery level. This operation + * requires the certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate + * + * @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 DeletedCertificateBundle} 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 _getDeletedCertificate(vaultBaseUrl, certificateName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedcertificates/{certificate-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedCertificateBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Permanently deletes the specified deleted certificate. + * + * The PurgeDeletedCertificate operation performs an irreversible deletion of + * the specified certificate, without possibility for recovery. The operation + * is not available if the recovery level does not specify 'Purgeable'. This + * operation requires the certificate/purge permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate + * + * @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 _purgeDeletedCertificate(vaultBaseUrl, certificateName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedcertificates/{certificate-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.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 !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Recovers the deleted certificate back to its current version under + * /certificates. + * + * The RecoverDeletedCertificate operation performs the reversal of the Delete + * operation. The operation is applicable in vaults enabled for soft-delete, + * and must be issued during the retention interval (available in the deleted + * certificate's attributes). This operation requires the certificates/recover + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the deleted certificate + * + * @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 CertificateBundle} 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 _recoverDeletedCertificate(vaultBaseUrl, certificateName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedcertificates/{certificate-name}/recover'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{certificate-name}', encodeURIComponent(certificateName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateBundle']().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); + }); +} + +/** + * List storage accounts managed by the specified key vault. This operation + * requires the storage/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 StorageListResult} 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 _getStorageAccounts(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['StorageListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists deleted storage accounts for the specified vault. + * + * The Get Deleted Storage Accounts operation returns the storage accounts that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 DeletedStorageListResult} 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 _getDeletedStorageAccounts(vaultBaseUrl, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedstorage'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedStorageListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets the specified deleted storage account. + * + * The Get Deleted Storage Account operation returns the specified deleted + * storage account along with its attributes. This operation requires the + * storage/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 DeletedStorageBundle} 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 _getDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedstorage/{storage-account-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedStorageBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Permanently deletes the specified storage account. + * + * The purge deleted storage account operation removes the secret permanently, + * without the possibility of recovery. This operation can only be performed on + * a soft-delete enabled vault. This operation requires the storage/purge + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 _purgeDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedstorage/{storage-account-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.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 !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Recovers the deleted storage account. + * + * Recovers the deleted storage account in the specified vault. This operation + * can only be performed on a soft-delete enabled vault. This operation + * requires the storage/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 StorageBundle} 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 _recoverDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedstorage/{storage-account-name}/recover'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['StorageBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Backs up the specified storage account. + * + * Requests that a backup of the specified storage account be downloaded to the + * client. This operation requires the storage/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 BackupStorageResult} 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 _backupStorageAccount(vaultBaseUrl, storageAccountName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}/backup'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['BackupStorageResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Restores a backed up storage account to a vault. + * + * Restores a backed up storage account to a vault. This operation requires the + * storage/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} storageBundleBackup The backup blob associated with a + * storage account. + * + * @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 StorageBundle} 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 _restoreStorageAccount(vaultBaseUrl, storageBundleBackup, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (!Buffer.isBuffer(storageBundleBackup)) { + throw new Error('storageBundleBackup cannot be null or undefined and it must be of type buffer.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if (storageBundleBackup !== null && storageBundleBackup !== undefined) { + parameters = new client.models['StorageRestoreParameters'](); + parameters.storageBundleBackup = storageBundleBackup; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/restore'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['StorageRestoreParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['StorageBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a storage account. This operation requires the storage/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 DeletedStorageBundle} 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 _deleteStorageAccount(vaultBaseUrl, storageAccountName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedStorageBundle']().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 a specified storage account. This operation requires + * the storage/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 StorageBundle} 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 _getStorageAccount(vaultBaseUrl, storageAccountName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['StorageBundle']().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); + }); +} + +/** + * Creates or updates a new storage account. This operation requires the + * storage/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} resourceId Storage account resource id. + * + * @param {string} activeKeyName Current active storage account key name. + * + * @param {boolean} autoRegenerateKey whether keyvault should manage the + * storage account for the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.regenerationPeriod] The key regeneration time + * duration specified in ISO-8601 format. + * + * @param {object} [options.storageAccountAttributes] The attributes of the + * storage account. + * + * @param {boolean} [options.storageAccountAttributes.enabled] the enabled + * state of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 StorageBundle} 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 _setStorageAccount(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let regenerationPeriod = (options && options.regenerationPeriod !== undefined) ? options.regenerationPeriod : undefined; + let storageAccountAttributes = (options && options.storageAccountAttributes !== undefined) ? options.storageAccountAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (resourceId === null || resourceId === undefined || typeof resourceId.valueOf() !== 'string') { + throw new Error('resourceId cannot be null or undefined and it must be of type string.'); + } + if (activeKeyName === null || activeKeyName === undefined || typeof activeKeyName.valueOf() !== 'string') { + throw new Error('activeKeyName cannot be null or undefined and it must be of type string.'); + } + if (autoRegenerateKey === null || autoRegenerateKey === undefined || typeof autoRegenerateKey !== 'boolean') { + throw new Error('autoRegenerateKey cannot be null or undefined and it must be of type boolean.'); + } + if (regenerationPeriod !== null && regenerationPeriod !== undefined && typeof regenerationPeriod.valueOf() !== 'string') { + throw new Error('regenerationPeriod must be of type string.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((resourceId !== null && resourceId !== undefined) || (activeKeyName !== null && activeKeyName !== undefined) || (autoRegenerateKey !== null && autoRegenerateKey !== undefined) || (regenerationPeriod !== null && regenerationPeriod !== undefined) || (storageAccountAttributes !== null && storageAccountAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['StorageAccountCreateParameters'](); + parameters.resourceId = resourceId; + parameters.activeKeyName = activeKeyName; + parameters.autoRegenerateKey = autoRegenerateKey; + parameters.regenerationPeriod = regenerationPeriod; + parameters.storageAccountAttributes = storageAccountAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['StorageAccountCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['StorageBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates the specified attributes associated with the given storage account. + * This operation requires the storage/set/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.activeKeyName] The current active storage account + * key name. + * + * @param {boolean} [options.autoRegenerateKey] whether keyvault should manage + * the storage account for the user. + * + * @param {string} [options.regenerationPeriod] The key regeneration time + * duration specified in ISO-8601 format. + * + * @param {object} [options.storageAccountAttributes] The attributes of the + * storage account. + * + * @param {boolean} [options.storageAccountAttributes.enabled] the enabled + * state of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 StorageBundle} 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 _updateStorageAccount(vaultBaseUrl, storageAccountName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let activeKeyName = (options && options.activeKeyName !== undefined) ? options.activeKeyName : undefined; + let autoRegenerateKey = (options && options.autoRegenerateKey !== undefined) ? options.autoRegenerateKey : undefined; + let regenerationPeriod = (options && options.regenerationPeriod !== undefined) ? options.regenerationPeriod : undefined; + let storageAccountAttributes = (options && options.storageAccountAttributes !== undefined) ? options.storageAccountAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (activeKeyName !== null && activeKeyName !== undefined && typeof activeKeyName.valueOf() !== 'string') { + throw new Error('activeKeyName must be of type string.'); + } + if (autoRegenerateKey !== null && autoRegenerateKey !== undefined && typeof autoRegenerateKey !== 'boolean') { + throw new Error('autoRegenerateKey must be of type boolean.'); + } + if (regenerationPeriod !== null && regenerationPeriod !== undefined && typeof regenerationPeriod.valueOf() !== 'string') { + throw new Error('regenerationPeriod must be of type string.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((activeKeyName !== null && activeKeyName !== undefined) || (autoRegenerateKey !== null && autoRegenerateKey !== undefined) || (regenerationPeriod !== null && regenerationPeriod !== undefined) || (storageAccountAttributes !== null && storageAccountAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['StorageAccountUpdateParameters'](); + parameters.activeKeyName = activeKeyName; + parameters.autoRegenerateKey = autoRegenerateKey; + parameters.regenerationPeriod = regenerationPeriod; + parameters.storageAccountAttributes = storageAccountAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['StorageAccountUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['StorageBundle']().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); + }); +} + +/** + * Regenerates the specified key value for the given storage account. This + * operation requires the storage/regeneratekey permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} keyName The storage account key name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link StorageBundle} 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 _regenerateStorageAccountKey(vaultBaseUrl, storageAccountName, keyName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (keyName === null || keyName === undefined || typeof keyName.valueOf() !== 'string') { + throw new Error('keyName cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if (keyName !== null && keyName !== undefined) { + parameters = new client.models['StorageAccountRegenerteKeyParameters'](); + parameters.keyName = keyName; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}/regeneratekey'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['StorageAccountRegenerteKeyParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['StorageBundle']().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); + }); +} + +/** + * List storage SAS definitions for the given storage account. This operation + * requires the storage/listsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 SasDefinitionListResult} 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 _getSasDefinitions(vaultBaseUrl, storageAccountName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}/sas'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SasDefinitionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists deleted SAS definitions for the specified vault and storage + * account. + * + * The Get Deleted Sas Definitions operation returns the SAS definitions that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/listsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 DeletedSasDefinitionListResult} 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 _getDeletedSasDefinitions(vaultBaseUrl, storageAccountName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let maxresults = (options && options.maxresults !== undefined) ? options.maxresults : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (maxresults !== null && maxresults !== undefined && typeof maxresults !== 'number') { + throw new Error('maxresults must be of type number.'); + } + if (maxresults !== null && maxresults !== undefined) { + if (maxresults > 25) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMaximum": 25'); + } + if (maxresults < 1) + { + throw new Error('"maxresults" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedstorage/{storage-account-name}/sas'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + let queryParameters = []; + if (maxresults !== null && maxresults !== undefined) { + queryParameters.push('maxresults=' + encodeURIComponent(maxresults.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedSasDefinitionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Gets the specified deleted sas definition. + * + * The Get Deleted SAS Definition operation returns the specified deleted SAS + * definition along with its attributes. This operation requires the + * storage/getsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedSasDefinitionBundle} 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 _getDeletedSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (sasDefinitionName === null || sasDefinitionName === undefined || typeof sasDefinitionName.valueOf() !== 'string') { + throw new Error('sasDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (sasDefinitionName !== null && sasDefinitionName !== undefined) { + if (sasDefinitionName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"sasDefinitionName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedstorage/{storage-account-name}/sas/{sas-definition-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + requestUrl = requestUrl.replace('{sas-definition-name}', encodeURIComponent(sasDefinitionName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedSasDefinitionBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Recovers the deleted SAS definition. + * + * Recovers the deleted SAS definition for the specified storage account. This + * operation can only be performed on a soft-delete enabled vault. This + * operation requires the storage/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SasDefinitionBundle} 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 _recoverDeletedSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (sasDefinitionName === null || sasDefinitionName === undefined || typeof sasDefinitionName.valueOf() !== 'string') { + throw new Error('sasDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (sasDefinitionName !== null && sasDefinitionName !== undefined) { + if (sasDefinitionName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"sasDefinitionName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + requestUrl = requestUrl.replace('{sas-definition-name}', encodeURIComponent(sasDefinitionName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SasDefinitionBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a SAS definition from a specified storage account. This operation + * requires the storage/deletesas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DeletedSasDefinitionBundle} 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 _deleteSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (sasDefinitionName === null || sasDefinitionName === undefined || typeof sasDefinitionName.valueOf() !== 'string') { + throw new Error('sasDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (sasDefinitionName !== null && sasDefinitionName !== undefined) { + if (sasDefinitionName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"sasDefinitionName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}/sas/{sas-definition-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + requestUrl = requestUrl.replace('{sas-definition-name}', encodeURIComponent(sasDefinitionName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedSasDefinitionBundle']().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 a SAS definition for the specified storage account. + * This operation requires the storage/getsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SasDefinitionBundle} 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 _getSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (sasDefinitionName === null || sasDefinitionName === undefined || typeof sasDefinitionName.valueOf() !== 'string') { + throw new Error('sasDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (sasDefinitionName !== null && sasDefinitionName !== undefined) { + if (sasDefinitionName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"sasDefinitionName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}/sas/{sas-definition-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + requestUrl = requestUrl.replace('{sas-definition-name}', encodeURIComponent(sasDefinitionName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SasDefinitionBundle']().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); + }); +} + +/** + * Creates or updates a new SAS definition for the specified storage account. + * This operation requires the storage/setsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {string} templateUri The SAS definition token template signed with an + * arbitrary key. Tokens created according to the SAS definition will have the + * same properties as the template. + * + * @param {string} sasType The type of SAS token the SAS definition will + * create. Possible values include: 'account', 'service' + * + * @param {string} validityPeriod The validity period of SAS tokens created + * according to the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.sasDefinitionAttributes] The attributes of the SAS + * definition. + * + * @param {boolean} [options.sasDefinitionAttributes.enabled] the enabled state + * of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 SasDefinitionBundle} 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 _setSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, templateUri, sasType, validityPeriod, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let sasDefinitionAttributes = (options && options.sasDefinitionAttributes !== undefined) ? options.sasDefinitionAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (sasDefinitionName === null || sasDefinitionName === undefined || typeof sasDefinitionName.valueOf() !== 'string') { + throw new Error('sasDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (sasDefinitionName !== null && sasDefinitionName !== undefined) { + if (sasDefinitionName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"sasDefinitionName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (templateUri === null || templateUri === undefined || typeof templateUri.valueOf() !== 'string') { + throw new Error('templateUri cannot be null or undefined and it must be of type string.'); + } + if (sasType === null || sasType === undefined || typeof sasType.valueOf() !== 'string') { + throw new Error('sasType cannot be null or undefined and it must be of type string.'); + } + if (validityPeriod === null || validityPeriod === undefined || typeof validityPeriod.valueOf() !== 'string') { + throw new Error('validityPeriod cannot be null or undefined and it must be of type string.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((templateUri !== null && templateUri !== undefined) || (sasType !== null && sasType !== undefined) || (validityPeriod !== null && validityPeriod !== undefined) || (sasDefinitionAttributes !== null && sasDefinitionAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['SasDefinitionCreateParameters'](); + parameters.templateUri = templateUri; + parameters.sasType = sasType; + parameters.validityPeriod = validityPeriod; + parameters.sasDefinitionAttributes = sasDefinitionAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}/sas/{sas-definition-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + requestUrl = requestUrl.replace('{sas-definition-name}', encodeURIComponent(sasDefinitionName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SasDefinitionCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SasDefinitionBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates the specified attributes associated with the given SAS definition. + * This operation requires the storage/setsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.templateUri] The SAS definition token template + * signed with an arbitrary key. Tokens created according to the SAS + * definition will have the same properties as the template. + * + * @param {string} [options.sasType] The type of SAS token the SAS definition + * will create. Possible values include: 'account', 'service' + * + * @param {string} [options.validityPeriod] The validity period of SAS tokens + * created according to the SAS definition. + * + * @param {object} [options.sasDefinitionAttributes] The attributes of the SAS + * definition. + * + * @param {boolean} [options.sasDefinitionAttributes.enabled] the enabled state + * of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 SasDefinitionBundle} 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 _updateSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let templateUri = (options && options.templateUri !== undefined) ? options.templateUri : undefined; + let sasType = (options && options.sasType !== undefined) ? options.sasType : undefined; + let validityPeriod = (options && options.validityPeriod !== undefined) ? options.validityPeriod : undefined; + let sasDefinitionAttributes = (options && options.sasDefinitionAttributes !== undefined) ? options.sasDefinitionAttributes : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // Validate + try { + if (vaultBaseUrl === null || vaultBaseUrl === undefined || typeof vaultBaseUrl.valueOf() !== 'string') { + throw new Error('vaultBaseUrl cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName === null || storageAccountName === undefined || typeof storageAccountName.valueOf() !== 'string') { + throw new Error('storageAccountName cannot be null or undefined and it must be of type string.'); + } + if (storageAccountName !== null && storageAccountName !== undefined) { + if (storageAccountName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"storageAccountName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (sasDefinitionName === null || sasDefinitionName === undefined || typeof sasDefinitionName.valueOf() !== 'string') { + throw new Error('sasDefinitionName cannot be null or undefined and it must be of type string.'); + } + if (sasDefinitionName !== null && sasDefinitionName !== undefined) { + if (sasDefinitionName.match(/^[0-9a-zA-Z]+$/) === null) + { + throw new Error('"sasDefinitionName" should satisfy the constraint - "Pattern": /^[0-9a-zA-Z]+$/'); + } + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (templateUri !== null && templateUri !== undefined && typeof templateUri.valueOf() !== 'string') { + throw new Error('templateUri must be of type string.'); + } + if (sasType !== null && sasType !== undefined && typeof sasType.valueOf() !== 'string') { + throw new Error('sasType must be of type string.'); + } + if (validityPeriod !== null && validityPeriod !== undefined && typeof validityPeriod.valueOf() !== 'string') { + throw new Error('validityPeriod must be of type string.'); + } + if (tags && typeof tags === 'object') { + for(let valueElement in tags) { + if (tags[valueElement] !== null && tags[valueElement] !== undefined && typeof tags[valueElement].valueOf() !== 'string') { + throw new Error('tags[valueElement] must be of type string.'); + } + } + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let parameters; + if ((templateUri !== null && templateUri !== undefined) || (sasType !== null && sasType !== undefined) || (validityPeriod !== null && validityPeriod !== undefined) || (sasDefinitionAttributes !== null && sasDefinitionAttributes !== undefined) || (tags !== null && tags !== undefined)) { + parameters = new client.models['SasDefinitionUpdateParameters'](); + parameters.templateUri = templateUri; + parameters.sasType = sasType; + parameters.validityPeriod = validityPeriod; + parameters.sasDefinitionAttributes = sasDefinitionAttributes; + parameters.tags = tags; + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'storage/{storage-account-name}/sas/{sas-definition-name}'; + requestUrl = requestUrl.replace('{vaultBaseUrl}', vaultBaseUrl); + requestUrl = requestUrl.replace('{storage-account-name}', encodeURIComponent(storageAccountName)); + requestUrl = requestUrl.replace('{sas-definition-name}', encodeURIComponent(sasDefinitionName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SasDefinitionUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SasDefinitionBundle']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Retrieves a list of individual key versions with the same key name. + * + * The full key identifier, attributes, and tags are provided in the response. + * This operation requires the keys/list permission. + * + * @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 KeyListResult} 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 _getKeyVersionsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a stored key. The LIST operation is + * applicable to all key types, however only the base key identifier, + * attributes, and tags are provided in the response. Individual versions of a + * key are not listed in the response. This operation requires the keys/list + * permission. + * + * @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 KeyListResult} 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 _getKeysNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['KeyListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists the deleted keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a deleted key. This operation includes + * deletion-specific information. The Get Deleted Keys operation is applicable + * for vaults enabled for soft-delete. While the operation can be invoked on + * any vault, it will return an error if invoked on a non soft-delete enabled + * vault. This operation requires the keys/list permission. + * + * @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 DeletedKeyListResult} 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 _getDeletedKeysNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedKeyListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List secrets in a specified key vault. + * + * The Get Secrets operation is applicable to the entire vault. However, only + * the base secret identifier and its attributes are provided in the response. + * Individual secret versions are not listed in the response. This operation + * requires the secrets/list permission. + * + * @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 SecretListResult} 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 _getSecretsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SecretListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List all versions of the specified secret. + * + * The full secret identifier and attributes are provided in the response. No + * values are returned for the secrets. This operations requires the + * secrets/list permission. + * + * @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 SecretListResult} 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 _getSecretVersionsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SecretListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists deleted secrets for the specified vault. + * + * The Get Deleted Secrets operation returns the secrets that have been deleted + * for a vault enabled for soft-delete. This operation requires the + * secrets/list permission. + * + * @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 DeletedSecretListResult} 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 _getDeletedSecretsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedSecretListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List certificates in a specified key vault + * + * The GetCertificates operation returns the set of certificates resources in + * the specified key vault. This operation requires the certificates/list + * permission. + * + * @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 CertificateListResult} 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 _getCertificatesNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List certificate issuers for a specified key vault. + * + * The GetCertificateIssuers operation returns the set of certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @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 CertificateIssuerListResult} 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 _getCertificateIssuersNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateIssuerListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary List the versions of a certificate. + * + * The GetCertificateVersions operation returns the versions of a certificate + * in the specified key vault. This operation requires the certificates/list + * permission. + * + * @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 CertificateListResult} 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 _getCertificateVersionsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['CertificateListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists the deleted certificates in the specified vault currently + * available for recovery. + * + * The GetDeletedCertificates operation retrieves the certificates in the + * current vault which are in a deleted state and ready for recovery or + * purging. This operation includes deletion-specific information. This + * operation requires the certificates/get/list permission. This operation can + * only be enabled on soft-delete enabled vaults. + * + * @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 DeletedCertificateListResult} 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 _getDeletedCertificatesNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedCertificateListResult']().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); + }); +} + +/** + * List storage accounts managed by the specified key vault. This operation + * requires the storage/list permission. + * + * @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 StorageListResult} 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 _getStorageAccountsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['StorageListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists deleted storage accounts for the specified vault. + * + * The Get Deleted Storage Accounts operation returns the storage accounts that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/list permission. + * + * @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 DeletedStorageListResult} 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 _getDeletedStorageAccountsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedStorageListResult']().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); + }); +} + +/** + * List storage SAS definitions for the given storage account. This operation + * requires the storage/listsas permission. + * + * @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 SasDefinitionListResult} 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 _getSasDefinitionsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['SasDefinitionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Lists deleted SAS definitions for the specified vault and storage + * account. + * + * The Get Deleted Sas Definitions operation returns the SAS definitions that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/listsas permission. + * + * @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 DeletedSasDefinitionListResult} 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 _getDeletedSasDefinitionsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this; + 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.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['KeyVaultError']().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['DeletedSasDefinitionListResult']().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 KeyVaultClient. */ +class KeyVaultClient extends ServiceClient { + /** + * Create a KeyVaultClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '7.0'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = '{vaultBaseUrl}'; + this.credentials = credentials; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.models = models; + this._createKey = _createKey; + this._importKey = _importKey; + this._deleteKey = _deleteKey; + this._updateKey = _updateKey; + this._getKey = _getKey; + this._getKeyVersions = _getKeyVersions; + this._getKeys = _getKeys; + this._backupKey = _backupKey; + this._restoreKey = _restoreKey; + this._encrypt = _encrypt; + this._decrypt = _decrypt; + this._sign = _sign; + this._verify = _verify; + this._wrapKey = _wrapKey; + this._unwrapKey = _unwrapKey; + this._getDeletedKeys = _getDeletedKeys; + this._getDeletedKey = _getDeletedKey; + this._purgeDeletedKey = _purgeDeletedKey; + this._recoverDeletedKey = _recoverDeletedKey; + this._setSecret = _setSecret; + this._deleteSecret = _deleteSecret; + this._updateSecret = _updateSecret; + this._getSecret = _getSecret; + this._getSecrets = _getSecrets; + this._getSecretVersions = _getSecretVersions; + this._getDeletedSecrets = _getDeletedSecrets; + this._getDeletedSecret = _getDeletedSecret; + this._purgeDeletedSecret = _purgeDeletedSecret; + this._recoverDeletedSecret = _recoverDeletedSecret; + this._backupSecret = _backupSecret; + this._restoreSecret = _restoreSecret; + this._getCertificates = _getCertificates; + this._deleteCertificate = _deleteCertificate; + this._setCertificateContacts = _setCertificateContacts; + this._getCertificateContacts = _getCertificateContacts; + this._deleteCertificateContacts = _deleteCertificateContacts; + this._getCertificateIssuers = _getCertificateIssuers; + this._setCertificateIssuer = _setCertificateIssuer; + this._updateCertificateIssuer = _updateCertificateIssuer; + this._getCertificateIssuer = _getCertificateIssuer; + this._deleteCertificateIssuer = _deleteCertificateIssuer; + this._createCertificate = _createCertificate; + this._importCertificate = _importCertificate; + this._getCertificateVersions = _getCertificateVersions; + this._getCertificatePolicy = _getCertificatePolicy; + this._updateCertificatePolicy = _updateCertificatePolicy; + this._updateCertificate = _updateCertificate; + this._getCertificate = _getCertificate; + this._updateCertificateOperation = _updateCertificateOperation; + this._getCertificateOperation = _getCertificateOperation; + this._deleteCertificateOperation = _deleteCertificateOperation; + this._mergeCertificate = _mergeCertificate; + this._backupCertificate = _backupCertificate; + this._restoreCertificate = _restoreCertificate; + this._getDeletedCertificates = _getDeletedCertificates; + this._getDeletedCertificate = _getDeletedCertificate; + this._purgeDeletedCertificate = _purgeDeletedCertificate; + this._recoverDeletedCertificate = _recoverDeletedCertificate; + this._getStorageAccounts = _getStorageAccounts; + this._getDeletedStorageAccounts = _getDeletedStorageAccounts; + this._getDeletedStorageAccount = _getDeletedStorageAccount; + this._purgeDeletedStorageAccount = _purgeDeletedStorageAccount; + this._recoverDeletedStorageAccount = _recoverDeletedStorageAccount; + this._backupStorageAccount = _backupStorageAccount; + this._restoreStorageAccount = _restoreStorageAccount; + this._deleteStorageAccount = _deleteStorageAccount; + this._getStorageAccount = _getStorageAccount; + this._setStorageAccount = _setStorageAccount; + this._updateStorageAccount = _updateStorageAccount; + this._regenerateStorageAccountKey = _regenerateStorageAccountKey; + this._getSasDefinitions = _getSasDefinitions; + this._getDeletedSasDefinitions = _getDeletedSasDefinitions; + this._getDeletedSasDefinition = _getDeletedSasDefinition; + this._recoverDeletedSasDefinition = _recoverDeletedSasDefinition; + this._deleteSasDefinition = _deleteSasDefinition; + this._getSasDefinition = _getSasDefinition; + this._setSasDefinition = _setSasDefinition; + this._updateSasDefinition = _updateSasDefinition; + this._getKeyVersionsNext = _getKeyVersionsNext; + this._getKeysNext = _getKeysNext; + this._getDeletedKeysNext = _getDeletedKeysNext; + this._getSecretsNext = _getSecretsNext; + this._getSecretVersionsNext = _getSecretVersionsNext; + this._getDeletedSecretsNext = _getDeletedSecretsNext; + this._getCertificatesNext = _getCertificatesNext; + this._getCertificateIssuersNext = _getCertificateIssuersNext; + this._getCertificateVersionsNext = _getCertificateVersionsNext; + this._getDeletedCertificatesNext = _getDeletedCertificatesNext; + this._getStorageAccountsNext = _getStorageAccountsNext; + this._getDeletedStorageAccountsNext = _getDeletedStorageAccountsNext; + this._getSasDefinitionsNext = _getSasDefinitionsNext; + this._getDeletedSasDefinitionsNext = _getDeletedSasDefinitionsNext; + msRest.addSerializationMixin(this); + } + + /** + * @summary Creates a new key, stores it, then returns key parameters and + * attributes to the client. + * + * The create key operation can be used to create any key type in Azure Key + * Vault. If the named key already exists, Azure Key Vault creates a new + * version of the key. It requires the keys/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name for the new key. The system will generate + * the version name for the new key. + * + * @param {string} kty The type of key to create. For valid values, see + * JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', + * 'oct' + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.keySize] The key size in bits. For example: 2048, + * 3072, or 4096 for RSA. + * + * @param {array} [options.keyOps] + * + * @param {object} [options.keyAttributes] + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @param {string} [options.curve] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * + * @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. + */ + createKeyWithHttpOperationResponse(vaultBaseUrl, keyName, kty, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._createKey(vaultBaseUrl, keyName, kty, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates a new key, stores it, then returns key parameters and + * attributes to the client. + * + * The create key operation can be used to create any key type in Azure Key + * Vault. If the named key already exists, Azure Key Vault creates a new + * version of the key. It requires the keys/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name for the new key. The system will generate + * the version name for the new key. + * + * @param {string} kty The type of key to create. For valid values, see + * JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', + * 'oct' + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.keySize] The key size in bits. For example: 2048, + * 3072, or 4096 for RSA. + * + * @param {array} [options.keyOps] + * + * @param {object} [options.keyAttributes] + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @param {string} [options.curve] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * + * @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 {KeyBundle} - 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 KeyBundle} 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. + */ + createKey(vaultBaseUrl, keyName, kty, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createKey(vaultBaseUrl, keyName, kty, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createKey(vaultBaseUrl, keyName, kty, options, optionalCallback); + } + } + + /** + * @summary Imports an externally created key, stores it, and returns key + * parameters and attributes to the client. + * + * The import key operation may be used to import any key type into an Azure + * Key Vault. If the named key already exists, Azure Key Vault creates a new + * version of the key. This operation requires the keys/import permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName Name for the imported key. + * + * @param {object} key The Json web key + * + * @param {string} [key.kid] Key identifier. + * + * @param {string} [key.kty] JsonWebKey Key Type (kty), as defined in + * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Possible + * values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {array} [key.keyOps] + * + * @param {buffer} [key.n] RSA modulus. + * + * @param {buffer} [key.e] RSA public exponent. + * + * @param {buffer} [key.d] RSA private exponent, or the D component of an EC + * private key. + * + * @param {buffer} [key.dp] RSA private key parameter. + * + * @param {buffer} [key.dq] RSA private key parameter. + * + * @param {buffer} [key.qi] RSA private key parameter. + * + * @param {buffer} [key.p] RSA secret prime. + * + * @param {buffer} [key.q] RSA secret prime, with p < q. + * + * @param {buffer} [key.k] Symmetric key. + * + * @param {buffer} [key.t] HSM Token, used with 'Bring Your Own Key'. + * + * @param {string} [key.crv] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * + * @param {buffer} [key.x] X component of an EC public key. + * + * @param {buffer} [key.y] Y component of an EC public key. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.hsm] Whether to import as a hardware key (HSM) or + * software key. + * + * @param {object} [options.keyAttributes] The key management attributes. + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + importKeyWithHttpOperationResponse(vaultBaseUrl, keyName, key, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._importKey(vaultBaseUrl, keyName, key, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Imports an externally created key, stores it, and returns key + * parameters and attributes to the client. + * + * The import key operation may be used to import any key type into an Azure + * Key Vault. If the named key already exists, Azure Key Vault creates a new + * version of the key. This operation requires the keys/import permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName Name for the imported key. + * + * @param {object} key The Json web key + * + * @param {string} [key.kid] Key identifier. + * + * @param {string} [key.kty] JsonWebKey Key Type (kty), as defined in + * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Possible + * values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {array} [key.keyOps] + * + * @param {buffer} [key.n] RSA modulus. + * + * @param {buffer} [key.e] RSA public exponent. + * + * @param {buffer} [key.d] RSA private exponent, or the D component of an EC + * private key. + * + * @param {buffer} [key.dp] RSA private key parameter. + * + * @param {buffer} [key.dq] RSA private key parameter. + * + * @param {buffer} [key.qi] RSA private key parameter. + * + * @param {buffer} [key.p] RSA secret prime. + * + * @param {buffer} [key.q] RSA secret prime, with p < q. + * + * @param {buffer} [key.k] Symmetric key. + * + * @param {buffer} [key.t] HSM Token, used with 'Bring Your Own Key'. + * + * @param {string} [key.crv] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * + * @param {buffer} [key.x] X component of an EC public key. + * + * @param {buffer} [key.y] Y component of an EC public key. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.hsm] Whether to import as a hardware key (HSM) or + * software key. + * + * @param {object} [options.keyAttributes] The key management attributes. + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {KeyBundle} - 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 KeyBundle} 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. + */ + importKey(vaultBaseUrl, keyName, key, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._importKey(vaultBaseUrl, keyName, key, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._importKey(vaultBaseUrl, keyName, key, options, optionalCallback); + } + } + + /** + * @summary Deletes a key of any type from storage in Azure Key Vault. + * + * The delete key operation cannot be used to remove individual versions of a + * key. This operation removes the cryptographic material associated with the + * key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or + * Encrypt/Decrypt operations. This operation requires the keys/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key 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. + */ + deleteKeyWithHttpOperationResponse(vaultBaseUrl, keyName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._deleteKey(vaultBaseUrl, keyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes a key of any type from storage in Azure Key Vault. + * + * The delete key operation cannot be used to remove individual versions of a + * key. This operation removes the cryptographic material associated with the + * key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or + * Encrypt/Decrypt operations. This operation requires the keys/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key 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 {DeletedKeyBundle} - 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 DeletedKeyBundle} 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. + */ + deleteKey(vaultBaseUrl, keyName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteKey(vaultBaseUrl, keyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteKey(vaultBaseUrl, keyName, options, optionalCallback); + } + } + + /** + * @summary The update key operation changes specified attributes of a stored + * key and can be applied to any key type and key version stored in Azure Key + * Vault. + * + * In order to perform this operation, the key must already exist in the Key + * Vault. Note: The cryptographic material of a key itself cannot be changed. + * This operation requires the keys/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of key to update. + * + * @param {string} keyVersion The version of the key to update. + * + * @param {object} [options] Optional Parameters. + * + * @param {array} [options.keyOps] Json web key operations. For more + * information on possible key operations, see JsonWebKeyOperation. + * + * @param {object} [options.keyAttributes] + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + updateKeyWithHttpOperationResponse(vaultBaseUrl, keyName, keyVersion, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._updateKey(vaultBaseUrl, keyName, keyVersion, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary The update key operation changes specified attributes of a stored + * key and can be applied to any key type and key version stored in Azure Key + * Vault. + * + * In order to perform this operation, the key must already exist in the Key + * Vault. Note: The cryptographic material of a key itself cannot be changed. + * This operation requires the keys/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of key to update. + * + * @param {string} keyVersion The version of the key to update. + * + * @param {object} [options] Optional Parameters. + * + * @param {array} [options.keyOps] Json web key operations. For more + * information on possible key operations, see JsonWebKeyOperation. + * + * @param {object} [options.keyAttributes] + * + * @param {boolean} [options.keyAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.keyAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.keyAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {KeyBundle} - 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 KeyBundle} 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. + */ + updateKey(vaultBaseUrl, keyName, keyVersion, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateKey(vaultBaseUrl, keyName, keyVersion, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateKey(vaultBaseUrl, keyName, keyVersion, options, optionalCallback); + } + } + + /** + * @summary Gets the public part of a stored key. + * + * The get key operation is applicable to all key types. If the requested key + * is symmetric, then no key material is released in the response. This + * operation requires the keys/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key to get. + * + * @param {string} keyVersion Adding the version parameter retrieves a specific + * version of a key. + * + * @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. + */ + getKeyWithHttpOperationResponse(vaultBaseUrl, keyName, keyVersion, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getKey(vaultBaseUrl, keyName, keyVersion, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the public part of a stored key. + * + * The get key operation is applicable to all key types. If the requested key + * is symmetric, then no key material is released in the response. This + * operation requires the keys/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key to get. + * + * @param {string} keyVersion Adding the version parameter retrieves a specific + * version of a key. + * + * @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 {KeyBundle} - 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 KeyBundle} 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. + */ + getKey(vaultBaseUrl, keyName, keyVersion, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getKey(vaultBaseUrl, keyName, keyVersion, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getKey(vaultBaseUrl, keyName, keyVersion, options, optionalCallback); + } + } + + /** + * @summary Retrieves a list of individual key versions with the same key name. + * + * The full key identifier, attributes, and tags are provided in the response. + * This operation requires the keys/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getKeyVersionsWithHttpOperationResponse(vaultBaseUrl, keyName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getKeyVersions(vaultBaseUrl, keyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves a list of individual key versions with the same key name. + * + * The full key identifier, attributes, and tags are provided in the response. + * This operation requires the keys/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {KeyListResult} - 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 KeyListResult} 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. + */ + getKeyVersions(vaultBaseUrl, keyName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getKeyVersions(vaultBaseUrl, keyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getKeyVersions(vaultBaseUrl, keyName, options, optionalCallback); + } + } + + /** + * @summary List keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a stored key. The LIST operation is + * applicable to all key types, however only the base key identifier, + * attributes, and tags are provided in the response. Individual versions of a + * key are not listed in the response. This operation requires the keys/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getKeysWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getKeys(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a stored key. The LIST operation is + * applicable to all key types, however only the base key identifier, + * attributes, and tags are provided in the response. Individual versions of a + * key are not listed in the response. This operation requires the keys/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {KeyListResult} - 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 KeyListResult} 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. + */ + getKeys(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getKeys(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getKeys(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary Requests that a backup of the specified key be downloaded to the + * client. + * + * The Key Backup operation exports a key from Azure Key Vault in a protected + * form. Note that this operation does NOT return key material in a form that + * can be used outside the Azure Key Vault system, the returned key material is + * either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The + * intent of this operation is to allow a client to GENERATE a key in one Azure + * Key Vault instance, BACKUP the key, and then RESTORE it into another Azure + * Key Vault instance. The BACKUP operation may be used to export, in protected + * form, any key type from Azure Key Vault. Individual versions of a key cannot + * be backed up. BACKUP / RESTORE can be performed within geographical + * boundaries only; meaning that a BACKUP from one geographical area cannot be + * restored to another geographical area. For example, a backup from the US + * geographical area cannot be restored in an EU geographical area. This + * operation requires the key/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @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. + */ + backupKeyWithHttpOperationResponse(vaultBaseUrl, keyName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._backupKey(vaultBaseUrl, keyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Requests that a backup of the specified key be downloaded to the + * client. + * + * The Key Backup operation exports a key from Azure Key Vault in a protected + * form. Note that this operation does NOT return key material in a form that + * can be used outside the Azure Key Vault system, the returned key material is + * either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The + * intent of this operation is to allow a client to GENERATE a key in one Azure + * Key Vault instance, BACKUP the key, and then RESTORE it into another Azure + * Key Vault instance. The BACKUP operation may be used to export, in protected + * form, any key type from Azure Key Vault. Individual versions of a key cannot + * be backed up. BACKUP / RESTORE can be performed within geographical + * boundaries only; meaning that a BACKUP from one geographical area cannot be + * restored to another geographical area. For example, a backup from the US + * geographical area cannot be restored in an EU geographical area. This + * operation requires the key/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @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 {BackupKeyResult} - 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 BackupKeyResult} 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. + */ + backupKey(vaultBaseUrl, keyName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._backupKey(vaultBaseUrl, keyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._backupKey(vaultBaseUrl, keyName, options, optionalCallback); + } + } + + /** + * @summary Restores a backed up key to a vault. + * + * Imports a previously backed up key into Azure Key Vault, restoring the key, + * its key identifier, attributes and access control policies. The RESTORE + * operation may be used to import a previously backed up key. Individual + * versions of a key cannot be restored. The key is restored in its entirety + * with the same key name as it had when it was backed up. If the key name is + * not available in the target Key Vault, the RESTORE operation will be + * rejected. While the key name is retained during restore, the final key + * identifier will change if the key is restored to a different vault. Restore + * will restore all versions and preserve version identifiers. The RESTORE + * operation is subject to security constraints: The target Key Vault must be + * owned by the same Microsoft Azure Subscription as the source Key Vault The + * user must have RESTORE permission in the target Key Vault. This operation + * requires the keys/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} keyBundleBackup The backup blob associated with a key + * bundle. + * + * @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. + */ + restoreKeyWithHttpOperationResponse(vaultBaseUrl, keyBundleBackup, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._restoreKey(vaultBaseUrl, keyBundleBackup, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Restores a backed up key to a vault. + * + * Imports a previously backed up key into Azure Key Vault, restoring the key, + * its key identifier, attributes and access control policies. The RESTORE + * operation may be used to import a previously backed up key. Individual + * versions of a key cannot be restored. The key is restored in its entirety + * with the same key name as it had when it was backed up. If the key name is + * not available in the target Key Vault, the RESTORE operation will be + * rejected. While the key name is retained during restore, the final key + * identifier will change if the key is restored to a different vault. Restore + * will restore all versions and preserve version identifiers. The RESTORE + * operation is subject to security constraints: The target Key Vault must be + * owned by the same Microsoft Azure Subscription as the source Key Vault The + * user must have RESTORE permission in the target Key Vault. This operation + * requires the keys/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} keyBundleBackup The backup blob associated with a key + * bundle. + * + * @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 {KeyBundle} - 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 KeyBundle} 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. + */ + restoreKey(vaultBaseUrl, keyBundleBackup, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._restoreKey(vaultBaseUrl, keyBundleBackup, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._restoreKey(vaultBaseUrl, keyBundleBackup, options, optionalCallback); + } + } + + /** + * @summary Encrypts an arbitrary sequence of bytes using an encryption key + * that is stored in a key vault. + * + * The ENCRYPT operation encrypts an arbitrary sequence of bytes using an + * encryption key that is stored in Azure Key Vault. Note that the ENCRYPT + * operation only supports a single block of data, the size of which is + * dependent on the target key and the encryption algorithm to be used. The + * ENCRYPT operation is only strictly necessary for symmetric keys stored in + * Azure Key Vault since protection with an asymmetric key can be performed + * using public portion of the key. This operation is supported for asymmetric + * keys as a convenience for callers that have a key-reference but do not have + * access to the public key material. This operation requires the keys/encrypt + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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. + */ + encryptWithHttpOperationResponse(vaultBaseUrl, keyName, keyVersion, algorithm, value, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._encrypt(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Encrypts an arbitrary sequence of bytes using an encryption key + * that is stored in a key vault. + * + * The ENCRYPT operation encrypts an arbitrary sequence of bytes using an + * encryption key that is stored in Azure Key Vault. Note that the ENCRYPT + * operation only supports a single block of data, the size of which is + * dependent on the target key and the encryption algorithm to be used. The + * ENCRYPT operation is only strictly necessary for symmetric keys stored in + * Azure Key Vault since protection with an asymmetric key can be performed + * using public portion of the key. This operation is supported for asymmetric + * keys as a convenience for callers that have a key-reference but do not have + * access to the public key material. This operation requires the keys/encrypt + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 {KeyOperationResult} - 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 KeyOperationResult} 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. + */ + encrypt(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._encrypt(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._encrypt(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, optionalCallback); + } + } + + /** + * @summary Decrypts a single block of encrypted data. + * + * The DECRYPT operation decrypts a well-formed block of ciphertext using the + * target encryption key and specified algorithm. This operation is the reverse + * of the ENCRYPT operation; only a single block of data may be decrypted, the + * size of this block is dependent on the target key and the algorithm to be + * used. The DECRYPT operation applies to asymmetric and symmetric keys stored + * in Azure Key Vault since it uses the private portion of the key. This + * operation requires the keys/decrypt permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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. + */ + decryptWithHttpOperationResponse(vaultBaseUrl, keyName, keyVersion, algorithm, value, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._decrypt(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Decrypts a single block of encrypted data. + * + * The DECRYPT operation decrypts a well-formed block of ciphertext using the + * target encryption key and specified algorithm. This operation is the reverse + * of the ENCRYPT operation; only a single block of data may be decrypted, the + * size of this block is dependent on the target key and the algorithm to be + * used. The DECRYPT operation applies to asymmetric and symmetric keys stored + * in Azure Key Vault since it uses the private portion of the key. This + * operation requires the keys/decrypt permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 {KeyOperationResult} - 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 KeyOperationResult} 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. + */ + decrypt(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._decrypt(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._decrypt(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, optionalCallback); + } + } + + /** + * @summary Creates a signature from a digest using the specified key. + * + * The SIGN operation is applicable to asymmetric and symmetric keys stored in + * Azure Key Vault since this operation uses the private portion of the key. + * This operation requires the keys/sign permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm The signing/verification algorithm identifier. For + * more information on possible algorithm types, see + * JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', + * 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', + * 'ES256K' + * + * @param {buffer} value + * + * @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. + */ + signWithHttpOperationResponse(vaultBaseUrl, keyName, keyVersion, algorithm, value, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._sign(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates a signature from a digest using the specified key. + * + * The SIGN operation is applicable to asymmetric and symmetric keys stored in + * Azure Key Vault since this operation uses the private portion of the key. + * This operation requires the keys/sign permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm The signing/verification algorithm identifier. For + * more information on possible algorithm types, see + * JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', + * 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', + * 'ES256K' + * + * @param {buffer} value + * + * @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 {KeyOperationResult} - 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 KeyOperationResult} 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. + */ + sign(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._sign(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._sign(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, optionalCallback); + } + } + + /** + * @summary Verifies a signature using a specified key. + * + * The VERIFY operation is applicable to symmetric keys stored in Azure Key + * Vault. VERIFY is not strictly necessary for asymmetric keys stored in Azure + * Key Vault since signature verification can be performed using the public + * portion of the key but this operation is supported as a convenience for + * callers that only have a key-reference and not the public portion of the + * key. This operation requires the keys/verify permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm The signing/verification algorithm. For more + * information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + * Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', + * 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' + * + * @param {buffer} digest The digest used for signing. + * + * @param {buffer} signature The signature to be verified. + * + * @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. + */ + verifyWithHttpOperationResponse(vaultBaseUrl, keyName, keyVersion, algorithm, digest, signature, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._verify(vaultBaseUrl, keyName, keyVersion, algorithm, digest, signature, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Verifies a signature using a specified key. + * + * The VERIFY operation is applicable to symmetric keys stored in Azure Key + * Vault. VERIFY is not strictly necessary for asymmetric keys stored in Azure + * Key Vault since signature verification can be performed using the public + * portion of the key but this operation is supported as a convenience for + * callers that only have a key-reference and not the public portion of the + * key. This operation requires the keys/verify permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm The signing/verification algorithm. For more + * information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + * Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', + * 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' + * + * @param {buffer} digest The digest used for signing. + * + * @param {buffer} signature The signature to be verified. + * + * @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 {KeyVerifyResult} - 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 KeyVerifyResult} 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. + */ + verify(vaultBaseUrl, keyName, keyVersion, algorithm, digest, signature, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._verify(vaultBaseUrl, keyName, keyVersion, algorithm, digest, signature, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._verify(vaultBaseUrl, keyName, keyVersion, algorithm, digest, signature, options, optionalCallback); + } + } + + /** + * @summary Wraps a symmetric key using a specified key. + * + * The WRAP operation supports encryption of a symmetric key using a key + * encryption key that has previously been stored in an Azure Key Vault. The + * WRAP operation is only strictly necessary for symmetric keys stored in Azure + * Key Vault since protection with an asymmetric key can be performed using the + * public portion of the key. This operation is supported for asymmetric keys + * as a convenience for callers that have a key-reference but do not have + * access to the public key material. This operation requires the keys/wrapKey + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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. + */ + wrapKeyWithHttpOperationResponse(vaultBaseUrl, keyName, keyVersion, algorithm, value, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._wrapKey(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Wraps a symmetric key using a specified key. + * + * The WRAP operation supports encryption of a symmetric key using a key + * encryption key that has previously been stored in an Azure Key Vault. The + * WRAP operation is only strictly necessary for symmetric keys stored in Azure + * Key Vault since protection with an asymmetric key can be performed using the + * public portion of the key. This operation is supported for asymmetric keys + * as a convenience for callers that have a key-reference but do not have + * access to the public key material. This operation requires the keys/wrapKey + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 {KeyOperationResult} - 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 KeyOperationResult} 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. + */ + wrapKey(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._wrapKey(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._wrapKey(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, optionalCallback); + } + } + + /** + * @summary Unwraps a symmetric key using the specified key that was initially + * used for wrapping that key. + * + * The UNWRAP operation supports decryption of a symmetric key using the target + * key encryption key. This operation is the reverse of the WRAP operation. The + * UNWRAP operation applies to asymmetric and symmetric keys stored in Azure + * Key Vault since it uses the private portion of the key. This operation + * requires the keys/unwrapKey permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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. + */ + unwrapKeyWithHttpOperationResponse(vaultBaseUrl, keyName, keyVersion, algorithm, value, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._unwrapKey(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Unwraps a symmetric key using the specified key that was initially + * used for wrapping that key. + * + * The UNWRAP operation supports decryption of a symmetric key using the target + * key encryption key. This operation is the reverse of the WRAP operation. The + * UNWRAP operation applies to asymmetric and symmetric keys stored in Azure + * Key Vault since it uses the private portion of the key. This operation + * requires the keys/unwrapKey permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @param {string} keyVersion The version of the key. + * + * @param {string} algorithm algorithm identifier. Possible values include: + * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * + * @param {buffer} value + * + * @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 {KeyOperationResult} - 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 KeyOperationResult} 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. + */ + unwrapKey(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._unwrapKey(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._unwrapKey(vaultBaseUrl, keyName, keyVersion, algorithm, value, options, optionalCallback); + } + } + + /** + * @summary Lists the deleted keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a deleted key. This operation includes + * deletion-specific information. The Get Deleted Keys operation is applicable + * for vaults enabled for soft-delete. While the operation can be invoked on + * any vault, it will return an error if invoked on a non soft-delete enabled + * vault. This operation requires the keys/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getDeletedKeysWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedKeys(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists the deleted keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a deleted key. This operation includes + * deletion-specific information. The Get Deleted Keys operation is applicable + * for vaults enabled for soft-delete. While the operation can be invoked on + * any vault, it will return an error if invoked on a non soft-delete enabled + * vault. This operation requires the keys/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {DeletedKeyListResult} - 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 DeletedKeyListResult} 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. + */ + getDeletedKeys(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedKeys(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedKeys(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary Gets the public part of a deleted key. + * + * The Get Deleted Key operation is applicable for soft-delete enabled vaults. + * While the operation can be invoked on any vault, it will return an error if + * invoked on a non soft-delete enabled vault. This operation requires the + * keys/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @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. + */ + getDeletedKeyWithHttpOperationResponse(vaultBaseUrl, keyName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedKey(vaultBaseUrl, keyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the public part of a deleted key. + * + * The Get Deleted Key operation is applicable for soft-delete enabled vaults. + * While the operation can be invoked on any vault, it will return an error if + * invoked on a non soft-delete enabled vault. This operation requires the + * keys/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key. + * + * @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 {DeletedKeyBundle} - 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 DeletedKeyBundle} 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. + */ + getDeletedKey(vaultBaseUrl, keyName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedKey(vaultBaseUrl, keyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedKey(vaultBaseUrl, keyName, options, optionalCallback); + } + } + + /** + * @summary Permanently deletes the specified key. + * + * The Purge Deleted Key operation is applicable for soft-delete enabled + * vaults. While the operation can be invoked on any vault, it will return an + * error if invoked on a non soft-delete enabled vault. This operation requires + * the keys/purge permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key + * + * @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. + */ + purgeDeletedKeyWithHttpOperationResponse(vaultBaseUrl, keyName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._purgeDeletedKey(vaultBaseUrl, keyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Permanently deletes the specified key. + * + * The Purge Deleted Key operation is applicable for soft-delete enabled + * vaults. While the operation can be invoked on any vault, it will return an + * error if invoked on a non soft-delete enabled vault. This operation requires + * the keys/purge permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the key + * + * @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. + */ + purgeDeletedKey(vaultBaseUrl, keyName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._purgeDeletedKey(vaultBaseUrl, keyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._purgeDeletedKey(vaultBaseUrl, keyName, options, optionalCallback); + } + } + + /** + * @summary Recovers the deleted key to its latest version. + * + * The Recover Deleted Key operation is applicable for deleted keys in + * soft-delete enabled vaults. It recovers the deleted key back to its latest + * version under /keys. An attempt to recover an non-deleted key will return an + * error. Consider this the inverse of the delete operation on soft-delete + * enabled vaults. This operation requires the keys/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the deleted key. + * + * @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. + */ + recoverDeletedKeyWithHttpOperationResponse(vaultBaseUrl, keyName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._recoverDeletedKey(vaultBaseUrl, keyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Recovers the deleted key to its latest version. + * + * The Recover Deleted Key operation is applicable for deleted keys in + * soft-delete enabled vaults. It recovers the deleted key back to its latest + * version under /keys. An attempt to recover an non-deleted key will return an + * error. Consider this the inverse of the delete operation on soft-delete + * enabled vaults. This operation requires the keys/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} keyName The name of the deleted key. + * + * @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 {KeyBundle} - 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 KeyBundle} 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. + */ + recoverDeletedKey(vaultBaseUrl, keyName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._recoverDeletedKey(vaultBaseUrl, keyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._recoverDeletedKey(vaultBaseUrl, keyName, options, optionalCallback); + } + } + + /** + * @summary Sets a secret in a specified key vault. + * + * The SET operation adds a secret to the Azure Key Vault. If the named secret + * already exists, Azure Key Vault creates a new version of that secret. This + * operation requires the secrets/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} value The value of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @param {string} [options.contentType] Type of the secret value such as a + * password. + * + * @param {object} [options.secretAttributes] The secret management attributes. + * + * @param {boolean} [options.secretAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.secretAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.secretAttributes.expires] Expiry date in UTC. + * + * @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. + */ + setSecretWithHttpOperationResponse(vaultBaseUrl, secretName, value, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._setSecret(vaultBaseUrl, secretName, value, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Sets a secret in a specified key vault. + * + * The SET operation adds a secret to the Azure Key Vault. If the named secret + * already exists, Azure Key Vault creates a new version of that secret. This + * operation requires the secrets/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} value The value of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @param {string} [options.contentType] Type of the secret value such as a + * password. + * + * @param {object} [options.secretAttributes] The secret management attributes. + * + * @param {boolean} [options.secretAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.secretAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.secretAttributes.expires] Expiry date in UTC. + * + * @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 {SecretBundle} - 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 SecretBundle} 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. + */ + setSecret(vaultBaseUrl, secretName, value, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._setSecret(vaultBaseUrl, secretName, value, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setSecret(vaultBaseUrl, secretName, value, options, optionalCallback); + } + } + + /** + * @summary Deletes a secret from a specified key vault. + * + * The DELETE operation applies to any secret stored in Azure Key Vault. DELETE + * cannot be applied to an individual version of a secret. This operation + * requires the secrets/delete permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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. + */ + deleteSecretWithHttpOperationResponse(vaultBaseUrl, secretName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._deleteSecret(vaultBaseUrl, secretName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes a secret from a specified key vault. + * + * The DELETE operation applies to any secret stored in Azure Key Vault. DELETE + * cannot be applied to an individual version of a secret. This operation + * requires the secrets/delete permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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 {DeletedSecretBundle} - 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 DeletedSecretBundle} 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. + */ + deleteSecret(vaultBaseUrl, secretName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteSecret(vaultBaseUrl, secretName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteSecret(vaultBaseUrl, secretName, options, optionalCallback); + } + } + + /** + * @summary Updates the attributes associated with a specified secret in a + * given key vault. + * + * The UPDATE operation changes specified attributes of an existing stored + * secret. Attributes that are not specified in the request are left unchanged. + * The value of a secret itself cannot be changed. This operation requires the + * secrets/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} secretVersion The version of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.contentType] Type of the secret value such as a + * password. + * + * @param {object} [options.secretAttributes] The secret management attributes. + * + * @param {boolean} [options.secretAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.secretAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.secretAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + updateSecretWithHttpOperationResponse(vaultBaseUrl, secretName, secretVersion, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._updateSecret(vaultBaseUrl, secretName, secretVersion, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Updates the attributes associated with a specified secret in a + * given key vault. + * + * The UPDATE operation changes specified attributes of an existing stored + * secret. Attributes that are not specified in the request are left unchanged. + * The value of a secret itself cannot be changed. This operation requires the + * secrets/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} secretVersion The version of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.contentType] Type of the secret value such as a + * password. + * + * @param {object} [options.secretAttributes] The secret management attributes. + * + * @param {boolean} [options.secretAttributes.enabled] Determines whether the + * object is enabled. + * + * @param {date} [options.secretAttributes.notBefore] Not before date in UTC. + * + * @param {date} [options.secretAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {SecretBundle} - 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 SecretBundle} 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. + */ + updateSecret(vaultBaseUrl, secretName, secretVersion, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateSecret(vaultBaseUrl, secretName, secretVersion, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateSecret(vaultBaseUrl, secretName, secretVersion, options, optionalCallback); + } + } + + /** + * @summary Get a specified secret from a given key vault. + * + * The GET operation is applicable to any secret stored in Azure Key Vault. + * This operation requires the secrets/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} secretVersion The version of the secret. + * + * @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. + */ + getSecretWithHttpOperationResponse(vaultBaseUrl, secretName, secretVersion, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getSecret(vaultBaseUrl, secretName, secretVersion, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Get a specified secret from a given key vault. + * + * The GET operation is applicable to any secret stored in Azure Key Vault. + * This operation requires the secrets/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {string} secretVersion The version of the secret. + * + * @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 {SecretBundle} - 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 SecretBundle} 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. + */ + getSecret(vaultBaseUrl, secretName, secretVersion, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getSecret(vaultBaseUrl, secretName, secretVersion, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getSecret(vaultBaseUrl, secretName, secretVersion, options, optionalCallback); + } + } + + /** + * @summary List secrets in a specified key vault. + * + * The Get Secrets operation is applicable to the entire vault. However, only + * the base secret identifier and its attributes are provided in the response. + * Individual secret versions are not listed in the response. This operation + * requires the secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified, the service will return up to 25 results. + * + * @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. + */ + getSecretsWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getSecrets(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List secrets in a specified key vault. + * + * The Get Secrets operation is applicable to the entire vault. However, only + * the base secret identifier and its attributes are provided in the response. + * Individual secret versions are not listed in the response. This operation + * requires the secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified, the service will return up to 25 results. + * + * @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 {SecretListResult} - 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 SecretListResult} 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. + */ + getSecrets(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getSecrets(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getSecrets(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary List all versions of the specified secret. + * + * The full secret identifier and attributes are provided in the response. No + * values are returned for the secrets. This operations requires the + * secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified, the service will return up to 25 results. + * + * @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. + */ + getSecretVersionsWithHttpOperationResponse(vaultBaseUrl, secretName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getSecretVersions(vaultBaseUrl, secretName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List all versions of the specified secret. + * + * The full secret identifier and attributes are provided in the response. No + * values are returned for the secrets. This operations requires the + * secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified, the service will return up to 25 results. + * + * @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 {SecretListResult} - 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 SecretListResult} 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. + */ + getSecretVersions(vaultBaseUrl, secretName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getSecretVersions(vaultBaseUrl, secretName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getSecretVersions(vaultBaseUrl, secretName, options, optionalCallback); + } + } + + /** + * @summary Lists deleted secrets for the specified vault. + * + * The Get Deleted Secrets operation returns the secrets that have been deleted + * for a vault enabled for soft-delete. This operation requires the + * secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getDeletedSecretsWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedSecrets(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists deleted secrets for the specified vault. + * + * The Get Deleted Secrets operation returns the secrets that have been deleted + * for a vault enabled for soft-delete. This operation requires the + * secrets/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {DeletedSecretListResult} - 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 DeletedSecretListResult} 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. + */ + getDeletedSecrets(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedSecrets(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedSecrets(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary Gets the specified deleted secret. + * + * The Get Deleted Secret operation returns the specified deleted secret along + * with its attributes. This operation requires the secrets/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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. + */ + getDeletedSecretWithHttpOperationResponse(vaultBaseUrl, secretName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedSecret(vaultBaseUrl, secretName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the specified deleted secret. + * + * The Get Deleted Secret operation returns the specified deleted secret along + * with its attributes. This operation requires the secrets/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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 {DeletedSecretBundle} - 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 DeletedSecretBundle} 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. + */ + getDeletedSecret(vaultBaseUrl, secretName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedSecret(vaultBaseUrl, secretName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedSecret(vaultBaseUrl, secretName, options, optionalCallback); + } + } + + /** + * @summary Permanently deletes the specified secret. + * + * The purge deleted secret operation removes the secret permanently, without + * the possibility of recovery. This operation can only be enabled on a + * soft-delete enabled vault. This operation requires the secrets/purge + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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. + */ + purgeDeletedSecretWithHttpOperationResponse(vaultBaseUrl, secretName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._purgeDeletedSecret(vaultBaseUrl, secretName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Permanently deletes the specified secret. + * + * The purge deleted secret operation removes the secret permanently, without + * the possibility of recovery. This operation can only be enabled on a + * soft-delete enabled vault. This operation requires the secrets/purge + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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. + */ + purgeDeletedSecret(vaultBaseUrl, secretName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._purgeDeletedSecret(vaultBaseUrl, secretName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._purgeDeletedSecret(vaultBaseUrl, secretName, options, optionalCallback); + } + } + + /** + * @summary Recovers the deleted secret to the latest version. + * + * Recovers the deleted secret in the specified vault. This operation can only + * be performed on a soft-delete enabled vault. This operation requires the + * secrets/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the deleted secret. + * + * @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. + */ + recoverDeletedSecretWithHttpOperationResponse(vaultBaseUrl, secretName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._recoverDeletedSecret(vaultBaseUrl, secretName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Recovers the deleted secret to the latest version. + * + * Recovers the deleted secret in the specified vault. This operation can only + * be performed on a soft-delete enabled vault. This operation requires the + * secrets/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the deleted secret. + * + * @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 {SecretBundle} - 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 SecretBundle} 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. + */ + recoverDeletedSecret(vaultBaseUrl, secretName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._recoverDeletedSecret(vaultBaseUrl, secretName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._recoverDeletedSecret(vaultBaseUrl, secretName, options, optionalCallback); + } + } + + /** + * @summary Backs up the specified secret. + * + * Requests that a backup of the specified secret be downloaded to the client. + * All versions of the secret will be downloaded. This operation requires the + * secrets/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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. + */ + backupSecretWithHttpOperationResponse(vaultBaseUrl, secretName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._backupSecret(vaultBaseUrl, secretName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Backs up the specified secret. + * + * Requests that a backup of the specified secret be downloaded to the client. + * All versions of the secret will be downloaded. This operation requires the + * secrets/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} secretName The name of the secret. + * + * @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 {BackupSecretResult} - 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 BackupSecretResult} 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. + */ + backupSecret(vaultBaseUrl, secretName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._backupSecret(vaultBaseUrl, secretName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._backupSecret(vaultBaseUrl, secretName, options, optionalCallback); + } + } + + /** + * @summary Restores a backed up secret to a vault. + * + * Restores a backed up secret, and all its versions, to a vault. This + * operation requires the secrets/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} secretBundleBackup The backup blob associated with a secret + * bundle. + * + * @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. + */ + restoreSecretWithHttpOperationResponse(vaultBaseUrl, secretBundleBackup, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._restoreSecret(vaultBaseUrl, secretBundleBackup, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Restores a backed up secret to a vault. + * + * Restores a backed up secret, and all its versions, to a vault. This + * operation requires the secrets/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} secretBundleBackup The backup blob associated with a secret + * bundle. + * + * @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 {SecretBundle} - 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 SecretBundle} 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. + */ + restoreSecret(vaultBaseUrl, secretBundleBackup, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._restoreSecret(vaultBaseUrl, secretBundleBackup, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._restoreSecret(vaultBaseUrl, secretBundleBackup, options, optionalCallback); + } + } + + /** + * @summary List certificates in a specified key vault + * + * The GetCertificates operation returns the set of certificates resources in + * the specified key vault. This operation requires the certificates/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @param {boolean} [options.includePending] Specifies whether to include + * certificates which are not completely provisioned. + * + * @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. + */ + getCertificatesWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificates(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List certificates in a specified key vault + * + * The GetCertificates operation returns the set of certificates resources in + * the specified key vault. This operation requires the certificates/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @param {boolean} [options.includePending] Specifies whether to include + * certificates which are not completely provisioned. + * + * @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 {CertificateListResult} - 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 CertificateListResult} 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. + */ + getCertificates(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificates(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificates(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary Deletes a certificate from a specified key vault. + * + * Deletes all versions of a certificate object along with its associated + * policy. Delete certificate cannot be used to remove individual versions of a + * certificate object. This operation requires the certificates/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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. + */ + deleteCertificateWithHttpOperationResponse(vaultBaseUrl, certificateName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._deleteCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes a certificate from a specified key vault. + * + * Deletes all versions of a certificate object along with its associated + * policy. Delete certificate cannot be used to remove individual versions of a + * certificate object. This operation requires the certificates/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 {DeletedCertificateBundle} - 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 DeletedCertificateBundle} 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. + */ + deleteCertificate(vaultBaseUrl, certificateName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteCertificate(vaultBaseUrl, certificateName, options, optionalCallback); + } + } + + /** + * @summary Sets the certificate contacts for the specified key vault. + * + * Sets the certificate contacts for the specified key vault. This operation + * requires the certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} contacts The contacts for the key vault certificate. + * + * @param {array} [contacts.contactList] The contact list for the vault + * certificates. + * + * @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. + */ + setCertificateContactsWithHttpOperationResponse(vaultBaseUrl, contacts, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._setCertificateContacts(vaultBaseUrl, contacts, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Sets the certificate contacts for the specified key vault. + * + * Sets the certificate contacts for the specified key vault. This operation + * requires the certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} contacts The contacts for the key vault certificate. + * + * @param {array} [contacts.contactList] The contact list for the vault + * certificates. + * + * @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 {Contacts} - 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 Contacts} 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. + */ + setCertificateContacts(vaultBaseUrl, contacts, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._setCertificateContacts(vaultBaseUrl, contacts, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setCertificateContacts(vaultBaseUrl, contacts, options, optionalCallback); + } + } + + /** + * @summary Lists the certificate contacts for a specified key vault. + * + * The GetCertificateContacts operation returns the set of certificate contact + * resources in the specified key vault. This operation requires the + * certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @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. + */ + getCertificateContactsWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificateContacts(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists the certificate contacts for a specified key vault. + * + * The GetCertificateContacts operation returns the set of certificate contact + * resources in the specified key vault. This operation requires the + * certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @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 {Contacts} - 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 Contacts} 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. + */ + getCertificateContacts(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificateContacts(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificateContacts(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary Deletes the certificate contacts for a specified key vault. + * + * Deletes the certificate contacts for a specified key vault certificate. This + * operation requires the certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @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. + */ + deleteCertificateContactsWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._deleteCertificateContacts(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes the certificate contacts for a specified key vault. + * + * Deletes the certificate contacts for a specified key vault certificate. This + * operation requires the certificates/managecontacts permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @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 {Contacts} - 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 Contacts} 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. + */ + deleteCertificateContacts(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteCertificateContacts(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteCertificateContacts(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary List certificate issuers for a specified key vault. + * + * The GetCertificateIssuers operation returns the set of certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getCertificateIssuersWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificateIssuers(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List certificate issuers for a specified key vault. + * + * The GetCertificateIssuers operation returns the set of certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {CertificateIssuerListResult} - 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 CertificateIssuerListResult} 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. + */ + getCertificateIssuers(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificateIssuers(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificateIssuers(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary Sets the specified certificate issuer. + * + * The SetCertificateIssuer operation adds or updates the specified certificate + * issuer. This operation requires the certificates/setissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @param {string} provider The issuer provider. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.credentials] The credentials to be used for the + * issuer. + * + * @param {string} [options.credentials.accountId] The user name/account + * name/account id. + * + * @param {string} [options.credentials.password] The password/secret/account + * key. + * + * @param {object} [options.organizationDetails] Details of the organization as + * provided to the issuer. + * + * @param {string} [options.organizationDetails.id] Id of the organization. + * + * @param {array} [options.organizationDetails.adminDetails] Details of the + * organization administrator. + * + * @param {object} [options.attributes] Attributes of the issuer object. + * + * @param {boolean} [options.attributes.enabled] Determines whether the issuer + * is enabled. + * + * @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. + */ + setCertificateIssuerWithHttpOperationResponse(vaultBaseUrl, issuerName, provider, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._setCertificateIssuer(vaultBaseUrl, issuerName, provider, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Sets the specified certificate issuer. + * + * The SetCertificateIssuer operation adds or updates the specified certificate + * issuer. This operation requires the certificates/setissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @param {string} provider The issuer provider. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.credentials] The credentials to be used for the + * issuer. + * + * @param {string} [options.credentials.accountId] The user name/account + * name/account id. + * + * @param {string} [options.credentials.password] The password/secret/account + * key. + * + * @param {object} [options.organizationDetails] Details of the organization as + * provided to the issuer. + * + * @param {string} [options.organizationDetails.id] Id of the organization. + * + * @param {array} [options.organizationDetails.adminDetails] Details of the + * organization administrator. + * + * @param {object} [options.attributes] Attributes of the issuer object. + * + * @param {boolean} [options.attributes.enabled] Determines whether the issuer + * is enabled. + * + * @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 {IssuerBundle} - 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 IssuerBundle} 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. + */ + setCertificateIssuer(vaultBaseUrl, issuerName, provider, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._setCertificateIssuer(vaultBaseUrl, issuerName, provider, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setCertificateIssuer(vaultBaseUrl, issuerName, provider, options, optionalCallback); + } + } + + /** + * @summary Updates the specified certificate issuer. + * + * The UpdateCertificateIssuer operation performs an update on the specified + * certificate issuer entity. This operation requires the + * certificates/setissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.provider] The issuer provider. + * + * @param {object} [options.credentials] The credentials to be used for the + * issuer. + * + * @param {string} [options.credentials.accountId] The user name/account + * name/account id. + * + * @param {string} [options.credentials.password] The password/secret/account + * key. + * + * @param {object} [options.organizationDetails] Details of the organization as + * provided to the issuer. + * + * @param {string} [options.organizationDetails.id] Id of the organization. + * + * @param {array} [options.organizationDetails.adminDetails] Details of the + * organization administrator. + * + * @param {object} [options.attributes] Attributes of the issuer object. + * + * @param {boolean} [options.attributes.enabled] Determines whether the issuer + * is enabled. + * + * @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. + */ + updateCertificateIssuerWithHttpOperationResponse(vaultBaseUrl, issuerName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._updateCertificateIssuer(vaultBaseUrl, issuerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Updates the specified certificate issuer. + * + * The UpdateCertificateIssuer operation performs an update on the specified + * certificate issuer entity. This operation requires the + * certificates/setissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.provider] The issuer provider. + * + * @param {object} [options.credentials] The credentials to be used for the + * issuer. + * + * @param {string} [options.credentials.accountId] The user name/account + * name/account id. + * + * @param {string} [options.credentials.password] The password/secret/account + * key. + * + * @param {object} [options.organizationDetails] Details of the organization as + * provided to the issuer. + * + * @param {string} [options.organizationDetails.id] Id of the organization. + * + * @param {array} [options.organizationDetails.adminDetails] Details of the + * organization administrator. + * + * @param {object} [options.attributes] Attributes of the issuer object. + * + * @param {boolean} [options.attributes.enabled] Determines whether the issuer + * is enabled. + * + * @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 {IssuerBundle} - 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 IssuerBundle} 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. + */ + updateCertificateIssuer(vaultBaseUrl, issuerName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateCertificateIssuer(vaultBaseUrl, issuerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateCertificateIssuer(vaultBaseUrl, issuerName, options, optionalCallback); + } + } + + /** + * @summary Lists the specified certificate issuer. + * + * The GetCertificateIssuer operation returns the specified certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @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. + */ + getCertificateIssuerWithHttpOperationResponse(vaultBaseUrl, issuerName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificateIssuer(vaultBaseUrl, issuerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists the specified certificate issuer. + * + * The GetCertificateIssuer operation returns the specified certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @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 {IssuerBundle} - 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 IssuerBundle} 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. + */ + getCertificateIssuer(vaultBaseUrl, issuerName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificateIssuer(vaultBaseUrl, issuerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificateIssuer(vaultBaseUrl, issuerName, options, optionalCallback); + } + } + + /** + * @summary Deletes the specified certificate issuer. + * + * The DeleteCertificateIssuer operation permanently removes the specified + * certificate issuer from the vault. This operation requires the + * certificates/manageissuers/deleteissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @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. + */ + deleteCertificateIssuerWithHttpOperationResponse(vaultBaseUrl, issuerName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._deleteCertificateIssuer(vaultBaseUrl, issuerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes the specified certificate issuer. + * + * The DeleteCertificateIssuer operation permanently removes the specified + * certificate issuer from the vault. This operation requires the + * certificates/manageissuers/deleteissuers permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} issuerName The name of the issuer. + * + * @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 {IssuerBundle} - 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 IssuerBundle} 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. + */ + deleteCertificateIssuer(vaultBaseUrl, issuerName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteCertificateIssuer(vaultBaseUrl, issuerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteCertificateIssuer(vaultBaseUrl, issuerName, options, optionalCallback); + } + } + + /** + * @summary Creates a new certificate. + * + * If this is the first version, the certificate resource is created. This + * operation requires the certificates/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + createCertificateWithHttpOperationResponse(vaultBaseUrl, certificateName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._createCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates a new certificate. + * + * If this is the first version, the certificate resource is created. This + * operation requires the certificates/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {CertificateOperation} - 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 CertificateOperation} 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. + */ + createCertificate(vaultBaseUrl, certificateName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createCertificate(vaultBaseUrl, certificateName, options, optionalCallback); + } + } + + /** + * @summary Imports a certificate into a specified key vault. + * + * Imports an existing valid certificate, containing a private key, into Azure + * Key Vault. The certificate to be imported can be in either PFX or PEM + * format. If the certificate is in PEM format the PEM file must contain the + * key as well as x509 certificates. This operation requires the + * certificates/import permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {string} base64EncodedCertificate Base64 encoded representation of + * the certificate object to import. This certificate needs to contain the + * private key. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.password] If the private key in + * base64EncodedCertificate is encrypted, the password used for encryption. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + importCertificateWithHttpOperationResponse(vaultBaseUrl, certificateName, base64EncodedCertificate, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._importCertificate(vaultBaseUrl, certificateName, base64EncodedCertificate, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Imports a certificate into a specified key vault. + * + * Imports an existing valid certificate, containing a private key, into Azure + * Key Vault. The certificate to be imported can be in either PFX or PEM + * format. If the certificate is in PEM format the PEM file must contain the + * key as well as x509 certificates. This operation requires the + * certificates/import permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {string} base64EncodedCertificate Base64 encoded representation of + * the certificate object to import. This certificate needs to contain the + * private key. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.password] If the private key in + * base64EncodedCertificate is encrypted, the password used for encryption. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {CertificateBundle} - 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 CertificateBundle} 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. + */ + importCertificate(vaultBaseUrl, certificateName, base64EncodedCertificate, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._importCertificate(vaultBaseUrl, certificateName, base64EncodedCertificate, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._importCertificate(vaultBaseUrl, certificateName, base64EncodedCertificate, options, optionalCallback); + } + } + + /** + * @summary List the versions of a certificate. + * + * The GetCertificateVersions operation returns the versions of a certificate + * in the specified key vault. This operation requires the certificates/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getCertificateVersionsWithHttpOperationResponse(vaultBaseUrl, certificateName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificateVersions(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List the versions of a certificate. + * + * The GetCertificateVersions operation returns the versions of a certificate + * in the specified key vault. This operation requires the certificates/list + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {CertificateListResult} - 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 CertificateListResult} 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. + */ + getCertificateVersions(vaultBaseUrl, certificateName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificateVersions(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificateVersions(vaultBaseUrl, certificateName, options, optionalCallback); + } + } + + /** + * @summary Lists the policy for a certificate. + * + * The GetCertificatePolicy operation returns the specified certificate policy + * resources in the specified key vault. This operation requires the + * certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in a given key + * 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. + */ + getCertificatePolicyWithHttpOperationResponse(vaultBaseUrl, certificateName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificatePolicy(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists the policy for a certificate. + * + * The GetCertificatePolicy operation returns the specified certificate policy + * resources in the specified key vault. This operation requires the + * certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in a given key + * 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 {CertificatePolicy} - 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 CertificatePolicy} 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. + */ + getCertificatePolicy(vaultBaseUrl, certificateName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificatePolicy(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificatePolicy(vaultBaseUrl, certificateName, options, optionalCallback); + } + } + + /** + * @summary Updates the policy for a certificate. + * + * Set specified members in the certificate policy. Leave others as null. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given + * vault. + * + * @param {object} certificatePolicy The policy for the certificate. + * + * @param {object} [certificatePolicy.keyProperties] Properties of the key + * backing a certificate. + * + * @param {boolean} [certificatePolicy.keyProperties.exportable] Indicates if + * the private key can be exported. + * + * @param {string} [certificatePolicy.keyProperties.keyType] The type of key + * pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [certificatePolicy.keyProperties.keySize] The key size in + * bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [certificatePolicy.keyProperties.reuseKey] Indicates if the + * same key pair will be used on certificate renewal. + * + * @param {string} [certificatePolicy.keyProperties.curve] Elliptic curve name. + * For valid values, see JsonWebKeyCurveName. Possible values include: 'P-256', + * 'P-384', 'P-521', 'P-256K' + * + * @param {object} [certificatePolicy.secretProperties] Properties of the + * secret backing a certificate. + * + * @param {string} [certificatePolicy.secretProperties.contentType] The media + * type (MIME type). + * + * @param {object} [certificatePolicy.x509CertificateProperties] Properties of + * the X509 component of a certificate. + * + * @param {string} [certificatePolicy.x509CertificateProperties.subject] The + * subject name. Should be a valid X509 distinguished Name. + * + * @param {array} [certificatePolicy.x509CertificateProperties.ekus] The + * enhanced key usage. + * + * @param {object} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames] The + * subject alternative names. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} [certificatePolicy.x509CertificateProperties.keyUsage] List + * of key usages. + * + * @param {number} + * [certificatePolicy.x509CertificateProperties.validityInMonths] The duration + * that the certificate is valid in months. + * + * @param {array} [certificatePolicy.lifetimeActions] Actions that will be + * performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [certificatePolicy.issuerParameters] Parameters for the + * issuer of the X509 component of a certificate. + * + * @param {string} [certificatePolicy.issuerParameters.name] Name of the + * referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [certificatePolicy.issuerParameters.certificateType] Type of + * certificate to be requested from the issuer provider. + * + * @param {boolean} + * [certificatePolicy.issuerParameters.certificateTransparency] Indicates if + * the certificates generated under this policy should be published to + * certificate transparency logs. + * + * @param {object} [certificatePolicy.attributes] The certificate attributes. + * + * @param {boolean} [certificatePolicy.attributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [certificatePolicy.attributes.notBefore] Not before date in + * UTC. + * + * @param {date} [certificatePolicy.attributes.expires] Expiry date in UTC. + * + * @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. + */ + updateCertificatePolicyWithHttpOperationResponse(vaultBaseUrl, certificateName, certificatePolicy, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._updateCertificatePolicy(vaultBaseUrl, certificateName, certificatePolicy, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Updates the policy for a certificate. + * + * Set specified members in the certificate policy. Leave others as null. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given + * vault. + * + * @param {object} certificatePolicy The policy for the certificate. + * + * @param {object} [certificatePolicy.keyProperties] Properties of the key + * backing a certificate. + * + * @param {boolean} [certificatePolicy.keyProperties.exportable] Indicates if + * the private key can be exported. + * + * @param {string} [certificatePolicy.keyProperties.keyType] The type of key + * pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [certificatePolicy.keyProperties.keySize] The key size in + * bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [certificatePolicy.keyProperties.reuseKey] Indicates if the + * same key pair will be used on certificate renewal. + * + * @param {string} [certificatePolicy.keyProperties.curve] Elliptic curve name. + * For valid values, see JsonWebKeyCurveName. Possible values include: 'P-256', + * 'P-384', 'P-521', 'P-256K' + * + * @param {object} [certificatePolicy.secretProperties] Properties of the + * secret backing a certificate. + * + * @param {string} [certificatePolicy.secretProperties.contentType] The media + * type (MIME type). + * + * @param {object} [certificatePolicy.x509CertificateProperties] Properties of + * the X509 component of a certificate. + * + * @param {string} [certificatePolicy.x509CertificateProperties.subject] The + * subject name. Should be a valid X509 distinguished Name. + * + * @param {array} [certificatePolicy.x509CertificateProperties.ekus] The + * enhanced key usage. + * + * @param {object} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames] The + * subject alternative names. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} [certificatePolicy.x509CertificateProperties.keyUsage] List + * of key usages. + * + * @param {number} + * [certificatePolicy.x509CertificateProperties.validityInMonths] The duration + * that the certificate is valid in months. + * + * @param {array} [certificatePolicy.lifetimeActions] Actions that will be + * performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [certificatePolicy.issuerParameters] Parameters for the + * issuer of the X509 component of a certificate. + * + * @param {string} [certificatePolicy.issuerParameters.name] Name of the + * referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [certificatePolicy.issuerParameters.certificateType] Type of + * certificate to be requested from the issuer provider. + * + * @param {boolean} + * [certificatePolicy.issuerParameters.certificateTransparency] Indicates if + * the certificates generated under this policy should be published to + * certificate transparency logs. + * + * @param {object} [certificatePolicy.attributes] The certificate attributes. + * + * @param {boolean} [certificatePolicy.attributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [certificatePolicy.attributes.notBefore] Not before date in + * UTC. + * + * @param {date} [certificatePolicy.attributes.expires] Expiry date in UTC. + * + * @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 {CertificatePolicy} - 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 CertificatePolicy} 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. + */ + updateCertificatePolicy(vaultBaseUrl, certificateName, certificatePolicy, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateCertificatePolicy(vaultBaseUrl, certificateName, certificatePolicy, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateCertificatePolicy(vaultBaseUrl, certificateName, certificatePolicy, options, optionalCallback); + } + } + + /** + * @summary Updates the specified attributes associated with the given + * certificate. + * + * The UpdateCertificate operation applies the specified update on the given + * certificate; the only elements updated are the certificate's attributes. + * This operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given key + * vault. + * + * @param {string} certificateVersion The version of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + updateCertificateWithHttpOperationResponse(vaultBaseUrl, certificateName, certificateVersion, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._updateCertificate(vaultBaseUrl, certificateName, certificateVersion, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Updates the specified attributes associated with the given + * certificate. + * + * The UpdateCertificate operation applies the specified update on the given + * certificate; the only elements updated are the certificate's attributes. + * This operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given key + * vault. + * + * @param {string} certificateVersion The version of the certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificatePolicy] The management policy for the + * certificate. + * + * @param {object} [options.certificatePolicy.keyProperties] Properties of the + * key backing a certificate. + * + * @param {boolean} [options.certificatePolicy.keyProperties.exportable] + * Indicates if the private key can be exported. + * + * @param {string} [options.certificatePolicy.keyProperties.keyType] The type + * of key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * + * @param {number} [options.certificatePolicy.keyProperties.keySize] The key + * size in bits. For example: 2048, 3072, or 4096 for RSA. + * + * @param {boolean} [options.certificatePolicy.keyProperties.reuseKey] + * Indicates if the same key pair will be used on certificate renewal. + * + * @param {string} [options.certificatePolicy.keyProperties.curve] Elliptic + * curve name. For valid values, see JsonWebKeyCurveName. Possible values + * include: 'P-256', 'P-384', 'P-521', 'P-256K' + * + * @param {object} [options.certificatePolicy.secretProperties] Properties of + * the secret backing a certificate. + * + * @param {string} [options.certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * + * @param {object} [options.certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * + * @param {string} + * [options.certificatePolicy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * + * @param {array} [options.certificatePolicy.x509CertificateProperties.ekus] + * The enhanced key usage. + * + * @param {object} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames] + * The subject alternative names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * + * @param {array} + * [options.certificatePolicy.x509CertificateProperties.keyUsage] List of key + * usages. + * + * @param {number} + * [options.certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * + * @param {array} [options.certificatePolicy.lifetimeActions] Actions that will + * be performed by Key Vault over the lifetime of a certificate. + * + * @param {object} [options.certificatePolicy.issuerParameters] Parameters for + * the issuer of the X509 component of a certificate. + * + * @param {string} [options.certificatePolicy.issuerParameters.name] Name of + * the referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * + * @param {string} [options.certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * + * @param {boolean} + * [options.certificatePolicy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * + * @param {object} [options.certificatePolicy.attributes] The certificate + * attributes. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {CertificateBundle} - 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 CertificateBundle} 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. + */ + updateCertificate(vaultBaseUrl, certificateName, certificateVersion, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateCertificate(vaultBaseUrl, certificateName, certificateVersion, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateCertificate(vaultBaseUrl, certificateName, certificateVersion, options, optionalCallback); + } + } + + /** + * @summary Gets information about a certificate. + * + * Gets information about a specific certificate. This operation requires the + * certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given + * vault. + * + * @param {string} certificateVersion The version of the certificate. + * + * @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. + */ + getCertificateWithHttpOperationResponse(vaultBaseUrl, certificateName, certificateVersion, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificate(vaultBaseUrl, certificateName, certificateVersion, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets information about a certificate. + * + * Gets information about a specific certificate. This operation requires the + * certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate in the given + * vault. + * + * @param {string} certificateVersion The version of the certificate. + * + * @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 {CertificateBundle} - 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 CertificateBundle} 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. + */ + getCertificate(vaultBaseUrl, certificateName, certificateVersion, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificate(vaultBaseUrl, certificateName, certificateVersion, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificate(vaultBaseUrl, certificateName, certificateVersion, options, optionalCallback); + } + } + + /** + * @summary Updates a certificate operation. + * + * Updates a certificate creation operation that is already in progress. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {boolean} cancellationRequested Indicates if cancellation was + * requested on the certificate 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. + */ + updateCertificateOperationWithHttpOperationResponse(vaultBaseUrl, certificateName, cancellationRequested, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._updateCertificateOperation(vaultBaseUrl, certificateName, cancellationRequested, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Updates a certificate operation. + * + * Updates a certificate creation operation that is already in progress. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {boolean} cancellationRequested Indicates if cancellation was + * requested on the certificate 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 {CertificateOperation} - 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 CertificateOperation} 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. + */ + updateCertificateOperation(vaultBaseUrl, certificateName, cancellationRequested, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateCertificateOperation(vaultBaseUrl, certificateName, cancellationRequested, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateCertificateOperation(vaultBaseUrl, certificateName, cancellationRequested, options, optionalCallback); + } + } + + /** + * @summary Gets the creation operation of a certificate. + * + * Gets the creation operation associated with a specified certificate. This + * operation requires the certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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. + */ + getCertificateOperationWithHttpOperationResponse(vaultBaseUrl, certificateName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificateOperation(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the creation operation of a certificate. + * + * Gets the creation operation associated with a specified certificate. This + * operation requires the certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 {CertificateOperation} - 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 CertificateOperation} 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. + */ + getCertificateOperation(vaultBaseUrl, certificateName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificateOperation(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificateOperation(vaultBaseUrl, certificateName, options, optionalCallback); + } + } + + /** + * @summary Deletes the creation operation for a specific certificate. + * + * Deletes the creation operation for a specified certificate that is in the + * process of being created. The certificate is no longer created. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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. + */ + deleteCertificateOperationWithHttpOperationResponse(vaultBaseUrl, certificateName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._deleteCertificateOperation(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes the creation operation for a specific certificate. + * + * Deletes the creation operation for a specified certificate that is in the + * process of being created. The certificate is no longer created. This + * operation requires the certificates/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 {CertificateOperation} - 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 CertificateOperation} 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. + */ + deleteCertificateOperation(vaultBaseUrl, certificateName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteCertificateOperation(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteCertificateOperation(vaultBaseUrl, certificateName, options, optionalCallback); + } + } + + /** + * @summary Merges a certificate or a certificate chain with a key pair + * existing on the server. + * + * The MergeCertificate operation performs the merging of a certificate or + * certificate chain with a key pair currently available in the service. This + * operation requires the certificates/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {array} x509Certificates The certificate or the certificate chain to + * merge. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + mergeCertificateWithHttpOperationResponse(vaultBaseUrl, certificateName, x509Certificates, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._mergeCertificate(vaultBaseUrl, certificateName, x509Certificates, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Merges a certificate or a certificate chain with a key pair + * existing on the server. + * + * The MergeCertificate operation performs the merging of a certificate or + * certificate chain with a key pair currently available in the service. This + * operation requires the certificates/create permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @param {array} x509Certificates The certificate or the certificate chain to + * merge. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.certificateAttributes] The attributes of the + * certificate (optional). + * + * @param {boolean} [options.certificateAttributes.enabled] Determines whether + * the object is enabled. + * + * @param {date} [options.certificateAttributes.notBefore] Not before date in + * UTC. + * + * @param {date} [options.certificateAttributes.expires] Expiry date in UTC. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {CertificateBundle} - 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 CertificateBundle} 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. + */ + mergeCertificate(vaultBaseUrl, certificateName, x509Certificates, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._mergeCertificate(vaultBaseUrl, certificateName, x509Certificates, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._mergeCertificate(vaultBaseUrl, certificateName, x509Certificates, options, optionalCallback); + } + } + + /** + * @summary Backs up the specified certificate. + * + * Requests that a backup of the specified certificate be downloaded to the + * client. All versions of the certificate will be downloaded. This operation + * requires the certificates/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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. + */ + backupCertificateWithHttpOperationResponse(vaultBaseUrl, certificateName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._backupCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Backs up the specified certificate. + * + * Requests that a backup of the specified certificate be downloaded to the + * client. All versions of the certificate will be downloaded. This operation + * requires the certificates/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate. + * + * @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 {BackupCertificateResult} - 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 BackupCertificateResult} 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. + */ + backupCertificate(vaultBaseUrl, certificateName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._backupCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._backupCertificate(vaultBaseUrl, certificateName, options, optionalCallback); + } + } + + /** + * @summary Restores a backed up certificate to a vault. + * + * Restores a backed up certificate, and all its versions, to a vault. This + * operation requires the certificates/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} certificateBundleBackup The backup blob associated with a + * certificate bundle. + * + * @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. + */ + restoreCertificateWithHttpOperationResponse(vaultBaseUrl, certificateBundleBackup, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._restoreCertificate(vaultBaseUrl, certificateBundleBackup, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Restores a backed up certificate to a vault. + * + * Restores a backed up certificate, and all its versions, to a vault. This + * operation requires the certificates/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} certificateBundleBackup The backup blob associated with a + * certificate bundle. + * + * @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 {CertificateBundle} - 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 CertificateBundle} 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. + */ + restoreCertificate(vaultBaseUrl, certificateBundleBackup, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._restoreCertificate(vaultBaseUrl, certificateBundleBackup, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._restoreCertificate(vaultBaseUrl, certificateBundleBackup, options, optionalCallback); + } + } + + /** + * @summary Lists the deleted certificates in the specified vault currently + * available for recovery. + * + * The GetDeletedCertificates operation retrieves the certificates in the + * current vault which are in a deleted state and ready for recovery or + * purging. This operation includes deletion-specific information. This + * operation requires the certificates/get/list permission. This operation can + * only be enabled on soft-delete enabled vaults. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @param {boolean} [options.includePending] Specifies whether to include + * certificates which are not completely provisioned. + * + * @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. + */ + getDeletedCertificatesWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedCertificates(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists the deleted certificates in the specified vault currently + * available for recovery. + * + * The GetDeletedCertificates operation retrieves the certificates in the + * current vault which are in a deleted state and ready for recovery or + * purging. This operation includes deletion-specific information. This + * operation requires the certificates/get/list permission. This operation can + * only be enabled on soft-delete enabled vaults. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @param {boolean} [options.includePending] Specifies whether to include + * certificates which are not completely provisioned. + * + * @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 {DeletedCertificateListResult} - 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 DeletedCertificateListResult} 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. + */ + getDeletedCertificates(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedCertificates(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedCertificates(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary Retrieves information about the specified deleted certificate. + * + * The GetDeletedCertificate operation retrieves the deleted certificate + * information plus its attributes, such as retention interval, scheduled + * permanent deletion and the current deletion recovery level. This operation + * requires the certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate + * + * @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. + */ + getDeletedCertificateWithHttpOperationResponse(vaultBaseUrl, certificateName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves information about the specified deleted certificate. + * + * The GetDeletedCertificate operation retrieves the deleted certificate + * information plus its attributes, such as retention interval, scheduled + * permanent deletion and the current deletion recovery level. This operation + * requires the certificates/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate + * + * @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 {DeletedCertificateBundle} - 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 DeletedCertificateBundle} 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. + */ + getDeletedCertificate(vaultBaseUrl, certificateName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedCertificate(vaultBaseUrl, certificateName, options, optionalCallback); + } + } + + /** + * @summary Permanently deletes the specified deleted certificate. + * + * The PurgeDeletedCertificate operation performs an irreversible deletion of + * the specified certificate, without possibility for recovery. The operation + * is not available if the recovery level does not specify 'Purgeable'. This + * operation requires the certificate/purge permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate + * + * @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. + */ + purgeDeletedCertificateWithHttpOperationResponse(vaultBaseUrl, certificateName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._purgeDeletedCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Permanently deletes the specified deleted certificate. + * + * The PurgeDeletedCertificate operation performs an irreversible deletion of + * the specified certificate, without possibility for recovery. The operation + * is not available if the recovery level does not specify 'Purgeable'. This + * operation requires the certificate/purge permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the certificate + * + * @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. + */ + purgeDeletedCertificate(vaultBaseUrl, certificateName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._purgeDeletedCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._purgeDeletedCertificate(vaultBaseUrl, certificateName, options, optionalCallback); + } + } + + /** + * @summary Recovers the deleted certificate back to its current version under + * /certificates. + * + * The RecoverDeletedCertificate operation performs the reversal of the Delete + * operation. The operation is applicable in vaults enabled for soft-delete, + * and must be issued during the retention interval (available in the deleted + * certificate's attributes). This operation requires the certificates/recover + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the deleted certificate + * + * @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. + */ + recoverDeletedCertificateWithHttpOperationResponse(vaultBaseUrl, certificateName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._recoverDeletedCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Recovers the deleted certificate back to its current version under + * /certificates. + * + * The RecoverDeletedCertificate operation performs the reversal of the Delete + * operation. The operation is applicable in vaults enabled for soft-delete, + * and must be issued during the retention interval (available in the deleted + * certificate's attributes). This operation requires the certificates/recover + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} certificateName The name of the deleted certificate + * + * @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 {CertificateBundle} - 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 CertificateBundle} 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. + */ + recoverDeletedCertificate(vaultBaseUrl, certificateName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._recoverDeletedCertificate(vaultBaseUrl, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._recoverDeletedCertificate(vaultBaseUrl, certificateName, options, optionalCallback); + } + } + + /** + * List storage accounts managed by the specified key vault. This operation + * requires the storage/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getStorageAccountsWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getStorageAccounts(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List storage accounts managed by the specified key vault. This operation + * requires the storage/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {StorageListResult} - 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 StorageListResult} 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. + */ + getStorageAccounts(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getStorageAccounts(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getStorageAccounts(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary Lists deleted storage accounts for the specified vault. + * + * The Get Deleted Storage Accounts operation returns the storage accounts that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getDeletedStorageAccountsWithHttpOperationResponse(vaultBaseUrl, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedStorageAccounts(vaultBaseUrl, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists deleted storage accounts for the specified vault. + * + * The Get Deleted Storage Accounts operation returns the storage accounts that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/list permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {DeletedStorageListResult} - 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 DeletedStorageListResult} 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. + */ + getDeletedStorageAccounts(vaultBaseUrl, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedStorageAccounts(vaultBaseUrl, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedStorageAccounts(vaultBaseUrl, options, optionalCallback); + } + } + + /** + * @summary Gets the specified deleted storage account. + * + * The Get Deleted Storage Account operation returns the specified deleted + * storage account along with its attributes. This operation requires the + * storage/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + getDeletedStorageAccountWithHttpOperationResponse(vaultBaseUrl, storageAccountName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the specified deleted storage account. + * + * The Get Deleted Storage Account operation returns the specified deleted + * storage account along with its attributes. This operation requires the + * storage/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 {DeletedStorageBundle} - 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 DeletedStorageBundle} 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. + */ + getDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback); + } + } + + /** + * @summary Permanently deletes the specified storage account. + * + * The purge deleted storage account operation removes the secret permanently, + * without the possibility of recovery. This operation can only be performed on + * a soft-delete enabled vault. This operation requires the storage/purge + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + purgeDeletedStorageAccountWithHttpOperationResponse(vaultBaseUrl, storageAccountName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._purgeDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Permanently deletes the specified storage account. + * + * The purge deleted storage account operation removes the secret permanently, + * without the possibility of recovery. This operation can only be performed on + * a soft-delete enabled vault. This operation requires the storage/purge + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + purgeDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._purgeDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._purgeDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback); + } + } + + /** + * @summary Recovers the deleted storage account. + * + * Recovers the deleted storage account in the specified vault. This operation + * can only be performed on a soft-delete enabled vault. This operation + * requires the storage/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + recoverDeletedStorageAccountWithHttpOperationResponse(vaultBaseUrl, storageAccountName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._recoverDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Recovers the deleted storage account. + * + * Recovers the deleted storage account in the specified vault. This operation + * can only be performed on a soft-delete enabled vault. This operation + * requires the storage/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 {StorageBundle} - 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 StorageBundle} 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. + */ + recoverDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._recoverDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._recoverDeletedStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback); + } + } + + /** + * @summary Backs up the specified storage account. + * + * Requests that a backup of the specified storage account be downloaded to the + * client. This operation requires the storage/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + backupStorageAccountWithHttpOperationResponse(vaultBaseUrl, storageAccountName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._backupStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Backs up the specified storage account. + * + * Requests that a backup of the specified storage account be downloaded to the + * client. This operation requires the storage/backup permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 {BackupStorageResult} - 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 BackupStorageResult} 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. + */ + backupStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._backupStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._backupStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback); + } + } + + /** + * @summary Restores a backed up storage account to a vault. + * + * Restores a backed up storage account to a vault. This operation requires the + * storage/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} storageBundleBackup The backup blob associated with a + * storage account. + * + * @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. + */ + restoreStorageAccountWithHttpOperationResponse(vaultBaseUrl, storageBundleBackup, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._restoreStorageAccount(vaultBaseUrl, storageBundleBackup, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Restores a backed up storage account to a vault. + * + * Restores a backed up storage account to a vault. This operation requires the + * storage/restore permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {buffer} storageBundleBackup The backup blob associated with a + * storage account. + * + * @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 {StorageBundle} - 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 StorageBundle} 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. + */ + restoreStorageAccount(vaultBaseUrl, storageBundleBackup, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._restoreStorageAccount(vaultBaseUrl, storageBundleBackup, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._restoreStorageAccount(vaultBaseUrl, storageBundleBackup, options, optionalCallback); + } + } + + /** + * Deletes a storage account. This operation requires the storage/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + deleteStorageAccountWithHttpOperationResponse(vaultBaseUrl, storageAccountName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._deleteStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a storage account. This operation requires the storage/delete + * permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 {DeletedStorageBundle} - 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 DeletedStorageBundle} 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. + */ + deleteStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback); + } + } + + /** + * Gets information about a specified storage account. This operation requires + * the storage/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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. + */ + getStorageAccountWithHttpOperationResponse(vaultBaseUrl, storageAccountName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about a specified storage account. This operation requires + * the storage/get permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @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 {StorageBundle} - 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 StorageBundle} 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. + */ + getStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback); + } + } + + /** + * Creates or updates a new storage account. This operation requires the + * storage/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} resourceId Storage account resource id. + * + * @param {string} activeKeyName Current active storage account key name. + * + * @param {boolean} autoRegenerateKey whether keyvault should manage the + * storage account for the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.regenerationPeriod] The key regeneration time + * duration specified in ISO-8601 format. + * + * @param {object} [options.storageAccountAttributes] The attributes of the + * storage account. + * + * @param {boolean} [options.storageAccountAttributes.enabled] the enabled + * state of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + setStorageAccountWithHttpOperationResponse(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._setStorageAccount(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates a new storage account. This operation requires the + * storage/set permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} resourceId Storage account resource id. + * + * @param {string} activeKeyName Current active storage account key name. + * + * @param {boolean} autoRegenerateKey whether keyvault should manage the + * storage account for the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.regenerationPeriod] The key regeneration time + * duration specified in ISO-8601 format. + * + * @param {object} [options.storageAccountAttributes] The attributes of the + * storage account. + * + * @param {boolean} [options.storageAccountAttributes.enabled] the enabled + * state of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {StorageBundle} - 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 StorageBundle} 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. + */ + setStorageAccount(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._setStorageAccount(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setStorageAccount(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey, options, optionalCallback); + } + } + + /** + * Updates the specified attributes associated with the given storage account. + * This operation requires the storage/set/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.activeKeyName] The current active storage account + * key name. + * + * @param {boolean} [options.autoRegenerateKey] whether keyvault should manage + * the storage account for the user. + * + * @param {string} [options.regenerationPeriod] The key regeneration time + * duration specified in ISO-8601 format. + * + * @param {object} [options.storageAccountAttributes] The attributes of the + * storage account. + * + * @param {boolean} [options.storageAccountAttributes.enabled] the enabled + * state of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + updateStorageAccountWithHttpOperationResponse(vaultBaseUrl, storageAccountName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._updateStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates the specified attributes associated with the given storage account. + * This operation requires the storage/set/update permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.activeKeyName] The current active storage account + * key name. + * + * @param {boolean} [options.autoRegenerateKey] whether keyvault should manage + * the storage account for the user. + * + * @param {string} [options.regenerationPeriod] The key regeneration time + * duration specified in ISO-8601 format. + * + * @param {object} [options.storageAccountAttributes] The attributes of the + * storage account. + * + * @param {boolean} [options.storageAccountAttributes.enabled] the enabled + * state of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {StorageBundle} - 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 StorageBundle} 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. + */ + updateStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateStorageAccount(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateStorageAccount(vaultBaseUrl, storageAccountName, options, optionalCallback); + } + } + + /** + * Regenerates the specified key value for the given storage account. This + * operation requires the storage/regeneratekey permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} keyName The storage account key name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + regenerateStorageAccountKeyWithHttpOperationResponse(vaultBaseUrl, storageAccountName, keyName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._regenerateStorageAccountKey(vaultBaseUrl, storageAccountName, keyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Regenerates the specified key value for the given storage account. This + * operation requires the storage/regeneratekey permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} keyName The storage account key name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {StorageBundle} - 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 StorageBundle} 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. + */ + regenerateStorageAccountKey(vaultBaseUrl, storageAccountName, keyName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._regenerateStorageAccountKey(vaultBaseUrl, storageAccountName, keyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._regenerateStorageAccountKey(vaultBaseUrl, storageAccountName, keyName, options, optionalCallback); + } + } + + /** + * List storage SAS definitions for the given storage account. This operation + * requires the storage/listsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getSasDefinitionsWithHttpOperationResponse(vaultBaseUrl, storageAccountName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getSasDefinitions(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List storage SAS definitions for the given storage account. This operation + * requires the storage/listsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {SasDefinitionListResult} - 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 SasDefinitionListResult} 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. + */ + getSasDefinitions(vaultBaseUrl, storageAccountName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getSasDefinitions(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getSasDefinitions(vaultBaseUrl, storageAccountName, options, optionalCallback); + } + } + + /** + * @summary Lists deleted SAS definitions for the specified vault and storage + * account. + * + * The Get Deleted Sas Definitions operation returns the SAS definitions that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/listsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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. + */ + getDeletedSasDefinitionsWithHttpOperationResponse(vaultBaseUrl, storageAccountName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedSasDefinitions(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists deleted SAS definitions for the specified vault and storage + * account. + * + * The Get Deleted Sas Definitions operation returns the SAS definitions that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/listsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.maxresults] Maximum number of results to return in + * a page. If not specified the service will return up to 25 results. + * + * @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 {DeletedSasDefinitionListResult} - 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 DeletedSasDefinitionListResult} 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. + */ + getDeletedSasDefinitions(vaultBaseUrl, storageAccountName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedSasDefinitions(vaultBaseUrl, storageAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedSasDefinitions(vaultBaseUrl, storageAccountName, options, optionalCallback); + } + } + + /** + * @summary Gets the specified deleted sas definition. + * + * The Get Deleted SAS Definition operation returns the specified deleted SAS + * definition along with its attributes. This operation requires the + * storage/getsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getDeletedSasDefinitionWithHttpOperationResponse(vaultBaseUrl, storageAccountName, sasDefinitionName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the specified deleted sas definition. + * + * The Get Deleted SAS Definition operation returns the specified deleted SAS + * definition along with its attributes. This operation requires the + * storage/getsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DeletedSasDefinitionBundle} - 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 DeletedSasDefinitionBundle} 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. + */ + getDeletedSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, optionalCallback); + } + } + + /** + * @summary Recovers the deleted SAS definition. + * + * Recovers the deleted SAS definition for the specified storage account. This + * operation can only be performed on a soft-delete enabled vault. This + * operation requires the storage/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + recoverDeletedSasDefinitionWithHttpOperationResponse(vaultBaseUrl, storageAccountName, sasDefinitionName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._recoverDeletedSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Recovers the deleted SAS definition. + * + * Recovers the deleted SAS definition for the specified storage account. This + * operation can only be performed on a soft-delete enabled vault. This + * operation requires the storage/recover permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SasDefinitionBundle} - 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 SasDefinitionBundle} 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. + */ + recoverDeletedSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._recoverDeletedSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._recoverDeletedSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, optionalCallback); + } + } + + /** + * Deletes a SAS definition from a specified storage account. This operation + * requires the storage/deletesas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteSasDefinitionWithHttpOperationResponse(vaultBaseUrl, storageAccountName, sasDefinitionName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._deleteSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a SAS definition from a specified storage account. This operation + * requires the storage/deletesas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DeletedSasDefinitionBundle} - 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 DeletedSasDefinitionBundle} 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. + */ + deleteSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, optionalCallback); + } + } + + /** + * Gets information about a SAS definition for the specified storage account. + * This operation requires the storage/getsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getSasDefinitionWithHttpOperationResponse(vaultBaseUrl, storageAccountName, sasDefinitionName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about a SAS definition for the specified storage account. + * This operation requires the storage/getsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SasDefinitionBundle} - 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 SasDefinitionBundle} 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. + */ + getSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, optionalCallback); + } + } + + /** + * Creates or updates a new SAS definition for the specified storage account. + * This operation requires the storage/setsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {string} templateUri The SAS definition token template signed with an + * arbitrary key. Tokens created according to the SAS definition will have the + * same properties as the template. + * + * @param {string} sasType The type of SAS token the SAS definition will + * create. Possible values include: 'account', 'service' + * + * @param {string} validityPeriod The validity period of SAS tokens created + * according to the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.sasDefinitionAttributes] The attributes of the SAS + * definition. + * + * @param {boolean} [options.sasDefinitionAttributes.enabled] the enabled state + * of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + setSasDefinitionWithHttpOperationResponse(vaultBaseUrl, storageAccountName, sasDefinitionName, templateUri, sasType, validityPeriod, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._setSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, templateUri, sasType, validityPeriod, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates a new SAS definition for the specified storage account. + * This operation requires the storage/setsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {string} templateUri The SAS definition token template signed with an + * arbitrary key. Tokens created according to the SAS definition will have the + * same properties as the template. + * + * @param {string} sasType The type of SAS token the SAS definition will + * create. Possible values include: 'account', 'service' + * + * @param {string} validityPeriod The validity period of SAS tokens created + * according to the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.sasDefinitionAttributes] The attributes of the SAS + * definition. + * + * @param {boolean} [options.sasDefinitionAttributes.enabled] the enabled state + * of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {SasDefinitionBundle} - 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 SasDefinitionBundle} 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. + */ + setSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, templateUri, sasType, validityPeriod, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._setSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, templateUri, sasType, validityPeriod, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, templateUri, sasType, validityPeriod, options, optionalCallback); + } + } + + /** + * Updates the specified attributes associated with the given SAS definition. + * This operation requires the storage/setsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.templateUri] The SAS definition token template + * signed with an arbitrary key. Tokens created according to the SAS + * definition will have the same properties as the template. + * + * @param {string} [options.sasType] The type of SAS token the SAS definition + * will create. Possible values include: 'account', 'service' + * + * @param {string} [options.validityPeriod] The validity period of SAS tokens + * created according to the SAS definition. + * + * @param {object} [options.sasDefinitionAttributes] The attributes of the SAS + * definition. + * + * @param {boolean} [options.sasDefinitionAttributes.enabled] the enabled state + * of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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. + */ + updateSasDefinitionWithHttpOperationResponse(vaultBaseUrl, storageAccountName, sasDefinitionName, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._updateSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates the specified attributes associated with the given SAS definition. + * This operation requires the storage/setsas permission. + * + * @param {string} vaultBaseUrl The vault name, for example + * https://myvault.vault.azure.net. + * + * @param {string} storageAccountName The name of the storage account. + * + * @param {string} sasDefinitionName The name of the SAS definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.templateUri] The SAS definition token template + * signed with an arbitrary key. Tokens created according to the SAS + * definition will have the same properties as the template. + * + * @param {string} [options.sasType] The type of SAS token the SAS definition + * will create. Possible values include: 'account', 'service' + * + * @param {string} [options.validityPeriod] The validity period of SAS tokens + * created according to the SAS definition. + * + * @param {object} [options.sasDefinitionAttributes] The attributes of the SAS + * definition. + * + * @param {boolean} [options.sasDefinitionAttributes.enabled] the enabled state + * of the object. + * + * @param {object} [options.tags] Application specific metadata in the form of + * key-value pairs. + * + * @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 {SasDefinitionBundle} - 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 SasDefinitionBundle} 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. + */ + updateSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateSasDefinition(vaultBaseUrl, storageAccountName, sasDefinitionName, options, optionalCallback); + } + } + + /** + * @summary Retrieves a list of individual key versions with the same key name. + * + * The full key identifier, attributes, and tags are provided in the response. + * This operation requires the keys/list permission. + * + * @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. + */ + getKeyVersionsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getKeyVersionsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Retrieves a list of individual key versions with the same key name. + * + * The full key identifier, attributes, and tags are provided in the response. + * This operation requires the keys/list permission. + * + * @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 {KeyListResult} - 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 KeyListResult} 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. + */ + getKeyVersionsNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getKeyVersionsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getKeyVersionsNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary List keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a stored key. The LIST operation is + * applicable to all key types, however only the base key identifier, + * attributes, and tags are provided in the response. Individual versions of a + * key are not listed in the response. This operation requires the keys/list + * permission. + * + * @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. + */ + getKeysNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getKeysNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a stored key. The LIST operation is + * applicable to all key types, however only the base key identifier, + * attributes, and tags are provided in the response. Individual versions of a + * key are not listed in the response. This operation requires the keys/list + * permission. + * + * @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 {KeyListResult} - 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 KeyListResult} 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. + */ + getKeysNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getKeysNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getKeysNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Lists the deleted keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a deleted key. This operation includes + * deletion-specific information. The Get Deleted Keys operation is applicable + * for vaults enabled for soft-delete. While the operation can be invoked on + * any vault, it will return an error if invoked on a non soft-delete enabled + * vault. This operation requires the keys/list permission. + * + * @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. + */ + getDeletedKeysNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedKeysNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists the deleted keys in the specified vault. + * + * Retrieves a list of the keys in the Key Vault as JSON Web Key structures + * that contain the public part of a deleted key. This operation includes + * deletion-specific information. The Get Deleted Keys operation is applicable + * for vaults enabled for soft-delete. While the operation can be invoked on + * any vault, it will return an error if invoked on a non soft-delete enabled + * vault. This operation requires the keys/list permission. + * + * @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 {DeletedKeyListResult} - 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 DeletedKeyListResult} 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. + */ + getDeletedKeysNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedKeysNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedKeysNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary List secrets in a specified key vault. + * + * The Get Secrets operation is applicable to the entire vault. However, only + * the base secret identifier and its attributes are provided in the response. + * Individual secret versions are not listed in the response. This operation + * requires the secrets/list permission. + * + * @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. + */ + getSecretsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getSecretsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List secrets in a specified key vault. + * + * The Get Secrets operation is applicable to the entire vault. However, only + * the base secret identifier and its attributes are provided in the response. + * Individual secret versions are not listed in the response. This operation + * requires the secrets/list permission. + * + * @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 {SecretListResult} - 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 SecretListResult} 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. + */ + getSecretsNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getSecretsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getSecretsNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary List all versions of the specified secret. + * + * The full secret identifier and attributes are provided in the response. No + * values are returned for the secrets. This operations requires the + * secrets/list permission. + * + * @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. + */ + getSecretVersionsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getSecretVersionsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List all versions of the specified secret. + * + * The full secret identifier and attributes are provided in the response. No + * values are returned for the secrets. This operations requires the + * secrets/list permission. + * + * @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 {SecretListResult} - 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 SecretListResult} 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. + */ + getSecretVersionsNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getSecretVersionsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getSecretVersionsNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Lists deleted secrets for the specified vault. + * + * The Get Deleted Secrets operation returns the secrets that have been deleted + * for a vault enabled for soft-delete. This operation requires the + * secrets/list permission. + * + * @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. + */ + getDeletedSecretsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedSecretsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists deleted secrets for the specified vault. + * + * The Get Deleted Secrets operation returns the secrets that have been deleted + * for a vault enabled for soft-delete. This operation requires the + * secrets/list permission. + * + * @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 {DeletedSecretListResult} - 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 DeletedSecretListResult} 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. + */ + getDeletedSecretsNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedSecretsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedSecretsNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary List certificates in a specified key vault + * + * The GetCertificates operation returns the set of certificates resources in + * the specified key vault. This operation requires the certificates/list + * permission. + * + * @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. + */ + getCertificatesNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificatesNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List certificates in a specified key vault + * + * The GetCertificates operation returns the set of certificates resources in + * the specified key vault. This operation requires the certificates/list + * permission. + * + * @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 {CertificateListResult} - 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 CertificateListResult} 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. + */ + getCertificatesNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificatesNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificatesNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary List certificate issuers for a specified key vault. + * + * The GetCertificateIssuers operation returns the set of certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @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. + */ + getCertificateIssuersNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificateIssuersNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List certificate issuers for a specified key vault. + * + * The GetCertificateIssuers operation returns the set of certificate issuer + * resources in the specified key vault. This operation requires the + * certificates/manageissuers/getissuers permission. + * + * @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 {CertificateIssuerListResult} - 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 CertificateIssuerListResult} 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. + */ + getCertificateIssuersNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificateIssuersNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificateIssuersNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary List the versions of a certificate. + * + * The GetCertificateVersions operation returns the versions of a certificate + * in the specified key vault. This operation requires the certificates/list + * permission. + * + * @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. + */ + getCertificateVersionsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getCertificateVersionsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List the versions of a certificate. + * + * The GetCertificateVersions operation returns the versions of a certificate + * in the specified key vault. This operation requires the certificates/list + * permission. + * + * @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 {CertificateListResult} - 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 CertificateListResult} 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. + */ + getCertificateVersionsNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getCertificateVersionsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getCertificateVersionsNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Lists the deleted certificates in the specified vault currently + * available for recovery. + * + * The GetDeletedCertificates operation retrieves the certificates in the + * current vault which are in a deleted state and ready for recovery or + * purging. This operation includes deletion-specific information. This + * operation requires the certificates/get/list permission. This operation can + * only be enabled on soft-delete enabled vaults. + * + * @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. + */ + getDeletedCertificatesNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedCertificatesNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists the deleted certificates in the specified vault currently + * available for recovery. + * + * The GetDeletedCertificates operation retrieves the certificates in the + * current vault which are in a deleted state and ready for recovery or + * purging. This operation includes deletion-specific information. This + * operation requires the certificates/get/list permission. This operation can + * only be enabled on soft-delete enabled vaults. + * + * @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 {DeletedCertificateListResult} - 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 DeletedCertificateListResult} 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. + */ + getDeletedCertificatesNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedCertificatesNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedCertificatesNext(nextPageLink, options, optionalCallback); + } + } + + /** + * List storage accounts managed by the specified key vault. This operation + * requires the storage/list permission. + * + * @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. + */ + getStorageAccountsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getStorageAccountsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List storage accounts managed by the specified key vault. This operation + * requires the storage/list permission. + * + * @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 {StorageListResult} - 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 StorageListResult} 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. + */ + getStorageAccountsNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getStorageAccountsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getStorageAccountsNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Lists deleted storage accounts for the specified vault. + * + * The Get Deleted Storage Accounts operation returns the storage accounts that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/list permission. + * + * @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. + */ + getDeletedStorageAccountsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedStorageAccountsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists deleted storage accounts for the specified vault. + * + * The Get Deleted Storage Accounts operation returns the storage accounts that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/list permission. + * + * @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 {DeletedStorageListResult} - 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 DeletedStorageListResult} 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. + */ + getDeletedStorageAccountsNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedStorageAccountsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedStorageAccountsNext(nextPageLink, options, optionalCallback); + } + } + + /** + * List storage SAS definitions for the given storage account. This operation + * requires the storage/listsas permission. + * + * @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. + */ + getSasDefinitionsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getSasDefinitionsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List storage SAS definitions for the given storage account. This operation + * requires the storage/listsas permission. + * + * @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 {SasDefinitionListResult} - 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 SasDefinitionListResult} 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. + */ + getSasDefinitionsNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getSasDefinitionsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getSasDefinitionsNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Lists deleted SAS definitions for the specified vault and storage + * account. + * + * The Get Deleted Sas Definitions operation returns the SAS definitions that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/listsas permission. + * + * @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. + */ + getDeletedSasDefinitionsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._getDeletedSasDefinitionsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists deleted SAS definitions for the specified vault and storage + * account. + * + * The Get Deleted Sas Definitions operation returns the SAS definitions that + * have been deleted for a vault enabled for soft-delete. This operation + * requires the storage/listsas permission. + * + * @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 {DeletedSasDefinitionListResult} - 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 DeletedSasDefinitionListResult} 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. + */ + getDeletedSasDefinitionsNext(nextPageLink, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getDeletedSasDefinitionsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDeletedSasDefinitionsNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = KeyVaultClient; +module.exports['default'] = KeyVaultClient; +module.exports.KeyVaultClient = KeyVaultClient; +module.exports.KeyVaultModels = models; diff --git a/lib/services/keyvault/lib/models/action.js b/lib/services/keyvault/lib/models/action.js new file mode 100644 index 0000000000..268118dfb9 --- /dev/null +++ b/lib/services/keyvault/lib/models/action.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'; + +/** + * The action that will be executed. + * + */ +class Action { + /** + * Create a Action. + * @property {string} [actionType] The type of the action. Possible values + * include: 'EmailContacts', 'AutoRenew' + */ + constructor() { + } + + /** + * Defines the metadata of Action + * + * @returns {object} metadata of Action + * + */ + mapper() { + return { + required: false, + serializedName: 'Action', + type: { + name: 'Composite', + className: 'Action', + modelProperties: { + actionType: { + required: false, + serializedName: 'action_type', + type: { + name: 'Enum', + allowedValues: [ 'EmailContacts', 'AutoRenew' ] + } + } + } + } + }; + } +} + +module.exports = Action; diff --git a/lib/services/keyvault/lib/models/administratorDetails.js b/lib/services/keyvault/lib/models/administratorDetails.js new file mode 100644 index 0000000000..0ceee9519e --- /dev/null +++ b/lib/services/keyvault/lib/models/administratorDetails.js @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Details of the organization administrator of the certificate issuer. + * + */ +class AdministratorDetails { + /** + * Create a AdministratorDetails. + * @property {string} [firstName] First name. + * @property {string} [lastName] Last name. + * @property {string} [emailAddress] Email address. + * @property {string} [phone] Phone number. + */ + constructor() { + } + + /** + * Defines the metadata of AdministratorDetails + * + * @returns {object} metadata of AdministratorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'AdministratorDetails', + type: { + name: 'Composite', + className: 'AdministratorDetails', + modelProperties: { + firstName: { + required: false, + serializedName: 'first_name', + type: { + name: 'String' + } + }, + lastName: { + required: false, + serializedName: 'last_name', + type: { + name: 'String' + } + }, + emailAddress: { + required: false, + serializedName: 'email', + type: { + name: 'String' + } + }, + phone: { + required: false, + serializedName: 'phone', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdministratorDetails; diff --git a/lib/services/keyvault/lib/models/attributes.js b/lib/services/keyvault/lib/models/attributes.js new file mode 100644 index 0000000000..d2a88bf823 --- /dev/null +++ b/lib/services/keyvault/lib/models/attributes.js @@ -0,0 +1,86 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The object attributes managed by the KeyVault service. + * + */ +class Attributes { + /** + * Create a Attributes. + * @property {boolean} [enabled] Determines whether the object is enabled. + * @property {date} [notBefore] Not before date in UTC. + * @property {date} [expires] Expiry date in UTC. + * @property {date} [created] Creation time in UTC. + * @property {date} [updated] Last updated time in UTC. + */ + constructor() { + } + + /** + * Defines the metadata of Attributes + * + * @returns {object} metadata of Attributes + * + */ + mapper() { + return { + required: false, + serializedName: 'Attributes', + type: { + name: 'Composite', + className: 'Attributes', + modelProperties: { + enabled: { + required: false, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + notBefore: { + required: false, + serializedName: 'nbf', + type: { + name: 'UnixTime' + } + }, + expires: { + required: false, + serializedName: 'exp', + type: { + name: 'UnixTime' + } + }, + created: { + required: false, + readOnly: true, + serializedName: 'created', + type: { + name: 'UnixTime' + } + }, + updated: { + required: false, + readOnly: true, + serializedName: 'updated', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = Attributes; diff --git a/lib/services/keyvault/lib/models/backupCertificateResult.js b/lib/services/keyvault/lib/models/backupCertificateResult.js new file mode 100644 index 0000000000..00514bcf76 --- /dev/null +++ b/lib/services/keyvault/lib/models/backupCertificateResult.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'; + +/** + * The backup certificate result, containing the backup blob. + * + */ +class BackupCertificateResult { + /** + * Create a BackupCertificateResult. + * @property {buffer} [value] The backup blob containing the backed up + * certificate. + */ + constructor() { + } + + /** + * Defines the metadata of BackupCertificateResult + * + * @returns {object} metadata of BackupCertificateResult + * + */ + mapper() { + return { + required: false, + serializedName: 'BackupCertificateResult', + type: { + name: 'Composite', + className: 'BackupCertificateResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = BackupCertificateResult; diff --git a/lib/services/keyvault/lib/models/backupKeyResult.js b/lib/services/keyvault/lib/models/backupKeyResult.js new file mode 100644 index 0000000000..0a9b298c66 --- /dev/null +++ b/lib/services/keyvault/lib/models/backupKeyResult.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The backup key result, containing the backup blob. + * + */ +class BackupKeyResult { + /** + * Create a BackupKeyResult. + * @property {buffer} [value] The backup blob containing the backed up key. + */ + constructor() { + } + + /** + * Defines the metadata of BackupKeyResult + * + * @returns {object} metadata of BackupKeyResult + * + */ + mapper() { + return { + required: false, + serializedName: 'BackupKeyResult', + type: { + name: 'Composite', + className: 'BackupKeyResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = BackupKeyResult; diff --git a/lib/services/keyvault/lib/models/backupSecretResult.js b/lib/services/keyvault/lib/models/backupSecretResult.js new file mode 100644 index 0000000000..19f57b76ee --- /dev/null +++ b/lib/services/keyvault/lib/models/backupSecretResult.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'; + +/** + * The backup secret result, containing the backup blob. + * + */ +class BackupSecretResult { + /** + * Create a BackupSecretResult. + * @property {buffer} [value] The backup blob containing the backed up + * secret. + */ + constructor() { + } + + /** + * Defines the metadata of BackupSecretResult + * + * @returns {object} metadata of BackupSecretResult + * + */ + mapper() { + return { + required: false, + serializedName: 'BackupSecretResult', + type: { + name: 'Composite', + className: 'BackupSecretResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = BackupSecretResult; diff --git a/lib/services/keyvault/lib/models/backupStorageResult.js b/lib/services/keyvault/lib/models/backupStorageResult.js new file mode 100644 index 0000000000..79d343bc69 --- /dev/null +++ b/lib/services/keyvault/lib/models/backupStorageResult.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'; + +/** + * The backup storage result, containing the backup blob. + * + */ +class BackupStorageResult { + /** + * Create a BackupStorageResult. + * @property {buffer} [value] The backup blob containing the backed up + * storage account. + */ + constructor() { + } + + /** + * Defines the metadata of BackupStorageResult + * + * @returns {object} metadata of BackupStorageResult + * + */ + mapper() { + return { + required: false, + serializedName: 'BackupStorageResult', + type: { + name: 'Composite', + className: 'BackupStorageResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = BackupStorageResult; diff --git a/lib/services/keyvault/lib/models/certificateAttributes.js b/lib/services/keyvault/lib/models/certificateAttributes.js new file mode 100644 index 0000000000..06919c2047 --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateAttributes.js @@ -0,0 +1,101 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The certificate management attributes. + * + * @extends models['Attributes'] + */ +class CertificateAttributes extends models['Attributes'] { + /** + * Create a CertificateAttributes. + * @property {string} [recoveryLevel] Reflects the deletion recovery level + * currently in effect for certificates in the current vault. If it contains + * 'Purgeable', the certificate can be permanently deleted by a privileged + * user; otherwise, only the system can purge the certificate, at the end of + * the retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of CertificateAttributes + * + * @returns {object} metadata of CertificateAttributes + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateAttributes', + type: { + name: 'Composite', + className: 'CertificateAttributes', + modelProperties: { + enabled: { + required: false, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + notBefore: { + required: false, + serializedName: 'nbf', + type: { + name: 'UnixTime' + } + }, + expires: { + required: false, + serializedName: 'exp', + type: { + name: 'UnixTime' + } + }, + created: { + required: false, + readOnly: true, + serializedName: 'created', + type: { + name: 'UnixTime' + } + }, + updated: { + required: false, + readOnly: true, + serializedName: 'updated', + type: { + name: 'UnixTime' + } + }, + recoveryLevel: { + required: false, + nullable: false, + readOnly: true, + serializedName: 'recoveryLevel', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CertificateAttributes; diff --git a/lib/services/keyvault/lib/models/certificateBundle.js b/lib/services/keyvault/lib/models/certificateBundle.js new file mode 100644 index 0000000000..5b42a8c7b9 --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateBundle.js @@ -0,0 +1,198 @@ +/* + * 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 certificate bundle consists of a certificate (X509) plus its attributes. + * + */ +class CertificateBundle { + /** + * Create a CertificateBundle. + * @property {string} [id] The certificate id. + * @property {string} [kid] The key id. + * @property {string} [sid] The secret id. + * @property {buffer} [x509Thumbprint] Thumbprint of the certificate. + * @property {object} [policy] The management policy. + * @property {string} [policy.id] The certificate id. + * @property {object} [policy.keyProperties] Properties of the key backing a + * certificate. + * @property {boolean} [policy.keyProperties.exportable] Indicates if the + * private key can be exported. + * @property {string} [policy.keyProperties.keyType] The type of key pair to + * be used for the certificate. Possible values include: 'EC', 'EC-HSM', + * 'RSA', 'RSA-HSM', 'oct' + * @property {number} [policy.keyProperties.keySize] The key size in bits. + * For example: 2048, 3072, or 4096 for RSA. + * @property {boolean} [policy.keyProperties.reuseKey] Indicates if the same + * key pair will be used on certificate renewal. + * @property {string} [policy.keyProperties.curve] Elliptic curve name. For + * valid values, see JsonWebKeyCurveName. Possible values include: 'P-256', + * 'P-384', 'P-521', 'P-256K' + * @property {object} [policy.secretProperties] Properties of the secret + * backing a certificate. + * @property {string} [policy.secretProperties.contentType] The media type + * (MIME type). + * @property {object} [policy.x509CertificateProperties] Properties of the + * X509 component of a certificate. + * @property {string} [policy.x509CertificateProperties.subject] The subject + * name. Should be a valid X509 distinguished Name. + * @property {array} [policy.x509CertificateProperties.ekus] The enhanced key + * usage. + * @property {object} + * [policy.x509CertificateProperties.subjectAlternativeNames] The subject + * alternative names. + * @property {array} + * [policy.x509CertificateProperties.subjectAlternativeNames.emails] Email + * addresses. + * @property {array} + * [policy.x509CertificateProperties.subjectAlternativeNames.dnsNames] Domain + * names. + * @property {array} + * [policy.x509CertificateProperties.subjectAlternativeNames.upns] User + * principal names. + * @property {array} [policy.x509CertificateProperties.keyUsage] List of key + * usages. + * @property {number} [policy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * @property {array} [policy.lifetimeActions] Actions that will be performed + * by Key Vault over the lifetime of a certificate. + * @property {object} [policy.issuerParameters] Parameters for the issuer of + * the X509 component of a certificate. + * @property {string} [policy.issuerParameters.name] Name of the referenced + * issuer object or reserved names; for example, 'Self' or 'Unknown'. + * @property {string} [policy.issuerParameters.certificateType] Type of + * certificate to be requested from the issuer provider. + * @property {boolean} [policy.issuerParameters.certificateTransparency] + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + * @property {object} [policy.attributes] The certificate attributes. + * @property {string} [policy.attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for certificates in the current vault. + * If it contains 'Purgeable', the certificate can be permanently deleted by + * a privileged user; otherwise, only the system can purge the certificate, + * at the end of the retention interval. Possible values include: + * 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {buffer} [cer] CER contents of x509 certificate. + * @property {string} [contentType] The content type of the secret. + * @property {object} [attributes] The certificate attributes. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for certificates in the current vault. + * If it contains 'Purgeable', the certificate can be permanently deleted by + * a privileged user; otherwise, only the system can purge the certificate, + * at the end of the retention interval. Possible values include: + * 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs + */ + constructor() { + } + + /** + * Defines the metadata of CertificateBundle + * + * @returns {object} metadata of CertificateBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateBundle', + type: { + name: 'Composite', + className: 'CertificateBundle', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + kid: { + required: false, + readOnly: true, + serializedName: 'kid', + type: { + name: 'String' + } + }, + sid: { + required: false, + readOnly: true, + serializedName: 'sid', + type: { + name: 'String' + } + }, + x509Thumbprint: { + required: false, + readOnly: true, + serializedName: 'x5t', + type: { + name: 'Base64Url' + } + }, + policy: { + required: false, + readOnly: true, + serializedName: 'policy', + type: { + name: 'Composite', + className: 'CertificatePolicy' + } + }, + cer: { + required: false, + serializedName: 'cer', + type: { + name: 'ByteArray' + } + }, + contentType: { + required: false, + serializedName: 'contentType', + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'CertificateAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = CertificateBundle; diff --git a/lib/services/keyvault/lib/models/certificateCreateParameters.js b/lib/services/keyvault/lib/models/certificateCreateParameters.js new file mode 100644 index 0000000000..a1d8bb3d44 --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateCreateParameters.js @@ -0,0 +1,151 @@ +/* + * 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 certificate create parameters. + * + */ +class CertificateCreateParameters { + /** + * Create a CertificateCreateParameters. + * @property {object} [certificatePolicy] The management policy for the + * certificate. + * @property {string} [certificatePolicy.id] The certificate id. + * @property {object} [certificatePolicy.keyProperties] Properties of the key + * backing a certificate. + * @property {boolean} [certificatePolicy.keyProperties.exportable] Indicates + * if the private key can be exported. + * @property {string} [certificatePolicy.keyProperties.keyType] The type of + * key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * @property {number} [certificatePolicy.keyProperties.keySize] The key size + * in bits. For example: 2048, 3072, or 4096 for RSA. + * @property {boolean} [certificatePolicy.keyProperties.reuseKey] Indicates + * if the same key pair will be used on certificate renewal. + * @property {string} [certificatePolicy.keyProperties.curve] Elliptic curve + * name. For valid values, see JsonWebKeyCurveName. Possible values include: + * 'P-256', 'P-384', 'P-521', 'P-256K' + * @property {object} [certificatePolicy.secretProperties] Properties of the + * secret backing a certificate. + * @property {string} [certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * @property {object} [certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * @property {string} [certificatePolicy.x509CertificateProperties.subject] + * The subject name. Should be a valid X509 distinguished Name. + * @property {array} [certificatePolicy.x509CertificateProperties.ekus] The + * enhanced key usage. + * @property {object} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames] The + * subject alternative names. + * @property {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * @property {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * @property {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * @property {array} [certificatePolicy.x509CertificateProperties.keyUsage] + * List of key usages. + * @property {number} + * [certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * @property {array} [certificatePolicy.lifetimeActions] Actions that will be + * performed by Key Vault over the lifetime of a certificate. + * @property {object} [certificatePolicy.issuerParameters] Parameters for the + * issuer of the X509 component of a certificate. + * @property {string} [certificatePolicy.issuerParameters.name] Name of the + * referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * @property {string} [certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * @property {boolean} + * [certificatePolicy.issuerParameters.certificateTransparency] Indicates if + * the certificates generated under this policy should be published to + * certificate transparency logs. + * @property {object} [certificatePolicy.attributes] The certificate + * attributes. + * @property {string} [certificatePolicy.attributes.recoveryLevel] Reflects + * the deletion recovery level currently in effect for certificates in the + * current vault. If it contains 'Purgeable', the certificate can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the certificate, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [certificateAttributes] The attributes of the + * certificate (optional). + * @property {string} [certificateAttributes.recoveryLevel] Reflects the + * deletion recovery level currently in effect for certificates in the + * current vault. If it contains 'Purgeable', the certificate can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the certificate, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateCreateParameters + * + * @returns {object} metadata of CertificateCreateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateCreateParameters', + type: { + name: 'Composite', + className: 'CertificateCreateParameters', + modelProperties: { + certificatePolicy: { + required: false, + serializedName: 'policy', + type: { + name: 'Composite', + className: 'CertificatePolicy' + } + }, + certificateAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'CertificateAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = CertificateCreateParameters; diff --git a/lib/services/keyvault/lib/models/certificateImportParameters.js b/lib/services/keyvault/lib/models/certificateImportParameters.js new file mode 100644 index 0000000000..aa68fd4f40 --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateImportParameters.js @@ -0,0 +1,170 @@ +/* + * 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 certificate import parameters. + * + */ +class CertificateImportParameters { + /** + * Create a CertificateImportParameters. + * @property {string} base64EncodedCertificate Base64 encoded representation + * of the certificate object to import. This certificate needs to contain the + * private key. + * @property {string} [password] If the private key in + * base64EncodedCertificate is encrypted, the password used for encryption. + * @property {object} [certificatePolicy] The management policy for the + * certificate. + * @property {string} [certificatePolicy.id] The certificate id. + * @property {object} [certificatePolicy.keyProperties] Properties of the key + * backing a certificate. + * @property {boolean} [certificatePolicy.keyProperties.exportable] Indicates + * if the private key can be exported. + * @property {string} [certificatePolicy.keyProperties.keyType] The type of + * key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * @property {number} [certificatePolicy.keyProperties.keySize] The key size + * in bits. For example: 2048, 3072, or 4096 for RSA. + * @property {boolean} [certificatePolicy.keyProperties.reuseKey] Indicates + * if the same key pair will be used on certificate renewal. + * @property {string} [certificatePolicy.keyProperties.curve] Elliptic curve + * name. For valid values, see JsonWebKeyCurveName. Possible values include: + * 'P-256', 'P-384', 'P-521', 'P-256K' + * @property {object} [certificatePolicy.secretProperties] Properties of the + * secret backing a certificate. + * @property {string} [certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * @property {object} [certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * @property {string} [certificatePolicy.x509CertificateProperties.subject] + * The subject name. Should be a valid X509 distinguished Name. + * @property {array} [certificatePolicy.x509CertificateProperties.ekus] The + * enhanced key usage. + * @property {object} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames] The + * subject alternative names. + * @property {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * @property {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * @property {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * @property {array} [certificatePolicy.x509CertificateProperties.keyUsage] + * List of key usages. + * @property {number} + * [certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * @property {array} [certificatePolicy.lifetimeActions] Actions that will be + * performed by Key Vault over the lifetime of a certificate. + * @property {object} [certificatePolicy.issuerParameters] Parameters for the + * issuer of the X509 component of a certificate. + * @property {string} [certificatePolicy.issuerParameters.name] Name of the + * referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * @property {string} [certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * @property {boolean} + * [certificatePolicy.issuerParameters.certificateTransparency] Indicates if + * the certificates generated under this policy should be published to + * certificate transparency logs. + * @property {object} [certificatePolicy.attributes] The certificate + * attributes. + * @property {string} [certificatePolicy.attributes.recoveryLevel] Reflects + * the deletion recovery level currently in effect for certificates in the + * current vault. If it contains 'Purgeable', the certificate can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the certificate, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [certificateAttributes] The attributes of the + * certificate (optional). + * @property {string} [certificateAttributes.recoveryLevel] Reflects the + * deletion recovery level currently in effect for certificates in the + * current vault. If it contains 'Purgeable', the certificate can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the certificate, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateImportParameters + * + * @returns {object} metadata of CertificateImportParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateImportParameters', + type: { + name: 'Composite', + className: 'CertificateImportParameters', + modelProperties: { + base64EncodedCertificate: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'pwd', + type: { + name: 'String' + } + }, + certificatePolicy: { + required: false, + serializedName: 'policy', + type: { + name: 'Composite', + className: 'CertificatePolicy' + } + }, + certificateAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'CertificateAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = CertificateImportParameters; diff --git a/lib/services/keyvault/lib/models/certificateIssuerItem.js b/lib/services/keyvault/lib/models/certificateIssuerItem.js new file mode 100644 index 0000000000..aa116816d2 --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateIssuerItem.js @@ -0,0 +1,60 @@ +/* + * 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 certificate issuer item containing certificate issuer metadata. + * + */ +class CertificateIssuerItem { + /** + * Create a CertificateIssuerItem. + * @property {string} [id] Certificate Identifier. + * @property {string} [provider] The issuer provider. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateIssuerItem + * + * @returns {object} metadata of CertificateIssuerItem + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateIssuerItem', + type: { + name: 'Composite', + className: 'CertificateIssuerItem', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CertificateIssuerItem; diff --git a/lib/services/keyvault/lib/models/certificateIssuerListResult.js b/lib/services/keyvault/lib/models/certificateIssuerListResult.js new file mode 100644 index 0000000000..7518161466 --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateIssuerListResult.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The certificate issuer list result. + */ +class CertificateIssuerListResult extends Array { + /** + * Create a CertificateIssuerListResult. + * @property {string} [nextLink] The URL to get the next set of certificate + * issuers. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of CertificateIssuerListResult + * + * @returns {object} metadata of CertificateIssuerListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateIssuerListResult', + type: { + name: 'Composite', + className: 'CertificateIssuerListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CertificateIssuerItemElementType', + type: { + name: 'Composite', + className: 'CertificateIssuerItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CertificateIssuerListResult; diff --git a/lib/services/keyvault/lib/models/certificateIssuerSetParameters.js b/lib/services/keyvault/lib/models/certificateIssuerSetParameters.js new file mode 100644 index 0000000000..895ed1f646 --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateIssuerSetParameters.js @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The certificate issuer set parameters. + * + */ +class CertificateIssuerSetParameters { + /** + * Create a CertificateIssuerSetParameters. + * @property {string} provider The issuer provider. + * @property {object} [credentials] The credentials to be used for the + * issuer. + * @property {string} [credentials.accountId] The user name/account + * name/account id. + * @property {string} [credentials.password] The password/secret/account key. + * @property {object} [organizationDetails] Details of the organization as + * provided to the issuer. + * @property {string} [organizationDetails.id] Id of the organization. + * @property {array} [organizationDetails.adminDetails] Details of the + * organization administrator. + * @property {object} [attributes] Attributes of the issuer object. + * @property {boolean} [attributes.enabled] Determines whether the issuer is + * enabled. + * @property {date} [attributes.created] Creation time in UTC. + * @property {date} [attributes.updated] Last updated time in UTC. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateIssuerSetParameters + * + * @returns {object} metadata of CertificateIssuerSetParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateIssuerSetParameters', + type: { + name: 'Composite', + className: 'CertificateIssuerSetParameters', + modelProperties: { + provider: { + required: true, + serializedName: 'provider', + type: { + name: 'String' + } + }, + credentials: { + required: false, + serializedName: 'credentials', + type: { + name: 'Composite', + className: 'IssuerCredentials' + } + }, + organizationDetails: { + required: false, + serializedName: 'org_details', + type: { + name: 'Composite', + className: 'OrganizationDetails' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'IssuerAttributes' + } + } + } + } + }; + } +} + +module.exports = CertificateIssuerSetParameters; diff --git a/lib/services/keyvault/lib/models/certificateIssuerUpdateParameters.js b/lib/services/keyvault/lib/models/certificateIssuerUpdateParameters.js new file mode 100644 index 0000000000..26dc576a54 --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateIssuerUpdateParameters.js @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The certificate issuer update parameters. + * + */ +class CertificateIssuerUpdateParameters { + /** + * Create a CertificateIssuerUpdateParameters. + * @property {string} [provider] The issuer provider. + * @property {object} [credentials] The credentials to be used for the + * issuer. + * @property {string} [credentials.accountId] The user name/account + * name/account id. + * @property {string} [credentials.password] The password/secret/account key. + * @property {object} [organizationDetails] Details of the organization as + * provided to the issuer. + * @property {string} [organizationDetails.id] Id of the organization. + * @property {array} [organizationDetails.adminDetails] Details of the + * organization administrator. + * @property {object} [attributes] Attributes of the issuer object. + * @property {boolean} [attributes.enabled] Determines whether the issuer is + * enabled. + * @property {date} [attributes.created] Creation time in UTC. + * @property {date} [attributes.updated] Last updated time in UTC. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateIssuerUpdateParameters + * + * @returns {object} metadata of CertificateIssuerUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateIssuerUpdateParameters', + type: { + name: 'Composite', + className: 'CertificateIssuerUpdateParameters', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + credentials: { + required: false, + serializedName: 'credentials', + type: { + name: 'Composite', + className: 'IssuerCredentials' + } + }, + organizationDetails: { + required: false, + serializedName: 'org_details', + type: { + name: 'Composite', + className: 'OrganizationDetails' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'IssuerAttributes' + } + } + } + } + }; + } +} + +module.exports = CertificateIssuerUpdateParameters; diff --git a/lib/services/keyvault/lib/models/certificateItem.js b/lib/services/keyvault/lib/models/certificateItem.js new file mode 100644 index 0000000000..7709c6edba --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateItem.js @@ -0,0 +1,92 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The certificate item containing certificate metadata. + * + */ +class CertificateItem { + /** + * Create a CertificateItem. + * @property {string} [id] Certificate identifier. + * @property {object} [attributes] The certificate management attributes. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for certificates in the current vault. + * If it contains 'Purgeable', the certificate can be permanently deleted by + * a privileged user; otherwise, only the system can purge the certificate, + * at the end of the retention interval. Possible values include: + * 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + * @property {buffer} [x509Thumbprint] Thumbprint of the certificate. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateItem + * + * @returns {object} metadata of CertificateItem + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateItem', + type: { + name: 'Composite', + className: 'CertificateItem', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'CertificateAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + x509Thumbprint: { + required: false, + serializedName: 'x5t', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = CertificateItem; diff --git a/lib/services/keyvault/lib/models/certificateListResult.js b/lib/services/keyvault/lib/models/certificateListResult.js new file mode 100644 index 0000000000..e911edf163 --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateListResult.js @@ -0,0 +1,69 @@ +/* + * 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 certificate list result. + */ +class CertificateListResult extends Array { + /** + * Create a CertificateListResult. + * @property {string} [nextLink] The URL to get the next set of certificates. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of CertificateListResult + * + * @returns {object} metadata of CertificateListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateListResult', + type: { + name: 'Composite', + className: 'CertificateListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CertificateItemElementType', + type: { + name: 'Composite', + className: 'CertificateItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CertificateListResult; diff --git a/lib/services/keyvault/lib/models/certificateMergeParameters.js b/lib/services/keyvault/lib/models/certificateMergeParameters.js new file mode 100644 index 0000000000..25d91dc2af --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateMergeParameters.js @@ -0,0 +1,93 @@ +/* + * 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 certificate merge parameters + * + */ +class CertificateMergeParameters { + /** + * Create a CertificateMergeParameters. + * @property {array} x509Certificates The certificate or the certificate + * chain to merge. + * @property {object} [certificateAttributes] The attributes of the + * certificate (optional). + * @property {string} [certificateAttributes.recoveryLevel] Reflects the + * deletion recovery level currently in effect for certificates in the + * current vault. If it contains 'Purgeable', the certificate can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the certificate, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateMergeParameters + * + * @returns {object} metadata of CertificateMergeParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateMergeParameters', + type: { + name: 'Composite', + className: 'CertificateMergeParameters', + modelProperties: { + x509Certificates: { + required: true, + serializedName: 'x5c', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BufferElementType', + type: { + name: 'ByteArray' + } + } + } + }, + certificateAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'CertificateAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = CertificateMergeParameters; diff --git a/lib/services/keyvault/lib/models/certificateOperation.js b/lib/services/keyvault/lib/models/certificateOperation.js new file mode 100644 index 0000000000..02ae47b8aa --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateOperation.js @@ -0,0 +1,135 @@ +/* + * 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 certificate operation is returned in case of asynchronous requests. + * + */ +class CertificateOperation { + /** + * Create a CertificateOperation. + * @property {string} [id] The certificate id. + * @property {object} [issuerParameters] Parameters for the issuer of the + * X509 component of a certificate. + * @property {string} [issuerParameters.name] Name of the referenced issuer + * object or reserved names; for example, 'Self' or 'Unknown'. + * @property {string} [issuerParameters.certificateType] Type of certificate + * to be requested from the issuer provider. + * @property {boolean} [issuerParameters.certificateTransparency] Indicates + * if the certificates generated under this policy should be published to + * certificate transparency logs. + * @property {buffer} [csr] The certificate signing request (CSR) that is + * being used in the certificate operation. + * @property {boolean} [cancellationRequested] Indicates if cancellation was + * requested on the certificate operation. + * @property {string} [status] Status of the certificate operation. + * @property {string} [statusDetails] The status details of the certificate + * operation. + * @property {object} [error] Error encountered, if any, during the + * certificate operation. + * @property {string} [error.code] The error code. + * @property {string} [error.message] The error message. + * @property {object} [error.innerError] + * @property {string} [target] Location which contains the result of the + * certificate operation. + * @property {string} [requestId] Identifier for the certificate operation. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateOperation + * + * @returns {object} metadata of CertificateOperation + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateOperation', + type: { + name: 'Composite', + className: 'CertificateOperation', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + issuerParameters: { + required: false, + serializedName: 'issuer', + type: { + name: 'Composite', + className: 'IssuerParameters' + } + }, + csr: { + required: false, + serializedName: 'csr', + type: { + name: 'ByteArray' + } + }, + cancellationRequested: { + required: false, + serializedName: 'cancellation_requested', + type: { + name: 'Boolean' + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + statusDetails: { + required: false, + serializedName: 'status_details', + type: { + name: 'String' + } + }, + error: { + required: false, + serializedName: 'error', + type: { + name: 'Composite', + className: 'ErrorModel' + } + }, + target: { + required: false, + serializedName: 'target', + type: { + name: 'String' + } + }, + requestId: { + required: false, + serializedName: 'request_id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CertificateOperation; diff --git a/lib/services/keyvault/lib/models/certificateOperationUpdateParameter.js b/lib/services/keyvault/lib/models/certificateOperationUpdateParameter.js new file mode 100644 index 0000000000..7f058ff02c --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateOperationUpdateParameter.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The certificate operation update parameters. + * + */ +class CertificateOperationUpdateParameter { + /** + * Create a CertificateOperationUpdateParameter. + * @property {boolean} cancellationRequested Indicates if cancellation was + * requested on the certificate operation. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateOperationUpdateParameter + * + * @returns {object} metadata of CertificateOperationUpdateParameter + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateOperationUpdateParameter', + type: { + name: 'Composite', + className: 'CertificateOperationUpdateParameter', + modelProperties: { + cancellationRequested: { + required: true, + serializedName: 'cancellation_requested', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = CertificateOperationUpdateParameter; diff --git a/lib/services/keyvault/lib/models/certificatePolicy.js b/lib/services/keyvault/lib/models/certificatePolicy.js new file mode 100644 index 0000000000..8c1044e778 --- /dev/null +++ b/lib/services/keyvault/lib/models/certificatePolicy.js @@ -0,0 +1,162 @@ +/* + * 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'; + +/** + * Management policy for a certificate. + * + */ +class CertificatePolicy { + /** + * Create a CertificatePolicy. + * @property {string} [id] The certificate id. + * @property {object} [keyProperties] Properties of the key backing a + * certificate. + * @property {boolean} [keyProperties.exportable] Indicates if the private + * key can be exported. + * @property {string} [keyProperties.keyType] The type of key pair to be used + * for the certificate. Possible values include: 'EC', 'EC-HSM', 'RSA', + * 'RSA-HSM', 'oct' + * @property {number} [keyProperties.keySize] The key size in bits. For + * example: 2048, 3072, or 4096 for RSA. + * @property {boolean} [keyProperties.reuseKey] Indicates if the same key + * pair will be used on certificate renewal. + * @property {string} [keyProperties.curve] Elliptic curve name. For valid + * values, see JsonWebKeyCurveName. Possible values include: 'P-256', + * 'P-384', 'P-521', 'P-256K' + * @property {object} [secretProperties] Properties of the secret backing a + * certificate. + * @property {string} [secretProperties.contentType] The media type (MIME + * type). + * @property {object} [x509CertificateProperties] Properties of the X509 + * component of a certificate. + * @property {string} [x509CertificateProperties.subject] The subject name. + * Should be a valid X509 distinguished Name. + * @property {array} [x509CertificateProperties.ekus] The enhanced key usage. + * @property {object} [x509CertificateProperties.subjectAlternativeNames] The + * subject alternative names. + * @property {array} + * [x509CertificateProperties.subjectAlternativeNames.emails] Email + * addresses. + * @property {array} + * [x509CertificateProperties.subjectAlternativeNames.dnsNames] Domain names. + * @property {array} [x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * @property {array} [x509CertificateProperties.keyUsage] List of key usages. + * @property {number} [x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * @property {array} [lifetimeActions] Actions that will be performed by Key + * Vault over the lifetime of a certificate. + * @property {object} [issuerParameters] Parameters for the issuer of the + * X509 component of a certificate. + * @property {string} [issuerParameters.name] Name of the referenced issuer + * object or reserved names; for example, 'Self' or 'Unknown'. + * @property {string} [issuerParameters.certificateType] Type of certificate + * to be requested from the issuer provider. + * @property {boolean} [issuerParameters.certificateTransparency] Indicates + * if the certificates generated under this policy should be published to + * certificate transparency logs. + * @property {object} [attributes] The certificate attributes. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for certificates in the current vault. + * If it contains 'Purgeable', the certificate can be permanently deleted by + * a privileged user; otherwise, only the system can purge the certificate, + * at the end of the retention interval. Possible values include: + * 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + */ + constructor() { + } + + /** + * Defines the metadata of CertificatePolicy + * + * @returns {object} metadata of CertificatePolicy + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificatePolicy', + type: { + name: 'Composite', + className: 'CertificatePolicy', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + keyProperties: { + required: false, + serializedName: 'key_props', + type: { + name: 'Composite', + className: 'KeyProperties' + } + }, + secretProperties: { + required: false, + serializedName: 'secret_props', + type: { + name: 'Composite', + className: 'SecretProperties' + } + }, + x509CertificateProperties: { + required: false, + serializedName: 'x509_props', + type: { + name: 'Composite', + className: 'X509CertificateProperties' + } + }, + lifetimeActions: { + required: false, + serializedName: 'lifetime_actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LifetimeActionElementType', + type: { + name: 'Composite', + className: 'LifetimeAction' + } + } + } + }, + issuerParameters: { + required: false, + serializedName: 'issuer', + type: { + name: 'Composite', + className: 'IssuerParameters' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'CertificateAttributes' + } + } + } + } + }; + } +} + +module.exports = CertificatePolicy; diff --git a/lib/services/keyvault/lib/models/certificateRestoreParameters.js b/lib/services/keyvault/lib/models/certificateRestoreParameters.js new file mode 100644 index 0000000000..a445efe8ec --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateRestoreParameters.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The certificate restore parameters. + * + */ +class CertificateRestoreParameters { + /** + * Create a CertificateRestoreParameters. + * @property {buffer} certificateBundleBackup The backup blob associated with + * a certificate bundle. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateRestoreParameters + * + * @returns {object} metadata of CertificateRestoreParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateRestoreParameters', + type: { + name: 'Composite', + className: 'CertificateRestoreParameters', + modelProperties: { + certificateBundleBackup: { + required: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = CertificateRestoreParameters; diff --git a/lib/services/keyvault/lib/models/certificateUpdateParameters.js b/lib/services/keyvault/lib/models/certificateUpdateParameters.js new file mode 100644 index 0000000000..b9d6cb2f4a --- /dev/null +++ b/lib/services/keyvault/lib/models/certificateUpdateParameters.js @@ -0,0 +1,151 @@ +/* + * 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 certificate update parameters. + * + */ +class CertificateUpdateParameters { + /** + * Create a CertificateUpdateParameters. + * @property {object} [certificatePolicy] The management policy for the + * certificate. + * @property {string} [certificatePolicy.id] The certificate id. + * @property {object} [certificatePolicy.keyProperties] Properties of the key + * backing a certificate. + * @property {boolean} [certificatePolicy.keyProperties.exportable] Indicates + * if the private key can be exported. + * @property {string} [certificatePolicy.keyProperties.keyType] The type of + * key pair to be used for the certificate. Possible values include: 'EC', + * 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * @property {number} [certificatePolicy.keyProperties.keySize] The key size + * in bits. For example: 2048, 3072, or 4096 for RSA. + * @property {boolean} [certificatePolicy.keyProperties.reuseKey] Indicates + * if the same key pair will be used on certificate renewal. + * @property {string} [certificatePolicy.keyProperties.curve] Elliptic curve + * name. For valid values, see JsonWebKeyCurveName. Possible values include: + * 'P-256', 'P-384', 'P-521', 'P-256K' + * @property {object} [certificatePolicy.secretProperties] Properties of the + * secret backing a certificate. + * @property {string} [certificatePolicy.secretProperties.contentType] The + * media type (MIME type). + * @property {object} [certificatePolicy.x509CertificateProperties] + * Properties of the X509 component of a certificate. + * @property {string} [certificatePolicy.x509CertificateProperties.subject] + * The subject name. Should be a valid X509 distinguished Name. + * @property {array} [certificatePolicy.x509CertificateProperties.ekus] The + * enhanced key usage. + * @property {object} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames] The + * subject alternative names. + * @property {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.emails] + * Email addresses. + * @property {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.dnsNames] + * Domain names. + * @property {array} + * [certificatePolicy.x509CertificateProperties.subjectAlternativeNames.upns] + * User principal names. + * @property {array} [certificatePolicy.x509CertificateProperties.keyUsage] + * List of key usages. + * @property {number} + * [certificatePolicy.x509CertificateProperties.validityInMonths] The + * duration that the certificate is valid in months. + * @property {array} [certificatePolicy.lifetimeActions] Actions that will be + * performed by Key Vault over the lifetime of a certificate. + * @property {object} [certificatePolicy.issuerParameters] Parameters for the + * issuer of the X509 component of a certificate. + * @property {string} [certificatePolicy.issuerParameters.name] Name of the + * referenced issuer object or reserved names; for example, 'Self' or + * 'Unknown'. + * @property {string} [certificatePolicy.issuerParameters.certificateType] + * Type of certificate to be requested from the issuer provider. + * @property {boolean} + * [certificatePolicy.issuerParameters.certificateTransparency] Indicates if + * the certificates generated under this policy should be published to + * certificate transparency logs. + * @property {object} [certificatePolicy.attributes] The certificate + * attributes. + * @property {string} [certificatePolicy.attributes.recoveryLevel] Reflects + * the deletion recovery level currently in effect for certificates in the + * current vault. If it contains 'Purgeable', the certificate can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the certificate, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [certificateAttributes] The attributes of the + * certificate (optional). + * @property {string} [certificateAttributes.recoveryLevel] Reflects the + * deletion recovery level currently in effect for certificates in the + * current vault. If it contains 'Purgeable', the certificate can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the certificate, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateUpdateParameters + * + * @returns {object} metadata of CertificateUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateUpdateParameters', + type: { + name: 'Composite', + className: 'CertificateUpdateParameters', + modelProperties: { + certificatePolicy: { + required: false, + serializedName: 'policy', + type: { + name: 'Composite', + className: 'CertificatePolicy' + } + }, + certificateAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'CertificateAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = CertificateUpdateParameters; diff --git a/lib/services/keyvault/lib/models/contact.js b/lib/services/keyvault/lib/models/contact.js new file mode 100644 index 0000000000..e25aec76e4 --- /dev/null +++ b/lib/services/keyvault/lib/models/contact.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'; + +/** + * The contact information for the vault certificates. + * + */ +class Contact { + /** + * Create a Contact. + * @property {string} [emailAddress] Email address. + * @property {string} [name] Name. + * @property {string} [phone] Phone number. + */ + constructor() { + } + + /** + * Defines the metadata of Contact + * + * @returns {object} metadata of Contact + * + */ + mapper() { + return { + required: false, + serializedName: 'Contact', + type: { + name: 'Composite', + className: 'Contact', + modelProperties: { + emailAddress: { + required: false, + serializedName: 'email', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + phone: { + required: false, + serializedName: 'phone', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Contact; diff --git a/lib/services/keyvault/lib/models/contacts.js b/lib/services/keyvault/lib/models/contacts.js new file mode 100644 index 0000000000..96551c7db3 --- /dev/null +++ b/lib/services/keyvault/lib/models/contacts.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The contacts for the vault certificates. + * + */ +class Contacts { + /** + * Create a Contacts. + * @property {string} [id] Identifier for the contacts collection. + * @property {array} [contactList] The contact list for the vault + * certificates. + */ + constructor() { + } + + /** + * Defines the metadata of Contacts + * + * @returns {object} metadata of Contacts + * + */ + mapper() { + return { + required: false, + serializedName: 'Contacts', + type: { + name: 'Composite', + className: 'Contacts', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + contactList: { + required: false, + serializedName: 'contacts', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ContactElementType', + type: { + name: 'Composite', + className: 'Contact' + } + } + } + } + } + } + }; + } +} + +module.exports = Contacts; diff --git a/lib/services/keyvault/lib/models/deletedCertificateBundle.js b/lib/services/keyvault/lib/models/deletedCertificateBundle.js new file mode 100644 index 0000000000..be88d98ea9 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedCertificateBundle.js @@ -0,0 +1,155 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A Deleted Certificate consisting of its previous id, attributes and its + * tags, as well as information on when it will be purged. + * + * @extends models['CertificateBundle'] + */ +class DeletedCertificateBundle extends models['CertificateBundle'] { + /** + * Create a DeletedCertificateBundle. + * @property {string} [recoveryId] The url of the recovery object, used to + * identify and recover the deleted certificate. + * @property {date} [scheduledPurgeDate] The time when the certificate is + * scheduled to be purged, in UTC + * @property {date} [deletedDate] The time when the certificate was deleted, + * in UTC + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedCertificateBundle + * + * @returns {object} metadata of DeletedCertificateBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedCertificateBundle', + type: { + name: 'Composite', + className: 'DeletedCertificateBundle', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + kid: { + required: false, + readOnly: true, + serializedName: 'kid', + type: { + name: 'String' + } + }, + sid: { + required: false, + readOnly: true, + serializedName: 'sid', + type: { + name: 'String' + } + }, + x509Thumbprint: { + required: false, + readOnly: true, + serializedName: 'x5t', + type: { + name: 'Base64Url' + } + }, + policy: { + required: false, + readOnly: true, + serializedName: 'policy', + type: { + name: 'Composite', + className: 'CertificatePolicy' + } + }, + cer: { + required: false, + serializedName: 'cer', + type: { + name: 'ByteArray' + } + }, + contentType: { + required: false, + serializedName: 'contentType', + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'CertificateAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + recoveryId: { + required: false, + serializedName: 'recoveryId', + type: { + name: 'String' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'UnixTime' + } + }, + deletedDate: { + required: false, + readOnly: true, + serializedName: 'deletedDate', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = DeletedCertificateBundle; diff --git a/lib/services/keyvault/lib/models/deletedCertificateItem.js b/lib/services/keyvault/lib/models/deletedCertificateItem.js new file mode 100644 index 0000000000..e8d20f8f77 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedCertificateItem.js @@ -0,0 +1,114 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The deleted certificate item containing metadata about the deleted + * certificate. + * + * @extends models['CertificateItem'] + */ +class DeletedCertificateItem extends models['CertificateItem'] { + /** + * Create a DeletedCertificateItem. + * @property {string} [recoveryId] The url of the recovery object, used to + * identify and recover the deleted certificate. + * @property {date} [scheduledPurgeDate] The time when the certificate is + * scheduled to be purged, in UTC + * @property {date} [deletedDate] The time when the certificate was deleted, + * in UTC + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedCertificateItem + * + * @returns {object} metadata of DeletedCertificateItem + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedCertificateItem', + type: { + name: 'Composite', + className: 'DeletedCertificateItem', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'CertificateAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + x509Thumbprint: { + required: false, + serializedName: 'x5t', + type: { + name: 'Base64Url' + } + }, + recoveryId: { + required: false, + serializedName: 'recoveryId', + type: { + name: 'String' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'UnixTime' + } + }, + deletedDate: { + required: false, + readOnly: true, + serializedName: 'deletedDate', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = DeletedCertificateItem; diff --git a/lib/services/keyvault/lib/models/deletedCertificateListResult.js b/lib/services/keyvault/lib/models/deletedCertificateListResult.js new file mode 100644 index 0000000000..65c6c98943 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedCertificateListResult.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A list of certificates that have been deleted in this vault. + */ +class DeletedCertificateListResult extends Array { + /** + * Create a DeletedCertificateListResult. + * @property {string} [nextLink] The URL to get the next set of deleted + * certificates. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedCertificateListResult + * + * @returns {object} metadata of DeletedCertificateListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedCertificateListResult', + type: { + name: 'Composite', + className: 'DeletedCertificateListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DeletedCertificateItemElementType', + type: { + name: 'Composite', + className: 'DeletedCertificateItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DeletedCertificateListResult; diff --git a/lib/services/keyvault/lib/models/deletedKeyBundle.js b/lib/services/keyvault/lib/models/deletedKeyBundle.js new file mode 100644 index 0000000000..5f19408bc5 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedKeyBundle.js @@ -0,0 +1,115 @@ +/* + * 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 DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion + * info + * + * @extends models['KeyBundle'] + */ +class DeletedKeyBundle extends models['KeyBundle'] { + /** + * Create a DeletedKeyBundle. + * @property {string} [recoveryId] The url of the recovery object, used to + * identify and recover the deleted key. + * @property {date} [scheduledPurgeDate] The time when the key is scheduled + * to be purged, in UTC + * @property {date} [deletedDate] The time when the key was deleted, in UTC + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedKeyBundle + * + * @returns {object} metadata of DeletedKeyBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedKeyBundle', + type: { + name: 'Composite', + className: 'DeletedKeyBundle', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'Composite', + className: 'JsonWebKey' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'KeyAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + managed: { + required: false, + readOnly: true, + serializedName: 'managed', + type: { + name: 'Boolean' + } + }, + recoveryId: { + required: false, + serializedName: 'recoveryId', + type: { + name: 'String' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'UnixTime' + } + }, + deletedDate: { + required: false, + readOnly: true, + serializedName: 'deletedDate', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = DeletedKeyBundle; diff --git a/lib/services/keyvault/lib/models/deletedKeyItem.js b/lib/services/keyvault/lib/models/deletedKeyItem.js new file mode 100644 index 0000000000..f4058af07b --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedKeyItem.js @@ -0,0 +1,114 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The deleted key item containing the deleted key metadata and information + * about deletion. + * + * @extends models['KeyItem'] + */ +class DeletedKeyItem extends models['KeyItem'] { + /** + * Create a DeletedKeyItem. + * @property {string} [recoveryId] The url of the recovery object, used to + * identify and recover the deleted key. + * @property {date} [scheduledPurgeDate] The time when the key is scheduled + * to be purged, in UTC + * @property {date} [deletedDate] The time when the key was deleted, in UTC + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedKeyItem + * + * @returns {object} metadata of DeletedKeyItem + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedKeyItem', + type: { + name: 'Composite', + className: 'DeletedKeyItem', + modelProperties: { + kid: { + required: false, + serializedName: 'kid', + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'KeyAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + managed: { + required: false, + readOnly: true, + serializedName: 'managed', + type: { + name: 'Boolean' + } + }, + recoveryId: { + required: false, + serializedName: 'recoveryId', + type: { + name: 'String' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'UnixTime' + } + }, + deletedDate: { + required: false, + readOnly: true, + serializedName: 'deletedDate', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = DeletedKeyItem; diff --git a/lib/services/keyvault/lib/models/deletedKeyListResult.js b/lib/services/keyvault/lib/models/deletedKeyListResult.js new file mode 100644 index 0000000000..a97bd0fa7d --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedKeyListResult.js @@ -0,0 +1,69 @@ +/* + * 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 list of keys that have been deleted in this vault. + */ +class DeletedKeyListResult extends Array { + /** + * Create a DeletedKeyListResult. + * @property {string} [nextLink] The URL to get the next set of deleted keys. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedKeyListResult + * + * @returns {object} metadata of DeletedKeyListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedKeyListResult', + type: { + name: 'Composite', + className: 'DeletedKeyListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DeletedKeyItemElementType', + type: { + name: 'Composite', + className: 'DeletedKeyItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DeletedKeyListResult; diff --git a/lib/services/keyvault/lib/models/deletedSasDefinitionBundle.js b/lib/services/keyvault/lib/models/deletedSasDefinitionBundle.js new file mode 100644 index 0000000000..986ca783e1 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedSasDefinitionBundle.js @@ -0,0 +1,142 @@ +/* + * 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 deleted SAS definition bundle consisting of its previous id, attributes + * and its tags, as well as information on when it will be purged. + * + * @extends models['SasDefinitionBundle'] + */ +class DeletedSasDefinitionBundle extends models['SasDefinitionBundle'] { + /** + * Create a DeletedSasDefinitionBundle. + * @property {string} [recoveryId] The url of the recovery object, used to + * identify and recover the deleted SAS definition. + * @property {date} [scheduledPurgeDate] The time when the SAS definition is + * scheduled to be purged, in UTC + * @property {date} [deletedDate] The time when the SAS definition was + * deleted, in UTC + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedSasDefinitionBundle + * + * @returns {object} metadata of DeletedSasDefinitionBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedSasDefinitionBundle', + type: { + name: 'Composite', + className: 'DeletedSasDefinitionBundle', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + secretId: { + required: false, + readOnly: true, + serializedName: 'sid', + type: { + name: 'String' + } + }, + templateUri: { + required: false, + readOnly: true, + serializedName: 'templateUri', + type: { + name: 'String' + } + }, + sasType: { + required: false, + readOnly: true, + serializedName: 'sasType', + type: { + name: 'String' + } + }, + validityPeriod: { + required: false, + readOnly: true, + serializedName: 'validityPeriod', + type: { + name: 'String' + } + }, + attributes: { + required: false, + readOnly: true, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SasDefinitionAttributes' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + recoveryId: { + required: false, + serializedName: 'recoveryId', + type: { + name: 'String' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'UnixTime' + } + }, + deletedDate: { + required: false, + readOnly: true, + serializedName: 'deletedDate', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = DeletedSasDefinitionBundle; diff --git a/lib/services/keyvault/lib/models/deletedSasDefinitionItem.js b/lib/services/keyvault/lib/models/deletedSasDefinitionItem.js new file mode 100644 index 0000000000..604ddde3a8 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedSasDefinitionItem.js @@ -0,0 +1,118 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The deleted SAS definition item containing metadata about the deleted SAS + * definition. + * + * @extends models['SasDefinitionItem'] + */ +class DeletedSasDefinitionItem extends models['SasDefinitionItem'] { + /** + * Create a DeletedSasDefinitionItem. + * @property {string} [recoveryId] The url of the recovery object, used to + * identify and recover the deleted SAS definition. + * @property {date} [scheduledPurgeDate] The time when the SAS definition is + * scheduled to be purged, in UTC + * @property {date} [deletedDate] The time when the SAS definition was + * deleted, in UTC + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedSasDefinitionItem + * + * @returns {object} metadata of DeletedSasDefinitionItem + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedSasDefinitionItem', + type: { + name: 'Composite', + className: 'DeletedSasDefinitionItem', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + secretId: { + required: false, + readOnly: true, + serializedName: 'sid', + type: { + name: 'String' + } + }, + attributes: { + required: false, + readOnly: true, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SasDefinitionAttributes' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + recoveryId: { + required: false, + serializedName: 'recoveryId', + type: { + name: 'String' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'UnixTime' + } + }, + deletedDate: { + required: false, + readOnly: true, + serializedName: 'deletedDate', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = DeletedSasDefinitionItem; diff --git a/lib/services/keyvault/lib/models/deletedSasDefinitionListResult.js b/lib/services/keyvault/lib/models/deletedSasDefinitionListResult.js new file mode 100644 index 0000000000..5a78a4eae0 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedSasDefinitionListResult.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The deleted SAS definition list result + */ +class DeletedSasDefinitionListResult extends Array { + /** + * Create a DeletedSasDefinitionListResult. + * @property {string} [nextLink] The URL to get the next set of deleted SAS + * definitions. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedSasDefinitionListResult + * + * @returns {object} metadata of DeletedSasDefinitionListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedSasDefinitionListResult', + type: { + name: 'Composite', + className: 'DeletedSasDefinitionListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DeletedSasDefinitionItemElementType', + type: { + name: 'Composite', + className: 'DeletedSasDefinitionItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DeletedSasDefinitionListResult; diff --git a/lib/services/keyvault/lib/models/deletedSecretBundle.js b/lib/services/keyvault/lib/models/deletedSecretBundle.js new file mode 100644 index 0000000000..871154aee1 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedSecretBundle.js @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A Deleted Secret consisting of its previous id, attributes and its tags, as + * well as information on when it will be purged. + * + * @extends models['SecretBundle'] + */ +class DeletedSecretBundle extends models['SecretBundle'] { + /** + * Create a DeletedSecretBundle. + * @property {string} [recoveryId] The url of the recovery object, used to + * identify and recover the deleted secret. + * @property {date} [scheduledPurgeDate] The time when the secret is + * scheduled to be purged, in UTC + * @property {date} [deletedDate] The time when the secret was deleted, in + * UTC + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedSecretBundle + * + * @returns {object} metadata of DeletedSecretBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedSecretBundle', + type: { + name: 'Composite', + className: 'DeletedSecretBundle', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + contentType: { + required: false, + serializedName: 'contentType', + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SecretAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + kid: { + required: false, + readOnly: true, + serializedName: 'kid', + type: { + name: 'String' + } + }, + managed: { + required: false, + readOnly: true, + serializedName: 'managed', + type: { + name: 'Boolean' + } + }, + recoveryId: { + required: false, + serializedName: 'recoveryId', + type: { + name: 'String' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'UnixTime' + } + }, + deletedDate: { + required: false, + readOnly: true, + serializedName: 'deletedDate', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = DeletedSecretBundle; diff --git a/lib/services/keyvault/lib/models/deletedSecretItem.js b/lib/services/keyvault/lib/models/deletedSecretItem.js new file mode 100644 index 0000000000..a9ae77e4fc --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedSecretItem.js @@ -0,0 +1,121 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The deleted secret item containing metadata about the deleted secret. + * + * @extends models['SecretItem'] + */ +class DeletedSecretItem extends models['SecretItem'] { + /** + * Create a DeletedSecretItem. + * @property {string} [recoveryId] The url of the recovery object, used to + * identify and recover the deleted secret. + * @property {date} [scheduledPurgeDate] The time when the secret is + * scheduled to be purged, in UTC + * @property {date} [deletedDate] The time when the secret was deleted, in + * UTC + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedSecretItem + * + * @returns {object} metadata of DeletedSecretItem + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedSecretItem', + type: { + name: 'Composite', + className: 'DeletedSecretItem', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SecretAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + contentType: { + required: false, + serializedName: 'contentType', + type: { + name: 'String' + } + }, + managed: { + required: false, + readOnly: true, + serializedName: 'managed', + type: { + name: 'Boolean' + } + }, + recoveryId: { + required: false, + serializedName: 'recoveryId', + type: { + name: 'String' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'UnixTime' + } + }, + deletedDate: { + required: false, + readOnly: true, + serializedName: 'deletedDate', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = DeletedSecretItem; diff --git a/lib/services/keyvault/lib/models/deletedSecretListResult.js b/lib/services/keyvault/lib/models/deletedSecretListResult.js new file mode 100644 index 0000000000..6ae0336076 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedSecretListResult.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The deleted secret list result + */ +class DeletedSecretListResult extends Array { + /** + * Create a DeletedSecretListResult. + * @property {string} [nextLink] The URL to get the next set of deleted + * secrets. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedSecretListResult + * + * @returns {object} metadata of DeletedSecretListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedSecretListResult', + type: { + name: 'Composite', + className: 'DeletedSecretListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DeletedSecretItemElementType', + type: { + name: 'Composite', + className: 'DeletedSecretItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DeletedSecretListResult; diff --git a/lib/services/keyvault/lib/models/deletedStorageAccountItem.js b/lib/services/keyvault/lib/models/deletedStorageAccountItem.js new file mode 100644 index 0000000000..02a64e6187 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedStorageAccountItem.js @@ -0,0 +1,118 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The deleted storage account item containing metadata about the deleted + * storage account. + * + * @extends models['StorageAccountItem'] + */ +class DeletedStorageAccountItem extends models['StorageAccountItem'] { + /** + * Create a DeletedStorageAccountItem. + * @property {string} [recoveryId] The url of the recovery object, used to + * identify and recover the deleted storage account. + * @property {date} [scheduledPurgeDate] The time when the storage account is + * scheduled to be purged, in UTC + * @property {date} [deletedDate] The time when the storage account was + * deleted, in UTC + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedStorageAccountItem + * + * @returns {object} metadata of DeletedStorageAccountItem + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedStorageAccountItem', + type: { + name: 'Composite', + className: 'DeletedStorageAccountItem', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + resourceId: { + required: false, + readOnly: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + attributes: { + required: false, + readOnly: true, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'StorageAccountAttributes' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + recoveryId: { + required: false, + serializedName: 'recoveryId', + type: { + name: 'String' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'UnixTime' + } + }, + deletedDate: { + required: false, + readOnly: true, + serializedName: 'deletedDate', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = DeletedStorageAccountItem; diff --git a/lib/services/keyvault/lib/models/deletedStorageBundle.js b/lib/services/keyvault/lib/models/deletedStorageBundle.js new file mode 100644 index 0000000000..8d7c94aae1 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedStorageBundle.js @@ -0,0 +1,142 @@ +/* + * 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 deleted storage account bundle consisting of its previous id, attributes + * and its tags, as well as information on when it will be purged. + * + * @extends models['StorageBundle'] + */ +class DeletedStorageBundle extends models['StorageBundle'] { + /** + * Create a DeletedStorageBundle. + * @property {string} [recoveryId] The url of the recovery object, used to + * identify and recover the deleted storage account. + * @property {date} [scheduledPurgeDate] The time when the storage account is + * scheduled to be purged, in UTC + * @property {date} [deletedDate] The time when the storage account was + * deleted, in UTC + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedStorageBundle + * + * @returns {object} metadata of DeletedStorageBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedStorageBundle', + type: { + name: 'Composite', + className: 'DeletedStorageBundle', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + resourceId: { + required: false, + readOnly: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + activeKeyName: { + required: false, + readOnly: true, + serializedName: 'activeKeyName', + type: { + name: 'String' + } + }, + autoRegenerateKey: { + required: false, + readOnly: true, + serializedName: 'autoRegenerateKey', + type: { + name: 'Boolean' + } + }, + regenerationPeriod: { + required: false, + readOnly: true, + serializedName: 'regenerationPeriod', + type: { + name: 'String' + } + }, + attributes: { + required: false, + readOnly: true, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'StorageAccountAttributes' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + recoveryId: { + required: false, + serializedName: 'recoveryId', + type: { + name: 'String' + } + }, + scheduledPurgeDate: { + required: false, + readOnly: true, + serializedName: 'scheduledPurgeDate', + type: { + name: 'UnixTime' + } + }, + deletedDate: { + required: false, + readOnly: true, + serializedName: 'deletedDate', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = DeletedStorageBundle; diff --git a/lib/services/keyvault/lib/models/deletedStorageListResult.js b/lib/services/keyvault/lib/models/deletedStorageListResult.js new file mode 100644 index 0000000000..f8f242c946 --- /dev/null +++ b/lib/services/keyvault/lib/models/deletedStorageListResult.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The deleted storage account list result + */ +class DeletedStorageListResult extends Array { + /** + * Create a DeletedStorageListResult. + * @property {string} [nextLink] The URL to get the next set of deleted + * storage accounts. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeletedStorageListResult + * + * @returns {object} metadata of DeletedStorageListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DeletedStorageListResult', + type: { + name: 'Composite', + className: 'DeletedStorageListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DeletedStorageAccountItemElementType', + type: { + name: 'Composite', + className: 'DeletedStorageAccountItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DeletedStorageListResult; diff --git a/lib/services/keyvault/lib/models/errorModel.js b/lib/services/keyvault/lib/models/errorModel.js new file mode 100644 index 0000000000..23e4b02204 --- /dev/null +++ b/lib/services/keyvault/lib/models/errorModel.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The key vault server error. + * + */ +class ErrorModel { + /** + * Create a ErrorModel. + * @property {string} [code] The error code. + * @property {string} [message] The error message. + * @property {object} [innerError] + */ + constructor() { + } + + /** + * Defines the metadata of ErrorModel + * + * @returns {object} metadata of ErrorModel + * + */ + mapper() { + return { + required: false, + serializedName: 'Error', + type: { + name: 'Composite', + className: 'ErrorModel', + modelProperties: { + code: { + required: false, + readOnly: true, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + innerError: { + required: false, + readOnly: true, + serializedName: 'innererror', + type: { + name: 'Composite', + className: 'ErrorModel' + } + } + } + } + }; + } +} + +module.exports = ErrorModel; diff --git a/lib/services/keyvault/lib/models/index.d.ts b/lib/services/keyvault/lib/models/index.d.ts new file mode 100644 index 0000000000..914c9a2df3 --- /dev/null +++ b/lib/services/keyvault/lib/models/index.d.ts @@ -0,0 +1,1681 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { BaseResource, CloudError } from "ms-rest-azure"; +import * as moment from "moment"; + +export { + + BaseResource, + CloudError +}; + +/** + * The object attributes managed by the KeyVault service. + */ +export interface Attributes { + /** + * Determines whether the object is enabled. + */ + enabled?: boolean; + /** + * Not before date in UTC. + */ + notBefore?: Date; + /** + * Expiry date in UTC. + */ + expires?: Date; + /** + * Creation time in UTC. + */ + readonly created?: Date; + /** + * Last updated time in UTC. + */ + readonly updated?: Date; +} + +/** + * As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 + */ +export interface JsonWebKey { + /** + * Key identifier. + */ + kid?: string; + /** + * JsonWebKey Key Type (kty), as defined in + * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Possible values include: + * 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + */ + kty?: string; + keyOps?: string[]; + /** + * RSA modulus. + */ + n?: Buffer; + /** + * RSA public exponent. + */ + e?: Buffer; + /** + * RSA private exponent, or the D component of an EC private key. + */ + d?: Buffer; + /** + * RSA private key parameter. + */ + dp?: Buffer; + /** + * RSA private key parameter. + */ + dq?: Buffer; + /** + * RSA private key parameter. + */ + qi?: Buffer; + /** + * RSA secret prime. + */ + p?: Buffer; + /** + * RSA secret prime, with p < q. + */ + q?: Buffer; + /** + * Symmetric key. + */ + k?: Buffer; + /** + * HSM Token, used with 'Bring Your Own Key'. + */ + t?: Buffer; + /** + * Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: + * 'P-256', 'P-384', 'P-521', 'P-256K' + */ + crv?: string; + /** + * X component of an EC public key. + */ + x?: Buffer; + /** + * Y component of an EC public key. + */ + y?: Buffer; +} + +/** + * The attributes of a key managed by the key vault service. +*/ +export interface KeyAttributes extends Attributes { + /** + * Reflects the deletion recovery level currently in effect for keys in the current vault. If it + * contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only + * the system can purge the key, at the end of the retention interval. Possible values include: + * 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', 'Recoverable+ProtectedSubscription' + */ + readonly recoveryLevel?: string; +} + +/** + * A KeyBundle consisting of a WebKey plus its attributes. +*/ +export interface KeyBundle { + /** + * The Json web key. + */ + key?: JsonWebKey; + /** + * The key management attributes. + */ + attributes?: KeyAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; + /** + * True if the key's lifetime is managed by key vault. If this is a key backing a certificate, + * then managed will be true. + */ + readonly managed?: boolean; +} + +/** + * The key item containing key metadata. +*/ +export interface KeyItem { + /** + * Key identifier. + */ + kid?: string; + /** + * The key management attributes. + */ + attributes?: KeyAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; + /** + * True if the key's lifetime is managed by key vault. If this is a key backing a certificate, + * then managed will be true. + */ + readonly managed?: boolean; +} + +/** + * A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info +*/ +export interface DeletedKeyBundle extends KeyBundle { + /** + * The url of the recovery object, used to identify and recover the deleted key. + */ + recoveryId?: string; + /** + * The time when the key is scheduled to be purged, in UTC + */ + readonly scheduledPurgeDate?: Date; + /** + * The time when the key was deleted, in UTC + */ + readonly deletedDate?: Date; +} + +/** + * The deleted key item containing the deleted key metadata and information about deletion. +*/ +export interface DeletedKeyItem extends KeyItem { + /** + * The url of the recovery object, used to identify and recover the deleted key. + */ + recoveryId?: string; + /** + * The time when the key is scheduled to be purged, in UTC + */ + readonly scheduledPurgeDate?: Date; + /** + * The time when the key was deleted, in UTC + */ + readonly deletedDate?: Date; +} + +/** + * The secret management attributes. +*/ +export interface SecretAttributes extends Attributes { + /** + * Reflects the deletion recovery level currently in effect for secrets in the current vault. If + * it contains 'Purgeable', the secret can be permanently deleted by a privileged user; + * otherwise, only the system can purge the secret, at the end of the retention interval. + * Possible values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + */ + readonly recoveryLevel?: string; +} + +/** + * A secret consisting of a value, id and its attributes. +*/ +export interface SecretBundle { + /** + * The secret value. + */ + value?: string; + /** + * The secret id. + */ + id?: string; + /** + * The content type of the secret. + */ + contentType?: string; + /** + * The secret management attributes. + */ + attributes?: SecretAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; + /** + * If this is a secret backing a KV certificate, then this field specifies the corresponding key + * backing the KV certificate. + */ + readonly kid?: string; + /** + * True if the secret's lifetime is managed by key vault. If this is a secret backing a + * certificate, then managed will be true. + */ + readonly managed?: boolean; +} + +/** + * The secret item containing secret metadata. +*/ +export interface SecretItem { + /** + * Secret identifier. + */ + id?: string; + /** + * The secret management attributes. + */ + attributes?: SecretAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; + /** + * Type of the secret value such as a password. + */ + contentType?: string; + /** + * True if the secret's lifetime is managed by key vault. If this is a key backing a certificate, + * then managed will be true. + */ + readonly managed?: boolean; +} + +/** + * A Deleted Secret consisting of its previous id, attributes and its tags, as well as information + * on when it will be purged. +*/ +export interface DeletedSecretBundle extends SecretBundle { + /** + * The url of the recovery object, used to identify and recover the deleted secret. + */ + recoveryId?: string; + /** + * The time when the secret is scheduled to be purged, in UTC + */ + readonly scheduledPurgeDate?: Date; + /** + * The time when the secret was deleted, in UTC + */ + readonly deletedDate?: Date; +} + +/** + * The deleted secret item containing metadata about the deleted secret. +*/ +export interface DeletedSecretItem extends SecretItem { + /** + * The url of the recovery object, used to identify and recover the deleted secret. + */ + recoveryId?: string; + /** + * The time when the secret is scheduled to be purged, in UTC + */ + readonly scheduledPurgeDate?: Date; + /** + * The time when the secret was deleted, in UTC + */ + readonly deletedDate?: Date; +} + +/** + * The secret restore parameters. +*/ +export interface SecretRestoreParameters { + /** + * The backup blob associated with a secret bundle. + */ + secretBundleBackup: Buffer; +} + +/** + * The secret restore parameters. +*/ +export interface StorageRestoreParameters { + /** + * The backup blob associated with a storage account. + */ + storageBundleBackup: Buffer; +} + +/** + * The certificate management attributes. +*/ +export interface CertificateAttributes extends Attributes { + /** + * Reflects the deletion recovery level currently in effect for certificates in the current + * vault. If it contains 'Purgeable', the certificate can be permanently deleted by a privileged + * user; otherwise, only the system can purge the certificate, at the end of the retention + * interval. Possible values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + */ + readonly recoveryLevel?: string; +} + +/** + * The certificate item containing certificate metadata. +*/ +export interface CertificateItem { + /** + * Certificate identifier. + */ + id?: string; + /** + * The certificate management attributes. + */ + attributes?: CertificateAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; + /** + * Thumbprint of the certificate. + */ + x509Thumbprint?: Buffer; +} + +/** + * The certificate issuer item containing certificate issuer metadata. +*/ +export interface CertificateIssuerItem { + /** + * Certificate Identifier. + */ + id?: string; + /** + * The issuer provider. + */ + provider?: string; +} + +/** + * Properties of the key pair backing a certificate. +*/ +export interface KeyProperties { + /** + * Indicates if the private key can be exported. + */ + exportable?: boolean; + /** + * The type of key pair to be used for the certificate. Possible values include: 'EC', 'EC-HSM', + * 'RSA', 'RSA-HSM', 'oct' + */ + keyType?: string; + /** + * The key size in bits. For example: 2048, 3072, or 4096 for RSA. + */ + keySize?: number; + /** + * Indicates if the same key pair will be used on certificate renewal. + */ + reuseKey?: boolean; + /** + * Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: + * 'P-256', 'P-384', 'P-521', 'P-256K' + */ + curve?: string; +} + +/** + * Properties of the key backing a certificate. +*/ +export interface SecretProperties { + /** + * The media type (MIME type). + */ + contentType?: string; +} + +/** + * The subject alternate names of a X509 object. +*/ +export interface SubjectAlternativeNames { + /** + * Email addresses. + */ + emails?: string[]; + /** + * Domain names. + */ + dnsNames?: string[]; + /** + * User principal names. + */ + upns?: string[]; +} + +/** + * Properties of the X509 component of a certificate. +*/ +export interface X509CertificateProperties { + /** + * The subject name. Should be a valid X509 distinguished Name. + */ + subject?: string; + /** + * The enhanced key usage. + */ + ekus?: string[]; + /** + * The subject alternative names. + */ + subjectAlternativeNames?: SubjectAlternativeNames; + /** + * List of key usages. + */ + keyUsage?: string[]; + /** + * The duration that the certificate is valid in months. + */ + validityInMonths?: number; +} + +/** + * A condition to be satisfied for an action to be executed. +*/ +export interface Trigger { + /** + * Percentage of lifetime at which to trigger. Value should be between 1 and 99. + */ + lifetimePercentage?: number; + /** + * Days before expiry to attempt renewal. Value should be between 1 and validity_in_months + * multiplied by 27. If validity_in_months is 36, then value should be between 1 and 972 (36 * + * 27). + */ + daysBeforeExpiry?: number; +} + +/** + * The action that will be executed. +*/ +export interface Action { + /** + * The type of the action. Possible values include: 'EmailContacts', 'AutoRenew' + */ + actionType?: string; +} + +/** + * Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. +*/ +export interface LifetimeAction { + /** + * The condition that will execute the action. + */ + trigger?: Trigger; + /** + * The action that will be executed. + */ + action?: Action; +} + +/** + * Parameters for the issuer of the X509 component of a certificate. +*/ +export interface IssuerParameters { + /** + * Name of the referenced issuer object or reserved names; for example, 'Self' or 'Unknown'. + */ + name?: string; + /** + * Type of certificate to be requested from the issuer provider. + */ + certificateType?: string; + /** + * Indicates if the certificates generated under this policy should be published to certificate + * transparency logs. + */ + certificateTransparency?: boolean; +} + +/** + * Management policy for a certificate. +*/ +export interface CertificatePolicy { + /** + * The certificate id. + */ + readonly id?: string; + /** + * Properties of the key backing a certificate. + */ + keyProperties?: KeyProperties; + /** + * Properties of the secret backing a certificate. + */ + secretProperties?: SecretProperties; + /** + * Properties of the X509 component of a certificate. + */ + x509CertificateProperties?: X509CertificateProperties; + /** + * Actions that will be performed by Key Vault over the lifetime of a certificate. + */ + lifetimeActions?: LifetimeAction[]; + /** + * Parameters for the issuer of the X509 component of a certificate. + */ + issuerParameters?: IssuerParameters; + /** + * The certificate attributes. + */ + attributes?: CertificateAttributes; +} + +/** + * A certificate bundle consists of a certificate (X509) plus its attributes. +*/ +export interface CertificateBundle { + /** + * The certificate id. + */ + readonly id?: string; + /** + * The key id. + */ + readonly kid?: string; + /** + * The secret id. + */ + readonly sid?: string; + /** + * Thumbprint of the certificate. + */ + readonly x509Thumbprint?: Buffer; + /** + * The management policy. + */ + readonly policy?: CertificatePolicy; + /** + * CER contents of x509 certificate. + */ + cer?: Buffer; + /** + * The content type of the secret. + */ + contentType?: string; + /** + * The certificate attributes. + */ + attributes?: CertificateAttributes; + /** + * Application specific metadata in the form of key-value pairs + */ + tags?: { [propertyName: string]: string }; +} + +/** + * A Deleted Certificate consisting of its previous id, attributes and its tags, as well as + * information on when it will be purged. +*/ +export interface DeletedCertificateBundle extends CertificateBundle { + /** + * The url of the recovery object, used to identify and recover the deleted certificate. + */ + recoveryId?: string; + /** + * The time when the certificate is scheduled to be purged, in UTC + */ + readonly scheduledPurgeDate?: Date; + /** + * The time when the certificate was deleted, in UTC + */ + readonly deletedDate?: Date; +} + +/** + * The deleted certificate item containing metadata about the deleted certificate. +*/ +export interface DeletedCertificateItem extends CertificateItem { + /** + * The url of the recovery object, used to identify and recover the deleted certificate. + */ + recoveryId?: string; + /** + * The time when the certificate is scheduled to be purged, in UTC + */ + readonly scheduledPurgeDate?: Date; + /** + * The time when the certificate was deleted, in UTC + */ + readonly deletedDate?: Date; +} + +/** + * The key vault server error. +*/ +export interface ErrorModel { + /** + * The error code. + */ + readonly code?: string; + /** + * The error message. + */ + readonly message?: string; + readonly innerError?: ErrorModel; +} + +/** + * A certificate operation is returned in case of asynchronous requests. +*/ +export interface CertificateOperation { + /** + * The certificate id. + */ + readonly id?: string; + /** + * Parameters for the issuer of the X509 component of a certificate. + */ + issuerParameters?: IssuerParameters; + /** + * The certificate signing request (CSR) that is being used in the certificate operation. + */ + csr?: Buffer; + /** + * Indicates if cancellation was requested on the certificate operation. + */ + cancellationRequested?: boolean; + /** + * Status of the certificate operation. + */ + status?: string; + /** + * The status details of the certificate operation. + */ + statusDetails?: string; + /** + * Error encountered, if any, during the certificate operation. + */ + error?: ErrorModel; + /** + * Location which contains the result of the certificate operation. + */ + target?: string; + /** + * Identifier for the certificate operation. + */ + requestId?: string; +} + +/** + * The credentials to be used for the certificate issuer. +*/ +export interface IssuerCredentials { + /** + * The user name/account name/account id. + */ + accountId?: string; + /** + * The password/secret/account key. + */ + password?: string; +} + +/** + * Details of the organization administrator of the certificate issuer. +*/ +export interface AdministratorDetails { + /** + * First name. + */ + firstName?: string; + /** + * Last name. + */ + lastName?: string; + /** + * Email address. + */ + emailAddress?: string; + /** + * Phone number. + */ + phone?: string; +} + +/** + * Details of the organization of the certificate issuer. +*/ +export interface OrganizationDetails { + /** + * Id of the organization. + */ + id?: string; + /** + * Details of the organization administrator. + */ + adminDetails?: AdministratorDetails[]; +} + +/** + * The attributes of an issuer managed by the Key Vault service. +*/ +export interface IssuerAttributes { + /** + * Determines whether the issuer is enabled. + */ + enabled?: boolean; + /** + * Creation time in UTC. + */ + readonly created?: Date; + /** + * Last updated time in UTC. + */ + readonly updated?: Date; +} + +/** + * The issuer for Key Vault certificate. +*/ +export interface IssuerBundle { + /** + * Identifier for the issuer object. + */ + readonly id?: string; + /** + * The issuer provider. + */ + provider?: string; + /** + * The credentials to be used for the issuer. + */ + credentials?: IssuerCredentials; + /** + * Details of the organization as provided to the issuer. + */ + organizationDetails?: OrganizationDetails; + /** + * Attributes of the issuer object. + */ + attributes?: IssuerAttributes; +} + +/** + * The contact information for the vault certificates. +*/ +export interface Contact { + /** + * Email address. + */ + emailAddress?: string; + /** + * Name. + */ + name?: string; + /** + * Phone number. + */ + phone?: string; +} + +/** + * The contacts for the vault certificates. +*/ +export interface Contacts { + /** + * Identifier for the contacts collection. + */ + readonly id?: string; + /** + * The contact list for the vault certificates. + */ + contactList?: Contact[]; +} + +/** + * The key create parameters. +*/ +export interface KeyCreateParameters { + /** + * The type of key to create. For valid values, see JsonWebKeyType. Possible values include: + * 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + */ + kty: string; + /** + * The key size in bits. For example: 2048, 3072, or 4096 for RSA. + */ + keySize?: number; + keyOps?: string[]; + keyAttributes?: KeyAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; + /** + * Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: + * 'P-256', 'P-384', 'P-521', 'P-256K' + */ + curve?: string; +} + +/** + * The key import parameters. +*/ +export interface KeyImportParameters { + /** + * Whether to import as a hardware key (HSM) or software key. + */ + hsm?: boolean; + /** + * The Json web key + */ + key: JsonWebKey; + /** + * The key management attributes. + */ + keyAttributes?: KeyAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The key operations parameters. +*/ +export interface KeyOperationsParameters { + /** + * algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + */ + algorithm: string; + value: Buffer; +} + +/** + * The key operations parameters. +*/ +export interface KeySignParameters { + /** + * The signing/verification algorithm identifier. For more information on possible algorithm + * types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', + * 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' + */ + algorithm: string; + value: Buffer; +} + +/** + * The key verify parameters. +*/ +export interface KeyVerifyParameters { + /** + * The signing/verification algorithm. For more information on possible algorithm types, see + * JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', + * 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' + */ + algorithm: string; + /** + * The digest used for signing. + */ + digest: Buffer; + /** + * The signature to be verified. + */ + signature: Buffer; +} + +/** + * The key update parameters. +*/ +export interface KeyUpdateParameters { + /** + * Json web key operations. For more information on possible key operations, see + * JsonWebKeyOperation. + */ + keyOps?: string[]; + keyAttributes?: KeyAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The key restore parameters. +*/ +export interface KeyRestoreParameters { + /** + * The backup blob associated with a key bundle. + */ + keyBundleBackup: Buffer; +} + +/** + * The secret set parameters. +*/ +export interface SecretSetParameters { + /** + * The value of the secret. + */ + value: string; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; + /** + * Type of the secret value such as a password. + */ + contentType?: string; + /** + * The secret management attributes. + */ + secretAttributes?: SecretAttributes; +} + +/** + * The secret update parameters. +*/ +export interface SecretUpdateParameters { + /** + * Type of the secret value such as a password. + */ + contentType?: string; + /** + * The secret management attributes. + */ + secretAttributes?: SecretAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The certificate create parameters. +*/ +export interface CertificateCreateParameters { + /** + * The management policy for the certificate. + */ + certificatePolicy?: CertificatePolicy; + /** + * The attributes of the certificate (optional). + */ + certificateAttributes?: CertificateAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The certificate import parameters. +*/ +export interface CertificateImportParameters { + /** + * Base64 encoded representation of the certificate object to import. This certificate needs to + * contain the private key. + */ + base64EncodedCertificate: string; + /** + * If the private key in base64EncodedCertificate is encrypted, the password used for encryption. + */ + password?: string; + /** + * The management policy for the certificate. + */ + certificatePolicy?: CertificatePolicy; + /** + * The attributes of the certificate (optional). + */ + certificateAttributes?: CertificateAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The certificate update parameters. +*/ +export interface CertificateUpdateParameters { + /** + * The management policy for the certificate. + */ + certificatePolicy?: CertificatePolicy; + /** + * The attributes of the certificate (optional). + */ + certificateAttributes?: CertificateAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The certificate merge parameters +*/ +export interface CertificateMergeParameters { + /** + * The certificate or the certificate chain to merge. + */ + x509Certificates: Buffer[]; + /** + * The attributes of the certificate (optional). + */ + certificateAttributes?: CertificateAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The certificate issuer set parameters. +*/ +export interface CertificateIssuerSetParameters { + /** + * The issuer provider. + */ + provider: string; + /** + * The credentials to be used for the issuer. + */ + credentials?: IssuerCredentials; + /** + * Details of the organization as provided to the issuer. + */ + organizationDetails?: OrganizationDetails; + /** + * Attributes of the issuer object. + */ + attributes?: IssuerAttributes; +} + +/** + * The certificate issuer update parameters. +*/ +export interface CertificateIssuerUpdateParameters { + /** + * The issuer provider. + */ + provider?: string; + /** + * The credentials to be used for the issuer. + */ + credentials?: IssuerCredentials; + /** + * Details of the organization as provided to the issuer. + */ + organizationDetails?: OrganizationDetails; + /** + * Attributes of the issuer object. + */ + attributes?: IssuerAttributes; +} + +/** + * The certificate operation update parameters. +*/ +export interface CertificateOperationUpdateParameter { + /** + * Indicates if cancellation was requested on the certificate operation. + */ + cancellationRequested: boolean; +} + +/** + * The key operation result. +*/ +export interface KeyOperationResult { + /** + * Key identifier + */ + readonly kid?: string; + readonly result?: Buffer; +} + +/** + * The key verify result. +*/ +export interface KeyVerifyResult { + /** + * True if the signature is verified, otherwise false. + */ + readonly value?: boolean; +} + +/** + * The backup key result, containing the backup blob. +*/ +export interface BackupKeyResult { + /** + * The backup blob containing the backed up key. + */ + readonly value?: Buffer; +} + +/** + * The backup secret result, containing the backup blob. +*/ +export interface BackupSecretResult { + /** + * The backup blob containing the backed up secret. + */ + readonly value?: Buffer; +} + +/** + * The backup storage result, containing the backup blob. +*/ +export interface BackupStorageResult { + /** + * The backup blob containing the backed up storage account. + */ + readonly value?: Buffer; +} + +/** + * The pending certificate signing request result. +*/ +export interface PendingCertificateSigningRequestResult { + /** + * The pending certificate signing request as Base64 encoded string. + */ + readonly value?: string; +} + +/** + * The storage account management attributes. +*/ +export interface StorageAccountAttributes { + /** + * the enabled state of the object. + */ + enabled?: boolean; + /** + * Creation time in UTC. + */ + readonly created?: Date; + /** + * Last updated time in UTC. + */ + readonly updated?: Date; + /** + * Reflects the deletion recovery level currently in effect for storage accounts in the current + * vault. If it contains 'Purgeable' the storage account can be permanently deleted by a + * privileged user; otherwise, only the system can purge the storage account, at the end of the + * retention interval. Possible values include: 'Purgeable', 'Recoverable+Purgeable', + * 'Recoverable', 'Recoverable+ProtectedSubscription' + */ + readonly recoveryLevel?: string; +} + +/** + * A Storage account bundle consists of key vault storage account details plus its attributes. +*/ +export interface StorageBundle { + /** + * The storage account id. + */ + readonly id?: string; + /** + * The storage account resource id. + */ + readonly resourceId?: string; + /** + * The current active storage account key name. + */ + readonly activeKeyName?: string; + /** + * whether keyvault should manage the storage account for the user. + */ + readonly autoRegenerateKey?: boolean; + /** + * The key regeneration time duration specified in ISO-8601 format. + */ + readonly regenerationPeriod?: string; + /** + * The storage account attributes. + */ + readonly attributes?: StorageAccountAttributes; + /** + * Application specific metadata in the form of key-value pairs + */ + readonly tags?: { [propertyName: string]: string }; +} + +/** + * A deleted storage account bundle consisting of its previous id, attributes and its tags, as well + * as information on when it will be purged. +*/ +export interface DeletedStorageBundle extends StorageBundle { + /** + * The url of the recovery object, used to identify and recover the deleted storage account. + */ + recoveryId?: string; + /** + * The time when the storage account is scheduled to be purged, in UTC + */ + readonly scheduledPurgeDate?: Date; + /** + * The time when the storage account was deleted, in UTC + */ + readonly deletedDate?: Date; +} + +/** + * The storage account create parameters. +*/ +export interface StorageAccountCreateParameters { + /** + * Storage account resource id. + */ + resourceId: string; + /** + * Current active storage account key name. + */ + activeKeyName: string; + /** + * whether keyvault should manage the storage account for the user. + */ + autoRegenerateKey: boolean; + /** + * The key regeneration time duration specified in ISO-8601 format. + */ + regenerationPeriod?: string; + /** + * The attributes of the storage account. + */ + storageAccountAttributes?: StorageAccountAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The storage account update parameters. +*/ +export interface StorageAccountUpdateParameters { + /** + * The current active storage account key name. + */ + activeKeyName?: string; + /** + * whether keyvault should manage the storage account for the user. + */ + autoRegenerateKey?: boolean; + /** + * The key regeneration time duration specified in ISO-8601 format. + */ + regenerationPeriod?: string; + /** + * The attributes of the storage account. + */ + storageAccountAttributes?: StorageAccountAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The storage account key regenerate parameters. +*/ +export interface StorageAccountRegenerteKeyParameters { + /** + * The storage account key name. + */ + keyName: string; +} + +/** + * The storage account item containing storage account metadata. +*/ +export interface StorageAccountItem { + /** + * Storage identifier. + */ + readonly id?: string; + /** + * Storage account resource Id. + */ + readonly resourceId?: string; + /** + * The storage account management attributes. + */ + readonly attributes?: StorageAccountAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + readonly tags?: { [propertyName: string]: string }; +} + +/** + * The deleted storage account item containing metadata about the deleted storage account. +*/ +export interface DeletedStorageAccountItem extends StorageAccountItem { + /** + * The url of the recovery object, used to identify and recover the deleted storage account. + */ + recoveryId?: string; + /** + * The time when the storage account is scheduled to be purged, in UTC + */ + readonly scheduledPurgeDate?: Date; + /** + * The time when the storage account was deleted, in UTC + */ + readonly deletedDate?: Date; +} + +/** + * The SAS definition management attributes. +*/ +export interface SasDefinitionAttributes { + /** + * the enabled state of the object. + */ + enabled?: boolean; + /** + * Creation time in UTC. + */ + readonly created?: Date; + /** + * Last updated time in UTC. + */ + readonly updated?: Date; + /** + * Reflects the deletion recovery level currently in effect for SAS definitions in the current + * vault. If it contains 'Purgeable' the SAS definition can be permanently deleted by a + * privileged user; otherwise, only the system can purge the SAS definition, at the end of the + * retention interval. Possible values include: 'Purgeable', 'Recoverable+Purgeable', + * 'Recoverable', 'Recoverable+ProtectedSubscription' + */ + readonly recoveryLevel?: string; +} + +/** + * A SAS definition bundle consists of key vault SAS definition details plus its attributes. +*/ +export interface SasDefinitionBundle { + /** + * The SAS definition id. + */ + readonly id?: string; + /** + * Storage account SAS definition secret id. + */ + readonly secretId?: string; + /** + * The SAS definition token template signed with an arbitrary key. Tokens created according to + * the SAS definition will have the same properties as the template. + */ + readonly templateUri?: string; + /** + * The type of SAS token the SAS definition will create. Possible values include: 'account', + * 'service' + */ + readonly sasType?: string; + /** + * The validity period of SAS tokens created according to the SAS definition. + */ + readonly validityPeriod?: string; + /** + * The SAS definition attributes. + */ + readonly attributes?: SasDefinitionAttributes; + /** + * Application specific metadata in the form of key-value pairs + */ + readonly tags?: { [propertyName: string]: string }; +} + +/** + * A deleted SAS definition bundle consisting of its previous id, attributes and its tags, as well + * as information on when it will be purged. +*/ +export interface DeletedSasDefinitionBundle extends SasDefinitionBundle { + /** + * The url of the recovery object, used to identify and recover the deleted SAS definition. + */ + recoveryId?: string; + /** + * The time when the SAS definition is scheduled to be purged, in UTC + */ + readonly scheduledPurgeDate?: Date; + /** + * The time when the SAS definition was deleted, in UTC + */ + readonly deletedDate?: Date; +} + +/** + * The SAS definition item containing storage SAS definition metadata. +*/ +export interface SasDefinitionItem { + /** + * The storage SAS identifier. + */ + readonly id?: string; + /** + * The storage account SAS definition secret id. + */ + readonly secretId?: string; + /** + * The SAS definition management attributes. + */ + readonly attributes?: SasDefinitionAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + readonly tags?: { [propertyName: string]: string }; +} + +/** + * The deleted SAS definition item containing metadata about the deleted SAS definition. +*/ +export interface DeletedSasDefinitionItem extends SasDefinitionItem { + /** + * The url of the recovery object, used to identify and recover the deleted SAS definition. + */ + recoveryId?: string; + /** + * The time when the SAS definition is scheduled to be purged, in UTC + */ + readonly scheduledPurgeDate?: Date; + /** + * The time when the SAS definition was deleted, in UTC + */ + readonly deletedDate?: Date; +} + +/** + * The SAS definition create parameters. +*/ +export interface SasDefinitionCreateParameters { + /** + * The SAS definition token template signed with an arbitrary key. Tokens created according to + * the SAS definition will have the same properties as the template. + */ + templateUri: string; + /** + * The type of SAS token the SAS definition will create. Possible values include: 'account', + * 'service' + */ + sasType: string; + /** + * The validity period of SAS tokens created according to the SAS definition. + */ + validityPeriod: string; + /** + * The attributes of the SAS definition. + */ + sasDefinitionAttributes?: SasDefinitionAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The SAS definition update parameters. +*/ +export interface SasDefinitionUpdateParameters { + /** + * The SAS definition token template signed with an arbitrary key. Tokens created according to + * the SAS definition will have the same properties as the template. + */ + templateUri?: string; + /** + * The type of SAS token the SAS definition will create. Possible values include: 'account', + * 'service' + */ + sasType?: string; + /** + * The validity period of SAS tokens created according to the SAS definition. + */ + validityPeriod?: string; + /** + * The attributes of the SAS definition. + */ + sasDefinitionAttributes?: SasDefinitionAttributes; + /** + * Application specific metadata in the form of key-value pairs. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * The key vault error exception. +*/ +export interface KeyVaultError { + readonly error?: ErrorModel; +} + +/** + * The certificate restore parameters. +*/ +export interface CertificateRestoreParameters { + /** + * The backup blob associated with a certificate bundle. + */ + certificateBundleBackup: Buffer; +} + +/** + * The backup certificate result, containing the backup blob. +*/ +export interface BackupCertificateResult { + /** + * The backup blob containing the backed up certificate. + */ + readonly value?: Buffer; +} + +/** + * The key list result. +*/ +export interface KeyListResult extends Array { + /** + * The URL to get the next set of keys. + */ + readonly nextLink?: string; +} + +/** + * A list of keys that have been deleted in this vault. +*/ +export interface DeletedKeyListResult extends Array { + /** + * The URL to get the next set of deleted keys. + */ + readonly nextLink?: string; +} + +/** + * The secret list result. +*/ +export interface SecretListResult extends Array { + /** + * The URL to get the next set of secrets. + */ + readonly nextLink?: string; +} + +/** + * The deleted secret list result +*/ +export interface DeletedSecretListResult extends Array { + /** + * The URL to get the next set of deleted secrets. + */ + readonly nextLink?: string; +} + +/** + * The certificate list result. +*/ +export interface CertificateListResult extends Array { + /** + * The URL to get the next set of certificates. + */ + readonly nextLink?: string; +} + +/** + * The certificate issuer list result. +*/ +export interface CertificateIssuerListResult extends Array { + /** + * The URL to get the next set of certificate issuers. + */ + readonly nextLink?: string; +} + +/** + * A list of certificates that have been deleted in this vault. +*/ +export interface DeletedCertificateListResult extends Array { + /** + * The URL to get the next set of deleted certificates. + */ + readonly nextLink?: string; +} + +/** + * The storage accounts list result. +*/ +export interface StorageListResult extends Array { + /** + * The URL to get the next set of storage accounts. + */ + readonly nextLink?: string; +} + +/** + * The deleted storage account list result +*/ +export interface DeletedStorageListResult extends Array { + /** + * The URL to get the next set of deleted storage accounts. + */ + readonly nextLink?: string; +} + +/** + * The storage account SAS definition list result. +*/ +export interface SasDefinitionListResult extends Array { + /** + * The URL to get the next set of SAS definitions. + */ + readonly nextLink?: string; +} + +/** + * The deleted SAS definition list result +*/ +export interface DeletedSasDefinitionListResult extends Array { + /** + * The URL to get the next set of deleted SAS definitions. + */ + readonly nextLink?: string; +} diff --git a/lib/services/keyvault/lib/models/index.js b/lib/services/keyvault/lib/models/index.js new file mode 100644 index 0000000000..8514dd4e34 --- /dev/null +++ b/lib/services/keyvault/lib/models/index.js @@ -0,0 +1,109 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.Attributes = require('./attributes'); +exports.JsonWebKey = require('./jsonWebKey'); +exports.KeyAttributes = require('./keyAttributes'); +exports.KeyBundle = require('./keyBundle'); +exports.KeyItem = require('./keyItem'); +exports.DeletedKeyBundle = require('./deletedKeyBundle'); +exports.DeletedKeyItem = require('./deletedKeyItem'); +exports.SecretAttributes = require('./secretAttributes'); +exports.SecretBundle = require('./secretBundle'); +exports.SecretItem = require('./secretItem'); +exports.DeletedSecretBundle = require('./deletedSecretBundle'); +exports.DeletedSecretItem = require('./deletedSecretItem'); +exports.SecretRestoreParameters = require('./secretRestoreParameters'); +exports.StorageRestoreParameters = require('./storageRestoreParameters'); +exports.CertificateAttributes = require('./certificateAttributes'); +exports.CertificateItem = require('./certificateItem'); +exports.CertificateIssuerItem = require('./certificateIssuerItem'); +exports.KeyProperties = require('./keyProperties'); +exports.SecretProperties = require('./secretProperties'); +exports.SubjectAlternativeNames = require('./subjectAlternativeNames'); +exports.X509CertificateProperties = require('./x509CertificateProperties'); +exports.Trigger = require('./trigger'); +exports.Action = require('./action'); +exports.LifetimeAction = require('./lifetimeAction'); +exports.IssuerParameters = require('./issuerParameters'); +exports.CertificatePolicy = require('./certificatePolicy'); +exports.CertificateBundle = require('./certificateBundle'); +exports.DeletedCertificateBundle = require('./deletedCertificateBundle'); +exports.DeletedCertificateItem = require('./deletedCertificateItem'); +exports.ErrorModel = require('./errorModel'); +exports.CertificateOperation = require('./certificateOperation'); +exports.IssuerCredentials = require('./issuerCredentials'); +exports.AdministratorDetails = require('./administratorDetails'); +exports.OrganizationDetails = require('./organizationDetails'); +exports.IssuerAttributes = require('./issuerAttributes'); +exports.IssuerBundle = require('./issuerBundle'); +exports.Contact = require('./contact'); +exports.Contacts = require('./contacts'); +exports.KeyCreateParameters = require('./keyCreateParameters'); +exports.KeyImportParameters = require('./keyImportParameters'); +exports.KeyOperationsParameters = require('./keyOperationsParameters'); +exports.KeySignParameters = require('./keySignParameters'); +exports.KeyVerifyParameters = require('./keyVerifyParameters'); +exports.KeyUpdateParameters = require('./keyUpdateParameters'); +exports.KeyRestoreParameters = require('./keyRestoreParameters'); +exports.SecretSetParameters = require('./secretSetParameters'); +exports.SecretUpdateParameters = require('./secretUpdateParameters'); +exports.CertificateCreateParameters = require('./certificateCreateParameters'); +exports.CertificateImportParameters = require('./certificateImportParameters'); +exports.CertificateUpdateParameters = require('./certificateUpdateParameters'); +exports.CertificateMergeParameters = require('./certificateMergeParameters'); +exports.CertificateIssuerSetParameters = require('./certificateIssuerSetParameters'); +exports.CertificateIssuerUpdateParameters = require('./certificateIssuerUpdateParameters'); +exports.CertificateOperationUpdateParameter = require('./certificateOperationUpdateParameter'); +exports.KeyOperationResult = require('./keyOperationResult'); +exports.KeyVerifyResult = require('./keyVerifyResult'); +exports.BackupKeyResult = require('./backupKeyResult'); +exports.BackupSecretResult = require('./backupSecretResult'); +exports.BackupStorageResult = require('./backupStorageResult'); +exports.PendingCertificateSigningRequestResult = require('./pendingCertificateSigningRequestResult'); +exports.StorageAccountAttributes = require('./storageAccountAttributes'); +exports.StorageBundle = require('./storageBundle'); +exports.DeletedStorageBundle = require('./deletedStorageBundle'); +exports.StorageAccountCreateParameters = require('./storageAccountCreateParameters'); +exports.StorageAccountUpdateParameters = require('./storageAccountUpdateParameters'); +exports.StorageAccountRegenerteKeyParameters = require('./storageAccountRegenerteKeyParameters'); +exports.StorageAccountItem = require('./storageAccountItem'); +exports.DeletedStorageAccountItem = require('./deletedStorageAccountItem'); +exports.SasDefinitionAttributes = require('./sasDefinitionAttributes'); +exports.SasDefinitionBundle = require('./sasDefinitionBundle'); +exports.DeletedSasDefinitionBundle = require('./deletedSasDefinitionBundle'); +exports.SasDefinitionItem = require('./sasDefinitionItem'); +exports.DeletedSasDefinitionItem = require('./deletedSasDefinitionItem'); +exports.SasDefinitionCreateParameters = require('./sasDefinitionCreateParameters'); +exports.SasDefinitionUpdateParameters = require('./sasDefinitionUpdateParameters'); +exports.KeyVaultError = require('./keyVaultError'); +exports.CertificateRestoreParameters = require('./certificateRestoreParameters'); +exports.BackupCertificateResult = require('./backupCertificateResult'); +exports.KeyListResult = require('./keyListResult'); +exports.DeletedKeyListResult = require('./deletedKeyListResult'); +exports.SecretListResult = require('./secretListResult'); +exports.DeletedSecretListResult = require('./deletedSecretListResult'); +exports.CertificateListResult = require('./certificateListResult'); +exports.CertificateIssuerListResult = require('./certificateIssuerListResult'); +exports.DeletedCertificateListResult = require('./deletedCertificateListResult'); +exports.StorageListResult = require('./storageListResult'); +exports.DeletedStorageListResult = require('./deletedStorageListResult'); +exports.SasDefinitionListResult = require('./sasDefinitionListResult'); +exports.DeletedSasDefinitionListResult = require('./deletedSasDefinitionListResult'); diff --git a/lib/services/keyvault/lib/models/issuerAttributes.js b/lib/services/keyvault/lib/models/issuerAttributes.js new file mode 100644 index 0000000000..9bd9598682 --- /dev/null +++ b/lib/services/keyvault/lib/models/issuerAttributes.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The attributes of an issuer managed by the Key Vault service. + * + */ +class IssuerAttributes { + /** + * Create a IssuerAttributes. + * @property {boolean} [enabled] Determines whether the issuer is enabled. + * @property {date} [created] Creation time in UTC. + * @property {date} [updated] Last updated time in UTC. + */ + constructor() { + } + + /** + * Defines the metadata of IssuerAttributes + * + * @returns {object} metadata of IssuerAttributes + * + */ + mapper() { + return { + required: false, + serializedName: 'IssuerAttributes', + type: { + name: 'Composite', + className: 'IssuerAttributes', + modelProperties: { + enabled: { + required: false, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + created: { + required: false, + readOnly: true, + serializedName: 'created', + type: { + name: 'UnixTime' + } + }, + updated: { + required: false, + readOnly: true, + serializedName: 'updated', + type: { + name: 'UnixTime' + } + } + } + } + }; + } +} + +module.exports = IssuerAttributes; diff --git a/lib/services/keyvault/lib/models/issuerBundle.js b/lib/services/keyvault/lib/models/issuerBundle.js new file mode 100644 index 0000000000..1844e551b3 --- /dev/null +++ b/lib/services/keyvault/lib/models/issuerBundle.js @@ -0,0 +1,100 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The issuer for Key Vault certificate. + * + */ +class IssuerBundle { + /** + * Create a IssuerBundle. + * @property {string} [id] Identifier for the issuer object. + * @property {string} [provider] The issuer provider. + * @property {object} [credentials] The credentials to be used for the + * issuer. + * @property {string} [credentials.accountId] The user name/account + * name/account id. + * @property {string} [credentials.password] The password/secret/account key. + * @property {object} [organizationDetails] Details of the organization as + * provided to the issuer. + * @property {string} [organizationDetails.id] Id of the organization. + * @property {array} [organizationDetails.adminDetails] Details of the + * organization administrator. + * @property {object} [attributes] Attributes of the issuer object. + * @property {boolean} [attributes.enabled] Determines whether the issuer is + * enabled. + * @property {date} [attributes.created] Creation time in UTC. + * @property {date} [attributes.updated] Last updated time in UTC. + */ + constructor() { + } + + /** + * Defines the metadata of IssuerBundle + * + * @returns {object} metadata of IssuerBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'IssuerBundle', + type: { + name: 'Composite', + className: 'IssuerBundle', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + credentials: { + required: false, + serializedName: 'credentials', + type: { + name: 'Composite', + className: 'IssuerCredentials' + } + }, + organizationDetails: { + required: false, + serializedName: 'org_details', + type: { + name: 'Composite', + className: 'OrganizationDetails' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'IssuerAttributes' + } + } + } + } + }; + } +} + +module.exports = IssuerBundle; diff --git a/lib/services/keyvault/lib/models/issuerCredentials.js b/lib/services/keyvault/lib/models/issuerCredentials.js new file mode 100644 index 0000000000..3c37e7a2c3 --- /dev/null +++ b/lib/services/keyvault/lib/models/issuerCredentials.js @@ -0,0 +1,60 @@ +/* + * 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 credentials to be used for the certificate issuer. + * + */ +class IssuerCredentials { + /** + * Create a IssuerCredentials. + * @property {string} [accountId] The user name/account name/account id. + * @property {string} [password] The password/secret/account key. + */ + constructor() { + } + + /** + * Defines the metadata of IssuerCredentials + * + * @returns {object} metadata of IssuerCredentials + * + */ + mapper() { + return { + required: false, + serializedName: 'IssuerCredentials', + type: { + name: 'Composite', + className: 'IssuerCredentials', + modelProperties: { + accountId: { + required: false, + serializedName: 'account_id', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'pwd', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IssuerCredentials; diff --git a/lib/services/keyvault/lib/models/issuerParameters.js b/lib/services/keyvault/lib/models/issuerParameters.js new file mode 100644 index 0000000000..e8e05d7e87 --- /dev/null +++ b/lib/services/keyvault/lib/models/issuerParameters.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Parameters for the issuer of the X509 component of a certificate. + * + */ +class IssuerParameters { + /** + * Create a IssuerParameters. + * @property {string} [name] Name of the referenced issuer object or reserved + * names; for example, 'Self' or 'Unknown'. + * @property {string} [certificateType] Type of certificate to be requested + * from the issuer provider. + * @property {boolean} [certificateTransparency] Indicates if the + * certificates generated under this policy should be published to + * certificate transparency logs. + */ + constructor() { + } + + /** + * Defines the metadata of IssuerParameters + * + * @returns {object} metadata of IssuerParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'IssuerParameters', + type: { + name: 'Composite', + className: 'IssuerParameters', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + certificateType: { + required: false, + serializedName: 'cty', + type: { + name: 'String' + } + }, + certificateTransparency: { + required: false, + serializedName: 'cert_transparency', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = IssuerParameters; diff --git a/lib/services/keyvault/lib/models/jsonWebKey.js b/lib/services/keyvault/lib/models/jsonWebKey.js new file mode 100644 index 0000000000..87299c5cb3 --- /dev/null +++ b/lib/services/keyvault/lib/models/jsonWebKey.js @@ -0,0 +1,184 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 + * + */ +class JsonWebKey { + /** + * Create a JsonWebKey. + * @property {string} [kid] Key identifier. + * @property {string} [kty] JsonWebKey Key Type (kty), as defined in + * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. + * Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * @property {array} [keyOps] + * @property {buffer} [n] RSA modulus. + * @property {buffer} [e] RSA public exponent. + * @property {buffer} [d] RSA private exponent, or the D component of an EC + * private key. + * @property {buffer} [dp] RSA private key parameter. + * @property {buffer} [dq] RSA private key parameter. + * @property {buffer} [qi] RSA private key parameter. + * @property {buffer} [p] RSA secret prime. + * @property {buffer} [q] RSA secret prime, with p < q. + * @property {buffer} [k] Symmetric key. + * @property {buffer} [t] HSM Token, used with 'Bring Your Own Key'. + * @property {string} [crv] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * @property {buffer} [x] X component of an EC public key. + * @property {buffer} [y] Y component of an EC public key. + */ + constructor() { + } + + /** + * Defines the metadata of JsonWebKey + * + * @returns {object} metadata of JsonWebKey + * + */ + mapper() { + return { + required: false, + serializedName: 'JsonWebKey', + type: { + name: 'Composite', + className: 'JsonWebKey', + modelProperties: { + kid: { + required: false, + serializedName: 'kid', + type: { + name: 'String' + } + }, + kty: { + required: false, + serializedName: 'kty', + type: { + name: 'String' + } + }, + keyOps: { + required: false, + serializedName: 'key_ops', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + n: { + required: false, + serializedName: 'n', + type: { + name: 'Base64Url' + } + }, + e: { + required: false, + serializedName: 'e', + type: { + name: 'Base64Url' + } + }, + d: { + required: false, + serializedName: 'd', + type: { + name: 'Base64Url' + } + }, + dp: { + required: false, + serializedName: 'dp', + type: { + name: 'Base64Url' + } + }, + dq: { + required: false, + serializedName: 'dq', + type: { + name: 'Base64Url' + } + }, + qi: { + required: false, + serializedName: 'qi', + type: { + name: 'Base64Url' + } + }, + p: { + required: false, + serializedName: 'p', + type: { + name: 'Base64Url' + } + }, + q: { + required: false, + serializedName: 'q', + type: { + name: 'Base64Url' + } + }, + k: { + required: false, + serializedName: 'k', + type: { + name: 'Base64Url' + } + }, + t: { + required: false, + serializedName: 'key_hsm', + type: { + name: 'Base64Url' + } + }, + crv: { + required: false, + serializedName: 'crv', + type: { + name: 'String' + } + }, + x: { + required: false, + serializedName: 'x', + type: { + name: 'Base64Url' + } + }, + y: { + required: false, + serializedName: 'y', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = JsonWebKey; diff --git a/lib/services/keyvault/lib/models/keyAttributes.js b/lib/services/keyvault/lib/models/keyAttributes.js new file mode 100644 index 0000000000..b5e771e5de --- /dev/null +++ b/lib/services/keyvault/lib/models/keyAttributes.js @@ -0,0 +1,100 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The attributes of a key managed by the key vault service. + * + * @extends models['Attributes'] + */ +class KeyAttributes extends models['Attributes'] { + /** + * Create a KeyAttributes. + * @property {string} [recoveryLevel] Reflects the deletion recovery level + * currently in effect for keys in the current vault. If it contains + * 'Purgeable' the key can be permanently deleted by a privileged user; + * otherwise, only the system can purge the key, at the end of the retention + * interval. Possible values include: 'Purgeable', 'Recoverable+Purgeable', + * 'Recoverable', 'Recoverable+ProtectedSubscription' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of KeyAttributes + * + * @returns {object} metadata of KeyAttributes + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyAttributes', + type: { + name: 'Composite', + className: 'KeyAttributes', + modelProperties: { + enabled: { + required: false, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + notBefore: { + required: false, + serializedName: 'nbf', + type: { + name: 'UnixTime' + } + }, + expires: { + required: false, + serializedName: 'exp', + type: { + name: 'UnixTime' + } + }, + created: { + required: false, + readOnly: true, + serializedName: 'created', + type: { + name: 'UnixTime' + } + }, + updated: { + required: false, + readOnly: true, + serializedName: 'updated', + type: { + name: 'UnixTime' + } + }, + recoveryLevel: { + required: false, + nullable: false, + readOnly: true, + serializedName: 'recoveryLevel', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = KeyAttributes; diff --git a/lib/services/keyvault/lib/models/keyBundle.js b/lib/services/keyvault/lib/models/keyBundle.js new file mode 100644 index 0000000000..9314fdd6c0 --- /dev/null +++ b/lib/services/keyvault/lib/models/keyBundle.js @@ -0,0 +1,116 @@ +/* + * 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 KeyBundle consisting of a WebKey plus its attributes. + * + */ +class KeyBundle { + /** + * Create a KeyBundle. + * @property {object} [key] The Json web key. + * @property {string} [key.kid] Key identifier. + * @property {string} [key.kty] JsonWebKey Key Type (kty), as defined in + * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. + * Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * @property {array} [key.keyOps] + * @property {buffer} [key.n] RSA modulus. + * @property {buffer} [key.e] RSA public exponent. + * @property {buffer} [key.d] RSA private exponent, or the D component of an + * EC private key. + * @property {buffer} [key.dp] RSA private key parameter. + * @property {buffer} [key.dq] RSA private key parameter. + * @property {buffer} [key.qi] RSA private key parameter. + * @property {buffer} [key.p] RSA secret prime. + * @property {buffer} [key.q] RSA secret prime, with p < q. + * @property {buffer} [key.k] Symmetric key. + * @property {buffer} [key.t] HSM Token, used with 'Bring Your Own Key'. + * @property {string} [key.crv] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * @property {buffer} [key.x] X component of an EC public key. + * @property {buffer} [key.y] Y component of an EC public key. + * @property {object} [attributes] The key management attributes. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for keys in the current vault. If it + * contains 'Purgeable' the key can be permanently deleted by a privileged + * user; otherwise, only the system can purge the key, at the end of the + * retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + * @property {boolean} [managed] True if the key's lifetime is managed by key + * vault. If this is a key backing a certificate, then managed will be true. + */ + constructor() { + } + + /** + * Defines the metadata of KeyBundle + * + * @returns {object} metadata of KeyBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyBundle', + type: { + name: 'Composite', + className: 'KeyBundle', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'Composite', + className: 'JsonWebKey' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'KeyAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + managed: { + required: false, + readOnly: true, + serializedName: 'managed', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = KeyBundle; diff --git a/lib/services/keyvault/lib/models/keyCreateParameters.js b/lib/services/keyvault/lib/models/keyCreateParameters.js new file mode 100644 index 0000000000..15a1fb7133 --- /dev/null +++ b/lib/services/keyvault/lib/models/keyCreateParameters.js @@ -0,0 +1,123 @@ +/* + * 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 key create parameters. + * + */ +class KeyCreateParameters { + /** + * Create a KeyCreateParameters. + * @property {string} kty The type of key to create. For valid values, see + * JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', + * 'oct' + * @property {number} [keySize] The key size in bits. For example: 2048, + * 3072, or 4096 for RSA. + * @property {array} [keyOps] + * @property {object} [keyAttributes] + * @property {string} [keyAttributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for keys in the current vault. If it + * contains 'Purgeable' the key can be permanently deleted by a privileged + * user; otherwise, only the system can purge the key, at the end of the + * retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + * @property {string} [curve] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + */ + constructor() { + } + + /** + * Defines the metadata of KeyCreateParameters + * + * @returns {object} metadata of KeyCreateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyCreateParameters', + type: { + name: 'Composite', + className: 'KeyCreateParameters', + modelProperties: { + kty: { + required: true, + serializedName: 'kty', + constraints: { + MinLength: 1 + }, + type: { + name: 'String' + } + }, + keySize: { + required: false, + serializedName: 'key_size', + type: { + name: 'Number' + } + }, + keyOps: { + required: false, + serializedName: 'key_ops', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JsonWebKeyOperationElementType', + type: { + name: 'String' + } + } + } + }, + keyAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'KeyAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + curve: { + required: false, + serializedName: 'crv', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = KeyCreateParameters; diff --git a/lib/services/keyvault/lib/models/keyImportParameters.js b/lib/services/keyvault/lib/models/keyImportParameters.js new file mode 100644 index 0000000000..b8efa54e0e --- /dev/null +++ b/lib/services/keyvault/lib/models/keyImportParameters.js @@ -0,0 +1,115 @@ +/* + * 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 key import parameters. + * + */ +class KeyImportParameters { + /** + * Create a KeyImportParameters. + * @property {boolean} [hsm] Whether to import as a hardware key (HSM) or + * software key. + * @property {object} key The Json web key + * @property {string} [key.kid] Key identifier. + * @property {string} [key.kty] JsonWebKey Key Type (kty), as defined in + * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. + * Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + * @property {array} [key.keyOps] + * @property {buffer} [key.n] RSA modulus. + * @property {buffer} [key.e] RSA public exponent. + * @property {buffer} [key.d] RSA private exponent, or the D component of an + * EC private key. + * @property {buffer} [key.dp] RSA private key parameter. + * @property {buffer} [key.dq] RSA private key parameter. + * @property {buffer} [key.qi] RSA private key parameter. + * @property {buffer} [key.p] RSA secret prime. + * @property {buffer} [key.q] RSA secret prime, with p < q. + * @property {buffer} [key.k] Symmetric key. + * @property {buffer} [key.t] HSM Token, used with 'Bring Your Own Key'. + * @property {string} [key.crv] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + * @property {buffer} [key.x] X component of an EC public key. + * @property {buffer} [key.y] Y component of an EC public key. + * @property {object} [keyAttributes] The key management attributes. + * @property {string} [keyAttributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for keys in the current vault. If it + * contains 'Purgeable' the key can be permanently deleted by a privileged + * user; otherwise, only the system can purge the key, at the end of the + * retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of KeyImportParameters + * + * @returns {object} metadata of KeyImportParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyImportParameters', + type: { + name: 'Composite', + className: 'KeyImportParameters', + modelProperties: { + hsm: { + required: false, + serializedName: 'Hsm', + type: { + name: 'Boolean' + } + }, + key: { + required: true, + serializedName: 'key', + type: { + name: 'Composite', + className: 'JsonWebKey' + } + }, + keyAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'KeyAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = KeyImportParameters; diff --git a/lib/services/keyvault/lib/models/keyItem.js b/lib/services/keyvault/lib/models/keyItem.js new file mode 100644 index 0000000000..c309b90d1f --- /dev/null +++ b/lib/services/keyvault/lib/models/keyItem.js @@ -0,0 +1,94 @@ +/* + * 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 key item containing key metadata. + * + */ +class KeyItem { + /** + * Create a KeyItem. + * @property {string} [kid] Key identifier. + * @property {object} [attributes] The key management attributes. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for keys in the current vault. If it + * contains 'Purgeable' the key can be permanently deleted by a privileged + * user; otherwise, only the system can purge the key, at the end of the + * retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + * @property {boolean} [managed] True if the key's lifetime is managed by key + * vault. If this is a key backing a certificate, then managed will be true. + */ + constructor() { + } + + /** + * Defines the metadata of KeyItem + * + * @returns {object} metadata of KeyItem + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyItem', + type: { + name: 'Composite', + className: 'KeyItem', + modelProperties: { + kid: { + required: false, + serializedName: 'kid', + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'KeyAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + managed: { + required: false, + readOnly: true, + serializedName: 'managed', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = KeyItem; diff --git a/lib/services/keyvault/lib/models/keyListResult.js b/lib/services/keyvault/lib/models/keyListResult.js new file mode 100644 index 0000000000..ea2de892bf --- /dev/null +++ b/lib/services/keyvault/lib/models/keyListResult.js @@ -0,0 +1,69 @@ +/* + * 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 key list result. + */ +class KeyListResult extends Array { + /** + * Create a KeyListResult. + * @property {string} [nextLink] The URL to get the next set of keys. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of KeyListResult + * + * @returns {object} metadata of KeyListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyListResult', + type: { + name: 'Composite', + className: 'KeyListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'KeyItemElementType', + type: { + name: 'Composite', + className: 'KeyItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = KeyListResult; diff --git a/lib/services/keyvault/lib/models/keyOperationResult.js b/lib/services/keyvault/lib/models/keyOperationResult.js new file mode 100644 index 0000000000..9de7fc3140 --- /dev/null +++ b/lib/services/keyvault/lib/models/keyOperationResult.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The key operation result. + * + */ +class KeyOperationResult { + /** + * Create a KeyOperationResult. + * @property {string} [kid] Key identifier + * @property {buffer} [result] + */ + constructor() { + } + + /** + * Defines the metadata of KeyOperationResult + * + * @returns {object} metadata of KeyOperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyOperationResult', + type: { + name: 'Composite', + className: 'KeyOperationResult', + modelProperties: { + kid: { + required: false, + readOnly: true, + serializedName: 'kid', + type: { + name: 'String' + } + }, + result: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = KeyOperationResult; diff --git a/lib/services/keyvault/lib/models/keyOperationsParameters.js b/lib/services/keyvault/lib/models/keyOperationsParameters.js new file mode 100644 index 0000000000..b90a5a6c98 --- /dev/null +++ b/lib/services/keyvault/lib/models/keyOperationsParameters.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'; + +/** + * The key operations parameters. + * + */ +class KeyOperationsParameters { + /** + * Create a KeyOperationsParameters. + * @property {string} algorithm algorithm identifier. Possible values + * include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' + * @property {buffer} value + */ + constructor() { + } + + /** + * Defines the metadata of KeyOperationsParameters + * + * @returns {object} metadata of KeyOperationsParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyOperationsParameters', + type: { + name: 'Composite', + className: 'KeyOperationsParameters', + modelProperties: { + algorithm: { + required: true, + serializedName: 'alg', + constraints: { + MinLength: 1 + }, + type: { + name: 'String' + } + }, + value: { + required: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = KeyOperationsParameters; diff --git a/lib/services/keyvault/lib/models/keyProperties.js b/lib/services/keyvault/lib/models/keyProperties.js new file mode 100644 index 0000000000..4e02e4f289 --- /dev/null +++ b/lib/services/keyvault/lib/models/keyProperties.js @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Properties of the key pair backing a certificate. + * + */ +class KeyProperties { + /** + * Create a KeyProperties. + * @property {boolean} [exportable] Indicates if the private key can be + * exported. + * @property {string} [keyType] The type of key pair to be used for the + * certificate. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', + * 'oct' + * @property {number} [keySize] The key size in bits. For example: 2048, + * 3072, or 4096 for RSA. + * @property {boolean} [reuseKey] Indicates if the same key pair will be used + * on certificate renewal. + * @property {string} [curve] Elliptic curve name. For valid values, see + * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + * 'P-256K' + */ + constructor() { + } + + /** + * Defines the metadata of KeyProperties + * + * @returns {object} metadata of KeyProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyProperties', + type: { + name: 'Composite', + className: 'KeyProperties', + modelProperties: { + exportable: { + required: false, + serializedName: 'exportable', + type: { + name: 'Boolean' + } + }, + keyType: { + required: false, + serializedName: 'kty', + type: { + name: 'String' + } + }, + keySize: { + required: false, + serializedName: 'key_size', + type: { + name: 'Number' + } + }, + reuseKey: { + required: false, + serializedName: 'reuse_key', + type: { + name: 'Boolean' + } + }, + curve: { + required: false, + serializedName: 'crv', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = KeyProperties; diff --git a/lib/services/keyvault/lib/models/keyRestoreParameters.js b/lib/services/keyvault/lib/models/keyRestoreParameters.js new file mode 100644 index 0000000000..46c8f63913 --- /dev/null +++ b/lib/services/keyvault/lib/models/keyRestoreParameters.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The key restore parameters. + * + */ +class KeyRestoreParameters { + /** + * Create a KeyRestoreParameters. + * @property {buffer} keyBundleBackup The backup blob associated with a key + * bundle. + */ + constructor() { + } + + /** + * Defines the metadata of KeyRestoreParameters + * + * @returns {object} metadata of KeyRestoreParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyRestoreParameters', + type: { + name: 'Composite', + className: 'KeyRestoreParameters', + modelProperties: { + keyBundleBackup: { + required: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = KeyRestoreParameters; diff --git a/lib/services/keyvault/lib/models/keySignParameters.js b/lib/services/keyvault/lib/models/keySignParameters.js new file mode 100644 index 0000000000..30bb67238e --- /dev/null +++ b/lib/services/keyvault/lib/models/keySignParameters.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The key operations parameters. + * + */ +class KeySignParameters { + /** + * Create a KeySignParameters. + * @property {string} algorithm The signing/verification algorithm + * identifier. For more information on possible algorithm types, see + * JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', + * 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', + * 'ES256K' + * @property {buffer} value + */ + constructor() { + } + + /** + * Defines the metadata of KeySignParameters + * + * @returns {object} metadata of KeySignParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'KeySignParameters', + type: { + name: 'Composite', + className: 'KeySignParameters', + modelProperties: { + algorithm: { + required: true, + serializedName: 'alg', + constraints: { + MinLength: 1 + }, + type: { + name: 'String' + } + }, + value: { + required: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = KeySignParameters; diff --git a/lib/services/keyvault/lib/models/keyUpdateParameters.js b/lib/services/keyvault/lib/models/keyUpdateParameters.js new file mode 100644 index 0000000000..750f4ab353 --- /dev/null +++ b/lib/services/keyvault/lib/models/keyUpdateParameters.js @@ -0,0 +1,92 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The key update parameters. + * + */ +class KeyUpdateParameters { + /** + * Create a KeyUpdateParameters. + * @property {array} [keyOps] Json web key operations. For more information + * on possible key operations, see JsonWebKeyOperation. + * @property {object} [keyAttributes] + * @property {string} [keyAttributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for keys in the current vault. If it + * contains 'Purgeable' the key can be permanently deleted by a privileged + * user; otherwise, only the system can purge the key, at the end of the + * retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of KeyUpdateParameters + * + * @returns {object} metadata of KeyUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyUpdateParameters', + type: { + name: 'Composite', + className: 'KeyUpdateParameters', + modelProperties: { + keyOps: { + required: false, + serializedName: 'key_ops', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JsonWebKeyOperationElementType', + type: { + name: 'String' + } + } + } + }, + keyAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'KeyAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = KeyUpdateParameters; diff --git a/lib/services/keyvault/lib/models/keyVaultError.js b/lib/services/keyvault/lib/models/keyVaultError.js new file mode 100644 index 0000000000..068af6e427 --- /dev/null +++ b/lib/services/keyvault/lib/models/keyVaultError.js @@ -0,0 +1,57 @@ +/* + * 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 key vault error exception. + * + */ +class KeyVaultError { + /** + * Create a KeyVaultError. + * @property {object} [error] + * @property {string} [error.code] The error code. + * @property {string} [error.message] The error message. + * @property {object} [error.innerError] + */ + constructor() { + } + + /** + * Defines the metadata of KeyVaultError + * + * @returns {object} metadata of KeyVaultError + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyVaultError', + type: { + name: 'Composite', + className: 'KeyVaultError', + modelProperties: { + error: { + required: false, + readOnly: true, + serializedName: 'error', + type: { + name: 'Composite', + className: 'ErrorModel' + } + } + } + } + }; + } +} + +module.exports = KeyVaultError; diff --git a/lib/services/keyvault/lib/models/keyVerifyParameters.js b/lib/services/keyvault/lib/models/keyVerifyParameters.js new file mode 100644 index 0000000000..8611eb96e9 --- /dev/null +++ b/lib/services/keyvault/lib/models/keyVerifyParameters.js @@ -0,0 +1,74 @@ +/* + * 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 key verify parameters. + * + */ +class KeyVerifyParameters { + /** + * Create a KeyVerifyParameters. + * @property {string} algorithm The signing/verification algorithm. For more + * information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + * Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', + * 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' + * @property {buffer} digest The digest used for signing. + * @property {buffer} signature The signature to be verified. + */ + constructor() { + } + + /** + * Defines the metadata of KeyVerifyParameters + * + * @returns {object} metadata of KeyVerifyParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyVerifyParameters', + type: { + name: 'Composite', + className: 'KeyVerifyParameters', + modelProperties: { + algorithm: { + required: true, + serializedName: 'alg', + constraints: { + MinLength: 1 + }, + type: { + name: 'String' + } + }, + digest: { + required: true, + serializedName: 'digest', + type: { + name: 'Base64Url' + } + }, + signature: { + required: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = KeyVerifyParameters; diff --git a/lib/services/keyvault/lib/models/keyVerifyResult.js b/lib/services/keyvault/lib/models/keyVerifyResult.js new file mode 100644 index 0000000000..001c29cf63 --- /dev/null +++ b/lib/services/keyvault/lib/models/keyVerifyResult.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'; + +/** + * The key verify result. + * + */ +class KeyVerifyResult { + /** + * Create a KeyVerifyResult. + * @property {boolean} [value] True if the signature is verified, otherwise + * false. + */ + constructor() { + } + + /** + * Defines the metadata of KeyVerifyResult + * + * @returns {object} metadata of KeyVerifyResult + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyVerifyResult', + type: { + name: 'Composite', + className: 'KeyVerifyResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = KeyVerifyResult; diff --git a/lib/services/keyvault/lib/models/lifetimeAction.js b/lib/services/keyvault/lib/models/lifetimeAction.js new file mode 100644 index 0000000000..60eabd128e --- /dev/null +++ b/lib/services/keyvault/lib/models/lifetimeAction.js @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Action and its trigger that will be performed by Key Vault over the lifetime + * of a certificate. + * + */ +class LifetimeAction { + /** + * Create a LifetimeAction. + * @property {object} [trigger] The condition that will execute the action. + * @property {number} [trigger.lifetimePercentage] Percentage of lifetime at + * which to trigger. Value should be between 1 and 99. + * @property {number} [trigger.daysBeforeExpiry] Days before expiry to + * attempt renewal. Value should be between 1 and validity_in_months + * multiplied by 27. If validity_in_months is 36, then value should be + * between 1 and 972 (36 * 27). + * @property {object} [action] The action that will be executed. + * @property {string} [action.actionType] The type of the action. Possible + * values include: 'EmailContacts', 'AutoRenew' + */ + constructor() { + } + + /** + * Defines the metadata of LifetimeAction + * + * @returns {object} metadata of LifetimeAction + * + */ + mapper() { + return { + required: false, + serializedName: 'LifetimeAction', + type: { + name: 'Composite', + className: 'LifetimeAction', + modelProperties: { + trigger: { + required: false, + serializedName: 'trigger', + type: { + name: 'Composite', + className: 'Trigger' + } + }, + action: { + required: false, + serializedName: 'action', + type: { + name: 'Composite', + className: 'Action' + } + } + } + } + }; + } +} + +module.exports = LifetimeAction; diff --git a/lib/services/keyvault/lib/models/organizationDetails.js b/lib/services/keyvault/lib/models/organizationDetails.js new file mode 100644 index 0000000000..85b42f1200 --- /dev/null +++ b/lib/services/keyvault/lib/models/organizationDetails.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Details of the organization of the certificate issuer. + * + */ +class OrganizationDetails { + /** + * Create a OrganizationDetails. + * @property {string} [id] Id of the organization. + * @property {array} [adminDetails] Details of the organization + * administrator. + */ + constructor() { + } + + /** + * Defines the metadata of OrganizationDetails + * + * @returns {object} metadata of OrganizationDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'OrganizationDetails', + type: { + name: 'Composite', + className: 'OrganizationDetails', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + adminDetails: { + required: false, + serializedName: 'admin_details', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AdministratorDetailsElementType', + type: { + name: 'Composite', + className: 'AdministratorDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = OrganizationDetails; diff --git a/lib/services/keyvault/lib/models/pendingCertificateSigningRequestResult.js b/lib/services/keyvault/lib/models/pendingCertificateSigningRequestResult.js new file mode 100644 index 0000000000..3a1dc05620 --- /dev/null +++ b/lib/services/keyvault/lib/models/pendingCertificateSigningRequestResult.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'; + +/** + * The pending certificate signing request result. + * + */ +class PendingCertificateSigningRequestResult { + /** + * Create a PendingCertificateSigningRequestResult. + * @property {string} [value] The pending certificate signing request as + * Base64 encoded string. + */ + constructor() { + } + + /** + * Defines the metadata of PendingCertificateSigningRequestResult + * + * @returns {object} metadata of PendingCertificateSigningRequestResult + * + */ + mapper() { + return { + required: false, + serializedName: 'PendingCertificateSigningRequestResult', + type: { + name: 'Composite', + className: 'PendingCertificateSigningRequestResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PendingCertificateSigningRequestResult; diff --git a/lib/services/keyvault/lib/models/sasDefinitionAttributes.js b/lib/services/keyvault/lib/models/sasDefinitionAttributes.js new file mode 100644 index 0000000000..1ecb98ae20 --- /dev/null +++ b/lib/services/keyvault/lib/models/sasDefinitionAttributes.js @@ -0,0 +1,86 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The SAS definition management attributes. + * + */ +class SasDefinitionAttributes { + /** + * Create a SasDefinitionAttributes. + * @property {boolean} [enabled] the enabled state of the object. + * @property {date} [created] Creation time in UTC. + * @property {date} [updated] Last updated time in UTC. + * @property {string} [recoveryLevel] Reflects the deletion recovery level + * currently in effect for SAS definitions in the current vault. If it + * contains 'Purgeable' the SAS definition can be permanently deleted by a + * privileged user; otherwise, only the system can purge the SAS definition, + * at the end of the retention interval. Possible values include: + * 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + */ + constructor() { + } + + /** + * Defines the metadata of SasDefinitionAttributes + * + * @returns {object} metadata of SasDefinitionAttributes + * + */ + mapper() { + return { + required: false, + serializedName: 'SasDefinitionAttributes', + type: { + name: 'Composite', + className: 'SasDefinitionAttributes', + modelProperties: { + enabled: { + required: false, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + created: { + required: false, + readOnly: true, + serializedName: 'created', + type: { + name: 'UnixTime' + } + }, + updated: { + required: false, + readOnly: true, + serializedName: 'updated', + type: { + name: 'UnixTime' + } + }, + recoveryLevel: { + required: false, + nullable: false, + readOnly: true, + serializedName: 'recoveryLevel', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SasDefinitionAttributes; diff --git a/lib/services/keyvault/lib/models/sasDefinitionBundle.js b/lib/services/keyvault/lib/models/sasDefinitionBundle.js new file mode 100644 index 0000000000..4280ecccd5 --- /dev/null +++ b/lib/services/keyvault/lib/models/sasDefinitionBundle.js @@ -0,0 +1,131 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A SAS definition bundle consists of key vault SAS definition details plus + * its attributes. + * + */ +class SasDefinitionBundle { + /** + * Create a SasDefinitionBundle. + * @property {string} [id] The SAS definition id. + * @property {string} [secretId] Storage account SAS definition secret id. + * @property {string} [templateUri] The SAS definition token template signed + * with an arbitrary key. Tokens created according to the SAS definition + * will have the same properties as the template. + * @property {string} [sasType] The type of SAS token the SAS definition will + * create. Possible values include: 'account', 'service' + * @property {string} [validityPeriod] The validity period of SAS tokens + * created according to the SAS definition. + * @property {object} [attributes] The SAS definition attributes. + * @property {boolean} [attributes.enabled] the enabled state of the object. + * @property {date} [attributes.created] Creation time in UTC. + * @property {date} [attributes.updated] Last updated time in UTC. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for SAS definitions in the current + * vault. If it contains 'Purgeable' the SAS definition can be permanently + * deleted by a privileged user; otherwise, only the system can purge the SAS + * definition, at the end of the retention interval. Possible values include: + * 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs + */ + constructor() { + } + + /** + * Defines the metadata of SasDefinitionBundle + * + * @returns {object} metadata of SasDefinitionBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'SasDefinitionBundle', + type: { + name: 'Composite', + className: 'SasDefinitionBundle', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + secretId: { + required: false, + readOnly: true, + serializedName: 'sid', + type: { + name: 'String' + } + }, + templateUri: { + required: false, + readOnly: true, + serializedName: 'templateUri', + type: { + name: 'String' + } + }, + sasType: { + required: false, + readOnly: true, + serializedName: 'sasType', + type: { + name: 'String' + } + }, + validityPeriod: { + required: false, + readOnly: true, + serializedName: 'validityPeriod', + type: { + name: 'String' + } + }, + attributes: { + required: false, + readOnly: true, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SasDefinitionAttributes' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = SasDefinitionBundle; diff --git a/lib/services/keyvault/lib/models/sasDefinitionCreateParameters.js b/lib/services/keyvault/lib/models/sasDefinitionCreateParameters.js new file mode 100644 index 0000000000..095da5eef6 --- /dev/null +++ b/lib/services/keyvault/lib/models/sasDefinitionCreateParameters.js @@ -0,0 +1,110 @@ +/* + * 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 SAS definition create parameters. + * + */ +class SasDefinitionCreateParameters { + /** + * Create a SasDefinitionCreateParameters. + * @property {string} templateUri The SAS definition token template signed + * with an arbitrary key. Tokens created according to the SAS definition + * will have the same properties as the template. + * @property {string} sasType The type of SAS token the SAS definition will + * create. Possible values include: 'account', 'service' + * @property {string} validityPeriod The validity period of SAS tokens + * created according to the SAS definition. + * @property {object} [sasDefinitionAttributes] The attributes of the SAS + * definition. + * @property {boolean} [sasDefinitionAttributes.enabled] the enabled state of + * the object. + * @property {date} [sasDefinitionAttributes.created] Creation time in UTC. + * @property {date} [sasDefinitionAttributes.updated] Last updated time in + * UTC. + * @property {string} [sasDefinitionAttributes.recoveryLevel] Reflects the + * deletion recovery level currently in effect for SAS definitions in the + * current vault. If it contains 'Purgeable' the SAS definition can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the SAS definition, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of SasDefinitionCreateParameters + * + * @returns {object} metadata of SasDefinitionCreateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SasDefinitionCreateParameters', + type: { + name: 'Composite', + className: 'SasDefinitionCreateParameters', + modelProperties: { + templateUri: { + required: true, + serializedName: 'templateUri', + type: { + name: 'String' + } + }, + sasType: { + required: true, + serializedName: 'sasType', + type: { + name: 'String' + } + }, + validityPeriod: { + required: true, + serializedName: 'validityPeriod', + type: { + name: 'String' + } + }, + sasDefinitionAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SasDefinitionAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = SasDefinitionCreateParameters; diff --git a/lib/services/keyvault/lib/models/sasDefinitionItem.js b/lib/services/keyvault/lib/models/sasDefinitionItem.js new file mode 100644 index 0000000000..8d531b1a74 --- /dev/null +++ b/lib/services/keyvault/lib/models/sasDefinitionItem.js @@ -0,0 +1,100 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The SAS definition item containing storage SAS definition metadata. + * + */ +class SasDefinitionItem { + /** + * Create a SasDefinitionItem. + * @property {string} [id] The storage SAS identifier. + * @property {string} [secretId] The storage account SAS definition secret + * id. + * @property {object} [attributes] The SAS definition management attributes. + * @property {boolean} [attributes.enabled] the enabled state of the object. + * @property {date} [attributes.created] Creation time in UTC. + * @property {date} [attributes.updated] Last updated time in UTC. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for SAS definitions in the current + * vault. If it contains 'Purgeable' the SAS definition can be permanently + * deleted by a privileged user; otherwise, only the system can purge the SAS + * definition, at the end of the retention interval. Possible values include: + * 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of SasDefinitionItem + * + * @returns {object} metadata of SasDefinitionItem + * + */ + mapper() { + return { + required: false, + serializedName: 'SasDefinitionItem', + type: { + name: 'Composite', + className: 'SasDefinitionItem', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + secretId: { + required: false, + readOnly: true, + serializedName: 'sid', + type: { + name: 'String' + } + }, + attributes: { + required: false, + readOnly: true, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SasDefinitionAttributes' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = SasDefinitionItem; diff --git a/lib/services/keyvault/lib/models/sasDefinitionListResult.js b/lib/services/keyvault/lib/models/sasDefinitionListResult.js new file mode 100644 index 0000000000..926687b7fa --- /dev/null +++ b/lib/services/keyvault/lib/models/sasDefinitionListResult.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The storage account SAS definition list result. + */ +class SasDefinitionListResult extends Array { + /** + * Create a SasDefinitionListResult. + * @property {string} [nextLink] The URL to get the next set of SAS + * definitions. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SasDefinitionListResult + * + * @returns {object} metadata of SasDefinitionListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SasDefinitionListResult', + type: { + name: 'Composite', + className: 'SasDefinitionListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SasDefinitionItemElementType', + type: { + name: 'Composite', + className: 'SasDefinitionItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SasDefinitionListResult; diff --git a/lib/services/keyvault/lib/models/sasDefinitionUpdateParameters.js b/lib/services/keyvault/lib/models/sasDefinitionUpdateParameters.js new file mode 100644 index 0000000000..df09dd0498 --- /dev/null +++ b/lib/services/keyvault/lib/models/sasDefinitionUpdateParameters.js @@ -0,0 +1,110 @@ +/* + * 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 SAS definition update parameters. + * + */ +class SasDefinitionUpdateParameters { + /** + * Create a SasDefinitionUpdateParameters. + * @property {string} [templateUri] The SAS definition token template signed + * with an arbitrary key. Tokens created according to the SAS definition + * will have the same properties as the template. + * @property {string} [sasType] The type of SAS token the SAS definition will + * create. Possible values include: 'account', 'service' + * @property {string} [validityPeriod] The validity period of SAS tokens + * created according to the SAS definition. + * @property {object} [sasDefinitionAttributes] The attributes of the SAS + * definition. + * @property {boolean} [sasDefinitionAttributes.enabled] the enabled state of + * the object. + * @property {date} [sasDefinitionAttributes.created] Creation time in UTC. + * @property {date} [sasDefinitionAttributes.updated] Last updated time in + * UTC. + * @property {string} [sasDefinitionAttributes.recoveryLevel] Reflects the + * deletion recovery level currently in effect for SAS definitions in the + * current vault. If it contains 'Purgeable' the SAS definition can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the SAS definition, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of SasDefinitionUpdateParameters + * + * @returns {object} metadata of SasDefinitionUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SasDefinitionUpdateParameters', + type: { + name: 'Composite', + className: 'SasDefinitionUpdateParameters', + modelProperties: { + templateUri: { + required: false, + serializedName: 'templateUri', + type: { + name: 'String' + } + }, + sasType: { + required: false, + serializedName: 'sasType', + type: { + name: 'String' + } + }, + validityPeriod: { + required: false, + serializedName: 'validityPeriod', + type: { + name: 'String' + } + }, + sasDefinitionAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SasDefinitionAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = SasDefinitionUpdateParameters; diff --git a/lib/services/keyvault/lib/models/secretAttributes.js b/lib/services/keyvault/lib/models/secretAttributes.js new file mode 100644 index 0000000000..ca8e913a06 --- /dev/null +++ b/lib/services/keyvault/lib/models/secretAttributes.js @@ -0,0 +1,101 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The secret management attributes. + * + * @extends models['Attributes'] + */ +class SecretAttributes extends models['Attributes'] { + /** + * Create a SecretAttributes. + * @property {string} [recoveryLevel] Reflects the deletion recovery level + * currently in effect for secrets in the current vault. If it contains + * 'Purgeable', the secret can be permanently deleted by a privileged user; + * otherwise, only the system can purge the secret, at the end of the + * retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SecretAttributes + * + * @returns {object} metadata of SecretAttributes + * + */ + mapper() { + return { + required: false, + serializedName: 'SecretAttributes', + type: { + name: 'Composite', + className: 'SecretAttributes', + modelProperties: { + enabled: { + required: false, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + notBefore: { + required: false, + serializedName: 'nbf', + type: { + name: 'UnixTime' + } + }, + expires: { + required: false, + serializedName: 'exp', + type: { + name: 'UnixTime' + } + }, + created: { + required: false, + readOnly: true, + serializedName: 'created', + type: { + name: 'UnixTime' + } + }, + updated: { + required: false, + readOnly: true, + serializedName: 'updated', + type: { + name: 'UnixTime' + } + }, + recoveryLevel: { + required: false, + nullable: false, + readOnly: true, + serializedName: 'recoveryLevel', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SecretAttributes; diff --git a/lib/services/keyvault/lib/models/secretBundle.js b/lib/services/keyvault/lib/models/secretBundle.js new file mode 100644 index 0000000000..562d521f79 --- /dev/null +++ b/lib/services/keyvault/lib/models/secretBundle.js @@ -0,0 +1,122 @@ +/* + * 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 secret consisting of a value, id and its attributes. + * + */ +class SecretBundle { + /** + * Create a SecretBundle. + * @property {string} [value] The secret value. + * @property {string} [id] The secret id. + * @property {string} [contentType] The content type of the secret. + * @property {object} [attributes] The secret management attributes. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for secrets in the current vault. If it + * contains 'Purgeable', the secret can be permanently deleted by a + * privileged user; otherwise, only the system can purge the secret, at the + * end of the retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + * @property {string} [kid] If this is a secret backing a KV certificate, + * then this field specifies the corresponding key backing the KV + * certificate. + * @property {boolean} [managed] True if the secret's lifetime is managed by + * key vault. If this is a secret backing a certificate, then managed will be + * true. + */ + constructor() { + } + + /** + * Defines the metadata of SecretBundle + * + * @returns {object} metadata of SecretBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'SecretBundle', + type: { + name: 'Composite', + className: 'SecretBundle', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + contentType: { + required: false, + serializedName: 'contentType', + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SecretAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + kid: { + required: false, + readOnly: true, + serializedName: 'kid', + type: { + name: 'String' + } + }, + managed: { + required: false, + readOnly: true, + serializedName: 'managed', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = SecretBundle; diff --git a/lib/services/keyvault/lib/models/secretItem.js b/lib/services/keyvault/lib/models/secretItem.js new file mode 100644 index 0000000000..b4e350ae70 --- /dev/null +++ b/lib/services/keyvault/lib/models/secretItem.js @@ -0,0 +1,104 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The secret item containing secret metadata. + * + */ +class SecretItem { + /** + * Create a SecretItem. + * @property {string} [id] Secret identifier. + * @property {object} [attributes] The secret management attributes. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for secrets in the current vault. If it + * contains 'Purgeable', the secret can be permanently deleted by a + * privileged user; otherwise, only the system can purge the secret, at the + * end of the retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + * @property {string} [contentType] Type of the secret value such as a + * password. + * @property {boolean} [managed] True if the secret's lifetime is managed by + * key vault. If this is a key backing a certificate, then managed will be + * true. + */ + constructor() { + } + + /** + * Defines the metadata of SecretItem + * + * @returns {object} metadata of SecretItem + * + */ + mapper() { + return { + required: false, + serializedName: 'SecretItem', + type: { + name: 'Composite', + className: 'SecretItem', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + attributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SecretAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + contentType: { + required: false, + serializedName: 'contentType', + type: { + name: 'String' + } + }, + managed: { + required: false, + readOnly: true, + serializedName: 'managed', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = SecretItem; diff --git a/lib/services/keyvault/lib/models/secretListResult.js b/lib/services/keyvault/lib/models/secretListResult.js new file mode 100644 index 0000000000..53bd712106 --- /dev/null +++ b/lib/services/keyvault/lib/models/secretListResult.js @@ -0,0 +1,69 @@ +/* + * 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 secret list result. + */ +class SecretListResult extends Array { + /** + * Create a SecretListResult. + * @property {string} [nextLink] The URL to get the next set of secrets. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SecretListResult + * + * @returns {object} metadata of SecretListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SecretListResult', + type: { + name: 'Composite', + className: 'SecretListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SecretItemElementType', + type: { + name: 'Composite', + className: 'SecretItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SecretListResult; diff --git a/lib/services/keyvault/lib/models/secretProperties.js b/lib/services/keyvault/lib/models/secretProperties.js new file mode 100644 index 0000000000..4735cf588e --- /dev/null +++ b/lib/services/keyvault/lib/models/secretProperties.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Properties of the key backing a certificate. + * + */ +class SecretProperties { + /** + * Create a SecretProperties. + * @property {string} [contentType] The media type (MIME type). + */ + constructor() { + } + + /** + * Defines the metadata of SecretProperties + * + * @returns {object} metadata of SecretProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'SecretProperties', + type: { + name: 'Composite', + className: 'SecretProperties', + modelProperties: { + contentType: { + required: false, + serializedName: 'contentType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SecretProperties; diff --git a/lib/services/keyvault/lib/models/secretRestoreParameters.js b/lib/services/keyvault/lib/models/secretRestoreParameters.js new file mode 100644 index 0000000000..c0a77062a6 --- /dev/null +++ b/lib/services/keyvault/lib/models/secretRestoreParameters.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The secret restore parameters. + * + */ +class SecretRestoreParameters { + /** + * Create a SecretRestoreParameters. + * @property {buffer} secretBundleBackup The backup blob associated with a + * secret bundle. + */ + constructor() { + } + + /** + * Defines the metadata of SecretRestoreParameters + * + * @returns {object} metadata of SecretRestoreParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SecretRestoreParameters', + type: { + name: 'Composite', + className: 'SecretRestoreParameters', + modelProperties: { + secretBundleBackup: { + required: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = SecretRestoreParameters; diff --git a/lib/services/keyvault/lib/models/secretSetParameters.js b/lib/services/keyvault/lib/models/secretSetParameters.js new file mode 100644 index 0000000000..8803ec0c75 --- /dev/null +++ b/lib/services/keyvault/lib/models/secretSetParameters.js @@ -0,0 +1,93 @@ +/* + * 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 secret set parameters. + * + */ +class SecretSetParameters { + /** + * Create a SecretSetParameters. + * @property {string} value The value of the secret. + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + * @property {string} [contentType] Type of the secret value such as a + * password. + * @property {object} [secretAttributes] The secret management attributes. + * @property {string} [secretAttributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for secrets in the current vault. If it + * contains 'Purgeable', the secret can be permanently deleted by a + * privileged user; otherwise, only the system can purge the secret, at the + * end of the retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + */ + constructor() { + } + + /** + * Defines the metadata of SecretSetParameters + * + * @returns {object} metadata of SecretSetParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SecretSetParameters', + type: { + name: 'Composite', + className: 'SecretSetParameters', + modelProperties: { + value: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + contentType: { + required: false, + serializedName: 'contentType', + type: { + name: 'String' + } + }, + secretAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SecretAttributes' + } + } + } + } + }; + } +} + +module.exports = SecretSetParameters; diff --git a/lib/services/keyvault/lib/models/secretUpdateParameters.js b/lib/services/keyvault/lib/models/secretUpdateParameters.js new file mode 100644 index 0000000000..652c70387a --- /dev/null +++ b/lib/services/keyvault/lib/models/secretUpdateParameters.js @@ -0,0 +1,85 @@ +/* + * 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 secret update parameters. + * + */ +class SecretUpdateParameters { + /** + * Create a SecretUpdateParameters. + * @property {string} [contentType] Type of the secret value such as a + * password. + * @property {object} [secretAttributes] The secret management attributes. + * @property {string} [secretAttributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for secrets in the current vault. If it + * contains 'Purgeable', the secret can be permanently deleted by a + * privileged user; otherwise, only the system can purge the secret, at the + * end of the retention interval. Possible values include: 'Purgeable', + * 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of SecretUpdateParameters + * + * @returns {object} metadata of SecretUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SecretUpdateParameters', + type: { + name: 'Composite', + className: 'SecretUpdateParameters', + modelProperties: { + contentType: { + required: false, + serializedName: 'contentType', + type: { + name: 'String' + } + }, + secretAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'SecretAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = SecretUpdateParameters; diff --git a/lib/services/keyvault/lib/models/storageAccountAttributes.js b/lib/services/keyvault/lib/models/storageAccountAttributes.js new file mode 100644 index 0000000000..d82e4e1f78 --- /dev/null +++ b/lib/services/keyvault/lib/models/storageAccountAttributes.js @@ -0,0 +1,86 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The storage account management attributes. + * + */ +class StorageAccountAttributes { + /** + * Create a StorageAccountAttributes. + * @property {boolean} [enabled] the enabled state of the object. + * @property {date} [created] Creation time in UTC. + * @property {date} [updated] Last updated time in UTC. + * @property {string} [recoveryLevel] Reflects the deletion recovery level + * currently in effect for storage accounts in the current vault. If it + * contains 'Purgeable' the storage account can be permanently deleted by a + * privileged user; otherwise, only the system can purge the storage account, + * at the end of the retention interval. Possible values include: + * 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + */ + constructor() { + } + + /** + * Defines the metadata of StorageAccountAttributes + * + * @returns {object} metadata of StorageAccountAttributes + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageAccountAttributes', + type: { + name: 'Composite', + className: 'StorageAccountAttributes', + modelProperties: { + enabled: { + required: false, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + created: { + required: false, + readOnly: true, + serializedName: 'created', + type: { + name: 'UnixTime' + } + }, + updated: { + required: false, + readOnly: true, + serializedName: 'updated', + type: { + name: 'UnixTime' + } + }, + recoveryLevel: { + required: false, + nullable: false, + readOnly: true, + serializedName: 'recoveryLevel', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = StorageAccountAttributes; diff --git a/lib/services/keyvault/lib/models/storageAccountCreateParameters.js b/lib/services/keyvault/lib/models/storageAccountCreateParameters.js new file mode 100644 index 0000000000..331cab3fc5 --- /dev/null +++ b/lib/services/keyvault/lib/models/storageAccountCreateParameters.js @@ -0,0 +1,116 @@ +/* + * 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 storage account create parameters. + * + */ +class StorageAccountCreateParameters { + /** + * Create a StorageAccountCreateParameters. + * @property {string} resourceId Storage account resource id. + * @property {string} activeKeyName Current active storage account key name. + * @property {boolean} autoRegenerateKey whether keyvault should manage the + * storage account for the user. + * @property {string} [regenerationPeriod] The key regeneration time duration + * specified in ISO-8601 format. + * @property {object} [storageAccountAttributes] The attributes of the + * storage account. + * @property {boolean} [storageAccountAttributes.enabled] the enabled state + * of the object. + * @property {date} [storageAccountAttributes.created] Creation time in UTC. + * @property {date} [storageAccountAttributes.updated] Last updated time in + * UTC. + * @property {string} [storageAccountAttributes.recoveryLevel] Reflects the + * deletion recovery level currently in effect for storage accounts in the + * current vault. If it contains 'Purgeable' the storage account can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the storage account, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of StorageAccountCreateParameters + * + * @returns {object} metadata of StorageAccountCreateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageAccountCreateParameters', + type: { + name: 'Composite', + className: 'StorageAccountCreateParameters', + modelProperties: { + resourceId: { + required: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + activeKeyName: { + required: true, + serializedName: 'activeKeyName', + type: { + name: 'String' + } + }, + autoRegenerateKey: { + required: true, + serializedName: 'autoRegenerateKey', + type: { + name: 'Boolean' + } + }, + regenerationPeriod: { + required: false, + serializedName: 'regenerationPeriod', + type: { + name: 'String' + } + }, + storageAccountAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'StorageAccountAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = StorageAccountCreateParameters; diff --git a/lib/services/keyvault/lib/models/storageAccountItem.js b/lib/services/keyvault/lib/models/storageAccountItem.js new file mode 100644 index 0000000000..4fb92ad69a --- /dev/null +++ b/lib/services/keyvault/lib/models/storageAccountItem.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'; + +/** + * The storage account item containing storage account metadata. + * + */ +class StorageAccountItem { + /** + * Create a StorageAccountItem. + * @property {string} [id] Storage identifier. + * @property {string} [resourceId] Storage account resource Id. + * @property {object} [attributes] The storage account management attributes. + * @property {boolean} [attributes.enabled] the enabled state of the object. + * @property {date} [attributes.created] Creation time in UTC. + * @property {date} [attributes.updated] Last updated time in UTC. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for storage accounts in the current + * vault. If it contains 'Purgeable' the storage account can be permanently + * deleted by a privileged user; otherwise, only the system can purge the + * storage account, at the end of the retention interval. Possible values + * include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of StorageAccountItem + * + * @returns {object} metadata of StorageAccountItem + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageAccountItem', + type: { + name: 'Composite', + className: 'StorageAccountItem', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + resourceId: { + required: false, + readOnly: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + attributes: { + required: false, + readOnly: true, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'StorageAccountAttributes' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = StorageAccountItem; diff --git a/lib/services/keyvault/lib/models/storageAccountRegenerteKeyParameters.js b/lib/services/keyvault/lib/models/storageAccountRegenerteKeyParameters.js new file mode 100644 index 0000000000..22db4cdbdc --- /dev/null +++ b/lib/services/keyvault/lib/models/storageAccountRegenerteKeyParameters.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The storage account key regenerate parameters. + * + */ +class StorageAccountRegenerteKeyParameters { + /** + * Create a StorageAccountRegenerteKeyParameters. + * @property {string} keyName The storage account key name. + */ + constructor() { + } + + /** + * Defines the metadata of StorageAccountRegenerteKeyParameters + * + * @returns {object} metadata of StorageAccountRegenerteKeyParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageAccountRegenerteKeyParameters', + type: { + name: 'Composite', + className: 'StorageAccountRegenerteKeyParameters', + modelProperties: { + keyName: { + required: true, + serializedName: 'keyName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = StorageAccountRegenerteKeyParameters; diff --git a/lib/services/keyvault/lib/models/storageAccountUpdateParameters.js b/lib/services/keyvault/lib/models/storageAccountUpdateParameters.js new file mode 100644 index 0000000000..f007e32eac --- /dev/null +++ b/lib/services/keyvault/lib/models/storageAccountUpdateParameters.js @@ -0,0 +1,109 @@ +/* + * 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 storage account update parameters. + * + */ +class StorageAccountUpdateParameters { + /** + * Create a StorageAccountUpdateParameters. + * @property {string} [activeKeyName] The current active storage account key + * name. + * @property {boolean} [autoRegenerateKey] whether keyvault should manage the + * storage account for the user. + * @property {string} [regenerationPeriod] The key regeneration time duration + * specified in ISO-8601 format. + * @property {object} [storageAccountAttributes] The attributes of the + * storage account. + * @property {boolean} [storageAccountAttributes.enabled] the enabled state + * of the object. + * @property {date} [storageAccountAttributes.created] Creation time in UTC. + * @property {date} [storageAccountAttributes.updated] Last updated time in + * UTC. + * @property {string} [storageAccountAttributes.recoveryLevel] Reflects the + * deletion recovery level currently in effect for storage accounts in the + * current vault. If it contains 'Purgeable' the storage account can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the storage account, at the end of the retention interval. Possible + * values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs. + */ + constructor() { + } + + /** + * Defines the metadata of StorageAccountUpdateParameters + * + * @returns {object} metadata of StorageAccountUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageAccountUpdateParameters', + type: { + name: 'Composite', + className: 'StorageAccountUpdateParameters', + modelProperties: { + activeKeyName: { + required: false, + serializedName: 'activeKeyName', + type: { + name: 'String' + } + }, + autoRegenerateKey: { + required: false, + serializedName: 'autoRegenerateKey', + type: { + name: 'Boolean' + } + }, + regenerationPeriod: { + required: false, + serializedName: 'regenerationPeriod', + type: { + name: 'String' + } + }, + storageAccountAttributes: { + required: false, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'StorageAccountAttributes' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = StorageAccountUpdateParameters; diff --git a/lib/services/keyvault/lib/models/storageBundle.js b/lib/services/keyvault/lib/models/storageBundle.js new file mode 100644 index 0000000000..c0fedaf01b --- /dev/null +++ b/lib/services/keyvault/lib/models/storageBundle.js @@ -0,0 +1,130 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A Storage account bundle consists of key vault storage account details plus + * its attributes. + * + */ +class StorageBundle { + /** + * Create a StorageBundle. + * @property {string} [id] The storage account id. + * @property {string} [resourceId] The storage account resource id. + * @property {string} [activeKeyName] The current active storage account key + * name. + * @property {boolean} [autoRegenerateKey] whether keyvault should manage the + * storage account for the user. + * @property {string} [regenerationPeriod] The key regeneration time duration + * specified in ISO-8601 format. + * @property {object} [attributes] The storage account attributes. + * @property {boolean} [attributes.enabled] the enabled state of the object. + * @property {date} [attributes.created] Creation time in UTC. + * @property {date} [attributes.updated] Last updated time in UTC. + * @property {string} [attributes.recoveryLevel] Reflects the deletion + * recovery level currently in effect for storage accounts in the current + * vault. If it contains 'Purgeable' the storage account can be permanently + * deleted by a privileged user; otherwise, only the system can purge the + * storage account, at the end of the retention interval. Possible values + * include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription' + * @property {object} [tags] Application specific metadata in the form of + * key-value pairs + */ + constructor() { + } + + /** + * Defines the metadata of StorageBundle + * + * @returns {object} metadata of StorageBundle + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageBundle', + type: { + name: 'Composite', + className: 'StorageBundle', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + resourceId: { + required: false, + readOnly: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + activeKeyName: { + required: false, + readOnly: true, + serializedName: 'activeKeyName', + type: { + name: 'String' + } + }, + autoRegenerateKey: { + required: false, + readOnly: true, + serializedName: 'autoRegenerateKey', + type: { + name: 'Boolean' + } + }, + regenerationPeriod: { + required: false, + readOnly: true, + serializedName: 'regenerationPeriod', + type: { + name: 'String' + } + }, + attributes: { + required: false, + readOnly: true, + serializedName: 'attributes', + type: { + name: 'Composite', + className: 'StorageAccountAttributes' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = StorageBundle; diff --git a/lib/services/keyvault/lib/models/storageListResult.js b/lib/services/keyvault/lib/models/storageListResult.js new file mode 100644 index 0000000000..169a99be4c --- /dev/null +++ b/lib/services/keyvault/lib/models/storageListResult.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The storage accounts list result. + */ +class StorageListResult extends Array { + /** + * Create a StorageListResult. + * @property {string} [nextLink] The URL to get the next set of storage + * accounts. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StorageListResult + * + * @returns {object} metadata of StorageListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageListResult', + type: { + name: 'Composite', + className: 'StorageListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StorageAccountItemElementType', + type: { + name: 'Composite', + className: 'StorageAccountItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = StorageListResult; diff --git a/lib/services/keyvault/lib/models/storageRestoreParameters.js b/lib/services/keyvault/lib/models/storageRestoreParameters.js new file mode 100644 index 0000000000..3173da8a99 --- /dev/null +++ b/lib/services/keyvault/lib/models/storageRestoreParameters.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The secret restore parameters. + * + */ +class StorageRestoreParameters { + /** + * Create a StorageRestoreParameters. + * @property {buffer} storageBundleBackup The backup blob associated with a + * storage account. + */ + constructor() { + } + + /** + * Defines the metadata of StorageRestoreParameters + * + * @returns {object} metadata of StorageRestoreParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageRestoreParameters', + type: { + name: 'Composite', + className: 'StorageRestoreParameters', + modelProperties: { + storageBundleBackup: { + required: true, + serializedName: 'value', + type: { + name: 'Base64Url' + } + } + } + } + }; + } +} + +module.exports = StorageRestoreParameters; diff --git a/lib/services/keyvault/lib/models/subjectAlternativeNames.js b/lib/services/keyvault/lib/models/subjectAlternativeNames.js new file mode 100644 index 0000000000..c9de4fceac --- /dev/null +++ b/lib/services/keyvault/lib/models/subjectAlternativeNames.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'; + +/** + * The subject alternate names of a X509 object. + * + */ +class SubjectAlternativeNames { + /** + * Create a SubjectAlternativeNames. + * @property {array} [emails] Email addresses. + * @property {array} [dnsNames] Domain names. + * @property {array} [upns] User principal names. + */ + constructor() { + } + + /** + * Defines the metadata of SubjectAlternativeNames + * + * @returns {object} metadata of SubjectAlternativeNames + * + */ + mapper() { + return { + required: false, + serializedName: 'SubjectAlternativeNames', + type: { + name: 'Composite', + className: 'SubjectAlternativeNames', + modelProperties: { + emails: { + required: false, + serializedName: 'emails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + dnsNames: { + required: false, + serializedName: 'dns_names', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + upns: { + required: false, + serializedName: 'upns', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = SubjectAlternativeNames; diff --git a/lib/services/keyvault/lib/models/trigger.js b/lib/services/keyvault/lib/models/trigger.js new file mode 100644 index 0000000000..99bfb11c08 --- /dev/null +++ b/lib/services/keyvault/lib/models/trigger.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'; + +/** + * A condition to be satisfied for an action to be executed. + * + */ +class Trigger { + /** + * Create a Trigger. + * @property {number} [lifetimePercentage] Percentage of lifetime at which to + * trigger. Value should be between 1 and 99. + * @property {number} [daysBeforeExpiry] Days before expiry to attempt + * renewal. Value should be between 1 and validity_in_months multiplied by + * 27. If validity_in_months is 36, then value should be between 1 and 972 + * (36 * 27). + */ + constructor() { + } + + /** + * Defines the metadata of Trigger + * + * @returns {object} metadata of Trigger + * + */ + mapper() { + return { + required: false, + serializedName: 'Trigger', + type: { + name: 'Composite', + className: 'Trigger', + modelProperties: { + lifetimePercentage: { + required: false, + serializedName: 'lifetime_percentage', + constraints: { + InclusiveMaximum: 99, + InclusiveMinimum: 1 + }, + type: { + name: 'Number' + } + }, + daysBeforeExpiry: { + required: false, + serializedName: 'days_before_expiry', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = Trigger; diff --git a/lib/services/keyvault/lib/models/x509CertificateProperties.js b/lib/services/keyvault/lib/models/x509CertificateProperties.js new file mode 100644 index 0000000000..5d70c8e2d7 --- /dev/null +++ b/lib/services/keyvault/lib/models/x509CertificateProperties.js @@ -0,0 +1,108 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Properties of the X509 component of a certificate. + * + */ +class X509CertificateProperties { + /** + * Create a X509CertificateProperties. + * @property {string} [subject] The subject name. Should be a valid X509 + * distinguished Name. + * @property {array} [ekus] The enhanced key usage. + * @property {object} [subjectAlternativeNames] The subject alternative + * names. + * @property {array} [subjectAlternativeNames.emails] Email addresses. + * @property {array} [subjectAlternativeNames.dnsNames] Domain names. + * @property {array} [subjectAlternativeNames.upns] User principal names. + * @property {array} [keyUsage] List of key usages. + * @property {number} [validityInMonths] The duration that the certificate is + * valid in months. + */ + constructor() { + } + + /** + * Defines the metadata of X509CertificateProperties + * + * @returns {object} metadata of X509CertificateProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'X509CertificateProperties', + type: { + name: 'Composite', + className: 'X509CertificateProperties', + modelProperties: { + subject: { + required: false, + serializedName: 'subject', + type: { + name: 'String' + } + }, + ekus: { + required: false, + serializedName: 'ekus', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + subjectAlternativeNames: { + required: false, + serializedName: 'sans', + type: { + name: 'Composite', + className: 'SubjectAlternativeNames' + } + }, + keyUsage: { + required: false, + serializedName: 'key_usage', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'KeyUsageTypeElementType', + type: { + name: 'String' + } + } + } + }, + validityInMonths: { + required: false, + serializedName: 'validity_months', + constraints: { + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = X509CertificateProperties;