class Azure::KeyVault::V2015_06_01::KeyVaultClient
A service client - single point of access to the REST API.
Attributes
@return [String] The preferred language for the response.
@return [String] Client Api Version.
@return [String] the base URI of the service.
@return Credentials needed for the client to connect to Azure
.
@return [Boolean] 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.
@return [Integer] The retry timeout in seconds for Long Running Operations. Default value is 30.
Public Class Methods
Creates initializes a new instance of the KeyVaultClient
class. @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. @param options [Array] filters to be applied to the HTTP requests.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 40 def initialize(credentials = nil, options = nil) super(credentials, options) @base_url = '{vaultBaseUrl}' fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? @credentials = credentials @api_version = '2015-06-01' @accept_language = 'en-US' @long_running_operation_retry_timeout = 30 @generate_client_request_id = true add_telemetry end
Public Instance Methods
Requests that a backup of the specified key be downloaded to the client.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [BackupKeyResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 925 def backup_key(vault_base_url, key_name, custom_headers:nil) response = backup_key_async(vault_base_url, key_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Requests that a backup of the specified key be downloaded to the client.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 956 def backup_key_async(vault_base_url, key_name, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'keys/{key-name}/backup' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::BackupKeyResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Requests that a backup of the specified key be downloaded to the client.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 941 def backup_key_with_http_info(vault_base_url, key_name, custom_headers:nil) backup_key_async(vault_base_url, key_name, custom_headers:custom_headers).value! end
Creates a new certificate version. If this is the first version, the certificate resource is created.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param certificate_policy [CertificatePolicy] The management policy for the certificate @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateOperation] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3606 def create_certificate(vault_base_url, certificate_name, certificate_policy:nil, certificate_attributes:nil, tags:nil, custom_headers:nil) response = create_certificate_async(vault_base_url, certificate_name, certificate_policy:certificate_policy, certificate_attributes:certificate_attributes, tags:tags, custom_headers:custom_headers).value! response.body unless response.nil? end
Creates a new certificate version. If this is the first version, the certificate resource is created.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param certificate_policy [CertificatePolicy] The management policy for the certificate @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3651 def create_certificate_async(vault_base_url, certificate_name, certificate_policy:nil, certificate_attributes:nil, tags:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[0-9a-zA-Z-]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[0-9a-zA-Z-]+$$')).nil? fail ArgumentError, 'api_version is nil' if api_version.nil? parameters = Azure::KeyVault::V2015_06_01::Models::CertificateCreateParameters.new unless certificate_policy.nil? && certificate_attributes.nil? && tags.nil? parameters.certificate_policy = certificate_policy parameters.certificate_attributes = certificate_attributes parameters.tags = tags end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateCreateParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'certificates/{certificate-name}/create' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 202 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateOperation.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Creates a new certificate version. If this is the first version, the certificate resource is created.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param certificate_policy [CertificatePolicy] The management policy for the certificate @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3629 def create_certificate_with_http_info(vault_base_url, certificate_name, certificate_policy:nil, certificate_attributes:nil, tags:nil, custom_headers:nil) create_certificate_async(vault_base_url, certificate_name, certificate_policy:certificate_policy, certificate_attributes:certificate_attributes, tags:tags, custom_headers:custom_headers).value! end
Creates a new, named, key in the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param kty [JsonWebKeyType] The type of key to create. Valid key types, see JsonWebKeyType. Supported JsonWebKey key types (kty) for Elliptic Curve, RSA, HSM, Octet. Possible values include: 'EC', 'RSA', 'RSA-HSM', 'oct' @param key_size [Integer] The key size in bits. e.g. 1024 or 2048. @param key_ops [Array<JsonWebKeyOperation>] @param key_attributes [KeyAttributes] @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 131 def create_key(vault_base_url, key_name, kty, key_size:nil, key_ops:nil, key_attributes:nil, tags:nil, custom_headers:nil) response = create_key_async(vault_base_url, key_name, kty, key_size:key_size, key_ops:key_ops, key_attributes:key_attributes, tags:tags, custom_headers:custom_headers).value! response.body unless response.nil? end
Creates a new, named, key in the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param kty [JsonWebKeyType] The type of key to create. Valid key types, see JsonWebKeyType. Supported JsonWebKey key types (kty) for Elliptic Curve, RSA, HSM, Octet. Possible values include: 'EC', 'RSA', 'RSA-HSM', 'oct' @param key_size [Integer] The key size in bits. e.g. 1024 or 2048. @param key_ops [Array<JsonWebKeyOperation>] @param key_attributes [KeyAttributes] @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 178 def create_key_async(vault_base_url, key_name, kty, key_size:nil, key_ops:nil, key_attributes:nil, tags:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, "'key_name' should satisfy the constraint - 'Pattern': '^[0-9a-zA-Z-]+$'" if !key_name.nil? && key_name.match(Regexp.new('^^[0-9a-zA-Z-]+$$')).nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'kty is nil' if kty.nil? fail ArgumentError, "'kty' should satisfy the constraint - 'MinLength': '1'" if !kty.nil? && kty.length < 1 parameters = Azure::KeyVault::V2015_06_01::Models::KeyCreateParameters.new unless kty.nil? && key_size.nil? && key_ops.nil? && key_attributes.nil? && tags.nil? parameters.kty = kty parameters.key_size = key_size parameters.key_ops = key_ops parameters.key_attributes = key_attributes parameters.tags = tags end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::KeyCreateParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keys/{key-name}/create' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Creates a new, named, key in the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param kty [JsonWebKeyType] The type of key to create. Valid key types, see JsonWebKeyType. Supported JsonWebKey key types (kty) for Elliptic Curve, RSA, HSM, Octet. Possible values include: 'EC', 'RSA', 'RSA-HSM', 'oct' @param key_size [Integer] The key size in bits. e.g. 1024 or 2048. @param key_ops [Array<JsonWebKeyOperation>] @param key_attributes [KeyAttributes] @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 155 def create_key_with_http_info(vault_base_url, key_name, kty, key_size:nil, key_ops:nil, key_attributes:nil, tags:nil, custom_headers:nil) create_key_async(vault_base_url, key_name, kty, key_size:key_size, key_ops:key_ops, key_attributes:key_attributes, tags:tags, custom_headers:custom_headers).value! end
Decrypts a single block of encrypted data
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyOperationResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1261 def decrypt(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) response = decrypt_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:custom_headers).value! response.body unless response.nil? end
Decrypts a single block of encrypted data
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1300 def decrypt_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, 'key_version is nil' if key_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'algorithm is nil' if algorithm.nil? fail ArgumentError, "'algorithm' should satisfy the constraint - 'MinLength': '1'" if !algorithm.nil? && algorithm.length < 1 fail ArgumentError, 'value is nil' if value.nil? parameters = Azure::KeyVault::V2015_06_01::Models::KeyOperationsParameters.new unless algorithm.nil? && value.nil? parameters.algorithm = algorithm parameters.value = value end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::KeyOperationsParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keys/{key-name}/{key-version}/decrypt' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name,'key-version' => key_version}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyOperationResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Decrypts a single block of encrypted data
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1281 def decrypt_with_http_info(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) decrypt_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:custom_headers).value! end
Deletes a certificate from the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2660 def delete_certificate(vault_base_url, certificate_name, custom_headers:nil) response = delete_certificate_async(vault_base_url, certificate_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Deletes a certificate from the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2693 def delete_certificate_async(vault_base_url, certificate_name, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/{certificate-name}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Deletes the certificate contacts for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Contacts] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2953 def delete_certificate_contacts(vault_base_url, custom_headers:nil) response = delete_certificate_contacts_async(vault_base_url, custom_headers:custom_headers).value! response.body unless response.nil? end
Deletes the certificate contacts for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2982 def delete_certificate_contacts_async(vault_base_url, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/contacts' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::Contacts.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Deletes the certificate contacts for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2968 def delete_certificate_contacts_with_http_info(vault_base_url, custom_headers:nil) delete_certificate_contacts_async(vault_base_url, custom_headers:custom_headers).value! end
Deletes the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [IssuerBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3502 def delete_certificate_issuer(vault_base_url, issuer_name, custom_headers:nil) response = delete_certificate_issuer_async(vault_base_url, issuer_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Deletes the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3533 def delete_certificate_issuer_async(vault_base_url, issuer_name, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'issuer_name is nil' if issuer_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/issuers/{issuer-name}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'issuer-name' => issuer_name}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::IssuerBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Deletes the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3518 def delete_certificate_issuer_with_http_info(vault_base_url, issuer_name, custom_headers:nil) delete_certificate_issuer_async(vault_base_url, issuer_name, custom_headers:custom_headers).value! end
Deletes the certificate operation.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateOperation] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4648 def delete_certificate_operation(vault_base_url, certificate_name, custom_headers:nil) response = delete_certificate_operation_async(vault_base_url, certificate_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Deletes the certificate operation.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4679 def delete_certificate_operation_async(vault_base_url, certificate_name, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/{certificate-name}/pending' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateOperation.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Deletes the certificate operation.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4664 def delete_certificate_operation_with_http_info(vault_base_url, certificate_name, custom_headers:nil) delete_certificate_operation_async(vault_base_url, certificate_name, custom_headers:custom_headers).value! end
Deletes a certificate from the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2677 def delete_certificate_with_http_info(vault_base_url, certificate_name, custom_headers:nil) delete_certificate_async(vault_base_url, certificate_name, custom_headers:custom_headers).value! end
Deletes the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 393 def delete_key(vault_base_url, key_name, custom_headers:nil) response = delete_key_async(vault_base_url, key_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Deletes the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 424 def delete_key_async(vault_base_url, key_name, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'keys/{key-name}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Deletes the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 409 def delete_key_with_http_info(vault_base_url, key_name, custom_headers:nil) delete_key_async(vault_base_url, key_name, custom_headers:custom_headers).value! end
Deletes a secret from the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [SecretBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2030 def delete_secret(vault_base_url, secret_name, custom_headers:nil) response = delete_secret_async(vault_base_url, secret_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Deletes a secret from the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2061 def delete_secret_async(vault_base_url, secret_name, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'secret_name is nil' if secret_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'secrets/{secret-name}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'secret-name' => secret_name}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::SecretBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Deletes a secret from the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2046 def delete_secret_with_http_info(vault_base_url, secret_name, custom_headers:nil) delete_secret_async(vault_base_url, secret_name, custom_headers:custom_headers).value! end
Encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure
Key Vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyOperationResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1134 def encrypt(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) response = encrypt_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:custom_headers).value! response.body unless response.nil? end
Encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure
Key Vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1175 def encrypt_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, 'key_version is nil' if key_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'algorithm is nil' if algorithm.nil? fail ArgumentError, "'algorithm' should satisfy the constraint - 'MinLength': '1'" if !algorithm.nil? && algorithm.length < 1 fail ArgumentError, 'value is nil' if value.nil? parameters = Azure::KeyVault::V2015_06_01::Models::KeyOperationsParameters.new unless algorithm.nil? && value.nil? parameters.algorithm = algorithm parameters.value = value end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::KeyOperationsParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keys/{key-name}/{key-version}/encrypt' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name,'key-version' => key_version}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyOperationResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure
Key Vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1155 def encrypt_with_http_info(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) encrypt_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:custom_headers).value! end
Gets a Certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault @param certificate_version [String] The version of the certificate @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4334 def get_certificate(vault_base_url, certificate_name, certificate_version, custom_headers:nil) response = get_certificate_async(vault_base_url, certificate_name, certificate_version, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets a Certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault @param certificate_version [String] The version of the certificate @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4369 def get_certificate_async(vault_base_url, certificate_name, certificate_version, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, 'certificate_version is nil' if certificate_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/{certificate-name}/{certificate-version}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name,'certificate-version' => certificate_version}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets the certificate contacts for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Contacts] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2861 def get_certificate_contacts(vault_base_url, custom_headers:nil) response = get_certificate_contacts_async(vault_base_url, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets the certificate contacts for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2890 def get_certificate_contacts_async(vault_base_url, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/contacts' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::Contacts.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets the certificate contacts for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2876 def get_certificate_contacts_with_http_info(vault_base_url, custom_headers:nil) get_certificate_contacts_async(vault_base_url, custom_headers:custom_headers).value! end
Gets the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [IssuerBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3405 def get_certificate_issuer(vault_base_url, issuer_name, custom_headers:nil) response = get_certificate_issuer_async(vault_base_url, issuer_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3436 def get_certificate_issuer_async(vault_base_url, issuer_name, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'issuer_name is nil' if issuer_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/issuers/{issuer-name}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'issuer-name' => issuer_name}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::IssuerBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3421 def get_certificate_issuer_with_http_info(vault_base_url, issuer_name, custom_headers:nil) get_certificate_issuer_async(vault_base_url, issuer_name, custom_headers:custom_headers).value! end
List certificate issuers for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<CertificateIssuerItem>] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3047 def get_certificate_issuers(vault_base_url, maxresults:nil, custom_headers:nil) first_page = get_certificate_issuers_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List certificate issuers for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateIssuerListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5993 def get_certificate_issuers_as_lazy(vault_base_url, maxresults:nil, custom_headers:nil) first_page = get_certificate_issuers_as_lazy_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List certificate issuers for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 6026 def get_certificate_issuers_as_lazy_async(vault_base_url, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'certificates/issuers' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'maxresults' => maxresults}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateIssuerListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List certificate issuers for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 6010 def get_certificate_issuers_as_lazy_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil) get_certificate_issuers_as_lazy_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value! end
List certificate issuers for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3080 def get_certificate_issuers_async(vault_base_url, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/issuers' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'maxresults' => maxresults,'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateIssuerListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List certificate issuers for the specified vault.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateIssuerListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5326 def get_certificate_issuers_next(next_page_link, custom_headers:nil) response = get_certificate_issuers_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
List certificate issuers for the specified vault.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5355 def get_certificate_issuers_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = '{nextLink}' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateIssuerListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List certificate issuers for the specified vault.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5341 def get_certificate_issuers_next_with_http_info(next_page_link, custom_headers:nil) get_certificate_issuers_next_async(next_page_link, custom_headers:custom_headers).value! end
List certificate issuers for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3064 def get_certificate_issuers_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil) get_certificate_issuers_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value! end
Gets the certificate operation response.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateOperation] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4551 def get_certificate_operation(vault_base_url, certificate_name, custom_headers:nil) response = get_certificate_operation_async(vault_base_url, certificate_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets the certificate operation response.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4582 def get_certificate_operation_async(vault_base_url, certificate_name, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/{certificate-name}/pending' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateOperation.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets the certificate operation response.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4567 def get_certificate_operation_with_http_info(vault_base_url, certificate_name, custom_headers:nil) get_certificate_operation_async(vault_base_url, certificate_name, custom_headers:custom_headers).value! end
Gets the policy for a certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificatePolicy] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3984 def get_certificate_policy(vault_base_url, certificate_name, custom_headers:nil) response = get_certificate_policy_async(vault_base_url, certificate_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets the policy for a certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4017 def get_certificate_policy_async(vault_base_url, certificate_name, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/{certificate-name}/policy' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificatePolicy.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets the policy for a certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4001 def get_certificate_policy_with_http_info(vault_base_url, certificate_name, custom_headers:nil) get_certificate_policy_async(vault_base_url, certificate_name, custom_headers:custom_headers).value! end
List the versions of a certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<CertificateItem>] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3880 def get_certificate_versions(vault_base_url, certificate_name, maxresults:nil, custom_headers:nil) first_page = get_certificate_versions_as_lazy(vault_base_url, certificate_name, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List the versions of a certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 6089 def get_certificate_versions_as_lazy(vault_base_url, certificate_name, maxresults:nil, custom_headers:nil) first_page = get_certificate_versions_as_lazy_async(vault_base_url, certificate_name, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List the versions of a certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 6124 def get_certificate_versions_as_lazy_async(vault_base_url, certificate_name, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'certificates/{certificate-name}/versions' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'maxresults' => maxresults}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of a certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 6107 def get_certificate_versions_as_lazy_with_http_info(vault_base_url, certificate_name, maxresults:nil, custom_headers:nil) get_certificate_versions_as_lazy_async(vault_base_url, certificate_name, maxresults:maxresults, custom_headers:custom_headers).value! end
List the versions of a certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3915 def get_certificate_versions_async(vault_base_url, certificate_name, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates/{certificate-name}/versions' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'maxresults' => maxresults,'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of a certificate.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5416 def get_certificate_versions_next(next_page_link, custom_headers:nil) response = get_certificate_versions_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
List the versions of a certificate.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5445 def get_certificate_versions_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = '{nextLink}' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of a certificate.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5431 def get_certificate_versions_next_with_http_info(next_page_link, custom_headers:nil) get_certificate_versions_next_async(next_page_link, custom_headers:custom_headers).value! end
List the versions of a certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3898 def get_certificate_versions_with_http_info(vault_base_url, certificate_name, maxresults:nil, custom_headers:nil) get_certificate_versions_async(vault_base_url, certificate_name, maxresults:maxresults, custom_headers:custom_headers).value! end
Gets a Certificate.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault @param certificate_version [String] The version of the certificate @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4352 def get_certificate_with_http_info(vault_base_url, certificate_name, certificate_version, custom_headers:nil) get_certificate_async(vault_base_url, certificate_name, certificate_version, custom_headers:custom_headers).value! end
List certificates in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<CertificateItem>] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2560 def get_certificates(vault_base_url, maxresults:nil, custom_headers:nil) first_page = get_certificates_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List certificates in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5898 def get_certificates_as_lazy(vault_base_url, maxresults:nil, custom_headers:nil) first_page = get_certificates_as_lazy_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List certificates in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5931 def get_certificates_as_lazy_async(vault_base_url, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'certificates' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'maxresults' => maxresults}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List certificates in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5915 def get_certificates_as_lazy_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil) get_certificates_as_lazy_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value! end
List certificates in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2593 def get_certificates_async(vault_base_url, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'certificates' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'maxresults' => maxresults,'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List certificates in the specified vault
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5236 def get_certificates_next(next_page_link, custom_headers:nil) response = get_certificates_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
List certificates in the specified vault
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5265 def get_certificates_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = '{nextLink}' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List certificates in the specified vault
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5251 def get_certificates_next_with_http_info(next_page_link, custom_headers:nil) get_certificates_next_async(next_page_link, custom_headers:custom_headers).value! end
List certificates in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2577 def get_certificates_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil) get_certificates_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value! end
Retrieves the public portion of a key plus its attributes
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 620 def get_key(vault_base_url, key_name, key_version, custom_headers:nil) response = get_key_async(vault_base_url, key_name, key_version, custom_headers:custom_headers).value! response.body unless response.nil? end
Retrieves the public portion of a key plus its attributes
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 653 def get_key_async(vault_base_url, key_name, key_version, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, 'key_version is nil' if key_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'keys/{key-name}/{key-version}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name,'key-version' => key_version}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<KeyItem>] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 722 def get_key_versions(vault_base_url, key_name, maxresults:nil, custom_headers:nil) first_page = get_key_versions_as_lazy(vault_base_url, key_name, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List the versions of the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5509 def get_key_versions_as_lazy(vault_base_url, key_name, maxresults:nil, custom_headers:nil) first_page = get_key_versions_as_lazy_async(vault_base_url, key_name, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List the versions of the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5544 def get_key_versions_as_lazy_async(vault_base_url, key_name, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'keys/{key-name}/versions' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name}, query_params: {'maxresults' => maxresults}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5527 def get_key_versions_as_lazy_with_http_info(vault_base_url, key_name, maxresults:nil, custom_headers:nil) get_key_versions_as_lazy_async(vault_base_url, key_name, maxresults:maxresults, custom_headers:custom_headers).value! end
List the versions of the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 757 def get_key_versions_async(vault_base_url, key_name, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'keys/{key-name}/versions' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name}, query_params: {'maxresults' => maxresults,'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of the specified key
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4876 def get_key_versions_next(next_page_link, custom_headers:nil) response = get_key_versions_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
List the versions of the specified key
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4905 def get_key_versions_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = '{nextLink}' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of the specified key
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4891 def get_key_versions_next_with_http_info(next_page_link, custom_headers:nil) get_key_versions_next_async(next_page_link, custom_headers:custom_headers).value! end
List the versions of the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 740 def get_key_versions_with_http_info(vault_base_url, key_name, maxresults:nil, custom_headers:nil) get_key_versions_async(vault_base_url, key_name, maxresults:maxresults, custom_headers:custom_headers).value! end
Retrieves the public portion of a key plus its attributes
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 637 def get_key_with_http_info(vault_base_url, key_name, key_version, custom_headers:nil) get_key_async(vault_base_url, key_name, key_version, custom_headers:custom_headers).value! end
List keys in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<KeyItem>] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 826 def get_keys(vault_base_url, maxresults:nil, custom_headers:nil) first_page = get_keys_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List keys in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5608 def get_keys_as_lazy(vault_base_url, maxresults:nil, custom_headers:nil) first_page = get_keys_as_lazy_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List keys in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5641 def get_keys_as_lazy_async(vault_base_url, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'keys' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'maxresults' => maxresults}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List keys in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5625 def get_keys_as_lazy_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil) get_keys_as_lazy_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value! end
List keys in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 859 def get_keys_async(vault_base_url, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'keys' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'maxresults' => maxresults,'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List keys in the specified vault
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4966 def get_keys_next(next_page_link, custom_headers:nil) response = get_keys_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
List keys in the specified vault
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4995 def get_keys_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = '{nextLink}' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List keys in the specified vault
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4981 def get_keys_next_with_http_info(next_page_link, custom_headers:nil) get_keys_next_async(next_page_link, custom_headers:custom_headers).value! end
List keys in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 843 def get_keys_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil) get_keys_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value! end
Gets a secret.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param secret_version [String] The version of the secret @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [SecretBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2254 def get_secret(vault_base_url, secret_name, secret_version, custom_headers:nil) response = get_secret_async(vault_base_url, secret_name, secret_version, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets a secret.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param secret_version [String] The version of the secret @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2287 def get_secret_async(vault_base_url, secret_name, secret_version, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'secret_name is nil' if secret_name.nil? fail ArgumentError, 'secret_version is nil' if secret_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'secrets/{secret-name}/{secret-version}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'secret-name' => secret_name,'secret-version' => secret_version}, query_params: {'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::SecretBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of the specified secret
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<SecretItem>] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2456 def get_secret_versions(vault_base_url, secret_name, maxresults:nil, custom_headers:nil) first_page = get_secret_versions_as_lazy(vault_base_url, secret_name, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List the versions of the specified secret
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [SecretListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5799 def get_secret_versions_as_lazy(vault_base_url, secret_name, maxresults:nil, custom_headers:nil) first_page = get_secret_versions_as_lazy_async(vault_base_url, secret_name, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List the versions of the specified secret
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5834 def get_secret_versions_as_lazy_async(vault_base_url, secret_name, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'secret_name is nil' if secret_name.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'secrets/{secret-name}/versions' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'secret-name' => secret_name}, query_params: {'maxresults' => maxresults}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::SecretListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of the specified secret
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5817 def get_secret_versions_as_lazy_with_http_info(vault_base_url, secret_name, maxresults:nil, custom_headers:nil) get_secret_versions_as_lazy_async(vault_base_url, secret_name, maxresults:maxresults, custom_headers:custom_headers).value! end
List the versions of the specified secret
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2491 def get_secret_versions_async(vault_base_url, secret_name, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'secret_name is nil' if secret_name.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'secrets/{secret-name}/versions' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'secret-name' => secret_name}, query_params: {'maxresults' => maxresults,'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::SecretListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of the specified secret
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [SecretListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5146 def get_secret_versions_next(next_page_link, custom_headers:nil) response = get_secret_versions_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
List the versions of the specified secret
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5175 def get_secret_versions_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = '{nextLink}' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::SecretListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List the versions of the specified secret
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5161 def get_secret_versions_next_with_http_info(next_page_link, custom_headers:nil) get_secret_versions_next_async(next_page_link, custom_headers:custom_headers).value! end
List the versions of the specified secret
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2474 def get_secret_versions_with_http_info(vault_base_url, secret_name, maxresults:nil, custom_headers:nil) get_secret_versions_async(vault_base_url, secret_name, maxresults:maxresults, custom_headers:custom_headers).value! end
Gets a secret.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param secret_version [String] The version of the secret @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2271 def get_secret_with_http_info(vault_base_url, secret_name, secret_version, custom_headers:nil) get_secret_async(vault_base_url, secret_name, secret_version, custom_headers:custom_headers).value! end
List secrets in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<SecretItem>] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2355 def get_secrets(vault_base_url, maxresults:nil, custom_headers:nil) first_page = get_secrets_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List secrets in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [SecretListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5703 def get_secrets_as_lazy(vault_base_url, maxresults:nil, custom_headers:nil) first_page = get_secrets_as_lazy_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers) first_page.get_all_items end
List secrets in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5736 def get_secrets_as_lazy_async(vault_base_url, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'secrets' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'maxresults' => maxresults}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::SecretListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List secrets in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5720 def get_secrets_as_lazy_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil) get_secrets_as_lazy_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value! end
List secrets in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2388 def get_secrets_async(vault_base_url, maxresults:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMaximum': '25'" if !maxresults.nil? && maxresults > 25 fail ArgumentError, "'maxresults' should satisfy the constraint - 'InclusiveMinimum': '1'" if !maxresults.nil? && maxresults < 1 fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'secrets' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'maxresults' => maxresults,'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::SecretListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List secrets in the specified vault
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [SecretListResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5056 def get_secrets_next(next_page_link, custom_headers:nil) response = get_secrets_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
List secrets in the specified vault
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5085 def get_secrets_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = '{nextLink}' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::SecretListResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List secrets in the specified vault
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 5071 def get_secrets_next_with_http_info(next_page_link, custom_headers:nil) get_secrets_next_async(next_page_link, custom_headers:custom_headers).value! end
List secrets in the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param maxresults [Integer] Maximum number of results to return in a page. If not specified the service will return up to 25 results. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2372 def get_secrets_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil) get_secrets_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value! end
Imports a certificate into the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param base64encoded_certificate [String] Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key. @param password [String] If the private key in base64encoded_certificate is encrypted, the password used for encryption @param certificate_policy [CertificatePolicy] The management policy for the certificate @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3742 def import_certificate(vault_base_url, certificate_name, base64encoded_certificate, password:nil, certificate_policy:nil, certificate_attributes:nil, tags:nil, custom_headers:nil) response = import_certificate_async(vault_base_url, certificate_name, base64encoded_certificate, password:password, certificate_policy:certificate_policy, certificate_attributes:certificate_attributes, tags:tags, custom_headers:custom_headers).value! response.body unless response.nil? end
Imports a certificate into the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param base64encoded_certificate [String] Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key. @param password [String] If the private key in base64encoded_certificate is encrypted, the password used for encryption @param certificate_policy [CertificatePolicy] The management policy for the certificate @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3795 def import_certificate_async(vault_base_url, certificate_name, base64encoded_certificate, password:nil, certificate_policy:nil, certificate_attributes:nil, tags:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[0-9a-zA-Z-]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[0-9a-zA-Z-]+$$')).nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'base64encoded_certificate is nil' if base64encoded_certificate.nil? parameters = Azure::KeyVault::V2015_06_01::Models::CertificateImportParameters.new unless base64encoded_certificate.nil? && password.nil? && certificate_policy.nil? && certificate_attributes.nil? && tags.nil? parameters.base64encoded_certificate = base64encoded_certificate parameters.password = password parameters.certificate_policy = certificate_policy parameters.certificate_attributes = certificate_attributes parameters.tags = tags end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateImportParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'certificates/{certificate-name}/import' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Imports a certificate into the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param base64encoded_certificate [String] Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key. @param password [String] If the private key in base64encoded_certificate is encrypted, the password used for encryption @param certificate_policy [CertificatePolicy] The management policy for the certificate @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3769 def import_certificate_with_http_info(vault_base_url, certificate_name, base64encoded_certificate, password:nil, certificate_policy:nil, certificate_attributes:nil, tags:nil, custom_headers:nil) import_certificate_async(vault_base_url, certificate_name, base64encoded_certificate, password:password, certificate_policy:certificate_policy, certificate_attributes:certificate_attributes, tags:tags, custom_headers:custom_headers).value! end
Imports a key into the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key [JsonWebKey] The Json web key @param hsm [Boolean] Whether to import as a hardware key (HSM) or software key @param key_attributes [KeyAttributes] The key management attributes @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 268 def import_key(vault_base_url, key_name, key, hsm:nil, key_attributes:nil, tags:nil, custom_headers:nil) response = import_key_async(vault_base_url, key_name, key, hsm:hsm, key_attributes:key_attributes, tags:tags, custom_headers:custom_headers).value! response.body unless response.nil? end
Imports a key into the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key [JsonWebKey] The Json web key @param hsm [Boolean] Whether to import as a hardware key (HSM) or software key @param key_attributes [KeyAttributes] The key management attributes @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 311 def import_key_async(vault_base_url, key_name, key, hsm:nil, key_attributes:nil, tags:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, "'key_name' should satisfy the constraint - 'Pattern': '^[0-9a-zA-Z-]+$'" if !key_name.nil? && key_name.match(Regexp.new('^^[0-9a-zA-Z-]+$$')).nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'key is nil' if key.nil? parameters = Azure::KeyVault::V2015_06_01::Models::KeyImportParameters.new unless hsm.nil? && key.nil? && key_attributes.nil? && tags.nil? parameters.hsm = hsm parameters.key = key parameters.key_attributes = key_attributes parameters.tags = tags end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::KeyImportParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keys/{key-name}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:put, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Imports a key into the specified vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key [JsonWebKey] The Json web key @param hsm [Boolean] Whether to import as a hardware key (HSM) or software key @param key_attributes [KeyAttributes] The key management attributes @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 290 def import_key_with_http_info(vault_base_url, key_name, key, hsm:nil, key_attributes:nil, tags:nil, custom_headers:nil) import_key_async(vault_base_url, key_name, key, hsm:hsm, key_attributes:key_attributes, tags:tags, custom_headers:custom_headers).value! end
Makes a request and returns the body of the response. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [Hash{String=>String}] containing the body of the response. Example:
request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}" path = "/path" options = { body: request_content, query_params: {'api-version' => '2016-02-01'} } result = @client.make_request(:put, path, options)
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 70 def make_request(method, path, options = {}) result = make_request_with_http_info(method, path, options) result.body unless result.nil? end
Makes a request asynchronously. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 95 def make_request_async(method, path, options = {}) fail ArgumentError, 'method is nil' if method.nil? fail ArgumentError, 'path is nil' if path.nil? request_url = options[:base_url] || @base_url if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?) @request_headers['Content-Type'] = options[:headers]['Content-Type'] end request_headers = @request_headers request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil? options.merge!({headers: request_headers.merge(options[:headers] || {})}) options.merge!({credentials: @credentials}) unless @credentials.nil? super(request_url, method, path, options) end
Makes a request and returns the operation response. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 82 def make_request_with_http_info(method, path, options = {}) result = make_request_async(method, path, options).value! result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) result end
Merges a certificate or a certificate chain with a key pair existing on the server.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param x509certificates [Array<Array<Integer>>] The certificate or the certificate chain to merge @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4752 def merge_certificate(vault_base_url, certificate_name, x509certificates, certificate_attributes:nil, tags:nil, custom_headers:nil) response = merge_certificate_async(vault_base_url, certificate_name, x509certificates, certificate_attributes:certificate_attributes, tags:tags, custom_headers:custom_headers).value! response.body unless response.nil? end
Merges a certificate or a certificate chain with a key pair existing on the server.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param x509certificates [Array<Array<Integer>>] The certificate or the certificate chain to merge @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4797 def merge_certificate_async(vault_base_url, certificate_name, x509certificates, certificate_attributes:nil, tags:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'x509certificates is nil' if x509certificates.nil? parameters = Azure::KeyVault::V2015_06_01::Models::CertificateMergeParameters.new unless x509certificates.nil? && certificate_attributes.nil? && tags.nil? parameters.x509certificates = x509certificates parameters.certificate_attributes = certificate_attributes parameters.tags = tags end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateMergeParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'certificates/{certificate-name}/pending/merge' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 201 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 201 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Merges a certificate or a certificate chain with a key pair existing on the server.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param x509certificates [Array<Array<Integer>>] The certificate or the certificate chain to merge @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4775 def merge_certificate_with_http_info(vault_base_url, certificate_name, x509certificates, certificate_attributes:nil, tags:nil, custom_headers:nil) merge_certificate_async(vault_base_url, certificate_name, x509certificates, certificate_attributes:certificate_attributes, tags:tags, custom_headers:custom_headers).value! end
Restores the backup key in to a vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_bundle_backup the backup blob associated with a key bundle @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1022 def restore_key(vault_base_url, key_bundle_backup, custom_headers:nil) response = restore_key_async(vault_base_url, key_bundle_backup, custom_headers:custom_headers).value! response.body unless response.nil? end
Restores the backup key in to a vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_bundle_backup the backup blob associated with a key bundle @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1053 def restore_key_async(vault_base_url, key_bundle_backup, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'key_bundle_backup is nil' if key_bundle_backup.nil? parameters = Azure::KeyVault::V2015_06_01::Models::KeyRestoreParameters.new unless key_bundle_backup.nil? parameters.key_bundle_backup = key_bundle_backup end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::KeyRestoreParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keys/restore' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Restores the backup key in to a vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_bundle_backup the backup blob associated with a key bundle @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1038 def restore_key_with_http_info(vault_base_url, key_bundle_backup, custom_headers:nil) restore_key_async(vault_base_url, key_bundle_backup, custom_headers:custom_headers).value! end
Sets the certificate contacts for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param contacts [Contacts] The contacts for the vault certificates. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Contacts] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2759 def set_certificate_contacts(vault_base_url, contacts, custom_headers:nil) response = set_certificate_contacts_async(vault_base_url, contacts, custom_headers:custom_headers).value! response.body unless response.nil? end
Sets the certificate contacts for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param contacts [Contacts] The contacts for the vault certificates. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2790 def set_certificate_contacts_async(vault_base_url, contacts, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'contacts is nil' if contacts.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::Contacts.mapper() request_content = self.serialize(request_mapper, contacts) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'certificates/contacts' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:put, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::Contacts.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Sets the certificate contacts for the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param contacts [Contacts] The contacts for the vault certificates. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2775 def set_certificate_contacts_with_http_info(vault_base_url, contacts, custom_headers:nil) set_certificate_contacts_async(vault_base_url, contacts, custom_headers:custom_headers).value! end
Sets the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param provider [String] The issuer provider. @param credentials [IssuerCredentials] The credentials to be used for the issuer. @param organization_details [OrganizationDetails] Details of the organization as provided to the issuer. @param attributes [IssuerAttributes] Attributes of the issuer object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [IssuerBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3152 def set_certificate_issuer(vault_base_url, issuer_name, provider, credentials:nil, organization_details:nil, attributes:nil, custom_headers:nil) response = set_certificate_issuer_async(vault_base_url, issuer_name, provider, credentials:credentials, organization_details:organization_details, attributes:attributes, custom_headers:custom_headers).value! response.body unless response.nil? end
Sets the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param provider [String] The issuer provider. @param credentials [IssuerCredentials] The credentials to be used for the issuer. @param organization_details [OrganizationDetails] Details of the organization as provided to the issuer. @param attributes [IssuerAttributes] Attributes of the issuer object. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3195 def set_certificate_issuer_async(vault_base_url, issuer_name, provider, credentials:nil, organization_details:nil, attributes:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'issuer_name is nil' if issuer_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'provider is nil' if provider.nil? parameter = Azure::KeyVault::V2015_06_01::Models::CertificateIssuerSetParameters.new unless provider.nil? && credentials.nil? && organization_details.nil? && attributes.nil? parameter.provider = provider parameter.credentials = credentials parameter.organization_details = organization_details parameter.attributes = attributes end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateIssuerSetParameters.mapper() request_content = self.serialize(request_mapper, parameter) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'certificates/issuers/{issuer-name}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'issuer-name' => issuer_name}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:put, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::IssuerBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Sets the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param provider [String] The issuer provider. @param credentials [IssuerCredentials] The credentials to be used for the issuer. @param organization_details [OrganizationDetails] Details of the organization as provided to the issuer. @param attributes [IssuerAttributes] Attributes of the issuer object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3174 def set_certificate_issuer_with_http_info(vault_base_url, issuer_name, provider, credentials:nil, organization_details:nil, attributes:nil, custom_headers:nil) set_certificate_issuer_async(vault_base_url, issuer_name, provider, credentials:credentials, organization_details:organization_details, attributes:attributes, custom_headers:custom_headers).value! end
Sets a secret in the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param value [String] The value of the secret @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param content_type [String] Type of the secret value such as a password @param secret_attributes [SecretAttributes] The secret management attributes @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [SecretBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1907 def set_secret(vault_base_url, secret_name, value, tags:nil, content_type:nil, secret_attributes:nil, custom_headers:nil) response = set_secret_async(vault_base_url, secret_name, value, tags:tags, content_type:content_type, secret_attributes:secret_attributes, custom_headers:custom_headers).value! response.body unless response.nil? end
Sets a secret in the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param value [String] The value of the secret @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param content_type [String] Type of the secret value such as a password @param secret_attributes [SecretAttributes] The secret management attributes @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1948 def set_secret_async(vault_base_url, secret_name, value, tags:nil, content_type:nil, secret_attributes:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'secret_name is nil' if secret_name.nil? fail ArgumentError, "'secret_name' should satisfy the constraint - 'Pattern': '^[0-9a-zA-Z-]+$'" if !secret_name.nil? && secret_name.match(Regexp.new('^^[0-9a-zA-Z-]+$$')).nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'value is nil' if value.nil? parameters = Azure::KeyVault::V2015_06_01::Models::SecretSetParameters.new unless value.nil? && tags.nil? && content_type.nil? && secret_attributes.nil? parameters.value = value parameters.tags = tags parameters.content_type = content_type parameters.secret_attributes = secret_attributes end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::SecretSetParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'secrets/{secret-name}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'secret-name' => secret_name}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:put, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::SecretBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Sets a secret in the specified vault.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param value [String] The value of the secret @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param content_type [String] Type of the secret value such as a password @param secret_attributes [SecretAttributes] The secret management attributes @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1928 def set_secret_with_http_info(vault_base_url, secret_name, value, tags:nil, content_type:nil, secret_attributes:nil, custom_headers:nil) set_secret_async(vault_base_url, secret_name, value, tags:tags, content_type:content_type, secret_attributes:secret_attributes, custom_headers:custom_headers).value! end
Creates a signature from a digest using the specified key in the vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeySignatureAlgorithm] The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL' @param value @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyOperationResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1388 def sign(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) response = sign_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:custom_headers).value! response.body unless response.nil? end
Creates a signature from a digest using the specified key in the vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeySignatureAlgorithm] The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL' @param value @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1431 def sign_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, 'key_version is nil' if key_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'algorithm is nil' if algorithm.nil? fail ArgumentError, "'algorithm' should satisfy the constraint - 'MinLength': '1'" if !algorithm.nil? && algorithm.length < 1 fail ArgumentError, 'value is nil' if value.nil? parameters = Azure::KeyVault::V2015_06_01::Models::KeySignParameters.new unless algorithm.nil? && value.nil? parameters.algorithm = algorithm parameters.value = value end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::KeySignParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keys/{key-name}/{key-version}/sign' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name,'key-version' => key_version}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyOperationResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Creates a signature from a digest using the specified key in the vault
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeySignatureAlgorithm] The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL' @param value @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1410 def sign_with_http_info(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) sign_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:custom_headers).value! end
Unwraps a symmetric key using the specified key in the vault that has initially been used for wrapping the key.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyOperationResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1779 def unwrap_key(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) response = unwrap_key_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:custom_headers).value! response.body unless response.nil? end
Unwraps a symmetric key using the specified key in the vault that has initially been used for wrapping the key.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1820 def unwrap_key_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, 'key_version is nil' if key_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'algorithm is nil' if algorithm.nil? fail ArgumentError, "'algorithm' should satisfy the constraint - 'MinLength': '1'" if !algorithm.nil? && algorithm.length < 1 fail ArgumentError, 'value is nil' if value.nil? parameters = Azure::KeyVault::V2015_06_01::Models::KeyOperationsParameters.new unless algorithm.nil? && value.nil? parameters.algorithm = algorithm parameters.value = value end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::KeyOperationsParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keys/{key-name}/{key-version}/unwrapkey' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name,'key-version' => key_version}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyOperationResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Unwraps a symmetric key using the specified key in the vault that has initially been used for wrapping the key.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1800 def unwrap_key_with_http_info(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) unwrap_key_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:custom_headers).value! end
Updates the attributes associated with the specified certificate
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault @param certificate_version [String] The version of the certificate @param certificate_policy [CertificatePolicy] The management policy for the certificate @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4205 def update_certificate(vault_base_url, certificate_name, certificate_version, certificate_policy:nil, certificate_attributes:nil, tags:nil, custom_headers:nil) response = update_certificate_async(vault_base_url, certificate_name, certificate_version, certificate_policy:certificate_policy, certificate_attributes:certificate_attributes, tags:tags, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates the attributes associated with the specified certificate
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault @param certificate_version [String] The version of the certificate @param certificate_policy [CertificatePolicy] The management policy for the certificate @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4252 def update_certificate_async(vault_base_url, certificate_name, certificate_version, certificate_policy:nil, certificate_attributes:nil, tags:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, 'certificate_version is nil' if certificate_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? parameters = Azure::KeyVault::V2015_06_01::Models::CertificateUpdateParameters.new unless certificate_policy.nil? && certificate_attributes.nil? && tags.nil? parameters.certificate_policy = certificate_policy parameters.certificate_attributes = certificate_attributes parameters.tags = tags end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateUpdateParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'certificates/{certificate-name}/{certificate-version}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name,'certificate-version' => certificate_version}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Updates the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param provider [String] The issuer provider. @param credentials [IssuerCredentials] The credentials to be used for the issuer. @param organization_details [OrganizationDetails] Details of the organization as provided to the issuer. @param attributes [IssuerAttributes] Attributes of the issuer object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [IssuerBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3282 def update_certificate_issuer(vault_base_url, issuer_name, provider:nil, credentials:nil, organization_details:nil, attributes:nil, custom_headers:nil) response = update_certificate_issuer_async(vault_base_url, issuer_name, provider:provider, credentials:credentials, organization_details:organization_details, attributes:attributes, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param provider [String] The issuer provider. @param credentials [IssuerCredentials] The credentials to be used for the issuer. @param organization_details [OrganizationDetails] Details of the organization as provided to the issuer. @param attributes [IssuerAttributes] Attributes of the issuer object. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3325 def update_certificate_issuer_async(vault_base_url, issuer_name, provider:nil, credentials:nil, organization_details:nil, attributes:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'issuer_name is nil' if issuer_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? parameter = Azure::KeyVault::V2015_06_01::Models::CertificateIssuerUpdateParameters.new unless provider.nil? && credentials.nil? && organization_details.nil? && attributes.nil? parameter.provider = provider parameter.credentials = credentials parameter.organization_details = organization_details parameter.attributes = attributes end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateIssuerUpdateParameters.mapper() request_content = self.serialize(request_mapper, parameter) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'certificates/issuers/{issuer-name}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'issuer-name' => issuer_name}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::IssuerBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Updates the specified certificate issuer.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param issuer_name [String] The name of the issuer. @param provider [String] The issuer provider. @param credentials [IssuerCredentials] The credentials to be used for the issuer. @param organization_details [OrganizationDetails] Details of the organization as provided to the issuer. @param attributes [IssuerAttributes] Attributes of the issuer object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 3304 def update_certificate_issuer_with_http_info(vault_base_url, issuer_name, provider:nil, credentials:nil, organization_details:nil, attributes:nil, custom_headers:nil) update_certificate_issuer_async(vault_base_url, issuer_name, provider:provider, credentials:credentials, organization_details:organization_details, attributes:attributes, custom_headers:custom_headers).value! end
Updates a certificate operation.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param cancellation_requested [Boolean] Indicates if cancellation was requested on the certificate operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificateOperation] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4438 def update_certificate_operation(vault_base_url, certificate_name, cancellation_requested, custom_headers:nil) response = update_certificate_operation_async(vault_base_url, certificate_name, cancellation_requested, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates a certificate operation.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param cancellation_requested [Boolean] Indicates if cancellation was requested on the certificate operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4473 def update_certificate_operation_async(vault_base_url, certificate_name, cancellation_requested, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'cancellation_requested is nil' if cancellation_requested.nil? certificate_operation = CertificateOperationUpdateParameter.new unless cancellation_requested.nil? certificate_operation.cancellation_requested = cancellation_requested end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateOperationUpdateParameter.mapper() request_content = self.serialize(request_mapper, certificate_operation) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'certificates/{certificate-name}/pending' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificateOperation.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Updates a certificate operation.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate @param cancellation_requested [Boolean] Indicates if cancellation was requested on the certificate operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4456 def update_certificate_operation_with_http_info(vault_base_url, certificate_name, cancellation_requested, custom_headers:nil) update_certificate_operation_async(vault_base_url, certificate_name, cancellation_requested, custom_headers:custom_headers).value! end
Updates the policy for a certificate. Set appropriate members in the certificate_policy that must be updated. Leave others as null.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault. @param certificate_policy [CertificatePolicy] The policy for the certificate. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CertificatePolicy] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4086 def update_certificate_policy(vault_base_url, certificate_name, certificate_policy, custom_headers:nil) response = update_certificate_policy_async(vault_base_url, certificate_name, certificate_policy, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates the policy for a certificate. Set appropriate members in the certificate_policy that must be updated. Leave others as null.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault. @param certificate_policy [CertificatePolicy] The policy for the certificate. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4123 def update_certificate_policy_async(vault_base_url, certificate_name, certificate_policy, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, 'certificate_policy is nil' if certificate_policy.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::CertificatePolicy.mapper() request_content = self.serialize(request_mapper, certificate_policy) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'certificates/{certificate-name}/policy' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'certificate-name' => certificate_name}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::CertificatePolicy.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Updates the policy for a certificate. Set appropriate members in the certificate_policy that must be updated. Leave others as null.
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault. @param certificate_policy [CertificatePolicy] The policy for the certificate. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4105 def update_certificate_policy_with_http_info(vault_base_url, certificate_name, certificate_policy, custom_headers:nil) update_certificate_policy_async(vault_base_url, certificate_name, certificate_policy, custom_headers:custom_headers).value! end
Updates the attributes associated with the specified certificate
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param certificate_name [String] The name of the certificate in the given vault @param certificate_version [String] The version of the certificate @param certificate_policy [CertificatePolicy] The management policy for the certificate @param certificate_attributes [CertificateAttributes] The attributes of the certificate (optional) @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 4229 def update_certificate_with_http_info(vault_base_url, certificate_name, certificate_version, certificate_policy:nil, certificate_attributes:nil, tags:nil, custom_headers:nil) update_certificate_async(vault_base_url, certificate_name, certificate_version, certificate_policy:certificate_policy, certificate_attributes:certificate_attributes, tags:tags, custom_headers:custom_headers).value! end
Updates the Key Attributes associated with the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param key_ops [Array<JsonWebKeyOperation>] Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. @param key_attributes [KeyAttributes] @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 496 def update_key(vault_base_url, key_name, key_version, key_ops:nil, key_attributes:nil, tags:nil, custom_headers:nil) response = update_key_async(vault_base_url, key_name, key_version, key_ops:key_ops, key_attributes:key_attributes, tags:tags, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates the Key Attributes associated with the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param key_ops [Array<JsonWebKeyOperation>] Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. @param key_attributes [KeyAttributes] @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 539 def update_key_async(vault_base_url, key_name, key_version, key_ops:nil, key_attributes:nil, tags:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, 'key_version is nil' if key_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? parameters = Azure::KeyVault::V2015_06_01::Models::KeyUpdateParameters.new unless key_ops.nil? && key_attributes.nil? && tags.nil? parameters.key_ops = key_ops parameters.key_attributes = key_attributes parameters.tags = tags end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::KeyUpdateParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keys/{key-name}/{key-version}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name,'key-version' => key_version}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Updates the Key Attributes associated with the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param key_ops [Array<JsonWebKeyOperation>] Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. @param key_attributes [KeyAttributes] @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 518 def update_key_with_http_info(vault_base_url, key_name, key_version, key_ops:nil, key_attributes:nil, tags:nil, custom_headers:nil) update_key_async(vault_base_url, key_name, key_version, key_ops:key_ops, key_attributes:key_attributes, tags:tags, custom_headers:custom_headers).value! end
Updates the attributes associated with the specified secret
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param secret_version [String] The version of the secret @param content_type [String] Type of the secret value such as a password @param secret_attributes [SecretAttributes] The secret management attributes @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [SecretBundle] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2132 def update_secret(vault_base_url, secret_name, secret_version, content_type:nil, secret_attributes:nil, tags:nil, custom_headers:nil) response = update_secret_async(vault_base_url, secret_name, secret_version, content_type:content_type, secret_attributes:secret_attributes, tags:tags, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates the attributes associated with the specified secret
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param secret_version [String] The version of the secret @param content_type [String] Type of the secret value such as a password @param secret_attributes [SecretAttributes] The secret management attributes @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2173 def update_secret_async(vault_base_url, secret_name, secret_version, content_type:nil, secret_attributes:nil, tags:nil, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'secret_name is nil' if secret_name.nil? fail ArgumentError, 'secret_version is nil' if secret_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? parameters = Azure::KeyVault::V2015_06_01::Models::SecretUpdateParameters.new unless content_type.nil? && secret_attributes.nil? && tags.nil? parameters.content_type = content_type parameters.secret_attributes = secret_attributes parameters.tags = tags end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::SecretUpdateParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'secrets/{secret-name}/{secret-version}' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'secret-name' => secret_name,'secret-version' => secret_version}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::SecretBundle.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Updates the attributes associated with the specified secret
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param secret_name [String] The name of the secret in the given vault @param secret_version [String] The version of the secret @param content_type [String] Type of the secret value such as a password @param secret_attributes [SecretAttributes] The secret management attributes @param tags [Hash{String => String}] Application-specific metadata in the form of key-value pairs @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 2153 def update_secret_with_http_info(vault_base_url, secret_name, secret_version, content_type:nil, secret_attributes:nil, tags:nil, custom_headers:nil) update_secret_async(vault_base_url, secret_name, secret_version, content_type:content_type, secret_attributes:secret_attributes, tags:tags, custom_headers:custom_headers).value! end
Verifies a signature using the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeySignatureAlgorithm] The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL' @param digest The digest used for signing @param signature The signature to be verified @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyVerifyResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1520 def verify(vault_base_url, key_name, key_version, algorithm, digest, signature, custom_headers:nil) response = verify_async(vault_base_url, key_name, key_version, algorithm, digest, signature, custom_headers:custom_headers).value! response.body unless response.nil? end
Verifies a signature using the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeySignatureAlgorithm] The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL' @param digest The digest used for signing @param signature The signature to be verified @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1565 def verify_async(vault_base_url, key_name, key_version, algorithm, digest, signature, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, 'key_version is nil' if key_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'algorithm is nil' if algorithm.nil? fail ArgumentError, "'algorithm' should satisfy the constraint - 'MinLength': '1'" if !algorithm.nil? && algorithm.length < 1 fail ArgumentError, 'digest is nil' if digest.nil? fail ArgumentError, 'signature is nil' if signature.nil? parameters = Azure::KeyVault::V2015_06_01::Models::KeyVerifyParameters.new unless algorithm.nil? && digest.nil? && signature.nil? parameters.algorithm = algorithm parameters.digest = digest parameters.signature = signature end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::KeyVerifyParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keys/{key-name}/{key-version}/verify' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name,'key-version' => key_version}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyVerifyResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Verifies a signature using the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeySignatureAlgorithm] The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL' @param digest The digest used for signing @param signature The signature to be verified @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1543 def verify_with_http_info(vault_base_url, key_name, key_version, algorithm, digest, signature, custom_headers:nil) verify_async(vault_base_url, key_name, key_version, algorithm, digest, signature, custom_headers:custom_headers).value! end
Wraps a symmetric key using the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [KeyOperationResult] operation results.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1653 def wrap_key(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) response = wrap_key_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:custom_headers).value! response.body unless response.nil? end
Wraps a symmetric key using the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1692 def wrap_key_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) fail ArgumentError, 'vault_base_url is nil' if vault_base_url.nil? fail ArgumentError, 'key_name is nil' if key_name.nil? fail ArgumentError, 'key_version is nil' if key_version.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'algorithm is nil' if algorithm.nil? fail ArgumentError, "'algorithm' should satisfy the constraint - 'MinLength': '1'" if !algorithm.nil? && algorithm.length < 1 fail ArgumentError, 'value is nil' if value.nil? parameters = Azure::KeyVault::V2015_06_01::Models::KeyOperationsParameters.new unless algorithm.nil? && value.nil? parameters.algorithm = algorithm parameters.value = value end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::KeyVault::V2015_06_01::Models::KeyOperationsParameters.mapper() request_content = self.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keys/{key-name}/{key-version}/wrapkey' request_url = @base_url || self.base_url request_url = request_url.gsub('{vaultBaseUrl}', vault_base_url) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'key-name' => key_name,'key-version' => key_version}, query_params: {'api-version' => api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::KeyVault::V2015_06_01::Models::KeyOperationResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Wraps a symmetric key using the specified key
@param vault_base_url [String] The vault name, e.g. myvault.vault.azure.net @param key_name [String] The name of the key @param key_version [String] The version of the key @param algorithm [JsonWebKeyEncryptionAlgorithm] algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 1673 def wrap_key_with_http_info(vault_base_url, key_name, key_version, algorithm, value, custom_headers:nil) wrap_key_async(vault_base_url, key_name, key_version, algorithm, value, custom_headers:custom_headers).value! end
Private Instance Methods
Adds telemetry information.
# File lib/2015-06-01/generated/azure_key_vault/key_vault_client.rb, line 6181 def add_telemetry sdk_information = 'azure_key_vault' sdk_information = "#{sdk_information}/0.19.1" add_user_agent_information(sdk_information) end