azure_mgmt_scheduler 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_scheduler.gemspec +35 -0
  6. data/lib/azure_mgmt_scheduler.rb +73 -0
  7. data/lib/azure_mgmt_scheduler/job_collections.rb +642 -0
  8. data/lib/azure_mgmt_scheduler/jobs.rb +616 -0
  9. data/lib/azure_mgmt_scheduler/models/basic_authentication.rb +75 -0
  10. data/lib/azure_mgmt_scheduler/models/client_cert_authentication.rb +104 -0
  11. data/lib/azure_mgmt_scheduler/models/day_of_week.rb +21 -0
  12. data/lib/azure_mgmt_scheduler/models/http_authentication.rb +61 -0
  13. data/lib/azure_mgmt_scheduler/models/http_authentication_type.rb +18 -0
  14. data/lib/azure_mgmt_scheduler/models/http_request.rb +99 -0
  15. data/lib/azure_mgmt_scheduler/models/job_action.rb +159 -0
  16. data/lib/azure_mgmt_scheduler/models/job_action_type.rb +19 -0
  17. data/lib/azure_mgmt_scheduler/models/job_collection_definition.rb +109 -0
  18. data/lib/azure_mgmt_scheduler/models/job_collection_list_result.rb +86 -0
  19. data/lib/azure_mgmt_scheduler/models/job_collection_properties.rb +92 -0
  20. data/lib/azure_mgmt_scheduler/models/job_collection_quota.rb +82 -0
  21. data/lib/azure_mgmt_scheduler/models/job_collection_state.rb +18 -0
  22. data/lib/azure_mgmt_scheduler/models/job_definition.rb +89 -0
  23. data/lib/azure_mgmt_scheduler/models/job_error_action.rb +143 -0
  24. data/lib/azure_mgmt_scheduler/models/job_execution_status.rb +17 -0
  25. data/lib/azure_mgmt_scheduler/models/job_history_action_name.rb +16 -0
  26. data/lib/azure_mgmt_scheduler/models/job_history_definition.rb +90 -0
  27. data/lib/azure_mgmt_scheduler/models/job_history_definition_properties.rb +136 -0
  28. data/lib/azure_mgmt_scheduler/models/job_history_filter.rb +60 -0
  29. data/lib/azure_mgmt_scheduler/models/job_history_list_result.rb +87 -0
  30. data/lib/azure_mgmt_scheduler/models/job_list_result.rb +86 -0
  31. data/lib/azure_mgmt_scheduler/models/job_max_recurrence.rb +71 -0
  32. data/lib/azure_mgmt_scheduler/models/job_properties.rb +119 -0
  33. data/lib/azure_mgmt_scheduler/models/job_recurrence.rb +110 -0
  34. data/lib/azure_mgmt_scheduler/models/job_recurrence_schedule.rb +156 -0
  35. data/lib/azure_mgmt_scheduler/models/job_recurrence_schedule_monthly_occurrence.rb +73 -0
  36. data/lib/azure_mgmt_scheduler/models/job_schedule_day.rb +21 -0
  37. data/lib/azure_mgmt_scheduler/models/job_state.rb +18 -0
  38. data/lib/azure_mgmt_scheduler/models/job_state_filter.rb +60 -0
  39. data/lib/azure_mgmt_scheduler/models/job_status.rb +103 -0
  40. data/lib/azure_mgmt_scheduler/models/oauth_authentication.rb +93 -0
  41. data/lib/azure_mgmt_scheduler/models/recurrence_frequency.rb +19 -0
  42. data/lib/azure_mgmt_scheduler/models/retry_policy.rb +80 -0
  43. data/lib/azure_mgmt_scheduler/models/retry_type.rb +16 -0
  44. data/lib/azure_mgmt_scheduler/models/service_bus_authentication.rb +78 -0
  45. data/lib/azure_mgmt_scheduler/models/service_bus_authentication_type.rb +16 -0
  46. data/lib/azure_mgmt_scheduler/models/service_bus_brokered_message_properties.rb +168 -0
  47. data/lib/azure_mgmt_scheduler/models/service_bus_message.rb +122 -0
  48. data/lib/azure_mgmt_scheduler/models/service_bus_queue_message.rb +108 -0
  49. data/lib/azure_mgmt_scheduler/models/service_bus_topic_message.rb +108 -0
  50. data/lib/azure_mgmt_scheduler/models/service_bus_transport_type.rb +17 -0
  51. data/lib/azure_mgmt_scheduler/models/sku.rb +60 -0
  52. data/lib/azure_mgmt_scheduler/models/sku_definition.rb +17 -0
  53. data/lib/azure_mgmt_scheduler/models/storage_queue_message.rb +83 -0
  54. data/lib/azure_mgmt_scheduler/module_definition.rb +8 -0
  55. data/lib/azure_mgmt_scheduler/scheduler_management_client.rb +70 -0
  56. data/lib/azure_mgmt_scheduler/version.rb +8 -0
  57. metadata +183 -0
@@ -0,0 +1,616 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Scheduler
7
+ #
8
+ # Jobs
9
+ #
10
+ class Jobs
11
+ include Azure::ARM::Scheduler::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Jobs class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the SchedulerManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets a job.
27
+ #
28
+ # @param resource_group_name [String] The resource group name.
29
+ # @param job_collection_name [String] The job collection name.
30
+ # @param job_name [String] The job name.
31
+ # @param [Hash{String => String}] The hash of custom headers need to be
32
+ # applied to HTTP request.
33
+ #
34
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
35
+ # response.
36
+ #
37
+ def get(resource_group_name, job_collection_name, job_name, custom_headers = nil)
38
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
39
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
40
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
41
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
42
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
43
+ request_headers = {}
44
+
45
+ # Set Headers
46
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
47
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
48
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'
49
+ options = {
50
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
51
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
52
+ query_params: {'api-version' => @client.api_version},
53
+ headers: request_headers.merge(custom_headers || {})
54
+ }
55
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
56
+ promise = request.run_promise do |req|
57
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
58
+ end
59
+
60
+ promise = promise.then do |http_response|
61
+ status_code = http_response.status
62
+ response_content = http_response.body
63
+ unless status_code == 200
64
+ error_model = JSON.load(response_content)
65
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
66
+ end
67
+
68
+ # Create Result
69
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
70
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
71
+ # Deserialize Response
72
+ if status_code == 200
73
+ begin
74
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
75
+ unless parsed_response.nil?
76
+ parsed_response = JobDefinition.deserialize_object(parsed_response)
77
+ end
78
+ result.body = parsed_response
79
+ rescue Exception => e
80
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
81
+ end
82
+ end
83
+
84
+ result
85
+ end
86
+
87
+ promise.execute
88
+ end
89
+
90
+ #
91
+ # Provisions a new job or updates an existing job.
92
+ #
93
+ # @param resource_group_name [String] The resource group name.
94
+ # @param job_collection_name [String] The job collection name.
95
+ # @param job_name [String] The job name.
96
+ # @param job [JobDefinition] The job definition.
97
+ # @param [Hash{String => String}] The hash of custom headers need to be
98
+ # applied to HTTP request.
99
+ #
100
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
101
+ # response.
102
+ #
103
+ def create_or_update(resource_group_name, job_collection_name, job_name, job, custom_headers = nil)
104
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
105
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
106
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
107
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
108
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
109
+ fail ArgumentError, 'job is nil' if job.nil?
110
+ job.validate unless job.nil?
111
+ request_headers = {}
112
+
113
+ # Set Headers
114
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
115
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
116
+
117
+ # Serialize Request
118
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
119
+ unless job.nil?
120
+ job = JobDefinition.serialize_object(job)
121
+ end
122
+ request_content = JSON.generate(job, quirks_mode: true)
123
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'
124
+ options = {
125
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
126
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
127
+ query_params: {'api-version' => @client.api_version},
128
+ body: request_content,
129
+ headers: request_headers.merge(custom_headers || {})
130
+ }
131
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
132
+ promise = request.run_promise do |req|
133
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
134
+ end
135
+
136
+ promise = promise.then do |http_response|
137
+ status_code = http_response.status
138
+ response_content = http_response.body
139
+ unless status_code == 200 || status_code == 201
140
+ error_model = JSON.load(response_content)
141
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
142
+ end
143
+
144
+ # Create Result
145
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
146
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
147
+ # Deserialize Response
148
+ if status_code == 200
149
+ begin
150
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
151
+ unless parsed_response.nil?
152
+ parsed_response = JobDefinition.deserialize_object(parsed_response)
153
+ end
154
+ result.body = parsed_response
155
+ rescue Exception => e
156
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
157
+ end
158
+ end
159
+ # Deserialize Response
160
+ if status_code == 201
161
+ begin
162
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
163
+ unless parsed_response.nil?
164
+ parsed_response = JobDefinition.deserialize_object(parsed_response)
165
+ end
166
+ result.body = parsed_response
167
+ rescue Exception => e
168
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
169
+ end
170
+ end
171
+
172
+ result
173
+ end
174
+
175
+ promise.execute
176
+ end
177
+
178
+ #
179
+ # Patches an existing job.
180
+ #
181
+ # @param resource_group_name [String] The resource group name.
182
+ # @param job_collection_name [String] The job collection name.
183
+ # @param job_name [String] The job name.
184
+ # @param job [JobDefinition] The job definition.
185
+ # @param [Hash{String => String}] The hash of custom headers need to be
186
+ # applied to HTTP request.
187
+ #
188
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
189
+ # response.
190
+ #
191
+ def patch(resource_group_name, job_collection_name, job_name, job, custom_headers = nil)
192
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
193
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
194
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
195
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
196
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
197
+ fail ArgumentError, 'job is nil' if job.nil?
198
+ job.validate unless job.nil?
199
+ request_headers = {}
200
+
201
+ # Set Headers
202
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
203
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
204
+
205
+ # Serialize Request
206
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
207
+ unless job.nil?
208
+ job = JobDefinition.serialize_object(job)
209
+ end
210
+ request_content = JSON.generate(job, quirks_mode: true)
211
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'
212
+ options = {
213
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
214
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
215
+ query_params: {'api-version' => @client.api_version},
216
+ body: request_content,
217
+ headers: request_headers.merge(custom_headers || {})
218
+ }
219
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :patch, options)
220
+ promise = request.run_promise do |req|
221
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
222
+ end
223
+
224
+ promise = promise.then do |http_response|
225
+ status_code = http_response.status
226
+ response_content = http_response.body
227
+ unless status_code == 200
228
+ error_model = JSON.load(response_content)
229
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
230
+ end
231
+
232
+ # Create Result
233
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
234
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
235
+ # Deserialize Response
236
+ if status_code == 200
237
+ begin
238
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
239
+ unless parsed_response.nil?
240
+ parsed_response = JobDefinition.deserialize_object(parsed_response)
241
+ end
242
+ result.body = parsed_response
243
+ rescue Exception => e
244
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
245
+ end
246
+ end
247
+
248
+ result
249
+ end
250
+
251
+ promise.execute
252
+ end
253
+
254
+ #
255
+ # Deletes a job.
256
+ #
257
+ # @param resource_group_name [String] The resource group name.
258
+ # @param job_collection_name [String] The job collection name.
259
+ # @param job_name [String] The job name.
260
+ # @param [Hash{String => String}] The hash of custom headers need to be
261
+ # applied to HTTP request.
262
+ #
263
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
264
+ # response.
265
+ #
266
+ def delete(resource_group_name, job_collection_name, job_name, custom_headers = nil)
267
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
268
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
269
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
270
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
271
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
272
+ request_headers = {}
273
+
274
+ # Set Headers
275
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
276
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
277
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'
278
+ options = {
279
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
280
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
281
+ query_params: {'api-version' => @client.api_version},
282
+ headers: request_headers.merge(custom_headers || {})
283
+ }
284
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
285
+ promise = request.run_promise do |req|
286
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
287
+ end
288
+
289
+ promise = promise.then do |http_response|
290
+ status_code = http_response.status
291
+ response_content = http_response.body
292
+ unless status_code == 200
293
+ error_model = JSON.load(response_content)
294
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
295
+ end
296
+
297
+ # Create Result
298
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
299
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
300
+
301
+ result
302
+ end
303
+
304
+ promise.execute
305
+ end
306
+
307
+ #
308
+ # Runs a job.
309
+ #
310
+ # @param resource_group_name [String] The resource group name.
311
+ # @param job_collection_name [String] The job collection name.
312
+ # @param job_name [String] The job name.
313
+ # @param [Hash{String => String}] The hash of custom headers need to be
314
+ # applied to HTTP request.
315
+ #
316
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
317
+ # response.
318
+ #
319
+ def run(resource_group_name, job_collection_name, job_name, custom_headers = nil)
320
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
321
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
322
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
323
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
324
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
325
+ request_headers = {}
326
+
327
+ # Set Headers
328
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
329
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
330
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run'
331
+ options = {
332
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
333
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
334
+ query_params: {'api-version' => @client.api_version},
335
+ headers: request_headers.merge(custom_headers || {})
336
+ }
337
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
338
+ promise = request.run_promise do |req|
339
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
340
+ end
341
+
342
+ promise = promise.then do |http_response|
343
+ status_code = http_response.status
344
+ response_content = http_response.body
345
+ unless status_code == 200
346
+ error_model = JSON.load(response_content)
347
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
348
+ end
349
+
350
+ # Create Result
351
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
352
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
353
+
354
+ result
355
+ end
356
+
357
+ promise.execute
358
+ end
359
+
360
+ #
361
+ # Lists all jobs under the specified job collection.
362
+ #
363
+ # @param resource_group_name [String] The resource group name.
364
+ # @param job_collection_name [String] The job collection name.
365
+ # @param top [Integer] The number of jobs to request, in the of range [1..100].
366
+ # @param skip [Integer] The (0-based) index of the job history list from which
367
+ # to begin requesting entries.
368
+ # @param filter [String] The filter to apply on the job state.
369
+ # @param [Hash{String => String}] The hash of custom headers need to be
370
+ # applied to HTTP request.
371
+ #
372
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
373
+ # response.
374
+ #
375
+ def list(resource_group_name, job_collection_name, top = nil, skip = nil, filter = nil, custom_headers = nil)
376
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
377
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
378
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
379
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
380
+ request_headers = {}
381
+
382
+ # Set Headers
383
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
384
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
385
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs'
386
+ options = {
387
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
388
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name},
389
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$skip' => skip,'$filter' => filter},
390
+ headers: request_headers.merge(custom_headers || {})
391
+ }
392
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
393
+ promise = request.run_promise do |req|
394
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
395
+ end
396
+
397
+ promise = promise.then do |http_response|
398
+ status_code = http_response.status
399
+ response_content = http_response.body
400
+ unless status_code == 200
401
+ error_model = JSON.load(response_content)
402
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
403
+ end
404
+
405
+ # Create Result
406
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
407
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
408
+ # Deserialize Response
409
+ if status_code == 200
410
+ begin
411
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
412
+ unless parsed_response.nil?
413
+ parsed_response = JobListResult.deserialize_object(parsed_response)
414
+ end
415
+ result.body = parsed_response
416
+ rescue Exception => e
417
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
418
+ end
419
+ end
420
+
421
+ result
422
+ end
423
+
424
+ promise.execute
425
+ end
426
+
427
+ #
428
+ # Lists job history.
429
+ #
430
+ # @param resource_group_name [String] The resource group name.
431
+ # @param job_collection_name [String] The job collection name.
432
+ # @param job_name [String] The job name.
433
+ # @param top [Integer] the number of job history to request, in the of range
434
+ # [1..100].
435
+ # @param skip [Integer] The (0-based) index of the job history list from which
436
+ # to begin requesting entries.
437
+ # @param filter [String] The filter to apply on the job state.
438
+ # @param [Hash{String => String}] The hash of custom headers need to be
439
+ # applied to HTTP request.
440
+ #
441
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
442
+ # response.
443
+ #
444
+ def list_job_history(resource_group_name, job_collection_name, job_name, top = nil, skip = nil, filter = nil, custom_headers = nil)
445
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
446
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
447
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
448
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
449
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
450
+ request_headers = {}
451
+
452
+ # Set Headers
453
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
454
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
455
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/history'
456
+ options = {
457
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
458
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name,'jobName' => job_name},
459
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$skip' => skip,'$filter' => filter},
460
+ headers: request_headers.merge(custom_headers || {})
461
+ }
462
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
463
+ promise = request.run_promise do |req|
464
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
465
+ end
466
+
467
+ promise = promise.then do |http_response|
468
+ status_code = http_response.status
469
+ response_content = http_response.body
470
+ unless status_code == 200
471
+ error_model = JSON.load(response_content)
472
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
473
+ end
474
+
475
+ # Create Result
476
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
477
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
478
+ # Deserialize Response
479
+ if status_code == 200
480
+ begin
481
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
482
+ unless parsed_response.nil?
483
+ parsed_response = JobHistoryListResult.deserialize_object(parsed_response)
484
+ end
485
+ result.body = parsed_response
486
+ rescue Exception => e
487
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
488
+ end
489
+ end
490
+
491
+ result
492
+ end
493
+
494
+ promise.execute
495
+ end
496
+
497
+ #
498
+ # Lists all jobs under the specified job collection.
499
+ #
500
+ # @param next_page_link [String] The NextLink from the previous successful
501
+ # call to List operation.
502
+ # @param [Hash{String => String}] The hash of custom headers need to be
503
+ # applied to HTTP request.
504
+ #
505
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
506
+ # response.
507
+ #
508
+ def list_next(next_page_link, custom_headers = nil)
509
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
510
+ request_headers = {}
511
+
512
+ # Set Headers
513
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
514
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
515
+ path_template = '{nextLink}'
516
+ options = {
517
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
518
+ skip_encoding_path_params: {'nextLink' => next_page_link},
519
+ headers: request_headers.merge(custom_headers || {})
520
+ }
521
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
522
+ promise = request.run_promise do |req|
523
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
524
+ end
525
+
526
+ promise = promise.then do |http_response|
527
+ status_code = http_response.status
528
+ response_content = http_response.body
529
+ unless status_code == 200
530
+ error_model = JSON.load(response_content)
531
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
532
+ end
533
+
534
+ # Create Result
535
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
536
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
537
+ # Deserialize Response
538
+ if status_code == 200
539
+ begin
540
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
541
+ unless parsed_response.nil?
542
+ parsed_response = JobListResult.deserialize_object(parsed_response)
543
+ end
544
+ result.body = parsed_response
545
+ rescue Exception => e
546
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
547
+ end
548
+ end
549
+
550
+ result
551
+ end
552
+
553
+ promise.execute
554
+ end
555
+
556
+ #
557
+ # Lists job history.
558
+ #
559
+ # @param next_page_link [String] The NextLink from the previous successful
560
+ # call to List operation.
561
+ # @param [Hash{String => String}] The hash of custom headers need to be
562
+ # applied to HTTP request.
563
+ #
564
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
565
+ # response.
566
+ #
567
+ def list_job_history_next(next_page_link, custom_headers = nil)
568
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
569
+ request_headers = {}
570
+
571
+ # Set Headers
572
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
573
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
574
+ path_template = '{nextLink}'
575
+ options = {
576
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
577
+ skip_encoding_path_params: {'nextLink' => next_page_link},
578
+ headers: request_headers.merge(custom_headers || {})
579
+ }
580
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
581
+ promise = request.run_promise do |req|
582
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
583
+ end
584
+
585
+ promise = promise.then do |http_response|
586
+ status_code = http_response.status
587
+ response_content = http_response.body
588
+ unless status_code == 200
589
+ error_model = JSON.load(response_content)
590
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
591
+ end
592
+
593
+ # Create Result
594
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
595
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
596
+ # Deserialize Response
597
+ if status_code == 200
598
+ begin
599
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
600
+ unless parsed_response.nil?
601
+ parsed_response = JobHistoryListResult.deserialize_object(parsed_response)
602
+ end
603
+ result.body = parsed_response
604
+ rescue Exception => e
605
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
606
+ end
607
+ end
608
+
609
+ result
610
+ end
611
+
612
+ promise.execute
613
+ end
614
+
615
+ end
616
+ end