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

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

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns reference to the SchedulerManagementClient.

Returns:

  • reference to the SchedulerManagementClient



23
24
25
# File 'lib/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/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
243
244
# File 'lib/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?
  job.validate unless 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?

  # Serialize Request
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
  unless job.nil?
    job = JobDefinition.serialize_object(job)
  end
  request_content = job != nil ? JSON.generate(job, 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)
        unless parsed_response.nil?
          parsed_response = JobDefinition.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      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)
        unless parsed_response.nil?
          parsed_response = JobDefinition.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#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/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



367
368
369
370
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 367

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.



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/azure_mgmt_scheduler/jobs.rb', line 398

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.



383
384
385
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 383

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/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/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)
        unless parsed_response.nil?
          parsed_response = JobDefinition.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_with_http_info(resource_group_name, job_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/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) ⇒ 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:



541
542
543
544
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 541

def list(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!
  response.body unless response.nil?
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.



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
619
620
621
622
623
624
625
626
627
628
629
630
631
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 578

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)
        unless parsed_response.nil?
          parsed_response = JobListResult.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_job_history(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.

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:



649
650
651
652
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 649

def list_job_history(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!
  response.body unless response.nil?
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.



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
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 690

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)
        unless parsed_response.nil?
          parsed_response = JobHistoryListResult.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_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:



846
847
848
849
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 846

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.



875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 875

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)
        unless parsed_response.nil?
          parsed_response = JobHistoryListResult.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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



861
862
863
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 861

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.



670
671
672
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 670

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:



756
757
758
759
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 756

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.



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
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 785

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)
        unless parsed_response.nil?
          parsed_response = JobListResult.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all 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.



771
772
773
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 771

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.



560
561
562
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 560

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:



258
259
260
261
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 258

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.



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
354
355
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 291

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?
  job.validate unless 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?

  # Serialize Request
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
  unless job.nil?
    job = JobDefinition.serialize_object(job)
  end
  request_content = job != nil ? JSON.generate(job, 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)
        unless parsed_response.nil?
          parsed_response = JobDefinition.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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



275
276
277
# File 'lib/azure_mgmt_scheduler/jobs.rb', line 275

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/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
# File 'lib/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/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