cloudreactor_api_client 0.1.0.pre

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.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +92 -0
  4. data/cloudreactor_api_client.md +226 -0
  5. data/lib/cloudreactor_api_client/api/alert_methods_api.rb +482 -0
  6. data/lib/cloudreactor_api_client/api/email_notification_profiles_api.rb +482 -0
  7. data/lib/cloudreactor_api_client/api/pagerduty_profiles_api.rb +482 -0
  8. data/lib/cloudreactor_api_client/api/run_environments_api.rb +479 -0
  9. data/lib/cloudreactor_api_client/api/task_executions_api.rb +409 -0
  10. data/lib/cloudreactor_api_client/api/tasks_api.rb +412 -0
  11. data/lib/cloudreactor_api_client/api/workflow_executions_api.rb +549 -0
  12. data/lib/cloudreactor_api_client/api/workflow_task_instances_api.rb +424 -0
  13. data/lib/cloudreactor_api_client/api/workflow_transitions_api.rb +406 -0
  14. data/lib/cloudreactor_api_client/api/workflows_api.rb +482 -0
  15. data/lib/cloudreactor_api_client/api_client.rb +390 -0
  16. data/lib/cloudreactor_api_client/api_error.rb +57 -0
  17. data/lib/cloudreactor_api_client/configuration.rb +277 -0
  18. data/lib/cloudreactor_api_client/models/alert_method.rb +449 -0
  19. data/lib/cloudreactor_api_client/models/aws_ecs_execution_method.rb +517 -0
  20. data/lib/cloudreactor_api_client/models/aws_ecs_execution_method_capability.rb +565 -0
  21. data/lib/cloudreactor_api_client/models/aws_ecs_launch_type.rb +37 -0
  22. data/lib/cloudreactor_api_client/models/aws_ecs_run_environment_execution_method_capability.rb +476 -0
  23. data/lib/cloudreactor_api_client/models/aws_ecs_service_load_balancer_details.rb +307 -0
  24. data/lib/cloudreactor_api_client/models/aws_ecs_service_options.rb +308 -0
  25. data/lib/cloudreactor_api_client/models/current_service_info.rb +255 -0
  26. data/lib/cloudreactor_api_client/models/email_notification_profile.rb +454 -0
  27. data/lib/cloudreactor_api_client/models/execution_method_capability.rb +54 -0
  28. data/lib/cloudreactor_api_client/models/failure_behavior_enum.rb +38 -0
  29. data/lib/cloudreactor_api_client/models/group.rb +268 -0
  30. data/lib/cloudreactor_api_client/models/link.rb +301 -0
  31. data/lib/cloudreactor_api_client/models/name_and_uuid.rb +236 -0
  32. data/lib/cloudreactor_api_client/models/notification_severity.rb +39 -0
  33. data/lib/cloudreactor_api_client/models/pager_duty_profile.rb +484 -0
  34. data/lib/cloudreactor_api_client/models/paginated_alert_method_list.rb +247 -0
  35. data/lib/cloudreactor_api_client/models/paginated_email_notification_profile_list.rb +247 -0
  36. data/lib/cloudreactor_api_client/models/paginated_pager_duty_profile_list.rb +247 -0
  37. data/lib/cloudreactor_api_client/models/paginated_run_environment_list.rb +247 -0
  38. data/lib/cloudreactor_api_client/models/paginated_task_execution_list.rb +247 -0
  39. data/lib/cloudreactor_api_client/models/paginated_task_list.rb +247 -0
  40. data/lib/cloudreactor_api_client/models/paginated_workflow_execution_summary_list.rb +247 -0
  41. data/lib/cloudreactor_api_client/models/paginated_workflow_summary_list.rb +247 -0
  42. data/lib/cloudreactor_api_client/models/paginated_workflow_task_instance_list.rb +247 -0
  43. data/lib/cloudreactor_api_client/models/paginated_workflow_transition_list.rb +247 -0
  44. data/lib/cloudreactor_api_client/models/patched_alert_method.rb +405 -0
  45. data/lib/cloudreactor_api_client/models/patched_email_notification_profile.rb +415 -0
  46. data/lib/cloudreactor_api_client/models/patched_pager_duty_profile.rb +436 -0
  47. data/lib/cloudreactor_api_client/models/patched_run_environment.rb +511 -0
  48. data/lib/cloudreactor_api_client/models/patched_task.rb +897 -0
  49. data/lib/cloudreactor_api_client/models/patched_task_execution.rb +1904 -0
  50. data/lib/cloudreactor_api_client/models/patched_workflow.rb +507 -0
  51. data/lib/cloudreactor_api_client/models/patched_workflow_execution.rb +559 -0
  52. data/lib/cloudreactor_api_client/models/patched_workflow_task_instance.rb +676 -0
  53. data/lib/cloudreactor_api_client/models/patched_workflow_transition.rb +432 -0
  54. data/lib/cloudreactor_api_client/models/propagate_tags_enum.rb +37 -0
  55. data/lib/cloudreactor_api_client/models/rule_type_enum.rb +43 -0
  56. data/lib/cloudreactor_api_client/models/run_environment.rb +555 -0
  57. data/lib/cloudreactor_api_client/models/start_transition_condition_enum.rb +39 -0
  58. data/lib/cloudreactor_api_client/models/stop_reason_enum.rb +42 -0
  59. data/lib/cloudreactor_api_client/models/task.rb +941 -0
  60. data/lib/cloudreactor_api_client/models/task_execution.rb +1954 -0
  61. data/lib/cloudreactor_api_client/models/task_execution_status.rb +46 -0
  62. data/lib/cloudreactor_api_client/models/threshold_property_enum.rb +39 -0
  63. data/lib/cloudreactor_api_client/models/timeout_behavior_enum.rb +40 -0
  64. data/lib/cloudreactor_api_client/models/unknown_execution_method_capability.rb +238 -0
  65. data/lib/cloudreactor_api_client/models/workflow.rb +556 -0
  66. data/lib/cloudreactor_api_client/models/workflow_execution.rb +629 -0
  67. data/lib/cloudreactor_api_client/models/workflow_execution_status.rb +42 -0
  68. data/lib/cloudreactor_api_client/models/workflow_execution_summary.rb +523 -0
  69. data/lib/cloudreactor_api_client/models/workflow_summary.rb +513 -0
  70. data/lib/cloudreactor_api_client/models/workflow_task_instance.rb +715 -0
  71. data/lib/cloudreactor_api_client/models/workflow_task_instance_execution.rb +280 -0
  72. data/lib/cloudreactor_api_client/models/workflow_task_instance_execution_base.rb +270 -0
  73. data/lib/cloudreactor_api_client/models/workflow_transition.rb +467 -0
  74. data/lib/cloudreactor_api_client/models/workflow_transition_evaluation.rb +280 -0
  75. data/lib/cloudreactor_api_client/version.rb +15 -0
  76. data/lib/cloudreactor_api_client.rb +121 -0
  77. data/lib/cloudreactor_wrapper_io/status_updater.rb +124 -0
  78. data/lib/cloudreactor_wrapper_io.rb +13 -0
  79. data/spec/api/alert_methods_api_spec.rb +114 -0
  80. data/spec/api/email_notification_profiles_api_spec.rb +114 -0
  81. data/spec/api/pagerduty_profiles_api_spec.rb +114 -0
  82. data/spec/api/run_environments_api_spec.rb +113 -0
  83. data/spec/api/task_executions_api_spec.rb +102 -0
  84. data/spec/api/tasks_api_spec.rb +103 -0
  85. data/spec/api/workflow_executions_api_spec.rb +124 -0
  86. data/spec/api/workflow_task_instances_api_spec.rb +107 -0
  87. data/spec/api/workflow_transitions_api_spec.rb +101 -0
  88. data/spec/api/workflows_api_spec.rb +114 -0
  89. data/spec/api_client_spec.rb +226 -0
  90. data/spec/configuration_spec.rb +42 -0
  91. data/spec/integration/task_execution_integration_spec.rb +51 -0
  92. data/spec/models/alert_method_spec.rb +136 -0
  93. data/spec/models/aws_ecs_execution_method_capability_spec.rb +166 -0
  94. data/spec/models/aws_ecs_execution_method_spec.rb +148 -0
  95. data/spec/models/aws_ecs_launch_type_spec.rb +28 -0
  96. data/spec/models/aws_ecs_run_environment_execution_method_capability_spec.rb +130 -0
  97. data/spec/models/aws_ecs_service_load_balancer_details_spec.rb +46 -0
  98. data/spec/models/aws_ecs_service_options_spec.rb +88 -0
  99. data/spec/models/current_service_info_spec.rb +52 -0
  100. data/spec/models/email_notification_profile_spec.rb +118 -0
  101. data/spec/models/execution_method_capability_spec.rb +43 -0
  102. data/spec/models/failure_behavior_enum_spec.rb +28 -0
  103. data/spec/models/group_spec.rb +46 -0
  104. data/spec/models/link_spec.rb +70 -0
  105. data/spec/models/name_and_uuid_spec.rb +46 -0
  106. data/spec/models/notification_severity_spec.rb +28 -0
  107. data/spec/models/pager_duty_profile_spec.rb +118 -0
  108. data/spec/models/paginated_alert_method_list_spec.rb +52 -0
  109. data/spec/models/paginated_email_notification_profile_list_spec.rb +52 -0
  110. data/spec/models/paginated_pager_duty_profile_list_spec.rb +52 -0
  111. data/spec/models/paginated_run_environment_list_spec.rb +52 -0
  112. data/spec/models/paginated_task_execution_list_spec.rb +52 -0
  113. data/spec/models/paginated_task_list_spec.rb +52 -0
  114. data/spec/models/paginated_workflow_execution_summary_list_spec.rb +52 -0
  115. data/spec/models/paginated_workflow_summary_list_spec.rb +52 -0
  116. data/spec/models/paginated_workflow_task_instance_list_spec.rb +52 -0
  117. data/spec/models/paginated_workflow_transition_list_spec.rb +52 -0
  118. data/spec/models/patched_alert_method_spec.rb +136 -0
  119. data/spec/models/patched_email_notification_profile_spec.rb +118 -0
  120. data/spec/models/patched_pager_duty_profile_spec.rb +118 -0
  121. data/spec/models/patched_run_environment_spec.rb +136 -0
  122. data/spec/models/patched_task_execution_spec.rb +466 -0
  123. data/spec/models/patched_task_spec.rb +244 -0
  124. data/spec/models/patched_workflow_execution_spec.rb +172 -0
  125. data/spec/models/patched_workflow_spec.rb +142 -0
  126. data/spec/models/patched_workflow_task_instance_spec.rb +196 -0
  127. data/spec/models/patched_workflow_transition_spec.rb +118 -0
  128. data/spec/models/propagate_tags_enum_spec.rb +28 -0
  129. data/spec/models/rule_type_enum_spec.rb +28 -0
  130. data/spec/models/run_environment_spec.rb +136 -0
  131. data/spec/models/start_transition_condition_enum_spec.rb +28 -0
  132. data/spec/models/stop_reason_enum_spec.rb +28 -0
  133. data/spec/models/task_execution_spec.rb +466 -0
  134. data/spec/models/task_execution_status_spec.rb +28 -0
  135. data/spec/models/task_spec.rb +244 -0
  136. data/spec/models/threshold_property_enum_spec.rb +28 -0
  137. data/spec/models/timeout_behavior_enum_spec.rb +28 -0
  138. data/spec/models/unknown_execution_method_capability_spec.rb +40 -0
  139. data/spec/models/workflow_execution_spec.rb +172 -0
  140. data/spec/models/workflow_execution_status_spec.rb +28 -0
  141. data/spec/models/workflow_execution_summary_spec.rb +130 -0
  142. data/spec/models/workflow_spec.rb +142 -0
  143. data/spec/models/workflow_summary_spec.rb +124 -0
  144. data/spec/models/workflow_task_instance_execution_base_spec.rb +58 -0
  145. data/spec/models/workflow_task_instance_execution_spec.rb +64 -0
  146. data/spec/models/workflow_task_instance_spec.rb +196 -0
  147. data/spec/models/workflow_transition_evaluation_spec.rb +64 -0
  148. data/spec/models/workflow_transition_spec.rb +118 -0
  149. data/spec/spec_helper.rb +111 -0
  150. data/spec/wrapper_io/status_updater_spec.rb +147 -0
  151. metadata +305 -0
@@ -0,0 +1,523 @@
1
+ =begin
2
+ #CloudReactor API
3
+
4
+ #CloudReactor API Documentation
5
+
6
+ The version of the OpenAPI document: 0.2.0
7
+ Contact: jeff@cloudreactor.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module CloudReactorAPIClient
17
+ # A WorkflowExecution holds data on a specific execution (run) of a Workflow.
18
+ class WorkflowExecutionSummary
19
+ attr_accessor :url
20
+
21
+ attr_accessor :uuid
22
+
23
+ attr_accessor :dashboard_url
24
+
25
+ attr_accessor :status
26
+
27
+ attr_accessor :run_reason
28
+
29
+ attr_accessor :started_at
30
+
31
+ attr_accessor :finished_at
32
+
33
+ attr_accessor :last_heartbeat_at
34
+
35
+ attr_accessor :stop_reason
36
+
37
+ attr_accessor :marked_done_at
38
+
39
+ attr_accessor :kill_started_at
40
+
41
+ attr_accessor :kill_finished_at
42
+
43
+ attr_accessor :kill_error_code
44
+
45
+ attr_accessor :failed_attempts
46
+
47
+ attr_accessor :timed_out_attempts
48
+
49
+ attr_accessor :created_at
50
+
51
+ attr_accessor :updated_at
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'url' => :'url',
57
+ :'uuid' => :'uuid',
58
+ :'dashboard_url' => :'dashboard_url',
59
+ :'status' => :'status',
60
+ :'run_reason' => :'run_reason',
61
+ :'started_at' => :'started_at',
62
+ :'finished_at' => :'finished_at',
63
+ :'last_heartbeat_at' => :'last_heartbeat_at',
64
+ :'stop_reason' => :'stop_reason',
65
+ :'marked_done_at' => :'marked_done_at',
66
+ :'kill_started_at' => :'kill_started_at',
67
+ :'kill_finished_at' => :'kill_finished_at',
68
+ :'kill_error_code' => :'kill_error_code',
69
+ :'failed_attempts' => :'failed_attempts',
70
+ :'timed_out_attempts' => :'timed_out_attempts',
71
+ :'created_at' => :'created_at',
72
+ :'updated_at' => :'updated_at'
73
+ }
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'url' => :'String',
85
+ :'uuid' => :'String',
86
+ :'dashboard_url' => :'String',
87
+ :'status' => :'WorkflowExecutionStatus',
88
+ :'run_reason' => :'Integer',
89
+ :'started_at' => :'Time',
90
+ :'finished_at' => :'Time',
91
+ :'last_heartbeat_at' => :'Time',
92
+ :'stop_reason' => :'Integer',
93
+ :'marked_done_at' => :'Time',
94
+ :'kill_started_at' => :'Time',
95
+ :'kill_finished_at' => :'Time',
96
+ :'kill_error_code' => :'Integer',
97
+ :'failed_attempts' => :'Integer',
98
+ :'timed_out_attempts' => :'Integer',
99
+ :'created_at' => :'Time',
100
+ :'updated_at' => :'Time'
101
+ }
102
+ end
103
+
104
+ # List of attributes with nullable: true
105
+ def self.openapi_nullable
106
+ Set.new([
107
+ :'finished_at',
108
+ :'last_heartbeat_at',
109
+ :'stop_reason',
110
+ :'marked_done_at',
111
+ :'kill_started_at',
112
+ :'kill_finished_at',
113
+ :'kill_error_code',
114
+ ])
115
+ end
116
+
117
+ # Initializes the object
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ def initialize(attributes = {})
120
+ if (!attributes.is_a?(Hash))
121
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CloudReactorAPIClient::WorkflowExecutionSummary` initialize method"
122
+ end
123
+
124
+ # check to see if the attribute exists and convert string to symbol for hash key
125
+ attributes = attributes.each_with_object({}) { |(k, v), h|
126
+ if (!self.class.attribute_map.key?(k.to_sym))
127
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CloudReactorAPIClient::WorkflowExecutionSummary`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
128
+ end
129
+ h[k.to_sym] = v
130
+ }
131
+
132
+ if attributes.key?(:'url')
133
+ self.url = attributes[:'url']
134
+ end
135
+
136
+ if attributes.key?(:'uuid')
137
+ self.uuid = attributes[:'uuid']
138
+ end
139
+
140
+ if attributes.key?(:'dashboard_url')
141
+ self.dashboard_url = attributes[:'dashboard_url']
142
+ end
143
+
144
+ if attributes.key?(:'status')
145
+ self.status = attributes[:'status']
146
+ end
147
+
148
+ if attributes.key?(:'run_reason')
149
+ self.run_reason = attributes[:'run_reason']
150
+ end
151
+
152
+ if attributes.key?(:'started_at')
153
+ self.started_at = attributes[:'started_at']
154
+ end
155
+
156
+ if attributes.key?(:'finished_at')
157
+ self.finished_at = attributes[:'finished_at']
158
+ end
159
+
160
+ if attributes.key?(:'last_heartbeat_at')
161
+ self.last_heartbeat_at = attributes[:'last_heartbeat_at']
162
+ end
163
+
164
+ if attributes.key?(:'stop_reason')
165
+ self.stop_reason = attributes[:'stop_reason']
166
+ end
167
+
168
+ if attributes.key?(:'marked_done_at')
169
+ self.marked_done_at = attributes[:'marked_done_at']
170
+ end
171
+
172
+ if attributes.key?(:'kill_started_at')
173
+ self.kill_started_at = attributes[:'kill_started_at']
174
+ end
175
+
176
+ if attributes.key?(:'kill_finished_at')
177
+ self.kill_finished_at = attributes[:'kill_finished_at']
178
+ end
179
+
180
+ if attributes.key?(:'kill_error_code')
181
+ self.kill_error_code = attributes[:'kill_error_code']
182
+ end
183
+
184
+ if attributes.key?(:'failed_attempts')
185
+ self.failed_attempts = attributes[:'failed_attempts']
186
+ end
187
+
188
+ if attributes.key?(:'timed_out_attempts')
189
+ self.timed_out_attempts = attributes[:'timed_out_attempts']
190
+ end
191
+
192
+ if attributes.key?(:'created_at')
193
+ self.created_at = attributes[:'created_at']
194
+ end
195
+
196
+ if attributes.key?(:'updated_at')
197
+ self.updated_at = attributes[:'updated_at']
198
+ end
199
+ end
200
+
201
+ # Show invalid properties with the reasons. Usually used together with valid?
202
+ # @return Array for valid properties with the reasons
203
+ def list_invalid_properties
204
+ invalid_properties = Array.new
205
+ if @url.nil?
206
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
207
+ end
208
+
209
+ if @uuid.nil?
210
+ invalid_properties.push('invalid value for "uuid", uuid cannot be nil.')
211
+ end
212
+
213
+ if @dashboard_url.nil?
214
+ invalid_properties.push('invalid value for "dashboard_url", dashboard_url cannot be nil.')
215
+ end
216
+
217
+ if @status.nil?
218
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
219
+ end
220
+
221
+ if !@run_reason.nil? && @run_reason > 2147483647
222
+ invalid_properties.push('invalid value for "run_reason", must be smaller than or equal to 2147483647.')
223
+ end
224
+
225
+ if !@run_reason.nil? && @run_reason < -2147483648
226
+ invalid_properties.push('invalid value for "run_reason", must be greater than or equal to -2147483648.')
227
+ end
228
+
229
+ if @started_at.nil?
230
+ invalid_properties.push('invalid value for "started_at", started_at cannot be nil.')
231
+ end
232
+
233
+ if !@stop_reason.nil? && @stop_reason > 2147483647
234
+ invalid_properties.push('invalid value for "stop_reason", must be smaller than or equal to 2147483647.')
235
+ end
236
+
237
+ if !@stop_reason.nil? && @stop_reason < -2147483648
238
+ invalid_properties.push('invalid value for "stop_reason", must be greater than or equal to -2147483648.')
239
+ end
240
+
241
+ if !@kill_error_code.nil? && @kill_error_code > 2147483647
242
+ invalid_properties.push('invalid value for "kill_error_code", must be smaller than or equal to 2147483647.')
243
+ end
244
+
245
+ if !@kill_error_code.nil? && @kill_error_code < -2147483648
246
+ invalid_properties.push('invalid value for "kill_error_code", must be greater than or equal to -2147483648.')
247
+ end
248
+
249
+ if !@failed_attempts.nil? && @failed_attempts > 2147483647
250
+ invalid_properties.push('invalid value for "failed_attempts", must be smaller than or equal to 2147483647.')
251
+ end
252
+
253
+ if !@failed_attempts.nil? && @failed_attempts < -2147483648
254
+ invalid_properties.push('invalid value for "failed_attempts", must be greater than or equal to -2147483648.')
255
+ end
256
+
257
+ if !@timed_out_attempts.nil? && @timed_out_attempts > 2147483647
258
+ invalid_properties.push('invalid value for "timed_out_attempts", must be smaller than or equal to 2147483647.')
259
+ end
260
+
261
+ if !@timed_out_attempts.nil? && @timed_out_attempts < -2147483648
262
+ invalid_properties.push('invalid value for "timed_out_attempts", must be greater than or equal to -2147483648.')
263
+ end
264
+
265
+ if @created_at.nil?
266
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
267
+ end
268
+
269
+ if @updated_at.nil?
270
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
271
+ end
272
+
273
+ invalid_properties
274
+ end
275
+
276
+ # Check to see if the all the properties in the model are valid
277
+ # @return true if the model is valid
278
+ def valid?
279
+ return false if @url.nil?
280
+ return false if @uuid.nil?
281
+ return false if @dashboard_url.nil?
282
+ return false if @status.nil?
283
+ return false if !@run_reason.nil? && @run_reason > 2147483647
284
+ return false if !@run_reason.nil? && @run_reason < -2147483648
285
+ return false if @started_at.nil?
286
+ return false if !@stop_reason.nil? && @stop_reason > 2147483647
287
+ return false if !@stop_reason.nil? && @stop_reason < -2147483648
288
+ return false if !@kill_error_code.nil? && @kill_error_code > 2147483647
289
+ return false if !@kill_error_code.nil? && @kill_error_code < -2147483648
290
+ return false if !@failed_attempts.nil? && @failed_attempts > 2147483647
291
+ return false if !@failed_attempts.nil? && @failed_attempts < -2147483648
292
+ return false if !@timed_out_attempts.nil? && @timed_out_attempts > 2147483647
293
+ return false if !@timed_out_attempts.nil? && @timed_out_attempts < -2147483648
294
+ return false if @created_at.nil?
295
+ return false if @updated_at.nil?
296
+ true
297
+ end
298
+
299
+ # Custom attribute writer method with validation
300
+ # @param [Object] run_reason Value to be assigned
301
+ def run_reason=(run_reason)
302
+ if !run_reason.nil? && run_reason > 2147483647
303
+ fail ArgumentError, 'invalid value for "run_reason", must be smaller than or equal to 2147483647.'
304
+ end
305
+
306
+ if !run_reason.nil? && run_reason < -2147483648
307
+ fail ArgumentError, 'invalid value for "run_reason", must be greater than or equal to -2147483648.'
308
+ end
309
+
310
+ @run_reason = run_reason
311
+ end
312
+
313
+ # Custom attribute writer method with validation
314
+ # @param [Object] stop_reason Value to be assigned
315
+ def stop_reason=(stop_reason)
316
+ if !stop_reason.nil? && stop_reason > 2147483647
317
+ fail ArgumentError, 'invalid value for "stop_reason", must be smaller than or equal to 2147483647.'
318
+ end
319
+
320
+ if !stop_reason.nil? && stop_reason < -2147483648
321
+ fail ArgumentError, 'invalid value for "stop_reason", must be greater than or equal to -2147483648.'
322
+ end
323
+
324
+ @stop_reason = stop_reason
325
+ end
326
+
327
+ # Custom attribute writer method with validation
328
+ # @param [Object] kill_error_code Value to be assigned
329
+ def kill_error_code=(kill_error_code)
330
+ if !kill_error_code.nil? && kill_error_code > 2147483647
331
+ fail ArgumentError, 'invalid value for "kill_error_code", must be smaller than or equal to 2147483647.'
332
+ end
333
+
334
+ if !kill_error_code.nil? && kill_error_code < -2147483648
335
+ fail ArgumentError, 'invalid value for "kill_error_code", must be greater than or equal to -2147483648.'
336
+ end
337
+
338
+ @kill_error_code = kill_error_code
339
+ end
340
+
341
+ # Custom attribute writer method with validation
342
+ # @param [Object] failed_attempts Value to be assigned
343
+ def failed_attempts=(failed_attempts)
344
+ if !failed_attempts.nil? && failed_attempts > 2147483647
345
+ fail ArgumentError, 'invalid value for "failed_attempts", must be smaller than or equal to 2147483647.'
346
+ end
347
+
348
+ if !failed_attempts.nil? && failed_attempts < -2147483648
349
+ fail ArgumentError, 'invalid value for "failed_attempts", must be greater than or equal to -2147483648.'
350
+ end
351
+
352
+ @failed_attempts = failed_attempts
353
+ end
354
+
355
+ # Custom attribute writer method with validation
356
+ # @param [Object] timed_out_attempts Value to be assigned
357
+ def timed_out_attempts=(timed_out_attempts)
358
+ if !timed_out_attempts.nil? && timed_out_attempts > 2147483647
359
+ fail ArgumentError, 'invalid value for "timed_out_attempts", must be smaller than or equal to 2147483647.'
360
+ end
361
+
362
+ if !timed_out_attempts.nil? && timed_out_attempts < -2147483648
363
+ fail ArgumentError, 'invalid value for "timed_out_attempts", must be greater than or equal to -2147483648.'
364
+ end
365
+
366
+ @timed_out_attempts = timed_out_attempts
367
+ end
368
+
369
+ # Checks equality by comparing each attribute.
370
+ # @param [Object] Object to be compared
371
+ def ==(o)
372
+ return true if self.equal?(o)
373
+ self.class == o.class &&
374
+ url == o.url &&
375
+ uuid == o.uuid &&
376
+ dashboard_url == o.dashboard_url &&
377
+ status == o.status &&
378
+ run_reason == o.run_reason &&
379
+ started_at == o.started_at &&
380
+ finished_at == o.finished_at &&
381
+ last_heartbeat_at == o.last_heartbeat_at &&
382
+ stop_reason == o.stop_reason &&
383
+ marked_done_at == o.marked_done_at &&
384
+ kill_started_at == o.kill_started_at &&
385
+ kill_finished_at == o.kill_finished_at &&
386
+ kill_error_code == o.kill_error_code &&
387
+ failed_attempts == o.failed_attempts &&
388
+ timed_out_attempts == o.timed_out_attempts &&
389
+ created_at == o.created_at &&
390
+ updated_at == o.updated_at
391
+ end
392
+
393
+ # @see the `==` method
394
+ # @param [Object] Object to be compared
395
+ def eql?(o)
396
+ self == o
397
+ end
398
+
399
+ # Calculates hash code according to all attributes.
400
+ # @return [Integer] Hash code
401
+ def hash
402
+ [url, uuid, dashboard_url, status, run_reason, started_at, finished_at, last_heartbeat_at, stop_reason, marked_done_at, kill_started_at, kill_finished_at, kill_error_code, failed_attempts, timed_out_attempts, created_at, updated_at].hash
403
+ end
404
+
405
+ # Builds the object from hash
406
+ # @param [Hash] attributes Model attributes in the form of hash
407
+ # @return [Object] Returns the model itself
408
+ def self.build_from_hash(attributes)
409
+ new.build_from_hash(attributes)
410
+ end
411
+
412
+ # Builds the object from hash
413
+ # @param [Hash] attributes Model attributes in the form of hash
414
+ # @return [Object] Returns the model itself
415
+ def build_from_hash(attributes)
416
+ return nil unless attributes.is_a?(Hash)
417
+ self.class.openapi_types.each_pair do |key, type|
418
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
419
+ self.send("#{key}=", nil)
420
+ elsif type =~ /\AArray<(.*)>/i
421
+ # check to ensure the input is an array given that the attribute
422
+ # is documented as an array but the input is not
423
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
424
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
425
+ end
426
+ elsif !attributes[self.class.attribute_map[key]].nil?
427
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
428
+ end
429
+ end
430
+
431
+ self
432
+ end
433
+
434
+ # Deserializes the data based on type
435
+ # @param string type Data type
436
+ # @param string value Value to be deserialized
437
+ # @return [Object] Deserialized data
438
+ def _deserialize(type, value)
439
+ case type.to_sym
440
+ when :Time
441
+ Time.parse(value)
442
+ when :Date
443
+ Date.parse(value)
444
+ when :String
445
+ value.to_s
446
+ when :Integer
447
+ value.to_i
448
+ when :Float
449
+ value.to_f
450
+ when :Boolean
451
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
452
+ true
453
+ else
454
+ false
455
+ end
456
+ when :Object
457
+ # generic object (usually a Hash), return directly
458
+ value
459
+ when /\AArray<(?<inner_type>.+)>\z/
460
+ inner_type = Regexp.last_match[:inner_type]
461
+ value.map { |v| _deserialize(inner_type, v) }
462
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
463
+ k_type = Regexp.last_match[:k_type]
464
+ v_type = Regexp.last_match[:v_type]
465
+ {}.tap do |hash|
466
+ value.each do |k, v|
467
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
468
+ end
469
+ end
470
+ else # model
471
+ # models (e.g. Pet) or oneOf
472
+ klass = CloudReactorAPIClient.const_get(type)
473
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
474
+ end
475
+ end
476
+
477
+ # Returns the string representation of the object
478
+ # @return [String] String presentation of the object
479
+ def to_s
480
+ to_hash.to_s
481
+ end
482
+
483
+ # to_body is an alias to to_hash (backward compatibility)
484
+ # @return [Hash] Returns the object in the form of hash
485
+ def to_body
486
+ to_hash
487
+ end
488
+
489
+ # Returns the object in the form of hash
490
+ # @return [Hash] Returns the object in the form of hash
491
+ def to_hash
492
+ hash = {}
493
+ self.class.attribute_map.each_pair do |attr, param|
494
+ value = self.send(attr)
495
+ if value.nil?
496
+ is_nullable = self.class.openapi_nullable.include?(attr)
497
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
498
+ end
499
+
500
+ hash[param] = _to_hash(value)
501
+ end
502
+ hash
503
+ end
504
+
505
+ # Outputs non-array value in the form of hash
506
+ # For object, use to_hash. Otherwise, just return the value
507
+ # @param [Object] value Any valid value
508
+ # @return [Hash] Returns the value in the form of hash
509
+ def _to_hash(value)
510
+ if value.is_a?(Array)
511
+ value.compact.map { |v| _to_hash(v) }
512
+ elsif value.is_a?(Hash)
513
+ {}.tap do |hash|
514
+ value.each { |k, v| hash[k] = _to_hash(v) }
515
+ end
516
+ elsif value.respond_to? :to_hash
517
+ value.to_hash
518
+ else
519
+ value
520
+ end
521
+ end
522
+ end
523
+ end