class Azure::DataBox::Mgmt::V2018_01_01::Jobs

Jobs

Attributes

client[R]

@return [DataBoxManagementClient] reference to the DataBoxManagementClient

Private Class Methods

new(client) click to toggle source

Creates and initializes a new instance of the Jobs class. @param client service class for accessing basic functionality.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 17
def initialize(client)
  @client = client
end

Private Instance Methods

begin_create(resource_group_name, job_name, job_resource, custom_headers:nil) click to toggle source

Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param job_resource [JobResource] Job details from request body. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResource] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 803
def begin_create(resource_group_name, job_name, job_resource, custom_headers:nil)
  response = begin_create_async(resource_group_name, job_name, job_resource, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_create_async(resource_group_name, job_name, job_resource, custom_headers:nil) click to toggle source

Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param job_resource [JobResource] Job details from request body. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 840
def begin_create_async(resource_group_name, job_name, job_resource, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
  fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'job_resource is nil' if job_resource.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?

  # Serialize Request
  request_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.mapper()
  request_content = @client.serialize(request_mapper,  job_resource)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
      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 || 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.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
begin_create_with_http_info(resource_group_name, job_name, job_resource, custom_headers:nil) click to toggle source

Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param job_resource [JobResource] Job details from request body. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 822
def begin_create_with_http_info(resource_group_name, job_name, job_resource, custom_headers:nil)
  begin_create_async(resource_group_name, job_name, job_resource, custom_headers:custom_headers).value!
end
begin_delete(resource_group_name, job_name, custom_headers:nil) click to toggle source

Deletes a job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 917
def begin_delete(resource_group_name, job_name, custom_headers:nil)
  response = begin_delete_async(resource_group_name, job_name, custom_headers:custom_headers).value!
  nil
end
begin_delete_async(resource_group_name, job_name, custom_headers:nil) click to toggle source

Deletes a job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 950
def begin_delete_async(resource_group_name, job_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
  fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
      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 == 202 || status_code == 204
      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
begin_delete_with_http_info(resource_group_name, job_name, custom_headers:nil) click to toggle source

Deletes a job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 934
def begin_delete_with_http_info(resource_group_name, job_name, custom_headers:nil)
  begin_delete_async(resource_group_name, job_name, custom_headers:custom_headers).value!
end
begin_update(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil) click to toggle source

Updates the properties of an existing job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param job_resource_update_parameter [JobResourceUpdateParameter] Job update parameters from request body. @param if_match [String] Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResource] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1014
def begin_update(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil)
  response = begin_update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:if_match, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil) click to toggle source

Updates the properties of an existing job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param job_resource_update_parameter [JobResourceUpdateParameter] Job update parameters from request body. @param if_match [String] Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1055
def begin_update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
  fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'job_resource_update_parameter is nil' if job_resource_update_parameter.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::DataBox::Mgmt::V2018_01_01::Models::JobResourceUpdateParameter.mapper()
  request_content = @client.serialize(request_mapper,  job_resource_update_parameter)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
      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 || 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.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
begin_update_with_http_info(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil) click to toggle source

Updates the properties of an existing job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param job_resource_update_parameter [JobResourceUpdateParameter] Job update parameters from request body. @param if_match [String] Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1035
def begin_update_with_http_info(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil)
  begin_update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:if_match, custom_headers:custom_headers).value!
end
book_shipment_pick_up(resource_group_name, job_name, shipment_pick_up_request, custom_headers:nil) click to toggle source

Book shipment pick up.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param shipment_pick_up_request [ShipmentPickUpRequest] Details of shipment pick up request. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ShipmentPickUpResponse] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 480
def book_shipment_pick_up(resource_group_name, job_name, shipment_pick_up_request, custom_headers:nil)
  response = book_shipment_pick_up_async(resource_group_name, job_name, shipment_pick_up_request, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
book_shipment_pick_up_async(resource_group_name, job_name, shipment_pick_up_request, custom_headers:nil) click to toggle source

Book shipment pick up.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param shipment_pick_up_request [ShipmentPickUpRequest] Details of shipment pick up request. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 517
def book_shipment_pick_up_async(resource_group_name, job_name, shipment_pick_up_request, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
  fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'shipment_pick_up_request is nil' if shipment_pick_up_request.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?

  # Serialize Request
  request_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::ShipmentPickUpRequest.mapper()
  request_content = @client.serialize(request_mapper,  shipment_pick_up_request)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
      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(: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::DataBox::Mgmt::V2018_01_01::Models::ShipmentPickUpResponse.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
book_shipment_pick_up_with_http_info(resource_group_name, job_name, shipment_pick_up_request, custom_headers:nil) click to toggle source

Book shipment pick up.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param shipment_pick_up_request [ShipmentPickUpRequest] Details of shipment pick up request. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 499
def book_shipment_pick_up_with_http_info(resource_group_name, job_name, shipment_pick_up_request, custom_headers:nil)
  book_shipment_pick_up_async(resource_group_name, job_name, shipment_pick_up_request, custom_headers:custom_headers).value!
end
cancel(resource_group_name, job_name, cancellation_reason, custom_headers:nil) click to toggle source

CancelJob.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param cancellation_reason [CancellationReason] Reason for cancellation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 595
def cancel(resource_group_name, job_name, cancellation_reason, custom_headers:nil)
  response = cancel_async(resource_group_name, job_name, cancellation_reason, custom_headers:custom_headers).value!
  nil
end
cancel_async(resource_group_name, job_name, cancellation_reason, custom_headers:nil) click to toggle source

CancelJob.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param cancellation_reason [CancellationReason] Reason for cancellation. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 630
def cancel_async(resource_group_name, job_name, cancellation_reason, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
  fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'cancellation_reason is nil' if cancellation_reason.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?

  # Serialize Request
  request_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::CancellationReason.mapper()
  request_content = @client.serialize(request_mapper,  cancellation_reason)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
      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(: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 == 204
      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
cancel_with_http_info(resource_group_name, job_name, cancellation_reason, custom_headers:nil) click to toggle source

CancelJob.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param cancellation_reason [CancellationReason] Reason for cancellation. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 613
def cancel_with_http_info(resource_group_name, job_name, cancellation_reason, custom_headers:nil)
  cancel_async(resource_group_name, job_name, cancellation_reason, custom_headers:custom_headers).value!
end
create(resource_group_name, job_name, job_resource, custom_headers:nil) click to toggle source

Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param job_resource [JobResource] Job details from request body. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResource] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 335
def create(resource_group_name, job_name, job_resource, custom_headers:nil)
  response = create_async(resource_group_name, job_name, job_resource, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_async(resource_group_name, job_name, job_resource, custom_headers:nil) click to toggle source

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param job_resource [JobResource] Job details from request body. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 352
def create_async(resource_group_name, job_name, job_resource, custom_headers:nil)
  # Send request
  promise = begin_create_async(resource_group_name, job_name, job_resource, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.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
delete(resource_group_name, job_name, custom_headers:nil) click to toggle source

Deletes a job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 380
def delete(resource_group_name, job_name, custom_headers:nil)
  response = delete_async(resource_group_name, job_name, custom_headers:custom_headers).value!
  nil
end
delete_async(resource_group_name, job_name, custom_headers:nil) click to toggle source

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 396
def delete_async(resource_group_name, job_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, job_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
get(resource_group_name, job_name, expand:nil, custom_headers:nil) click to toggle source

Gets information about the specified job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param expand [String] $expand is supported on details parameter for job, which provides details on the job stages. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResource] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 226
def get(resource_group_name, job_name, expand:nil, custom_headers:nil)
  response = get_async(resource_group_name, job_name, expand:expand, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_async(resource_group_name, job_name, expand:nil, custom_headers:nil) click to toggle source

Gets information about the specified job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param expand [String] $expand is supported on details parameter for job, which provides details on the job stages. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 263
def get_async(resource_group_name, job_name, expand:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
  fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
      query_params: {'api-version' => @client.api_version,'$expand' => expand},
      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::DataBox::Mgmt::V2018_01_01::Models::JobResource.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
get_with_http_info(resource_group_name, job_name, expand:nil, custom_headers:nil) click to toggle source

Gets information about the specified job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param expand [String] $expand is supported on details parameter for job, which provides details on the job stages. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 245
def get_with_http_info(resource_group_name, job_name, expand:nil, custom_headers:nil)
  get_async(resource_group_name, job_name, expand:expand, custom_headers:custom_headers).value!
end
list(skip_token:nil, custom_headers:nil) click to toggle source

Lists all the jobs available under the subscription.

@param skip_token [String] $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<JobResource>] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 34
def list(skip_token:nil, custom_headers:nil)
  first_page = list_as_lazy(skip_token:skip_token, custom_headers:custom_headers)
  first_page.get_all_items
end
list_as_lazy(skip_token:nil, custom_headers:nil) click to toggle source

Lists all the jobs available under the subscription.

@param skip_token [String] $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResourceList] which provide lazy access to pages of the response.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1312
def list_as_lazy(skip_token:nil, custom_headers:nil)
  response = list_async(skip_token:skip_token, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_async(skip_token:nil, custom_headers:nil) click to toggle source

Lists all the jobs available under the subscription.

@param skip_token [String] $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 63
def list_async(skip_token:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version,'$skipToken' => skip_token},
      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::DataBox::Mgmt::V2018_01_01::Models::JobResourceList.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
list_by_resource_group(resource_group_name, skip_token:nil, custom_headers:nil) click to toggle source

Lists all the jobs available under the given resource group.

@param resource_group_name [String] The Resource Group Name @param skip_token [String] $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<JobResource>] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 127
def list_by_resource_group(resource_group_name, skip_token:nil, custom_headers:nil)
  first_page = list_by_resource_group_as_lazy(resource_group_name, skip_token:skip_token, custom_headers:custom_headers)
  first_page.get_all_items
end
list_by_resource_group_as_lazy(resource_group_name, skip_token:nil, custom_headers:nil) click to toggle source

Lists all the jobs available under the given resource group.

@param resource_group_name [String] The Resource Group Name @param skip_token [String] $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResourceList] which provide lazy access to pages of the response.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1334
def list_by_resource_group_as_lazy(resource_group_name, skip_token:nil, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, skip_token:skip_token, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_by_resource_group_async(resource_group_name, skip_token:nil, custom_headers:nil) click to toggle source

Lists all the jobs available under the given resource group.

@param resource_group_name [String] The Resource Group Name @param skip_token [String] $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 158
def list_by_resource_group_async(resource_group_name, skip_token:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
      query_params: {'api-version' => @client.api_version,'$skipToken' => skip_token},
      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::DataBox::Mgmt::V2018_01_01::Models::JobResourceList.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
list_by_resource_group_next(next_page_link, custom_headers:nil) click to toggle source

Lists all the jobs available under the given resource group.

@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 [JobResourceList] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1222
def list_by_resource_group_next(next_page_link, custom_headers:nil)
  response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_by_resource_group_next_async(next_page_link, custom_headers:nil) click to toggle source

Lists all the jobs available under the given resource group.

@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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1251
def list_by_resource_group_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::DataBox::Mgmt::V2018_01_01::Models::JobResourceList.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
list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Lists all the jobs available under the given resource group.

@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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1237
def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_by_resource_group_with_http_info(resource_group_name, skip_token:nil, custom_headers:nil) click to toggle source

Lists all the jobs available under the given resource group.

@param resource_group_name [String] The Resource Group Name @param skip_token [String] $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 143
def list_by_resource_group_with_http_info(resource_group_name, skip_token:nil, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, skip_token:skip_token, custom_headers:custom_headers).value!
end
list_credentials(resource_group_name, job_name, custom_headers:nil) click to toggle source

This method gets the unencrypted secrets related to the job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [UnencryptedCredentialsList] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 698
def list_credentials(resource_group_name, job_name, custom_headers:nil)
  response = list_credentials_async(resource_group_name, job_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_credentials_async(resource_group_name, job_name, custom_headers:nil) click to toggle source

This method gets the unencrypted secrets related to the job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 731
def list_credentials_async(resource_group_name, job_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
  fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
  fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
      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::DataBox::Mgmt::V2018_01_01::Models::UnencryptedCredentialsList.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
list_credentials_with_http_info(resource_group_name, job_name, custom_headers:nil) click to toggle source

This method gets the unencrypted secrets related to the job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 715
def list_credentials_with_http_info(resource_group_name, job_name, custom_headers:nil)
  list_credentials_async(resource_group_name, job_name, custom_headers:custom_headers).value!
end
list_next(next_page_link, custom_headers:nil) click to toggle source

Lists all the jobs available under the subscription.

@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 [JobResourceList] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1132
def list_next(next_page_link, custom_headers:nil)
  response = list_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_next_async(next_page_link, custom_headers:nil) click to toggle source

Lists all the jobs available under the subscription.

@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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1161
def list_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::DataBox::Mgmt::V2018_01_01::Models::JobResourceList.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
list_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Lists all the jobs available under the subscription.

@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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 1147
def list_next_with_http_info(next_page_link, custom_headers:nil)
  list_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_with_http_info(skip_token:nil, custom_headers:nil) click to toggle source

Lists all the jobs available under the subscription.

@param skip_token [String] $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 49
def list_with_http_info(skip_token:nil, custom_headers:nil)
  list_async(skip_token:skip_token, custom_headers:custom_headers).value!
end
update(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil) click to toggle source

Updates the properties of an existing job.

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param job_resource_update_parameter [JobResourceUpdateParameter] Job update parameters from request body. @param if_match [String] Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResource] operation results.

# File lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 428
def update(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil)
  response = update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:if_match, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil) click to toggle source

@param resource_group_name [String] The Resource Group Name @param job_name [String] The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only @param job_resource_update_parameter [JobResourceUpdateParameter] Job update parameters from request body. @param if_match [String] Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. @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/2018-01-01/generated/azure_mgmt_databox/jobs.rb, line 448
def update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil)
  # Send request
  promise = begin_update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:if_match, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.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