iron_titan 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +100 -29
  3. data/lib/iron_titan/api/core_api.rb +71 -12
  4. data/lib/iron_titan/api/images_api.rb +32 -32
  5. data/lib/iron_titan/api/jobs_api.rb +335 -75
  6. data/lib/iron_titan/api_client.rb +2 -2
  7. data/lib/iron_titan/api_error.rb +1 -1
  8. data/lib/iron_titan/models/error.rb +1 -1
  9. data/lib/iron_titan/models/error_body.rb +1 -1
  10. data/lib/iron_titan/models/id_status.rb +182 -0
  11. data/lib/iron_titan/models/image.rb +8 -8
  12. data/lib/iron_titan/models/image_wrapper.rb +1 -1
  13. data/lib/iron_titan/models/images_wrapper.rb +1 -1
  14. data/lib/iron_titan/models/job.rb +110 -103
  15. data/lib/iron_titan/models/job_wrapper.rb +1 -1
  16. data/lib/iron_titan/models/jobs_wrapper.rb +15 -5
  17. data/lib/iron_titan/models/new_job.rb +27 -50
  18. data/lib/iron_titan/models/new_job_with_image.rb +249 -0
  19. data/lib/iron_titan/models/new_jobs_wrapper.rb +2 -2
  20. data/lib/iron_titan/models/reason.rb +152 -0
  21. data/lib/iron_titan/version.rb +2 -2
  22. data/lib/iron_titan.rb +11 -9
  23. data/spec/api/core_api_spec.rb +21 -5
  24. data/spec/api/images_api_spec.rb +12 -12
  25. data/spec/api/jobs_api_spec.rb +92 -24
  26. data/spec/models/Error_spec.rb +2 -2
  27. data/spec/models/Job_spec.rb +15 -25
  28. data/spec/models/error_body_spec.rb +2 -2
  29. data/spec/models/id_status_spec.rb +56 -0
  30. data/spec/models/image_spec.rb +3 -3
  31. data/spec/models/image_wrapper_spec.rb +2 -2
  32. data/spec/models/images_wrapper_spec.rb +2 -2
  33. data/spec/models/job_wrapper_spec.rb +2 -2
  34. data/spec/models/jobs_wrapper_spec.rb +12 -2
  35. data/spec/models/log_spec.rb +1 -1
  36. data/spec/models/new_job_spec.rb +3 -33
  37. data/spec/models/new_job_with_image_spec.rb +116 -0
  38. data/spec/models/new_jobs_wrapper_spec.rb +2 -2
  39. data/spec/models/reason_spec.rb +36 -0
  40. metadata +11 -2
@@ -3,7 +3,7 @@ Titan API
3
3
 
4
4
  The ultimate, language agnostic, container based job processing framework.
5
5
 
6
- OpenAPI spec version: 0.1.1
6
+ OpenAPI spec version: 0.2.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
 
@@ -20,31 +20,36 @@ module IronTitan
20
20
  @api_client = api_client
21
21
  end
22
22
 
23
- # Gets job by id
24
- # Gets a job by id.
23
+ # Cancel a job.
24
+ # Cancels a job in delayed, queued or running status. The worker may continue to run a running job. reason is set to `client_request`.
25
25
  # @param id Job id
26
+ # @param details Human-readable detailed message explaining cancellation reason.
26
27
  # @param [Hash] opts the optional parameters
27
28
  # @return [JobWrapper]
28
- def job_id_get(id, opts = {})
29
- data, status_code, headers = job_id_get_with_http_info(id, opts)
29
+ def job_id_cancel_post(id, details, opts = {})
30
+ data, status_code, headers = job_id_cancel_post_with_http_info(id, details, opts)
30
31
  return data
31
32
  end
32
33
 
33
- # Gets job by id
34
- # Gets a job by id.
34
+ # Cancel a job.
35
+ # Cancels a job in delayed, queued or running status. The worker may continue to run a running job. reason is set to `client_request`.
35
36
  # @param id Job id
37
+ # @param details Human-readable detailed message explaining cancellation reason.
36
38
  # @param [Hash] opts the optional parameters
37
39
  # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers
38
- def job_id_get_with_http_info(id, opts = {})
40
+ def job_id_cancel_post_with_http_info(id, details, opts = {})
39
41
  if @api_client.config.debugging
40
- @api_client.config.logger.debug "Calling API: JobsApi#job_id_get ..."
42
+ @api_client.config.logger.debug "Calling API: JobsApi#job_id_cancel_post ..."
41
43
  end
42
44
 
43
45
  # verify the required parameter 'id' is set
44
- fail "Missing the required parameter 'id' when calling job_id_get" if id.nil?
46
+ fail "Missing the required parameter 'id' when calling job_id_cancel_post" if id.nil?
47
+
48
+ # verify the required parameter 'details' is set
49
+ fail "Missing the required parameter 'details' when calling job_id_cancel_post" if details.nil?
45
50
 
46
51
  # resource path
47
- local_var_path = "/job/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
52
+ local_var_path = "/job/{id}/cancel".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
48
53
 
49
54
  # query parameters
50
55
  query_params = {}
@@ -64,10 +69,10 @@ module IronTitan
64
69
  form_params = {}
65
70
 
66
71
  # http body (model)
67
- post_body = nil
72
+ post_body = @api_client.object_to_http_body(details)
68
73
 
69
74
  auth_names = []
70
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
75
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
71
76
  :header_params => header_params,
72
77
  :query_params => query_params,
73
78
  :form_params => form_params,
@@ -75,41 +80,110 @@ module IronTitan
75
80
  :auth_names => auth_names,
76
81
  :return_type => 'JobWrapper')
77
82
  if @api_client.config.debugging
78
- @api_client.config.logger.debug "API called: JobsApi#job_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
83
+ @api_client.config.logger.debug "API called: JobsApi#job_id_cancel_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
84
  end
80
85
  return data, status_code, headers
81
86
  end
82
87
 
83
- # Update a job
84
- # Typically used to update status on error/completion. TODO: only allow &#39;status&#39; field.
88
+ # Delete the job.
89
+ # Delete only succeeds if job status is one of `succeeded\n| failed | cancelled`. Cancel a job if it is another state and needs to\nbe deleted. All information about the job, including the log, is\nirretrievably lost when this is invoked.
85
90
  # @param id Job id
86
- # @param body Job data to post
91
+ # @param [Hash] opts the optional parameters
92
+ # @return [nil]
93
+ def job_id_delete(id, opts = {})
94
+ job_id_delete_with_http_info(id, opts)
95
+ return nil
96
+ end
97
+
98
+ # Delete the job.
99
+ # Delete only succeeds if job status is one of `succeeded\n| failed | cancelled`. Cancel a job if it is another state and needs to\nbe deleted. All information about the job, including the log, is\nirretrievably lost when this is invoked.
100
+ # @param id Job id
101
+ # @param [Hash] opts the optional parameters
102
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
103
+ def job_id_delete_with_http_info(id, opts = {})
104
+ if @api_client.config.debugging
105
+ @api_client.config.logger.debug "Calling API: JobsApi#job_id_delete ..."
106
+ end
107
+
108
+ # verify the required parameter 'id' is set
109
+ fail "Missing the required parameter 'id' when calling job_id_delete" if id.nil?
110
+
111
+ # resource path
112
+ local_var_path = "/job/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
113
+
114
+ # query parameters
115
+ query_params = {}
116
+
117
+ # header parameters
118
+ header_params = {}
119
+
120
+ # HTTP header 'Accept' (if needed)
121
+ _header_accept = ['application/json']
122
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
123
+
124
+ # HTTP header 'Content-Type'
125
+ _header_content_type = ['application/json']
126
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
127
+
128
+ # form parameters
129
+ form_params = {}
130
+
131
+ # http body (model)
132
+ post_body = nil
133
+
134
+ auth_names = []
135
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
136
+ :header_params => header_params,
137
+ :query_params => query_params,
138
+ :form_params => form_params,
139
+ :body => post_body,
140
+ :auth_names => auth_names)
141
+ if @api_client.config.debugging
142
+ @api_client.config.logger.debug "API called: JobsApi#job_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
143
+ end
144
+ return data, status_code, headers
145
+ end
146
+
147
+ # Mark job as failed.
148
+ # Job is marked as failed if it was in a valid state. Job's `completed_at` time is initialized.
149
+ # @param id Job id
150
+ # @param reason Reason for job failure.
151
+ # @param details Details of job failure.
152
+ # @param log Output log for the job. Content-Type must be \&quot;text/plain; charset=utf-8\&quot;.
87
153
  # @param [Hash] opts the optional parameters
88
154
  # @return [JobWrapper]
89
- def job_id_patch(id, body, opts = {})
90
- data, status_code, headers = job_id_patch_with_http_info(id, body, opts)
155
+ def job_id_fail_post(id, reason, details, log, opts = {})
156
+ data, status_code, headers = job_id_fail_post_with_http_info(id, reason, details, log, opts)
91
157
  return data
92
158
  end
93
159
 
94
- # Update a job
95
- # Typically used to update status on error/completion. TODO: only allow &#39;status&#39; field.
160
+ # Mark job as failed.
161
+ # Job is marked as failed if it was in a valid state. Job&#39;s `completed_at` time is initialized.
96
162
  # @param id Job id
97
- # @param body Job data to post
163
+ # @param reason Reason for job failure.
164
+ # @param details Details of job failure.
165
+ # @param log Output log for the job. Content-Type must be \&quot;text/plain; charset=utf-8\&quot;.
98
166
  # @param [Hash] opts the optional parameters
99
167
  # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers
100
- def job_id_patch_with_http_info(id, body, opts = {})
168
+ def job_id_fail_post_with_http_info(id, reason, details, log, opts = {})
101
169
  if @api_client.config.debugging
102
- @api_client.config.logger.debug "Calling API: JobsApi#job_id_patch ..."
170
+ @api_client.config.logger.debug "Calling API: JobsApi#job_id_fail_post ..."
103
171
  end
104
172
 
105
173
  # verify the required parameter 'id' is set
106
- fail "Missing the required parameter 'id' when calling job_id_patch" if id.nil?
174
+ fail "Missing the required parameter 'id' when calling job_id_fail_post" if id.nil?
107
175
 
108
- # verify the required parameter 'body' is set
109
- fail "Missing the required parameter 'body' when calling job_id_patch" if body.nil?
176
+ # verify the required parameter 'reason' is set
177
+ fail "Missing the required parameter 'reason' when calling job_id_fail_post" if reason.nil?
178
+
179
+ # verify the required parameter 'details' is set
180
+ fail "Missing the required parameter 'details' when calling job_id_fail_post" if details.nil?
181
+
182
+ # verify the required parameter 'log' is set
183
+ fail "Missing the required parameter 'log' when calling job_id_fail_post" if log.nil?
110
184
 
111
185
  # resource path
112
- local_var_path = "/job/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
186
+ local_var_path = "/job/{id}/fail".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
113
187
 
114
188
  # query parameters
115
189
  query_params = {}
@@ -122,17 +196,20 @@ module IronTitan
122
196
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
123
197
 
124
198
  # HTTP header 'Content-Type'
125
- _header_content_type = ['application/json']
199
+ _header_content_type = ['multipart/form-data']
126
200
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
127
201
 
128
202
  # form parameters
129
203
  form_params = {}
204
+ form_params["reason"] = reason
205
+ form_params["details"] = details
206
+ form_params["log"] = log
130
207
 
131
208
  # http body (model)
132
- post_body = @api_client.object_to_http_body(body)
209
+ post_body = nil
133
210
 
134
211
  auth_names = []
135
- data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
212
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
136
213
  :header_params => header_params,
137
214
  :query_params => query_params,
138
215
  :form_params => form_params,
@@ -140,36 +217,36 @@ module IronTitan
140
217
  :auth_names => auth_names,
141
218
  :return_type => 'JobWrapper')
142
219
  if @api_client.config.debugging
143
- @api_client.config.logger.debug "API called: JobsApi#job_id_patch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
220
+ @api_client.config.logger.debug "API called: JobsApi#job_id_fail_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
144
221
  end
145
222
  return data, status_code, headers
146
223
  end
147
224
 
148
- # Cancel a job.
149
- # This will prevent a job from running. TODO: should we attempt to kill a running job?
225
+ # Gets job by id
226
+ # Gets a job by id.
150
227
  # @param id Job id
151
228
  # @param [Hash] opts the optional parameters
152
229
  # @return [JobWrapper]
153
- def job_id_cancel_post(id, opts = {})
154
- data, status_code, headers = job_id_cancel_post_with_http_info(id, opts)
230
+ def job_id_get(id, opts = {})
231
+ data, status_code, headers = job_id_get_with_http_info(id, opts)
155
232
  return data
156
233
  end
157
234
 
158
- # Cancel a job.
159
- # This will prevent a job from running. TODO: should we attempt to kill a running job?
235
+ # Gets job by id
236
+ # Gets a job by id.
160
237
  # @param id Job id
161
238
  # @param [Hash] opts the optional parameters
162
239
  # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers
163
- def job_id_cancel_post_with_http_info(id, opts = {})
240
+ def job_id_get_with_http_info(id, opts = {})
164
241
  if @api_client.config.debugging
165
- @api_client.config.logger.debug "Calling API: JobsApi#job_id_cancel_post ..."
242
+ @api_client.config.logger.debug "Calling API: JobsApi#job_id_get ..."
166
243
  end
167
244
 
168
245
  # verify the required parameter 'id' is set
169
- fail "Missing the required parameter 'id' when calling job_id_cancel_post" if id.nil?
246
+ fail "Missing the required parameter 'id' when calling job_id_get" if id.nil?
170
247
 
171
248
  # resource path
172
- local_var_path = "/job/{id}/cancel".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
249
+ local_var_path = "/job/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
173
250
 
174
251
  # query parameters
175
252
  query_params = {}
@@ -192,7 +269,7 @@ module IronTitan
192
269
  post_body = nil
193
270
 
194
271
  auth_names = []
195
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
272
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
196
273
  :header_params => header_params,
197
274
  :query_params => query_params,
198
275
  :form_params => form_params,
@@ -200,7 +277,7 @@ module IronTitan
200
277
  :auth_names => auth_names,
201
278
  :return_type => 'JobWrapper')
202
279
  if @api_client.config.debugging
203
- @api_client.config.logger.debug "API called: JobsApi#job_id_cancel_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
280
+ @api_client.config.logger.debug "API called: JobsApi#job_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
204
281
  end
205
282
  return data, status_code, headers
206
283
  end
@@ -209,7 +286,7 @@ module IronTitan
209
286
  # Retrieves the log from log storage.
210
287
  # @param id Job id
211
288
  # @param [Hash] opts the optional parameters
212
- # @return [Log]
289
+ # @return [String]
213
290
  def job_id_log_get(id, opts = {})
214
291
  data, status_code, headers = job_id_log_get_with_http_info(id, opts)
215
292
  return data
@@ -219,7 +296,7 @@ module IronTitan
219
296
  # Retrieves the log from log storage.
220
297
  # @param id Job id
221
298
  # @param [Hash] opts the optional parameters
222
- # @return [Array<(Log, Fixnum, Hash)>] Log data, response status code and response headers
299
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
223
300
  def job_id_log_get_with_http_info(id, opts = {})
224
301
  if @api_client.config.debugging
225
302
  @api_client.config.logger.debug "Calling API: JobsApi#job_id_log_get ..."
@@ -238,7 +315,7 @@ module IronTitan
238
315
  header_params = {}
239
316
 
240
317
  # HTTP header 'Accept' (if needed)
241
- _header_accept = ['application/json']
318
+ _header_accept = ['text/plain']
242
319
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
243
320
 
244
321
  # HTTP header 'Content-Type'
@@ -258,7 +335,7 @@ module IronTitan
258
335
  :form_params => form_params,
259
336
  :body => post_body,
260
337
  :auth_names => auth_names,
261
- :return_type => 'Log')
338
+ :return_type => 'String')
262
339
  if @api_client.config.debugging
263
340
  @api_client.config.logger.debug "API called: JobsApi#job_id_log_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
264
341
  end
@@ -266,7 +343,7 @@ module IronTitan
266
343
  end
267
344
 
268
345
  # Retry a job.
269
- # If a job fails, you can retry the job with the original payload.
346
+ # The /retry endpoint can be used to force a retry of jobs with status succeeded or cancelled. It can also be used to retry jobs that in the failed state, but whose max_retries field is 0. The retried job will continue to have max_retries = 0.
270
347
  # @param id Job id
271
348
  # @param [Hash] opts the optional parameters
272
349
  # @return [JobWrapper]
@@ -276,7 +353,7 @@ module IronTitan
276
353
  end
277
354
 
278
355
  # Retry a job.
279
- # If a job fails, you can retry the job with the original payload.
356
+ # The /retry endpoint can be used to force a retry of jobs with status succeeded or cancelled. It can also be used to retry jobs that in the failed state, but whose max_retries field is 0. The retried job will continue to have max_retries = 0.
280
357
  # @param id Job id
281
358
  # @param [Hash] opts the optional parameters
282
359
  # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers
@@ -325,28 +402,153 @@ module IronTitan
325
402
  return data, status_code, headers
326
403
  end
327
404
 
405
+ # Mark job as succeeded.
406
+ # Job status is changed to succeeded if it was in a valid state before. Job's `completed_at` time is initialized.
407
+ # @param id Job id
408
+ # @param log Output log for the job. Content-Type must be \&quot;text/plain; charset=utf-8\&quot;.
409
+ # @param [Hash] opts the optional parameters
410
+ # @return [JobWrapper]
411
+ def job_id_success_post(id, log, opts = {})
412
+ data, status_code, headers = job_id_success_post_with_http_info(id, log, opts)
413
+ return data
414
+ end
415
+
416
+ # Mark job as succeeded.
417
+ # Job status is changed to succeeded if it was in a valid state before. Job&#39;s `completed_at` time is initialized.
418
+ # @param id Job id
419
+ # @param log Output log for the job. Content-Type must be \&quot;text/plain; charset=utf-8\&quot;.
420
+ # @param [Hash] opts the optional parameters
421
+ # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers
422
+ def job_id_success_post_with_http_info(id, log, opts = {})
423
+ if @api_client.config.debugging
424
+ @api_client.config.logger.debug "Calling API: JobsApi#job_id_success_post ..."
425
+ end
426
+
427
+ # verify the required parameter 'id' is set
428
+ fail "Missing the required parameter 'id' when calling job_id_success_post" if id.nil?
429
+
430
+ # verify the required parameter 'log' is set
431
+ fail "Missing the required parameter 'log' when calling job_id_success_post" if log.nil?
432
+
433
+ # resource path
434
+ local_var_path = "/job/{id}/success".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
435
+
436
+ # query parameters
437
+ query_params = {}
438
+
439
+ # header parameters
440
+ header_params = {}
441
+
442
+ # HTTP header 'Accept' (if needed)
443
+ _header_accept = ['application/json']
444
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
445
+
446
+ # HTTP header 'Content-Type'
447
+ _header_content_type = ['multipart/form-data']
448
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
449
+
450
+ # form parameters
451
+ form_params = {}
452
+ form_params["log"] = log
453
+
454
+ # http body (model)
455
+ post_body = nil
456
+
457
+ auth_names = []
458
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
459
+ :header_params => header_params,
460
+ :query_params => query_params,
461
+ :form_params => form_params,
462
+ :body => post_body,
463
+ :auth_names => auth_names,
464
+ :return_type => 'JobWrapper')
465
+ if @api_client.config.debugging
466
+ @api_client.config.logger.debug "API called: JobsApi#job_id_success_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
467
+ end
468
+ return data, status_code, headers
469
+ end
470
+
471
+ # Extend job timeout.
472
+ # Consumers can sometimes take a while to run the task after accepting it. An example is when the runner does not have the docker image locally, it can spend a significant time downloading the image.\nIf the timeout is small, the job may never get to run, or run but not be accepted by Titan. Consumers can touch the job before it times out. Titan will reset the timeout, giving the consumer another timeout seconds to run the job.\nTouch is only valid while the job is in a running state. If touch fails, the runner may stop running the job.
473
+ # @param id Job id
474
+ # @param [Hash] opts the optional parameters
475
+ # @return [nil]
476
+ def job_id_touch_post(id, opts = {})
477
+ job_id_touch_post_with_http_info(id, opts)
478
+ return nil
479
+ end
480
+
481
+ # Extend job timeout.
482
+ # Consumers can sometimes take a while to run the task after accepting it. An example is when the runner does not have the docker image locally, it can spend a significant time downloading the image.\nIf the timeout is small, the job may never get to run, or run but not be accepted by Titan. Consumers can touch the job before it times out. Titan will reset the timeout, giving the consumer another timeout seconds to run the job.\nTouch is only valid while the job is in a running state. If touch fails, the runner may stop running the job.
483
+ # @param id Job id
484
+ # @param [Hash] opts the optional parameters
485
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
486
+ def job_id_touch_post_with_http_info(id, opts = {})
487
+ if @api_client.config.debugging
488
+ @api_client.config.logger.debug "Calling API: JobsApi#job_id_touch_post ..."
489
+ end
490
+
491
+ # verify the required parameter 'id' is set
492
+ fail "Missing the required parameter 'id' when calling job_id_touch_post" if id.nil?
493
+
494
+ # resource path
495
+ local_var_path = "/job/{id}/touch".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
496
+
497
+ # query parameters
498
+ query_params = {}
499
+
500
+ # header parameters
501
+ header_params = {}
502
+
503
+ # HTTP header 'Accept' (if needed)
504
+ _header_accept = ['application/json']
505
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
506
+
507
+ # HTTP header 'Content-Type'
508
+ _header_content_type = ['application/json']
509
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
510
+
511
+ # form parameters
512
+ form_params = {}
513
+
514
+ # http body (model)
515
+ post_body = nil
516
+
517
+ auth_names = []
518
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
519
+ :header_params => header_params,
520
+ :query_params => query_params,
521
+ :form_params => form_params,
522
+ :body => post_body,
523
+ :auth_names => auth_names)
524
+ if @api_client.config.debugging
525
+ @api_client.config.logger.debug "API called: JobsApi#job_id_touch_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
526
+ end
527
+ return data, status_code, headers
528
+ end
529
+
328
530
  # Get next job.
329
- # Gets the next job in the queue, ready for processing.
531
+ # Gets the next job in the queue, ready for processing. Titan may return <=n jobs. Consumers should start processing jobs in order. Each returned job is set to `status` \"running\" and `started_at` is set to the current time. No other consumer can retrieve this job.
330
532
  # @param [Hash] opts the optional parameters
331
- # @option opts [Integer] :n Number of jobs to return.
533
+ # @option opts [Integer] :n Number of jobs to return. (default to 1)
332
534
  # @return [JobsWrapper]
333
- def jobs_get(opts = {})
334
- data, status_code, headers = jobs_get_with_http_info(opts)
535
+ def jobs_consume_get(opts = {})
536
+ data, status_code, headers = jobs_consume_get_with_http_info(opts)
335
537
  return data
336
538
  end
337
539
 
338
540
  # Get next job.
339
- # Gets the next job in the queue, ready for processing.
541
+ # Gets the next job in the queue, ready for processing. Titan may return &lt;=n jobs. Consumers should start processing jobs in order. Each returned job is set to `status` \&quot;running\&quot; and `started_at` is set to the current time. No other consumer can retrieve this job.
340
542
  # @param [Hash] opts the optional parameters
341
543
  # @option opts [Integer] :n Number of jobs to return.
342
544
  # @return [Array<(JobsWrapper, Fixnum, Hash)>] JobsWrapper data, response status code and response headers
343
- def jobs_get_with_http_info(opts = {})
545
+ def jobs_consume_get_with_http_info(opts = {})
344
546
  if @api_client.config.debugging
345
- @api_client.config.logger.debug "Calling API: JobsApi#jobs_get ..."
547
+ @api_client.config.logger.debug "Calling API: JobsApi#jobs_consume_get ..."
346
548
  end
347
549
 
348
550
  # resource path
349
- local_var_path = "/jobs".sub('{format}','json')
551
+ local_var_path = "/jobs/consume".sub('{format}','json')
350
552
 
351
553
  # query parameters
352
554
  query_params = {}
@@ -378,39 +580,37 @@ module IronTitan
378
580
  :auth_names => auth_names,
379
581
  :return_type => 'JobsWrapper')
380
582
  if @api_client.config.debugging
381
- @api_client.config.logger.debug "API called: JobsApi#jobs_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
583
+ @api_client.config.logger.debug "API called: JobsApi#jobs_consume_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
382
584
  end
383
585
  return data, status_code, headers
384
586
  end
385
587
 
386
- # Enqueue Job
387
- # Enqueues a job.
388
- # @param body Array of jobs to post.
588
+ # Peek at list of jobs.
589
+ # Get a list of active jobs. This endpoint can be used to observe the state of jobs in Titan. To run a job, use /jobs/consume. TODO: Needs pagination support.
389
590
  # @param [Hash] opts the optional parameters
591
+ # @option opts [Integer] :n Number of jobs to return. Titan may return &lt;=n jobs. Titan does not make any guarantees about job ordering, but jobs will not be repeated. To make sure you get unique jobs, use the cursor effectively. TODO: We don&#39;t actually support pagination. (default to 10)
390
592
  # @return [JobsWrapper]
391
- def jobs_post(body, opts = {})
392
- data, status_code, headers = jobs_post_with_http_info(body, opts)
593
+ def jobs_get(opts = {})
594
+ data, status_code, headers = jobs_get_with_http_info(opts)
393
595
  return data
394
596
  end
395
597
 
396
- # Enqueue Job
397
- # Enqueues a job.
398
- # @param body Array of jobs to post.
598
+ # Peek at list of jobs.
599
+ # Get a list of active jobs. This endpoint can be used to observe the state of jobs in Titan. To run a job, use /jobs/consume. TODO: Needs pagination support.
399
600
  # @param [Hash] opts the optional parameters
601
+ # @option opts [Integer] :n Number of jobs to return. Titan may return &lt;=n jobs. Titan does not make any guarantees about job ordering, but jobs will not be repeated. To make sure you get unique jobs, use the cursor effectively. TODO: We don&#39;t actually support pagination.
400
602
  # @return [Array<(JobsWrapper, Fixnum, Hash)>] JobsWrapper data, response status code and response headers
401
- def jobs_post_with_http_info(body, opts = {})
603
+ def jobs_get_with_http_info(opts = {})
402
604
  if @api_client.config.debugging
403
- @api_client.config.logger.debug "Calling API: JobsApi#jobs_post ..."
605
+ @api_client.config.logger.debug "Calling API: JobsApi#jobs_get ..."
404
606
  end
405
607
 
406
- # verify the required parameter 'body' is set
407
- fail "Missing the required parameter 'body' when calling jobs_post" if body.nil?
408
-
409
608
  # resource path
410
609
  local_var_path = "/jobs".sub('{format}','json')
411
610
 
412
611
  # query parameters
413
612
  query_params = {}
613
+ query_params[:'n'] = opts[:'n'] if opts[:'n']
414
614
 
415
615
  # header parameters
416
616
  header_params = {}
@@ -427,10 +627,10 @@ module IronTitan
427
627
  form_params = {}
428
628
 
429
629
  # http body (model)
430
- post_body = @api_client.object_to_http_body(body)
630
+ post_body = nil
431
631
 
432
632
  auth_names = []
433
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
633
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
434
634
  :header_params => header_params,
435
635
  :query_params => query_params,
436
636
  :form_params => form_params,
@@ -438,7 +638,7 @@ module IronTitan
438
638
  :auth_names => auth_names,
439
639
  :return_type => 'JobsWrapper')
440
640
  if @api_client.config.debugging
441
- @api_client.config.logger.debug "API called: JobsApi#jobs_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
641
+ @api_client.config.logger.debug "API called: JobsApi#jobs_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
442
642
  end
443
643
  return data, status_code, headers
444
644
  end
@@ -508,5 +708,65 @@ module IronTitan
508
708
  end
509
709
  return data, status_code, headers
510
710
  end
711
+
712
+ # Enqueue Job
713
+ # Enqueues job(s). If any of the jobs is invalid, none of the jobs are enqueued.
714
+ # @param body Array of jobs to post.
715
+ # @param [Hash] opts the optional parameters
716
+ # @return [JobsWrapper]
717
+ def jobs_post(body, opts = {})
718
+ data, status_code, headers = jobs_post_with_http_info(body, opts)
719
+ return data
720
+ end
721
+
722
+ # Enqueue Job
723
+ # Enqueues job(s). If any of the jobs is invalid, none of the jobs are enqueued.
724
+ # @param body Array of jobs to post.
725
+ # @param [Hash] opts the optional parameters
726
+ # @return [Array<(JobsWrapper, Fixnum, Hash)>] JobsWrapper data, response status code and response headers
727
+ def jobs_post_with_http_info(body, opts = {})
728
+ if @api_client.config.debugging
729
+ @api_client.config.logger.debug "Calling API: JobsApi#jobs_post ..."
730
+ end
731
+
732
+ # verify the required parameter 'body' is set
733
+ fail "Missing the required parameter 'body' when calling jobs_post" if body.nil?
734
+
735
+ # resource path
736
+ local_var_path = "/jobs".sub('{format}','json')
737
+
738
+ # query parameters
739
+ query_params = {}
740
+
741
+ # header parameters
742
+ header_params = {}
743
+
744
+ # HTTP header 'Accept' (if needed)
745
+ _header_accept = ['application/json']
746
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
747
+
748
+ # HTTP header 'Content-Type'
749
+ _header_content_type = ['application/json']
750
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
751
+
752
+ # form parameters
753
+ form_params = {}
754
+
755
+ # http body (model)
756
+ post_body = @api_client.object_to_http_body(body)
757
+
758
+ auth_names = []
759
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
760
+ :header_params => header_params,
761
+ :query_params => query_params,
762
+ :form_params => form_params,
763
+ :body => post_body,
764
+ :auth_names => auth_names,
765
+ :return_type => 'JobsWrapper')
766
+ if @api_client.config.debugging
767
+ @api_client.config.logger.debug "API called: JobsApi#jobs_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
768
+ end
769
+ return data, status_code, headers
770
+ end
511
771
  end
512
772
  end
@@ -3,7 +3,7 @@ Titan API
3
3
 
4
4
  The ultimate, language agnostic, container based job processing framework.
5
5
 
6
- OpenAPI spec version: 0.1.1
6
+ OpenAPI spec version: 0.2.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
 
@@ -29,7 +29,7 @@ module IronTitan
29
29
 
30
30
  def initialize(config = Configuration.default)
31
31
  @config = config
32
- @user_agent = "ruby-swagger-#{VERSION}"
32
+ @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
33
33
  @default_headers = {
34
34
  'Content-Type' => "application/json",
35
35
  'User-Agent' => @user_agent
@@ -3,7 +3,7 @@ Titan API
3
3
 
4
4
  The ultimate, language agnostic, container based job processing framework.
5
5
 
6
- OpenAPI spec version: 0.1.1
6
+ OpenAPI spec version: 0.2.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9