iron_titan 0.3.10 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +201 -0
- data/README.md +6 -5
- data/lib/iron_titan/api/groups_api.rb +34 -31
- data/lib/iron_titan/api/jobs_api.rb +140 -182
- data/lib/iron_titan/api/runner_api.rb +43 -47
- data/lib/iron_titan/api_client.rb +48 -8
- data/lib/iron_titan/api_error.rb +12 -1
- data/lib/iron_titan/configuration.rb +23 -0
- data/lib/iron_titan/models/complete.rb +63 -27
- data/lib/iron_titan/models/error.rb +59 -21
- data/lib/iron_titan/models/error_body.rb +61 -24
- data/lib/iron_titan/models/group.rb +112 -28
- data/lib/iron_titan/models/group_wrapper.rb +60 -21
- data/lib/iron_titan/models/groups_wrapper.rb +60 -21
- data/lib/iron_titan/models/id_status.rb +89 -28
- data/lib/iron_titan/models/job.rb +168 -90
- data/lib/iron_titan/models/job_wrapper.rb +60 -21
- data/lib/iron_titan/models/jobs_wrapper.rb +62 -24
- data/lib/iron_titan/models/new_job.rb +91 -42
- data/lib/iron_titan/models/new_jobs_wrapper.rb +60 -21
- data/lib/iron_titan/models/start.rb +59 -21
- data/lib/iron_titan/version.rb +13 -2
- data/lib/iron_titan.rb +12 -1
- data/spec/api/groups_api_spec.rb +16 -17
- data/spec/api/jobs_api_spec.rb +37 -78
- data/spec/api/runner_api_spec.rb +20 -21
- data/spec/api_client_spec.rb +296 -0
- data/spec/configuration_spec.rb +48 -0
- data/spec/models/complete_spec.rb +16 -17
- data/spec/models/error_body_spec.rb +15 -12
- data/spec/models/error_spec.rb +14 -7
- data/spec/models/group_spec.rb +33 -12
- data/spec/models/group_wrapper_spec.rb +14 -7
- data/spec/models/groups_wrapper_spec.rb +14 -7
- data/spec/models/id_status_spec.rb +18 -12
- data/spec/models/job_spec.rb +43 -88
- data/spec/models/job_wrapper_spec.rb +14 -7
- data/spec/models/jobs_wrapper_spec.rb +15 -12
- data/spec/models/new_job_spec.rb +20 -37
- data/spec/models/new_jobs_wrapper_spec.rb +14 -7
- data/spec/models/start_spec.rb +14 -7
- data/spec/spec_helper.rb +122 -0
- metadata +9 -2
@@ -3,18 +3,30 @@ Titan API
|
|
3
3
|
|
4
4
|
The ultimate, language agnostic, container based job processing framework.
|
5
5
|
|
6
|
-
OpenAPI spec version: 0.
|
6
|
+
OpenAPI spec version: 0.4.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
10
21
|
|
11
22
|
=end
|
12
23
|
|
13
24
|
require 'date'
|
14
25
|
|
15
26
|
module IronTitan
|
27
|
+
|
16
28
|
class Job
|
17
|
-
# Name of image to use.
|
29
|
+
# Name of Docker image to use. This is optional and can be used to override the image defined at the group level.
|
18
30
|
attr_accessor :image
|
19
31
|
|
20
32
|
# Payload for the job. This is what you pass into each job to make it do something.
|
@@ -23,13 +35,13 @@ module IronTitan
|
|
23
35
|
# Number of seconds to wait before queueing the job for consumption for the first time. Must be a positive integer. Jobs with a delay start in state \"delayed\" and transition to \"running\" after delay seconds.
|
24
36
|
attr_accessor :delay
|
25
37
|
|
26
|
-
# Maximum runtime in seconds. If a consumer retrieves the
|
38
|
+
# Maximum runtime in seconds. If a consumer retrieves the job, but does not change it's status within timeout seconds, the job is considered failed, with reason timeout (Titan may allow a small grace period). The consumer should also kill the job after timeout seconds. If a consumer tries to change status after Titan has already timed out the job, the consumer will be ignored.
|
27
39
|
attr_accessor :timeout
|
28
40
|
|
29
41
|
# Priority of the job. Higher has more priority. 3 levels from 0-2. Jobs at same priority are processed in FIFO order.
|
30
42
|
attr_accessor :priority
|
31
43
|
|
32
|
-
# \"Number of automatic retries this job is allowed. A retry will be attempted if a task fails. Max 25. Automatic retries are performed by titan when a task reaches a failed state and has `max_retries` > 0. A retry is performed by queueing a new job with the same image id and payload. The new job's max_retries is one less than the original. The new job's `retry_of` field is set to the original Job ID. Titan will delay the new job for retries_delay seconds before queueing it. Cancelled or successful tasks are never automatically retried.\"
|
44
|
+
# \"Number of automatic retries this job is allowed. A retry will be attempted if a task fails. Max 25. Automatic retries are performed by titan when a task reaches a failed state and has `max_retries` > 0. A retry is performed by queueing a new job with the same image id and payload. The new job's max_retries is one less than the original. The new job's `retry_of` field is set to the original Job ID. Titan will delay the new job for retries_delay seconds before queueing it. Cancelled or successful tasks are never automatically retried.\"
|
33
45
|
attr_accessor :max_retries
|
34
46
|
|
35
47
|
# Time in seconds to wait before retrying the job. Must be a non-negative integer.
|
@@ -38,16 +50,16 @@ module IronTitan
|
|
38
50
|
# Unique identifier representing a specific job.
|
39
51
|
attr_accessor :id
|
40
52
|
|
41
|
-
# States and valid transitions
|
53
|
+
# States and valid transitions. +---------+ +---------> delayed <----------------+ +----+----+ | | | | | +----v----+ | +---------> queued <----------------+ +----+----+ * | * | retry * creates new job +----v----+ * | running | * +--+-+-+--+ | +---------|-|-|-----+-------------+ +---|---------+ | +-----|---------+ | | | | | | | +-----v---^-+ +--v-------^+ +--v---^-+ | success | | cancelled | | error | +-----------+ +-----------+ +--------+ * delayed - has a delay. * queued - Ready to be consumed when it's turn comes. * running - Currently consumed by a runner which will attempt to process it. * success - (or complete? success/error is common javascript terminology) * error - Something went wrong. In this case more information can be obtained by inspecting the \"reason\" field. - timeout - killed - forcibly killed by worker due to resource restrictions or access violations. - bad_exit - exited with non-zero status due to program termination/crash. * cancelled - cancelled via API. More information in the reason field. - client_request - Request was cancelled by a client.
|
42
54
|
attr_accessor :status
|
43
55
|
|
44
|
-
# Group this job belongs to.
|
45
|
-
attr_accessor :
|
56
|
+
# Group this job belongs to.
|
57
|
+
attr_accessor :group_name
|
46
58
|
|
47
59
|
# The error message, if status is 'error'. This is errors due to things outside the job itself. Errors from user code will be found in the log.
|
48
60
|
attr_accessor :error
|
49
61
|
|
50
|
-
# Machine usable reason for job being in this state
|
62
|
+
# Machine usable reason for job being in this state. Valid values for error status are `timeout | killed | bad_exit`. Valid values for cancelled status are `client_request`. For everything else, this is undefined.
|
51
63
|
attr_accessor :reason
|
52
64
|
|
53
65
|
# Time when job was submitted. Always in UTC.
|
@@ -65,44 +77,52 @@ module IronTitan
|
|
65
77
|
# If this field is set, then this job was retried by the job referenced in this field.
|
66
78
|
attr_accessor :retry_at
|
67
79
|
|
80
|
+
# Env vars for the task. Comes from the ones set on the Group.
|
81
|
+
attr_accessor :env_vars
|
82
|
+
|
83
|
+
class EnumAttributeValidator
|
84
|
+
attr_reader :datatype
|
85
|
+
attr_reader :allowable_values
|
86
|
+
|
87
|
+
def initialize(datatype, allowable_values)
|
88
|
+
@allowable_values = allowable_values.map do |value|
|
89
|
+
case datatype.to_s
|
90
|
+
when /Integer/i
|
91
|
+
value.to_i
|
92
|
+
when /Float/i
|
93
|
+
value.to_f
|
94
|
+
else
|
95
|
+
value
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def valid?(value)
|
101
|
+
!value || allowable_values.include?(value)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
68
105
|
# Attribute mapping from ruby-style variable name to JSON key.
|
69
106
|
def self.attribute_map
|
70
107
|
{
|
71
|
-
|
72
108
|
:'image' => :'image',
|
73
|
-
|
74
109
|
:'payload' => :'payload',
|
75
|
-
|
76
110
|
:'delay' => :'delay',
|
77
|
-
|
78
111
|
:'timeout' => :'timeout',
|
79
|
-
|
80
112
|
:'priority' => :'priority',
|
81
|
-
|
82
113
|
:'max_retries' => :'max_retries',
|
83
|
-
|
84
114
|
:'retries_delay' => :'retries_delay',
|
85
|
-
|
86
115
|
:'id' => :'id',
|
87
|
-
|
88
116
|
:'status' => :'status',
|
89
|
-
|
90
|
-
:'name' => :'name',
|
91
|
-
|
117
|
+
:'group_name' => :'group_name',
|
92
118
|
:'error' => :'error',
|
93
|
-
|
94
119
|
:'reason' => :'reason',
|
95
|
-
|
96
120
|
:'created_at' => :'created_at',
|
97
|
-
|
98
121
|
:'started_at' => :'started_at',
|
99
|
-
|
100
122
|
:'completed_at' => :'completed_at',
|
101
|
-
|
102
123
|
:'retry_of' => :'retry_of',
|
103
|
-
|
104
|
-
:'
|
105
|
-
|
124
|
+
:'retry_at' => :'retry_at',
|
125
|
+
:'env_vars' => :'env_vars'
|
106
126
|
}
|
107
127
|
end
|
108
128
|
|
@@ -118,122 +138,166 @@ module IronTitan
|
|
118
138
|
:'retries_delay' => :'Integer',
|
119
139
|
:'id' => :'String',
|
120
140
|
:'status' => :'String',
|
121
|
-
:'
|
141
|
+
:'group_name' => :'String',
|
122
142
|
:'error' => :'String',
|
123
143
|
:'reason' => :'String',
|
124
144
|
:'created_at' => :'DateTime',
|
125
145
|
:'started_at' => :'DateTime',
|
126
146
|
:'completed_at' => :'DateTime',
|
127
147
|
:'retry_of' => :'String',
|
128
|
-
:'retry_at' => :'String'
|
129
|
-
|
148
|
+
:'retry_at' => :'String',
|
149
|
+
:'env_vars' => :'Hash<String, String>'
|
130
150
|
}
|
131
151
|
end
|
132
152
|
|
153
|
+
# Initializes the object
|
154
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
155
|
def initialize(attributes = {})
|
134
156
|
return unless attributes.is_a?(Hash)
|
135
157
|
|
136
158
|
# convert string to symbol for hash key
|
137
|
-
attributes = attributes.
|
159
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
138
160
|
|
139
|
-
|
140
|
-
if attributes[:'image']
|
161
|
+
if attributes.has_key?(:'image')
|
141
162
|
self.image = attributes[:'image']
|
142
163
|
end
|
143
|
-
|
144
|
-
if attributes
|
164
|
+
|
165
|
+
if attributes.has_key?(:'payload')
|
145
166
|
self.payload = attributes[:'payload']
|
146
167
|
end
|
147
|
-
|
148
|
-
if attributes
|
168
|
+
|
169
|
+
if attributes.has_key?(:'delay')
|
149
170
|
self.delay = attributes[:'delay']
|
150
171
|
else
|
151
172
|
self.delay = 0
|
152
173
|
end
|
153
|
-
|
154
|
-
if attributes
|
174
|
+
|
175
|
+
if attributes.has_key?(:'timeout')
|
155
176
|
self.timeout = attributes[:'timeout']
|
156
177
|
else
|
157
178
|
self.timeout = 60
|
158
179
|
end
|
159
|
-
|
160
|
-
if attributes
|
180
|
+
|
181
|
+
if attributes.has_key?(:'priority')
|
161
182
|
self.priority = attributes[:'priority']
|
162
183
|
end
|
163
|
-
|
164
|
-
if attributes
|
184
|
+
|
185
|
+
if attributes.has_key?(:'max_retries')
|
165
186
|
self.max_retries = attributes[:'max_retries']
|
166
187
|
else
|
167
188
|
self.max_retries = 0
|
168
189
|
end
|
169
|
-
|
170
|
-
if attributes
|
190
|
+
|
191
|
+
if attributes.has_key?(:'retries_delay')
|
171
192
|
self.retries_delay = attributes[:'retries_delay']
|
172
193
|
else
|
173
194
|
self.retries_delay = 60
|
174
195
|
end
|
175
|
-
|
176
|
-
if attributes
|
196
|
+
|
197
|
+
if attributes.has_key?(:'id')
|
177
198
|
self.id = attributes[:'id']
|
178
199
|
end
|
179
|
-
|
180
|
-
if attributes
|
200
|
+
|
201
|
+
if attributes.has_key?(:'status')
|
181
202
|
self.status = attributes[:'status']
|
182
203
|
end
|
183
|
-
|
184
|
-
if attributes
|
185
|
-
self.
|
204
|
+
|
205
|
+
if attributes.has_key?(:'group_name')
|
206
|
+
self.group_name = attributes[:'group_name']
|
186
207
|
end
|
187
|
-
|
188
|
-
if attributes
|
208
|
+
|
209
|
+
if attributes.has_key?(:'error')
|
189
210
|
self.error = attributes[:'error']
|
190
211
|
end
|
191
|
-
|
192
|
-
if attributes
|
212
|
+
|
213
|
+
if attributes.has_key?(:'reason')
|
193
214
|
self.reason = attributes[:'reason']
|
194
215
|
end
|
195
|
-
|
196
|
-
if attributes
|
216
|
+
|
217
|
+
if attributes.has_key?(:'created_at')
|
197
218
|
self.created_at = attributes[:'created_at']
|
198
219
|
end
|
199
|
-
|
200
|
-
if attributes
|
220
|
+
|
221
|
+
if attributes.has_key?(:'started_at')
|
201
222
|
self.started_at = attributes[:'started_at']
|
202
223
|
end
|
203
|
-
|
204
|
-
if attributes
|
224
|
+
|
225
|
+
if attributes.has_key?(:'completed_at')
|
205
226
|
self.completed_at = attributes[:'completed_at']
|
206
227
|
end
|
207
|
-
|
208
|
-
if attributes
|
228
|
+
|
229
|
+
if attributes.has_key?(:'retry_of')
|
209
230
|
self.retry_of = attributes[:'retry_of']
|
210
231
|
end
|
211
|
-
|
212
|
-
if attributes
|
232
|
+
|
233
|
+
if attributes.has_key?(:'retry_at')
|
213
234
|
self.retry_at = attributes[:'retry_at']
|
214
235
|
end
|
215
|
-
|
236
|
+
|
237
|
+
if attributes.has_key?(:'env_vars')
|
238
|
+
if (value = attributes[:'env_vars']).is_a?(Array)
|
239
|
+
self.env_vars = value
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
246
|
+
# @return Array for valid properies with the reasons
|
247
|
+
def list_invalid_properties
|
248
|
+
invalid_properties = Array.new
|
249
|
+
return invalid_properties
|
250
|
+
end
|
251
|
+
|
252
|
+
# Check to see if the all the properties in the model are valid
|
253
|
+
# @return true if the model is valid
|
254
|
+
def valid?
|
255
|
+
return false if @image.nil?
|
256
|
+
return false if @payload.to_s.length <
|
257
|
+
return false if @priority.nil?
|
258
|
+
status_validator = EnumAttributeValidator.new('String', ["delayed", "queued", "running", "success", "error", "cancelled"])
|
259
|
+
return false unless status_validator.valid?(@status)
|
260
|
+
reason_validator = EnumAttributeValidator.new('String', ["timeout", "killed", "bad_exit", "client_request"])
|
261
|
+
return false unless reason_validator.valid?(@reason)
|
262
|
+
return true
|
263
|
+
end
|
264
|
+
|
265
|
+
# Custom attribute writer method with validation
|
266
|
+
# @param [Object] payload Value to be assigned
|
267
|
+
def payload=(payload)
|
268
|
+
if payload.nil?
|
269
|
+
fail ArgumentError, "payload cannot be nil"
|
270
|
+
end
|
271
|
+
|
272
|
+
if payload.to_s.length <
|
273
|
+
fail ArgumentError, "invalid value for 'payload', the character length must be great than or equal to ."
|
274
|
+
end
|
275
|
+
|
276
|
+
@payload = payload
|
216
277
|
end
|
217
278
|
|
218
279
|
# Custom attribute writer method checking allowed values (enum).
|
280
|
+
# @param [Object] status Object to be assigned
|
219
281
|
def status=(status)
|
220
|
-
|
221
|
-
|
222
|
-
fail "invalid value for 'status', must be one of #{
|
282
|
+
validator = EnumAttributeValidator.new('String', ["delayed", "queued", "running", "success", "error", "cancelled"])
|
283
|
+
unless validator.valid?(status)
|
284
|
+
fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
|
223
285
|
end
|
224
286
|
@status = status
|
225
287
|
end
|
226
288
|
|
227
289
|
# Custom attribute writer method checking allowed values (enum).
|
290
|
+
# @param [Object] reason Object to be assigned
|
228
291
|
def reason=(reason)
|
229
|
-
|
230
|
-
|
231
|
-
fail "invalid value for 'reason', must be one of #{
|
292
|
+
validator = EnumAttributeValidator.new('String', ["timeout", "killed", "bad_exit", "client_request"])
|
293
|
+
unless validator.valid?(reason)
|
294
|
+
fail ArgumentError, "invalid value for 'reason', must be one of #{validator.allowable_values}."
|
232
295
|
end
|
233
296
|
@reason = reason
|
234
297
|
end
|
235
298
|
|
236
|
-
#
|
299
|
+
# Checks equality by comparing each attribute.
|
300
|
+
# @param [Object] Object to be compared
|
237
301
|
def ==(o)
|
238
302
|
return true if self.equal?(o)
|
239
303
|
self.class == o.class &&
|
@@ -246,46 +310,53 @@ module IronTitan
|
|
246
310
|
retries_delay == o.retries_delay &&
|
247
311
|
id == o.id &&
|
248
312
|
status == o.status &&
|
249
|
-
|
313
|
+
group_name == o.group_name &&
|
250
314
|
error == o.error &&
|
251
315
|
reason == o.reason &&
|
252
316
|
created_at == o.created_at &&
|
253
317
|
started_at == o.started_at &&
|
254
318
|
completed_at == o.completed_at &&
|
255
319
|
retry_of == o.retry_of &&
|
256
|
-
retry_at == o.retry_at
|
320
|
+
retry_at == o.retry_at &&
|
321
|
+
env_vars == o.env_vars
|
257
322
|
end
|
258
323
|
|
259
324
|
# @see the `==` method
|
325
|
+
# @param [Object] Object to be compared
|
260
326
|
def eql?(o)
|
261
327
|
self == o
|
262
328
|
end
|
263
329
|
|
264
|
-
#
|
330
|
+
# Calculates hash code according to all attributes.
|
331
|
+
# @return [Fixnum] Hash code
|
265
332
|
def hash
|
266
|
-
[image, payload, delay, timeout, priority, max_retries, retries_delay, id, status,
|
333
|
+
[image, payload, delay, timeout, priority, max_retries, retries_delay, id, status, group_name, error, reason, created_at, started_at, completed_at, retry_of, retry_at, env_vars].hash
|
267
334
|
end
|
268
335
|
|
269
|
-
#
|
336
|
+
# Builds the object from hash
|
337
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
338
|
+
# @return [Object] Returns the model itself
|
270
339
|
def build_from_hash(attributes)
|
271
340
|
return nil unless attributes.is_a?(Hash)
|
272
341
|
self.class.swagger_types.each_pair do |key, type|
|
273
342
|
if type =~ /^Array<(.*)>/i
|
343
|
+
# check to ensure the input is an array given that the the attribute
|
344
|
+
# is documented as an array but the input is not
|
274
345
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
275
346
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
276
|
-
else
|
277
|
-
#TODO show warning in debug mode
|
278
347
|
end
|
279
348
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
280
349
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
281
|
-
else
|
282
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
283
|
-
end
|
350
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
284
351
|
end
|
285
352
|
|
286
353
|
self
|
287
354
|
end
|
288
355
|
|
356
|
+
# Deserializes the data based on type
|
357
|
+
# @param string type Data type
|
358
|
+
# @param string value Value to be deserialized
|
359
|
+
# @return [Object] Deserialized data
|
289
360
|
def _deserialize(type, value)
|
290
361
|
case type.to_sym
|
291
362
|
when :DateTime
|
@@ -319,21 +390,25 @@ module IronTitan
|
|
319
390
|
end
|
320
391
|
end
|
321
392
|
else # model
|
322
|
-
|
323
|
-
|
393
|
+
temp_model = IronTitan.const_get(type).new
|
394
|
+
temp_model.build_from_hash(value)
|
324
395
|
end
|
325
396
|
end
|
326
397
|
|
398
|
+
# Returns the string representation of the object
|
399
|
+
# @return [String] String presentation of the object
|
327
400
|
def to_s
|
328
401
|
to_hash.to_s
|
329
402
|
end
|
330
403
|
|
331
|
-
# to_body is an alias to
|
404
|
+
# to_body is an alias to to_hash (backward compatibility)
|
405
|
+
# @return [Hash] Returns the object in the form of hash
|
332
406
|
def to_body
|
333
407
|
to_hash
|
334
408
|
end
|
335
409
|
|
336
|
-
#
|
410
|
+
# Returns the object in the form of hash
|
411
|
+
# @return [Hash] Returns the object in the form of hash
|
337
412
|
def to_hash
|
338
413
|
hash = {}
|
339
414
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -344,8 +419,10 @@ module IronTitan
|
|
344
419
|
hash
|
345
420
|
end
|
346
421
|
|
347
|
-
#
|
422
|
+
# Outputs non-array value in the form of hash
|
348
423
|
# For object, use to_hash. Otherwise, just return the value
|
424
|
+
# @param [Object] value Any valid value
|
425
|
+
# @return [Hash] Returns the value in the form of hash
|
349
426
|
def _to_hash(value)
|
350
427
|
if value.is_a?(Array)
|
351
428
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -361,4 +438,5 @@ module IronTitan
|
|
361
438
|
end
|
362
439
|
|
363
440
|
end
|
441
|
+
|
364
442
|
end
|
@@ -3,25 +3,36 @@ Titan API
|
|
3
3
|
|
4
4
|
The ultimate, language agnostic, container based job processing framework.
|
5
5
|
|
6
|
-
OpenAPI spec version: 0.
|
6
|
+
OpenAPI spec version: 0.4.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
10
21
|
|
11
22
|
=end
|
12
23
|
|
13
24
|
require 'date'
|
14
25
|
|
15
26
|
module IronTitan
|
27
|
+
|
16
28
|
class JobWrapper
|
17
29
|
attr_accessor :job
|
18
30
|
|
31
|
+
|
19
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
20
33
|
def self.attribute_map
|
21
34
|
{
|
22
|
-
|
23
35
|
:'job' => :'job'
|
24
|
-
|
25
36
|
}
|
26
37
|
end
|
27
38
|
|
@@ -29,24 +40,39 @@ module IronTitan
|
|
29
40
|
def self.swagger_types
|
30
41
|
{
|
31
42
|
:'job' => :'Job'
|
32
|
-
|
33
43
|
}
|
34
44
|
end
|
35
45
|
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
36
48
|
def initialize(attributes = {})
|
37
49
|
return unless attributes.is_a?(Hash)
|
38
50
|
|
39
51
|
# convert string to symbol for hash key
|
40
|
-
attributes = attributes.
|
52
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
41
53
|
|
42
|
-
|
43
|
-
if attributes[:'job']
|
54
|
+
if attributes.has_key?(:'job')
|
44
55
|
self.job = attributes[:'job']
|
45
56
|
end
|
46
|
-
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
61
|
+
# @return Array for valid properies with the reasons
|
62
|
+
def list_invalid_properties
|
63
|
+
invalid_properties = Array.new
|
64
|
+
return invalid_properties
|
65
|
+
end
|
66
|
+
|
67
|
+
# Check to see if the all the properties in the model are valid
|
68
|
+
# @return true if the model is valid
|
69
|
+
def valid?
|
70
|
+
return false if @job.nil?
|
71
|
+
return true
|
47
72
|
end
|
48
73
|
|
49
|
-
#
|
74
|
+
# Checks equality by comparing each attribute.
|
75
|
+
# @param [Object] Object to be compared
|
50
76
|
def ==(o)
|
51
77
|
return true if self.equal?(o)
|
52
78
|
self.class == o.class &&
|
@@ -54,35 +80,41 @@ module IronTitan
|
|
54
80
|
end
|
55
81
|
|
56
82
|
# @see the `==` method
|
83
|
+
# @param [Object] Object to be compared
|
57
84
|
def eql?(o)
|
58
85
|
self == o
|
59
86
|
end
|
60
87
|
|
61
|
-
#
|
88
|
+
# Calculates hash code according to all attributes.
|
89
|
+
# @return [Fixnum] Hash code
|
62
90
|
def hash
|
63
91
|
[job].hash
|
64
92
|
end
|
65
93
|
|
66
|
-
#
|
94
|
+
# Builds the object from hash
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
# @return [Object] Returns the model itself
|
67
97
|
def build_from_hash(attributes)
|
68
98
|
return nil unless attributes.is_a?(Hash)
|
69
99
|
self.class.swagger_types.each_pair do |key, type|
|
70
100
|
if type =~ /^Array<(.*)>/i
|
101
|
+
# check to ensure the input is an array given that the the attribute
|
102
|
+
# is documented as an array but the input is not
|
71
103
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
72
104
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
73
|
-
else
|
74
|
-
#TODO show warning in debug mode
|
75
105
|
end
|
76
106
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
77
107
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
78
|
-
else
|
79
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
80
|
-
end
|
108
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
81
109
|
end
|
82
110
|
|
83
111
|
self
|
84
112
|
end
|
85
113
|
|
114
|
+
# Deserializes the data based on type
|
115
|
+
# @param string type Data type
|
116
|
+
# @param string value Value to be deserialized
|
117
|
+
# @return [Object] Deserialized data
|
86
118
|
def _deserialize(type, value)
|
87
119
|
case type.to_sym
|
88
120
|
when :DateTime
|
@@ -116,21 +148,25 @@ module IronTitan
|
|
116
148
|
end
|
117
149
|
end
|
118
150
|
else # model
|
119
|
-
|
120
|
-
|
151
|
+
temp_model = IronTitan.const_get(type).new
|
152
|
+
temp_model.build_from_hash(value)
|
121
153
|
end
|
122
154
|
end
|
123
155
|
|
156
|
+
# Returns the string representation of the object
|
157
|
+
# @return [String] String presentation of the object
|
124
158
|
def to_s
|
125
159
|
to_hash.to_s
|
126
160
|
end
|
127
161
|
|
128
|
-
# to_body is an alias to
|
162
|
+
# to_body is an alias to to_hash (backward compatibility)
|
163
|
+
# @return [Hash] Returns the object in the form of hash
|
129
164
|
def to_body
|
130
165
|
to_hash
|
131
166
|
end
|
132
167
|
|
133
|
-
#
|
168
|
+
# Returns the object in the form of hash
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
134
170
|
def to_hash
|
135
171
|
hash = {}
|
136
172
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -141,8 +177,10 @@ module IronTitan
|
|
141
177
|
hash
|
142
178
|
end
|
143
179
|
|
144
|
-
#
|
180
|
+
# Outputs non-array value in the form of hash
|
145
181
|
# For object, use to_hash. Otherwise, just return the value
|
182
|
+
# @param [Object] value Any valid value
|
183
|
+
# @return [Hash] Returns the value in the form of hash
|
146
184
|
def _to_hash(value)
|
147
185
|
if value.is_a?(Array)
|
148
186
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -158,4 +196,5 @@ module IronTitan
|
|
158
196
|
end
|
159
197
|
|
160
198
|
end
|
199
|
+
|
161
200
|
end
|