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:



132
133
134
135
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 132

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.



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

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}'

  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,'jobCollectionName' => job_collection_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 == 201
      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?
    # 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.



149
150
151
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 149

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



356
357
358
359
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 356

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.



387
388
389
390
391
392
393
394
395
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
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 387

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}'

  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,'jobCollectionName' => job_collection_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 == 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
  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.



372
373
374
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 372

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

  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,'jobCollectionName' => job_collection_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(: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?
    # 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.

[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.

  • top (Integer) (defaults to: nil)

    The number of jobs to request, in the of range of

  • 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:



529
530
531
532
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 529

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.

[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.

  • top (Integer) (defaults to: nil)

    The number of jobs to request, in the of range of

  • 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.



919
920
921
922
923
924
925
926
927
928
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 919

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_page_link|
      list_next_async(next_page_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.

[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.

  • top (Integer) (defaults to: nil)

    The number of jobs to request, in the of range of

  • 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.



568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 568

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'

  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,'jobCollectionName' => job_collection_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$skip' => skip,'$filter' => filter},
      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?
    # 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 of

  • 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:



636
637
638
639
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 636

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 of

  • 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:



947
948
949
950
951
952
953
954
955
956
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 947

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_page_link|
      list_job_history_next_async(next_page_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 of

  • 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.



677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 677

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'

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

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:



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

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.

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.



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

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}'

  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?
    # 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.

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.



842
843
844
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 842

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 of

  • 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.



657
658
659
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 657

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.

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:



740
741
742
743
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 740

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.

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.



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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 769

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}'

  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?
    # 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.

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.



755
756
757
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 755

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.

[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.

  • top (Integer) (defaults to: nil)

    The number of jobs to request, in the of range of

  • 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.



549
550
551
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 549

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:



250
251
252
253
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 250

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.



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

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}'

  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,'jobCollectionName' => job_collection_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
      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?
    # 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.



267
268
269
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 267

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



440
441
442
443
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 440

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.



471
472
473
474
475
476
477
478
479
480
481
482
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
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 471

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'

  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,'jobCollectionName' => job_collection_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
  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.



456
457
458
# File 'lib/generated/azure_mgmt_scheduler/jobs.rb', line 456

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