Class: Azure::DataBox::Mgmt::V2018_01_01::Jobs

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb

Overview

Jobs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Jobs

Creates and initializes a new instance of the Jobs class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientDataBoxManagementClient (readonly)

Returns reference to the DataBoxManagementClient.

Returns:



22
23
24
# File 'lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create(resource_group_name, job_name, job_resource, custom_headers: nil) ⇒ JobResource

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.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • job_resource (JobResource)

    Job details from request body.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (JobResource)

    operation results.



803
804
805
806
# 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) ⇒ Concurrent::Promise

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.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • job_resource (JobResource)

    Job details from request body.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
# 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) ⇒ MsRestAzure::AzureOperationResponse

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.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • job_resource (JobResource)

    Job details from request body.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



822
823
824
# 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) ⇒ Object

Deletes a job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



917
918
919
920
# 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) ⇒ Concurrent::Promise

Deletes a job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
# 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) ⇒ MsRestAzure::AzureOperationResponse

Deletes a job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



934
935
936
# 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) ⇒ JobResource

Updates the properties of an existing job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only parameters from request body. performed only if the ETag of the job on the server matches this value. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • job_resource_update_parameter (JobResourceUpdateParameter)

    Job update

  • if_match (String) (defaults to: nil)

    Defines the If-Match condition. The patch will be

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (JobResource)

    operation results.



1014
1015
1016
1017
# 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) ⇒ Concurrent::Promise

Updates the properties of an existing job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only parameters from request body. performed only if the ETag of the job on the server matches this value. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • job_resource_update_parameter (JobResourceUpdateParameter)

    Job update

  • if_match (String) (defaults to: nil)

    Defines the If-Match condition. The patch will be

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
# 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) ⇒ MsRestAzure::AzureOperationResponse

Updates the properties of an existing job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only parameters from request body. performed only if the ETag of the job on the server matches this value. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • job_resource_update_parameter (JobResourceUpdateParameter)

    Job update

  • if_match (String) (defaults to: nil)

    Defines the If-Match condition. The patch will be

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1035
1036
1037
# 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) ⇒ ShipmentPickUpResponse

Book shipment pick up.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only pick up request. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • shipment_pick_up_request (ShipmentPickUpRequest)

    Details of shipment

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ShipmentPickUpResponse)

    operation results.



480
481
482
483
# 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) ⇒ Concurrent::Promise

Book shipment pick up.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only pick up request. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • shipment_pick_up_request (ShipmentPickUpRequest)

    Details of shipment

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# 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) ⇒ MsRestAzure::AzureOperationResponse

Book shipment pick up.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only pick up request. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • shipment_pick_up_request (ShipmentPickUpRequest)

    Details of shipment

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



499
500
501
# 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) ⇒ Object

CancelJob.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • cancellation_reason (CancellationReason)

    Reason for cancellation.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



595
596
597
598
# 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) ⇒ Concurrent::Promise

CancelJob.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • cancellation_reason (CancellationReason)

    Reason for cancellation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
# 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) ⇒ MsRestAzure::AzureOperationResponse

CancelJob.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • cancellation_reason (CancellationReason)

    Reason for cancellation.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



613
614
615
# 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) ⇒ JobResource

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.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • job_resource (JobResource)

    Job details from request body.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (JobResource)

    operation results.



335
336
337
338
# 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) ⇒ Concurrent::Promise

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • job_resource (JobResource)

    Job details from request body.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# 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) ⇒ Object

Deletes a job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



380
381
382
383
# 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) ⇒ Concurrent::Promise

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# 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) ⇒ JobResource

Gets information about the specified job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only which provides details on the job stages. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • expand (String) (defaults to: nil)

    $expand is supported on details parameter for job,

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (JobResource)

    operation results.



226
227
228
229
# 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) ⇒ Concurrent::Promise

Gets information about the specified job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only which provides details on the job stages. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • expand (String) (defaults to: nil)

    $expand is supported on details parameter for job,

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# 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) ⇒ MsRestAzure::AzureOperationResponse

Gets information about the specified job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only which provides details on the job stages. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • expand (String) (defaults to: nil)

    $expand is supported on details parameter for job,

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



245
246
247
# 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) ⇒ Array<JobResource>

Lists all the jobs available under the subscription.

provides the next page in the list of jobs. will be added to the HTTP request.

Parameters:

  • skip_token (String) (defaults to: nil)

    $skipToken is supported on Get list of jobs, which

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<JobResource>)

    operation results.



34
35
36
37
# 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) ⇒ JobResourceList

Lists all the jobs available under the subscription.

provides the next page in the list of jobs. will be added to the HTTP request.

Parameters:

  • skip_token (String) (defaults to: nil)

    $skipToken is supported on Get list of jobs, which

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (JobResourceList)

    which provide lazy access to pages of the response.



1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
# 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) ⇒ Concurrent::Promise

Lists all the jobs available under the subscription.

provides the next page in the list of jobs. to the HTTP request.

Parameters:

  • skip_token (String) (defaults to: nil)

    $skipToken is supported on Get list of jobs, which

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# 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) ⇒ Array<JobResource>

Lists all the jobs available under the given resource group.

provides the next page in the list of jobs. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • skip_token (String) (defaults to: nil)

    $skipToken is supported on Get list of jobs, which

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<JobResource>)

    operation results.



127
128
129
130
# 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) ⇒ JobResourceList

Lists all the jobs available under the given resource group.

provides the next page in the list of jobs. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • skip_token (String) (defaults to: nil)

    $skipToken is supported on Get list of jobs, which

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (JobResourceList)

    which provide lazy access to pages of the response.



1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
# 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) ⇒ Concurrent::Promise

Lists all the jobs available under the given resource group.

provides the next page in the list of jobs. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • skip_token (String) (defaults to: nil)

    $skipToken is supported on Get list of jobs, which

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# 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) ⇒ JobResourceList

Lists all the jobs available under the given resource group.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (JobResourceList)

    operation results.



1222
1223
1224
1225
# 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) ⇒ Concurrent::Promise

Lists all the jobs available under the given resource group.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
# 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) ⇒ MsRestAzure::AzureOperationResponse

Lists all the jobs available under the given resource group.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1237
1238
1239
# 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) ⇒ MsRestAzure::AzureOperationResponse

Lists all the jobs available under the given resource group.

provides the next page in the list of jobs. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • skip_token (String) (defaults to: nil)

    $skipToken is supported on Get list of jobs, which

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



143
144
145
# 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) ⇒ UnencryptedCredentialsList

This method gets the unencrypted secrets related to the job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (UnencryptedCredentialsList)

    operation results.



698
699
700
701
# 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) ⇒ Concurrent::Promise

This method gets the unencrypted secrets related to the job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
# 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) ⇒ MsRestAzure::AzureOperationResponse

This method gets the unencrypted secrets related to the job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



715
716
717
# 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) ⇒ JobResourceList

Lists all the jobs available under the subscription.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (JobResourceList)

    operation results.



1132
1133
1134
1135
# 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) ⇒ Concurrent::Promise

Lists all the jobs available under the subscription.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
# 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) ⇒ MsRestAzure::AzureOperationResponse

Lists all the jobs available under the subscription.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1147
1148
1149
# 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) ⇒ MsRestAzure::AzureOperationResponse

Lists all the jobs available under the subscription.

provides the next page in the list of jobs. will be added to the HTTP request.

Parameters:

  • skip_token (String) (defaults to: nil)

    $skipToken is supported on Get list of jobs, which

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



49
50
51
# 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) ⇒ JobResource

Updates the properties of an existing job.

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only parameters from request body. performed only if the ETag of the job on the server matches this value. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • job_resource_update_parameter (JobResourceUpdateParameter)

    Job update

  • if_match (String) (defaults to: nil)

    Defines the If-Match condition. The patch will be

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (JobResource)

    operation results.



428
429
430
431
# 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) ⇒ Concurrent::Promise

resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only parameters from request body. performed only if the ETag of the job on the server matches this value. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The Resource Group Name

  • job_name (String)

    The name of the job Resource within the specified

  • job_resource_update_parameter (JobResourceUpdateParameter)

    Job update

  • if_match (String) (defaults to: nil)

    Defines the If-Match condition. The patch will be

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# 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