class Azure::Batch::Mgmt::V2017_09_01::CertificateOperations
Attributes
@return [BatchManagementClient] reference to the BatchManagementClient
Public Class Methods
Creates and initializes a new instance of the CertificateOperations
class. @param client service class for accessing basic functionality.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 17 def initialize(client) @client = client end
Public Instance Methods
Creates a new certificate inside the specified account.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param parameters [CertificateCreateOrUpdateParameters] Additional parameters for certificate creation. @param if_match [String] The entity state (ETag) version of the certificate to update. A value of “*” can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. @param if_none_match [String] Set to '*' to allow a new certificate to be created, but to prevent updating an existing certificate. Other values will be ignored. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Certificate] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 672 def begin_create(resource_group_name, account_name, certificate_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil) response = begin_create_async(resource_group_name, account_name, certificate_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value! response.body unless response.nil? end
Creates a new certificate inside the specified account.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param parameters [CertificateCreateOrUpdateParameters] Additional parameters for certificate creation. @param if_match [String] The entity state (ETag) version of the certificate to update. A value of “*” can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. @param if_none_match [String] Set to '*' to allow a new certificate to be created, but to prevent updating an existing certificate. Other values will be ignored. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 727 def begin_create_async(resource_group_name, account_name, certificate_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MaxLength': '45'" if !certificate_name.nil? && certificate_name.length > 45 fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MinLength': '5'" if !certificate_name.nil? && certificate_name.length < 5 fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[\w]+-[\w]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[\w]+-[\w]+$$')).nil? fail ArgumentError, 'parameters is nil' if parameters.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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['If-Match'] = if_match unless if_match.nil? request_headers['If-None-Match'] = if_none_match unless if_none_match.nil? request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::CertificateCreateOrUpdateParameters.mapper() request_content = @client.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'certificateName' => certificate_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.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 MsRestAzure::AzureOperationError.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::Batch::Mgmt::V2017_09_01::Models::Certificate.mapper() result.body = @client.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 inside the specified account.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param parameters [CertificateCreateOrUpdateParameters] Additional parameters for certificate creation. @param if_match [String] The entity state (ETag) version of the certificate to update. A value of “*” can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. @param if_none_match [String] Set to '*' to allow a new certificate to be created, but to prevent updating an existing certificate. Other values will be ignored. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 700 def begin_create_with_http_info(resource_group_name, account_name, certificate_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil) begin_create_async(resource_group_name, account_name, certificate_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value! end
Deletes the specified certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 812 def begin_delete(resource_group_name, account_name, certificate_name, custom_headers:nil) response = begin_delete_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value! nil end
Deletes the specified certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 849 def begin_delete_async(resource_group_name, account_name, certificate_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MaxLength': '45'" if !certificate_name.nil? && certificate_name.length > 45 fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MinLength': '5'" if !certificate_name.nil? && certificate_name.length < 5 fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[\w]+-[\w]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[\w]+-[\w]+$$')).nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'certificateName' => certificate_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.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 || status_code == 204 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.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? result end promise.execute end
Deletes the specified certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 831 def begin_delete_with_http_info(resource_group_name, account_name, certificate_name, custom_headers:nil) begin_delete_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value! end
Cancels a failed deletion of a certificate from the specified account.
If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Certificate] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 534 def cancel_deletion(resource_group_name, account_name, certificate_name, custom_headers:nil) response = cancel_deletion_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Cancels a failed deletion of a certificate from the specified account.
If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 587 def cancel_deletion_async(resource_group_name, account_name, certificate_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MaxLength': '45'" if !certificate_name.nil? && certificate_name.length > 45 fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MinLength': '5'" if !certificate_name.nil? && certificate_name.length < 5 fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[\w]+-[\w]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[\w]+-[\w]+$$')).nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'certificateName' => certificate_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.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 MsRestAzure::AzureOperationError.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::Batch::Mgmt::V2017_09_01::Models::Certificate.mapper() result.body = @client.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
Cancels a failed deletion of a certificate from the specified account.
If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 561 def cancel_deletion_with_http_info(resource_group_name, account_name, certificate_name, custom_headers:nil) cancel_deletion_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value! end
Creates a new certificate inside the specified account.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param parameters [CertificateCreateOrUpdateParameters] Additional parameters for certificate creation. @param if_match [String] The entity state (ETag) version of the certificate to update. A value of “*” can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. @param if_none_match [String] Set to '*' to allow a new certificate to be created, but to prevent updating an existing certificate. Other values will be ignored. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Certificate] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 171 def create(resource_group_name, account_name, certificate_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil) response = create_async(resource_group_name, account_name, certificate_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value! response.body unless response.nil? end
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param parameters [CertificateCreateOrUpdateParameters] Additional parameters for certificate creation. @param if_match [String] The entity state (ETag) version of the certificate to update. A value of “*” can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. @param if_none_match [String] Set to '*' to allow a new certificate to be created, but to prevent updating an existing certificate. Other values will be ignored. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http response.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 198 def create_async(resource_group_name, account_name, certificate_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil) # Send request promise = begin_create_async(resource_group_name, account_name, certificate_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::Certificate.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end
Deletes the specified certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 365 def delete(resource_group_name, account_name, certificate_name, custom_headers:nil) response = delete_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value! nil end
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http response.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 383 def delete_async(resource_group_name, account_name, certificate_name, custom_headers:nil) # Send request promise = begin_delete_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end
Gets information about the specified certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Certificate] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 413 def get(resource_group_name, account_name, certificate_name, custom_headers:nil) response = get_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets information about the specified certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 450 def get_async(resource_group_name, account_name, certificate_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MaxLength': '45'" if !certificate_name.nil? && certificate_name.length > 45 fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MinLength': '5'" if !certificate_name.nil? && certificate_name.length < 5 fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[\w]+-[\w]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[\w]+-[\w]+$$')).nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'certificateName' => certificate_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.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 MsRestAzure::AzureOperationError.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::Batch::Mgmt::V2017_09_01::Models::Certificate.mapper() result.body = @client.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 information about the specified certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 432 def get_with_http_info(resource_group_name, account_name, certificate_name, custom_headers:nil) get_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value! end
Lists all of the certificates in the specified account.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param maxresults [Integer] The maximum number of items to return in the response. @param select [String] Comma separated list of properties that should be returned. e.g. “properties/provisioningState”. Only top level properties under properties/ are valid for selection. @param filter [String] OData filter expression. Valid properties for filtering are “properties/provisioningState”, “properties/provisioningStateTransitionTime”, “name”. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<Certificate>] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 43 def list_by_batch_account(resource_group_name, account_name, maxresults:nil, select:nil, filter:nil, custom_headers:nil) first_page = list_by_batch_account_as_lazy(resource_group_name, account_name, maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers) first_page.get_all_items end
Lists all of the certificates in the specified account.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param maxresults [Integer] The maximum number of items to return in the response. @param select [String] Comma separated list of properties that should be returned. e.g. “properties/provisioningState”. Only top level properties under properties/ are valid for selection. @param filter [String] OData filter expression. Valid properties for filtering are “properties/provisioningState”, “properties/provisioningStateTransitionTime”, “name”. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ListCertificatesResult] which provide lazy access to pages of the response.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 1011 def list_by_batch_account_as_lazy(resource_group_name, account_name, maxresults:nil, select:nil, filter:nil, custom_headers:nil) response = list_by_batch_account_async(resource_group_name, account_name, maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_page_link| list_by_batch_account_next_async(next_page_link, custom_headers:custom_headers) end page end end
Lists all of the certificates in the specified account.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param maxresults [Integer] The maximum number of items to return in the response. @param select [String] Comma separated list of properties that should be returned. e.g. “properties/provisioningState”. Only top level properties under properties/ are valid for selection. @param filter [String] OData filter expression. Valid properties for filtering are “properties/provisioningState”, “properties/provisioningStateTransitionTime”, “name”. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 90 def list_by_batch_account_async(resource_group_name, account_name, maxresults:nil, select:nil, filter:nil, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id}, query_params: {'maxresults' => maxresults,'$select' => select,'$filter' => filter,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.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 MsRestAzure::AzureOperationError.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::Batch::Mgmt::V2017_09_01::Models::ListCertificatesResult.mapper() result.body = @client.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
Lists all of the certificates in the specified account.
@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 [ListCertificatesResult] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 911 def list_by_batch_account_next(next_page_link, custom_headers:nil) response = list_by_batch_account_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
Lists all of the certificates in the specified account.
@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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 940 def list_by_batch_account_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'] = @client.accept_language unless @client.accept_language.nil? path_template = '{nextLink}' request_url = @base_url || @client.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 = @client.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 MsRestAzure::AzureOperationError.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::Batch::Mgmt::V2017_09_01::Models::ListCertificatesResult.mapper() result.body = @client.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
Lists all of the certificates in the specified account.
@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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 926 def list_by_batch_account_next_with_http_info(next_page_link, custom_headers:nil) list_by_batch_account_next_async(next_page_link, custom_headers:custom_headers).value! end
Lists all of the certificates in the specified account.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param maxresults [Integer] The maximum number of items to return in the response. @param select [String] Comma separated list of properties that should be returned. e.g. “properties/provisioningState”. Only top level properties under properties/ are valid for selection. @param filter [String] OData filter expression. Valid properties for filtering are “properties/provisioningState”, “properties/provisioningStateTransitionTime”, “name”. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 67 def list_by_batch_account_with_http_info(resource_group_name, account_name, maxresults:nil, select:nil, filter:nil, custom_headers:nil) list_by_batch_account_async(resource_group_name, account_name, maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers).value! end
Updates the properties of an existing certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param parameters [CertificateCreateOrUpdateParameters] Certificate entity to update. @param if_match [String] The entity state (ETag) version of the certificate to update. This value can be omitted or set to “*” to apply the operation unconditionally. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Certificate] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 235 def update(resource_group_name, account_name, certificate_name, parameters, if_match:nil, custom_headers:nil) response = update_async(resource_group_name, account_name, certificate_name, parameters, if_match:if_match, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates the properties of an existing certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param parameters [CertificateCreateOrUpdateParameters] Certificate entity to update. @param if_match [String] The entity state (ETag) version of the certificate to update. This value can be omitted or set to “*” to apply the operation unconditionally. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 282 def update_async(resource_group_name, account_name, certificate_name, parameters, if_match:nil, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil? fail ArgumentError, 'certificate_name is nil' if certificate_name.nil? fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MaxLength': '45'" if !certificate_name.nil? && certificate_name.length > 45 fail ArgumentError, "'certificate_name' should satisfy the constraint - 'MinLength': '5'" if !certificate_name.nil? && certificate_name.length < 5 fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[\w]+-[\w]+$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[\w]+-[\w]+$$')).nil? fail ArgumentError, 'parameters is nil' if parameters.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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['If-Match'] = if_match unless if_match.nil? request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::CertificateCreateOrUpdateParameters.mapper() request_content = @client.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'certificateName' => certificate_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.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 MsRestAzure::AzureOperationError.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::Batch::Mgmt::V2017_09_01::Models::Certificate.mapper() result.body = @client.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 properties of an existing certificate.
@param resource_group_name [String] The name of the resource group that contains the Batch
account. @param account_name [String] The name of the Batch
account. @param certificate_name [String] The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. @param parameters [CertificateCreateOrUpdateParameters] Certificate entity to update. @param if_match [String] The entity state (ETag) version of the certificate to update. This value can be omitted or set to “*” to apply the operation unconditionally. @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/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb, line 259 def update_with_http_info(resource_group_name, account_name, certificate_name, parameters, if_match:nil, custom_headers:nil) update_async(resource_group_name, account_name, certificate_name, parameters, if_match:if_match, custom_headers:custom_headers).value! end