Class: Azure::ARM::Scheduler::Jobs

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/generated/azure_mgmt_scheduler/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.



18
19
20
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSchedulerManagementClient (readonly)

Returns reference to the SchedulerManagementClient.

Returns:



23
24
25
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 23

def client
  @client
end

Instance Method Details

#create_or_update(resource_group_name, job_collection_name, job_name, job, custom_headers = nil) ⇒ JobDefinition

Provisions a new job or updates an existing job.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • job (JobDefinition)

    The job definition.

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

    A hash of custom headers that

Returns:



135
136
137
138
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 135

def create_or_update(resource_group_name, job_collection_name, job_name, job, custom_headers = nil)
  response = create_or_update_async(resource_group_name, job_collection_name, job_name, job, custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, job_collection_name, job_name, job, custom_headers = nil) ⇒ Concurrent::Promise

Provisions a new job or updates an existing job.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • job (JobDefinition)

    The job definition.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 168

def create_or_update_async(resource_group_name, job_collection_name, job_name, job, 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_collection_name is nil' if job_collection_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'job is nil' if job.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

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

  # Serialize Request
  request_mapper = JobDefinition.mapper()
  request_content = @client.serialize(request_mapper,  job, 'job')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 201
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobDefinition.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobDefinition.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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

#create_or_update_with_http_info(resource_group_name, job_collection_name, job_name, job, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Provisions a new job or updates an existing job.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • job (JobDefinition)

    The job definition.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



152
153
154
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 152

def create_or_update_with_http_info(resource_group_name, job_collection_name, job_name, job, custom_headers = nil)
  create_or_update_async(resource_group_name, job_collection_name, job_name, job, custom_headers).value!
end

#delete(resource_group_name, job_collection_name, job_name, custom_headers = nil) ⇒ Object

Deletes a job.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

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

    A hash of custom headers that



365
366
367
368
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 365

def delete(resource_group_name, job_collection_name, job_name, custom_headers = nil)
  response = delete_async(resource_group_name, job_collection_name, job_name, custom_headers).value!
  nil
end

#delete_async(resource_group_name, job_collection_name, job_name, custom_headers = nil) ⇒ Concurrent::Promise

Deletes a job.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 396

def delete_async(resource_group_name, job_collection_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_collection_name is nil' if job_collection_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # 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.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

#delete_with_http_info(resource_group_name, job_collection_name, job_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a job.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



381
382
383
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 381

def delete_with_http_info(resource_group_name, job_collection_name, job_name, custom_headers = nil)
  delete_async(resource_group_name, job_collection_name, job_name, custom_headers).value!
end

#get(resource_group_name, job_collection_name, job_name, custom_headers = nil) ⇒ JobDefinition

Gets a job.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

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

    A hash of custom headers that

Returns:



36
37
38
39
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 36

def get(resource_group_name, job_collection_name, job_name, custom_headers = nil)
  response = get_async(resource_group_name, job_collection_name, job_name, custom_headers).value!
  response.body unless response.nil?
end

#get_async(resource_group_name, job_collection_name, job_name, custom_headers = nil) ⇒ Concurrent::Promise

Gets a job.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
115
116
117
118
119
120
121
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 67

def get_async(resource_group_name, job_collection_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_collection_name is nil' if job_collection_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # 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.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobDefinition.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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_collection_name, job_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a job.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



52
53
54
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 52

def get_with_http_info(resource_group_name, job_collection_name, job_name, custom_headers = nil)
  get_async(resource_group_name, job_collection_name, job_name, custom_headers).value!
end

#list(resource_group_name, job_collection_name, top = nil, skip = nil, filter = nil, custom_headers = nil) ⇒ Array<JobDefinition>

Lists all jobs under the specified job collection.

to begin requesting entries. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • top (Integer) (defaults to: nil)

    The number of jobs to request, in the of range [1..100].

  • skip (Integer) (defaults to: nil)

    The (0-based) index of the job history list from which

  • filter (String) (defaults to: nil)

    The filter to apply on the job state.

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

    A hash of custom headers that

Returns:



568
569
570
571
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 568

def list(resource_group_name, job_collection_name, top = nil, skip = nil, filter = nil, custom_headers = nil)
  first_page = list_as_lazy(resource_group_name, job_collection_name, top, skip, filter, custom_headers)
  first_page.get_all_items
end

#list_as_lazy(resource_group_name, job_collection_name, top = nil, skip = nil, filter = nil, custom_headers = nil) ⇒ JobListResult

Lists all jobs under the specified job collection.

to begin requesting entries. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • top (Integer) (defaults to: nil)

    The number of jobs to request, in the of range [1..100].

  • skip (Integer) (defaults to: nil)

    The (0-based) index of the job history list from which

  • filter (String) (defaults to: nil)

    The filter to apply on the job state.

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

    A hash of custom headers that

Returns:

  • (JobListResult)

    which provide lazy access to pages of the response.



543
544
545
546
547
548
549
550
551
552
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 543

def list_as_lazy(resource_group_name, job_collection_name, top = nil, skip = nil, filter = nil, custom_headers = nil)
  response = list_async(resource_group_name, job_collection_name, top, skip, filter, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      list_next_async(next_link, custom_headers)
    end
    page
  end
end

#list_async(resource_group_name, job_collection_name, top = nil, skip = nil, filter = nil, custom_headers = nil) ⇒ Concurrent::Promise

Lists all jobs under the specified job collection.

to begin requesting entries. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • top (Integer) (defaults to: nil)

    The number of jobs to request, in the of range [1..100].

  • skip (Integer) (defaults to: nil)

    The (0-based) index of the job history list from which

  • filter (String) (defaults to: nil)

    The filter to apply on the job state.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
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
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 605

def list_async(resource_group_name, job_collection_name, top = nil, skip = nil, filter = 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_collection_name is nil' if job_collection_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # 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.Scheduler/jobCollections/{jobCollectionName}/jobs'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$skip' => skip,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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_job_history(resource_group_name, job_collection_name, job_name, top = nil, skip = nil, filter = nil, custom_headers = nil) ⇒ Array<JobHistoryDefinition>

Lists job history.

[1..100]. to begin requesting entries. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • top (Integer) (defaults to: nil)

    the number of job history to request, in the of range

  • skip (Integer) (defaults to: nil)

    The (0-based) index of the job history list from which

  • filter (String) (defaults to: nil)

    The filter to apply on the job state.

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

    A hash of custom headers that

Returns:



704
705
706
707
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 704

def list_job_history(resource_group_name, job_collection_name, job_name, top = nil, skip = nil, filter = nil, custom_headers = nil)
  first_page = list_job_history_as_lazy(resource_group_name, job_collection_name, job_name, top, skip, filter, custom_headers)
  first_page.get_all_items
end

#list_job_history_as_lazy(resource_group_name, job_collection_name, job_name, top = nil, skip = nil, filter = nil, custom_headers = nil) ⇒ JobHistoryListResult

Lists job history.

[1..100]. to begin requesting entries. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • top (Integer) (defaults to: nil)

    the number of job history to request, in the of range

  • skip (Integer) (defaults to: nil)

    The (0-based) index of the job history list from which

  • filter (String) (defaults to: nil)

    The filter to apply on the job state.

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

    A hash of custom headers that

Returns:



677
678
679
680
681
682
683
684
685
686
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 677

def list_job_history_as_lazy(resource_group_name, job_collection_name, job_name, top = nil, skip = nil, filter = nil, custom_headers = nil)
  response = list_job_history_async(resource_group_name, job_collection_name, job_name, top, skip, filter, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      list_job_history_next_async(next_link, custom_headers)
    end
    page
  end
end

#list_job_history_async(resource_group_name, job_collection_name, job_name, top = nil, skip = nil, filter = nil, custom_headers = nil) ⇒ Concurrent::Promise

Lists job history.

[1..100]. to begin requesting entries. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • top (Integer) (defaults to: nil)

    the number of job history to request, in the of range

  • skip (Integer) (defaults to: nil)

    The (0-based) index of the job history list from which

  • filter (String) (defaults to: nil)

    The filter to apply on the job state.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
788
789
790
791
792
793
794
795
796
797
798
799
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 745

def list_job_history_async(resource_group_name, job_collection_name, job_name, top = nil, skip = nil, filter = 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_collection_name is nil' if job_collection_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # 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.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/history'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$skip' => skip,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobHistoryListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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_job_history_next(next_page_link, custom_headers = nil) ⇒ JobHistoryListResult

Lists job history.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

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

    A hash of custom headers that

Returns:



901
902
903
904
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 901

def list_job_history_next(next_page_link, custom_headers = nil)
  response = list_job_history_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_job_history_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Lists job history.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
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
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 930

def list_job_history_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # 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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobHistoryListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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_job_history_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Lists job history.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



916
917
918
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 916

def list_job_history_next_with_http_info(next_page_link, custom_headers = nil)
  list_job_history_next_async(next_page_link, custom_headers).value!
end

#list_job_history_with_http_info(resource_group_name, job_collection_name, job_name, top = nil, skip = nil, filter = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Lists job history.

[1..100]. to begin requesting entries. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • top (Integer) (defaults to: nil)

    the number of job history to request, in the of range

  • skip (Integer) (defaults to: nil)

    The (0-based) index of the job history list from which

  • filter (String) (defaults to: nil)

    The filter to apply on the job state.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



725
726
727
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 725

def list_job_history_with_http_info(resource_group_name, job_collection_name, job_name, top = nil, skip = nil, filter = nil, custom_headers = nil)
  list_job_history_async(resource_group_name, job_collection_name, job_name, top, skip, filter, custom_headers).value!
end

#list_next(next_page_link, custom_headers = nil) ⇒ JobListResult

Lists all jobs under the specified job collection.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

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

    A hash of custom headers that

Returns:



811
812
813
814
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 811

def list_next(next_page_link, custom_headers = nil)
  response = list_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Lists all jobs under the specified job collection.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • 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
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 840

def list_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # 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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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 jobs under the specified job collection.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



826
827
828
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 826

def list_next_with_http_info(next_page_link, custom_headers = nil)
  list_next_async(next_page_link, custom_headers).value!
end

#list_with_http_info(resource_group_name, job_collection_name, top = nil, skip = nil, filter = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all jobs under the specified job collection.

to begin requesting entries. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • top (Integer) (defaults to: nil)

    The number of jobs to request, in the of range [1..100].

  • skip (Integer) (defaults to: nil)

    The (0-based) index of the job history list from which

  • filter (String) (defaults to: nil)

    The filter to apply on the job state.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



587
588
589
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 587

def list_with_http_info(resource_group_name, job_collection_name, top = nil, skip = nil, filter = nil, custom_headers = nil)
  list_async(resource_group_name, job_collection_name, top, skip, filter, custom_headers).value!
end

#patch(resource_group_name, job_collection_name, job_name, job, custom_headers = nil) ⇒ JobDefinition

Patches an existing job.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • job (JobDefinition)

    The job definition.

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

    A hash of custom headers that

Returns:



256
257
258
259
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 256

def patch(resource_group_name, job_collection_name, job_name, job, custom_headers = nil)
  response = patch_async(resource_group_name, job_collection_name, job_name, job, custom_headers).value!
  response.body unless response.nil?
end

#patch_async(resource_group_name, job_collection_name, job_name, job, custom_headers = nil) ⇒ Concurrent::Promise

Patches an existing job.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • job (JobDefinition)

    The job definition.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 289

def patch_async(resource_group_name, job_collection_name, job_name, job, 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_collection_name is nil' if job_collection_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'job is nil' if job.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

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

  # Serialize Request
  request_mapper = JobDefinition.mapper()
  request_content = @client.serialize(request_mapper,  job, 'job')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobDefinition.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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

#patch_with_http_info(resource_group_name, job_collection_name, job_name, job, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Patches an existing job.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • job (JobDefinition)

    The job definition.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



273
274
275
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 273

def patch_with_http_info(resource_group_name, job_collection_name, job_name, job, custom_headers = nil)
  patch_async(resource_group_name, job_collection_name, job_name, job, custom_headers).value!
end

#run(resource_group_name, job_collection_name, job_name, custom_headers = nil) ⇒ Object

Runs a job.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

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

    A hash of custom headers that



452
453
454
455
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 452

def run(resource_group_name, job_collection_name, job_name, custom_headers = nil)
  response = run_async(resource_group_name, job_collection_name, job_name, custom_headers).value!
  nil
end

#run_async(resource_group_name, job_collection_name, job_name, custom_headers = nil) ⇒ Concurrent::Promise

Runs a job.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 483

def run_async(resource_group_name, job_collection_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_collection_name is nil' if job_collection_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # 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.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

#run_with_http_info(resource_group_name, job_collection_name, job_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Runs a job.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name.

  • job_collection_name (String)

    The job collection name.

  • job_name (String)

    The job name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



468
469
470
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 468

def run_with_http_info(resource_group_name, job_collection_name, job_name, custom_headers = nil)
  run_async(resource_group_name, job_collection_name, job_name, custom_headers).value!
end