class Azure::Batch::Mgmt::V2017_09_01::PoolOperations
Attributes
@return [BatchManagementClient] reference to the BatchManagementClient
Public Class Methods
Creates and initializes a new instance of the PoolOperations
class. @param client service class for accessing basic functionality.
# File lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb, line 17 def initialize(client) @client = client end
Public Instance Methods
Creates a new pool 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 pool_name [String] The pool name. This must be unique within the account. @param parameters [Pool] Additional parameters for pool creation. @param if_match [String] The entity state (ETag) version of the pool to update. A value of “*” can be used to apply the operation only if the pool already exists. If omitted, this operation will always be applied. @param if_none_match [String] Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. 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 [Pool] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb, line 798 def begin_create(resource_group_name, account_name, pool_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil) response = begin_create_async(resource_group_name, account_name, pool_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 pool 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 pool_name [String] The pool name. This must be unique within the account. @param parameters [Pool] Additional parameters for pool creation. @param if_match [String] The entity state (ETag) version of the pool to update. A value of “*” can be used to apply the operation only if the pool already exists. If omitted, this operation will always be applied. @param if_none_match [String] Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. 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/pool_operations.rb, line 845 def begin_create_async(resource_group_name, account_name, pool_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, 'pool_name is nil' if pool_name.nil? fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64 fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1 fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).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::Pool.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}/pools/{poolName}' 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,'poolName' => pool_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::Pool.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 pool 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 pool_name [String] The pool name. This must be unique within the account. @param parameters [Pool] Additional parameters for pool creation. @param if_match [String] The entity state (ETag) version of the pool to update. A value of “*” can be used to apply the operation only if the pool already exists. If omitted, this operation will always be applied. @param if_none_match [String] Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. 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/pool_operations.rb, line 822 def begin_create_with_http_info(resource_group_name, account_name, pool_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil) begin_create_async(resource_group_name, account_name, pool_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value! end
Deletes the specified pool.
@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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 929 def begin_delete(resource_group_name, account_name, pool_name, custom_headers:nil) response = begin_delete_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value! nil end
Deletes the specified pool.
@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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 964 def begin_delete_async(resource_group_name, account_name, pool_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, 'pool_name is nil' if pool_name.nil? fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64 fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1 fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).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}/pools/{poolName}' 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,'poolName' => pool_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 pool.
@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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 947 def begin_delete_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil) begin_delete_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value! end
Creates a new pool 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 pool_name [String] The pool name. This must be unique within the account. @param parameters [Pool] Additional parameters for pool creation. @param if_match [String] The entity state (ETag) version of the pool to update. A value of “*” can be used to apply the operation only if the pool already exists. If omitted, this operation will always be applied. @param if_none_match [String] Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. 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 [Pool] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb, line 200 def create(resource_group_name, account_name, pool_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil) response = create_async(resource_group_name, account_name, pool_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 pool_name [String] The pool name. This must be unique within the account. @param parameters [Pool] Additional parameters for pool creation. @param if_match [String] The entity state (ETag) version of the pool to update. A value of “*” can be used to apply the operation only if the pool already exists. If omitted, this operation will always be applied. @param if_none_match [String] Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. 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/pool_operations.rb, line 223 def create_async(resource_group_name, account_name, pool_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil) # Send request promise = begin_create_async(resource_group_name, account_name, pool_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::Pool.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 pool.
@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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 389 def delete(resource_group_name, account_name, pool_name, custom_headers:nil) response = delete_async(resource_group_name, account_name, pool_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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 406 def delete_async(resource_group_name, account_name, pool_name, custom_headers:nil) # Send request promise = begin_delete_async(resource_group_name, account_name, pool_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
Disables automatic scaling for a pool.
@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 pool_name [String] The pool name. This must be unique within the account. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Pool] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb, line 545 def disable_auto_scale(resource_group_name, account_name, pool_name, custom_headers:nil) response = disable_auto_scale_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Disables automatic scaling for a pool.
@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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 580 def disable_auto_scale_async(resource_group_name, account_name, pool_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, 'pool_name is nil' if pool_name.nil? fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64 fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1 fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).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}/pools/{poolName}/disableAutoScale' 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,'poolName' => pool_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::Pool.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
Disables automatic scaling for a pool.
@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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 563 def disable_auto_scale_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil) disable_auto_scale_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value! end
Gets information about the specified pool.
@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 pool_name [String] The pool name. This must be unique within the account. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Pool] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb, line 435 def get(resource_group_name, account_name, pool_name, custom_headers:nil) response = get_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets information about the specified pool.
@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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 470 def get_async(resource_group_name, account_name, pool_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, 'pool_name is nil' if pool_name.nil? fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64 fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1 fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).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}/pools/{poolName}' 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,'poolName' => pool_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::Pool.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 pool.
@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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 453 def get_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil) get_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value! end
Lists all of the pools 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:
name properties/allocationState properties/allocationStateTransitionTime properties/creationTime properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale properties/scaleSettings/fixedScale @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<Pool>] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb, line 54 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 pools 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:
name properties/allocationState properties/allocationStateTransitionTime properties/creationTime properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale properties/scaleSettings/fixedScale @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ListPoolsResult] which provide lazy access to pages of the response.
# File lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb, line 1136 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 pools 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:
name properties/allocationState properties/allocationStateTransitionTime properties/creationTime properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale properties/scaleSettings/fixedScale @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/pool_operations.rb, line 123 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}/pools' 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::ListPoolsResult.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 pools 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 [ListPoolsResult] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb, line 1026 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 pools 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/pool_operations.rb, line 1055 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::ListPoolsResult.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 pools 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/pool_operations.rb, line 1041 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 pools 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:
name properties/allocationState properties/allocationStateTransitionTime properties/creationTime properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale properties/scaleSettings/fixedScale @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/pool_operations.rb, line 89 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
Stops an ongoing resize operation on the pool.
This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created.
@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 pool_name [String] The pool name. This must be unique within the account. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Pool] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb, line 664 def stop_resize(resource_group_name, account_name, pool_name, custom_headers:nil) response = stop_resize_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Stops an ongoing resize operation on the pool.
This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created.
@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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 717 def stop_resize_async(resource_group_name, account_name, pool_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, 'pool_name is nil' if pool_name.nil? fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64 fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1 fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).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}/pools/{poolName}/stopResize' 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,'poolName' => pool_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::Pool.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
Stops an ongoing resize operation on the pool.
This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created.
@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 pool_name [String] The pool name. This must be unique within the account. @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/pool_operations.rb, line 691 def stop_resize_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil) stop_resize_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value! end
Updates the properties of an existing pool.
@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 pool_name [String] The pool name. This must be unique within the account. @param parameters [Pool] Pool properties that should be updated. Properties that are supplied will be updated, any property not supplied will be unchanged. @param if_match [String] The entity state (ETag) version of the pool 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 [Pool] operation results.
# File lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb, line 260 def update(resource_group_name, account_name, pool_name, parameters, if_match:nil, custom_headers:nil) response = update_async(resource_group_name, account_name, pool_name, parameters, if_match:if_match, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates the properties of an existing pool.
@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 pool_name [String] The pool name. This must be unique within the account. @param parameters [Pool] Pool properties that should be updated. Properties that are supplied will be updated, any property not supplied will be unchanged. @param if_match [String] The entity state (ETag) version of the pool 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/pool_operations.rb, line 307 def update_async(resource_group_name, account_name, pool_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, 'pool_name is nil' if pool_name.nil? fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64 fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1 fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).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::Pool.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}/pools/{poolName}' 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,'poolName' => pool_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::Pool.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 pool.
@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 pool_name [String] The pool name. This must be unique within the account. @param parameters [Pool] Pool properties that should be updated. Properties that are supplied will be updated, any property not supplied will be unchanged. @param if_match [String] The entity state (ETag) version of the pool 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/pool_operations.rb, line 284 def update_with_http_info(resource_group_name, account_name, pool_name, parameters, if_match:nil, custom_headers:nil) update_async(resource_group_name, account_name, pool_name, parameters, if_match:if_match, custom_headers:custom_headers).value! end