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,449 @@
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
+ # An AlertMethod specifies one or more configured methods of notifying users or external sources of events that trigger when one or more conditions are satisfied.
18
+ class AlertMethod
19
+ attr_accessor :url
20
+
21
+ attr_accessor :uuid
22
+
23
+ attr_accessor :name
24
+
25
+ attr_accessor :description
26
+
27
+ attr_accessor :dashboard_url
28
+
29
+ attr_accessor :enabled
30
+
31
+ attr_accessor :method_details
32
+
33
+ attr_accessor :notify_on_success
34
+
35
+ attr_accessor :notify_on_failure
36
+
37
+ attr_accessor :notify_on_timeout
38
+
39
+ attr_accessor :error_severity_on_missing_execution
40
+
41
+ attr_accessor :error_severity_on_missing_heartbeat
42
+
43
+ attr_accessor :error_severity_on_service_down
44
+
45
+ # Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
46
+ attr_accessor :created_by_user
47
+
48
+ attr_accessor :created_by_group
49
+
50
+ attr_accessor :run_environment
51
+
52
+ attr_accessor :created_at
53
+
54
+ attr_accessor :updated_at
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'url' => :'url',
60
+ :'uuid' => :'uuid',
61
+ :'name' => :'name',
62
+ :'description' => :'description',
63
+ :'dashboard_url' => :'dashboard_url',
64
+ :'enabled' => :'enabled',
65
+ :'method_details' => :'method_details',
66
+ :'notify_on_success' => :'notify_on_success',
67
+ :'notify_on_failure' => :'notify_on_failure',
68
+ :'notify_on_timeout' => :'notify_on_timeout',
69
+ :'error_severity_on_missing_execution' => :'error_severity_on_missing_execution',
70
+ :'error_severity_on_missing_heartbeat' => :'error_severity_on_missing_heartbeat',
71
+ :'error_severity_on_service_down' => :'error_severity_on_service_down',
72
+ :'created_by_user' => :'created_by_user',
73
+ :'created_by_group' => :'created_by_group',
74
+ :'run_environment' => :'run_environment',
75
+ :'created_at' => :'created_at',
76
+ :'updated_at' => :'updated_at'
77
+ }
78
+ end
79
+
80
+ # Returns all the JSON keys this model knows about
81
+ def self.acceptable_attributes
82
+ attribute_map.values
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.openapi_types
87
+ {
88
+ :'url' => :'String',
89
+ :'uuid' => :'String',
90
+ :'name' => :'String',
91
+ :'description' => :'String',
92
+ :'dashboard_url' => :'String',
93
+ :'enabled' => :'Boolean',
94
+ :'method_details' => :'Hash<String, Object>',
95
+ :'notify_on_success' => :'Boolean',
96
+ :'notify_on_failure' => :'Boolean',
97
+ :'notify_on_timeout' => :'Boolean',
98
+ :'error_severity_on_missing_execution' => :'NotificationSeverity',
99
+ :'error_severity_on_missing_heartbeat' => :'NotificationSeverity',
100
+ :'error_severity_on_service_down' => :'NotificationSeverity',
101
+ :'created_by_user' => :'String',
102
+ :'created_by_group' => :'Group',
103
+ :'run_environment' => :'NameAndUuid',
104
+ :'created_at' => :'Time',
105
+ :'updated_at' => :'Time'
106
+ }
107
+ end
108
+
109
+ # List of attributes with nullable: true
110
+ def self.openapi_nullable
111
+ Set.new([
112
+ :'created_by_group',
113
+ :'run_environment',
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::AlertMethod` 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::AlertMethod`. 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?(:'name')
141
+ self.name = attributes[:'name']
142
+ end
143
+
144
+ if attributes.key?(:'description')
145
+ self.description = attributes[:'description']
146
+ end
147
+
148
+ if attributes.key?(:'dashboard_url')
149
+ self.dashboard_url = attributes[:'dashboard_url']
150
+ end
151
+
152
+ if attributes.key?(:'enabled')
153
+ self.enabled = attributes[:'enabled']
154
+ end
155
+
156
+ if attributes.key?(:'method_details')
157
+ if (value = attributes[:'method_details']).is_a?(Hash)
158
+ self.method_details = value
159
+ end
160
+ end
161
+
162
+ if attributes.key?(:'notify_on_success')
163
+ self.notify_on_success = attributes[:'notify_on_success']
164
+ end
165
+
166
+ if attributes.key?(:'notify_on_failure')
167
+ self.notify_on_failure = attributes[:'notify_on_failure']
168
+ end
169
+
170
+ if attributes.key?(:'notify_on_timeout')
171
+ self.notify_on_timeout = attributes[:'notify_on_timeout']
172
+ end
173
+
174
+ if attributes.key?(:'error_severity_on_missing_execution')
175
+ self.error_severity_on_missing_execution = attributes[:'error_severity_on_missing_execution']
176
+ end
177
+
178
+ if attributes.key?(:'error_severity_on_missing_heartbeat')
179
+ self.error_severity_on_missing_heartbeat = attributes[:'error_severity_on_missing_heartbeat']
180
+ end
181
+
182
+ if attributes.key?(:'error_severity_on_service_down')
183
+ self.error_severity_on_service_down = attributes[:'error_severity_on_service_down']
184
+ end
185
+
186
+ if attributes.key?(:'created_by_user')
187
+ self.created_by_user = attributes[:'created_by_user']
188
+ end
189
+
190
+ if attributes.key?(:'created_by_group')
191
+ self.created_by_group = attributes[:'created_by_group']
192
+ end
193
+
194
+ if attributes.key?(:'run_environment')
195
+ self.run_environment = attributes[:'run_environment']
196
+ end
197
+
198
+ if attributes.key?(:'created_at')
199
+ self.created_at = attributes[:'created_at']
200
+ end
201
+
202
+ if attributes.key?(:'updated_at')
203
+ self.updated_at = attributes[:'updated_at']
204
+ end
205
+ end
206
+
207
+ # Show invalid properties with the reasons. Usually used together with valid?
208
+ # @return Array for valid properties with the reasons
209
+ def list_invalid_properties
210
+ invalid_properties = Array.new
211
+ if @url.nil?
212
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
213
+ end
214
+
215
+ if @uuid.nil?
216
+ invalid_properties.push('invalid value for "uuid", uuid cannot be nil.')
217
+ end
218
+
219
+ if @name.nil?
220
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
221
+ end
222
+
223
+ if @name.to_s.length > 200
224
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 200.')
225
+ end
226
+
227
+ if !@description.nil? && @description.to_s.length > 5000
228
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 5000.')
229
+ end
230
+
231
+ if @dashboard_url.nil?
232
+ invalid_properties.push('invalid value for "dashboard_url", dashboard_url cannot be nil.')
233
+ end
234
+
235
+ if @method_details.nil?
236
+ invalid_properties.push('invalid value for "method_details", method_details cannot be nil.')
237
+ end
238
+
239
+ if @created_by_user.nil?
240
+ invalid_properties.push('invalid value for "created_by_user", created_by_user cannot be nil.')
241
+ end
242
+
243
+ if @created_at.nil?
244
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
245
+ end
246
+
247
+ if @updated_at.nil?
248
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
249
+ end
250
+
251
+ invalid_properties
252
+ end
253
+
254
+ # Check to see if the all the properties in the model are valid
255
+ # @return true if the model is valid
256
+ def valid?
257
+ return false if @url.nil?
258
+ return false if @uuid.nil?
259
+ return false if @name.nil?
260
+ return false if @name.to_s.length > 200
261
+ return false if !@description.nil? && @description.to_s.length > 5000
262
+ return false if @dashboard_url.nil?
263
+ return false if @method_details.nil?
264
+ return false if @created_by_user.nil?
265
+ return false if @created_at.nil?
266
+ return false if @updated_at.nil?
267
+ true
268
+ end
269
+
270
+ # Custom attribute writer method with validation
271
+ # @param [Object] name Value to be assigned
272
+ def name=(name)
273
+ if name.nil?
274
+ fail ArgumentError, 'name cannot be nil'
275
+ end
276
+
277
+ if name.to_s.length > 200
278
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 200.'
279
+ end
280
+
281
+ @name = name
282
+ end
283
+
284
+ # Custom attribute writer method with validation
285
+ # @param [Object] description Value to be assigned
286
+ def description=(description)
287
+ if !description.nil? && description.to_s.length > 5000
288
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 5000.'
289
+ end
290
+
291
+ @description = description
292
+ end
293
+
294
+ # Checks equality by comparing each attribute.
295
+ # @param [Object] Object to be compared
296
+ def ==(o)
297
+ return true if self.equal?(o)
298
+ self.class == o.class &&
299
+ url == o.url &&
300
+ uuid == o.uuid &&
301
+ name == o.name &&
302
+ description == o.description &&
303
+ dashboard_url == o.dashboard_url &&
304
+ enabled == o.enabled &&
305
+ method_details == o.method_details &&
306
+ notify_on_success == o.notify_on_success &&
307
+ notify_on_failure == o.notify_on_failure &&
308
+ notify_on_timeout == o.notify_on_timeout &&
309
+ error_severity_on_missing_execution == o.error_severity_on_missing_execution &&
310
+ error_severity_on_missing_heartbeat == o.error_severity_on_missing_heartbeat &&
311
+ error_severity_on_service_down == o.error_severity_on_service_down &&
312
+ created_by_user == o.created_by_user &&
313
+ created_by_group == o.created_by_group &&
314
+ run_environment == o.run_environment &&
315
+ created_at == o.created_at &&
316
+ updated_at == o.updated_at
317
+ end
318
+
319
+ # @see the `==` method
320
+ # @param [Object] Object to be compared
321
+ def eql?(o)
322
+ self == o
323
+ end
324
+
325
+ # Calculates hash code according to all attributes.
326
+ # @return [Integer] Hash code
327
+ def hash
328
+ [url, uuid, name, description, dashboard_url, enabled, method_details, notify_on_success, notify_on_failure, notify_on_timeout, error_severity_on_missing_execution, error_severity_on_missing_heartbeat, error_severity_on_service_down, created_by_user, created_by_group, run_environment, created_at, updated_at].hash
329
+ end
330
+
331
+ # Builds the object from hash
332
+ # @param [Hash] attributes Model attributes in the form of hash
333
+ # @return [Object] Returns the model itself
334
+ def self.build_from_hash(attributes)
335
+ new.build_from_hash(attributes)
336
+ end
337
+
338
+ # Builds the object from hash
339
+ # @param [Hash] attributes Model attributes in the form of hash
340
+ # @return [Object] Returns the model itself
341
+ def build_from_hash(attributes)
342
+ return nil unless attributes.is_a?(Hash)
343
+ self.class.openapi_types.each_pair do |key, type|
344
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
345
+ self.send("#{key}=", nil)
346
+ elsif type =~ /\AArray<(.*)>/i
347
+ # check to ensure the input is an array given that the attribute
348
+ # is documented as an array but the input is not
349
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
350
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
351
+ end
352
+ elsif !attributes[self.class.attribute_map[key]].nil?
353
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
354
+ end
355
+ end
356
+
357
+ self
358
+ end
359
+
360
+ # Deserializes the data based on type
361
+ # @param string type Data type
362
+ # @param string value Value to be deserialized
363
+ # @return [Object] Deserialized data
364
+ def _deserialize(type, value)
365
+ case type.to_sym
366
+ when :Time
367
+ Time.parse(value)
368
+ when :Date
369
+ Date.parse(value)
370
+ when :String
371
+ value.to_s
372
+ when :Integer
373
+ value.to_i
374
+ when :Float
375
+ value.to_f
376
+ when :Boolean
377
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
378
+ true
379
+ else
380
+ false
381
+ end
382
+ when :Object
383
+ # generic object (usually a Hash), return directly
384
+ value
385
+ when /\AArray<(?<inner_type>.+)>\z/
386
+ inner_type = Regexp.last_match[:inner_type]
387
+ value.map { |v| _deserialize(inner_type, v) }
388
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
389
+ k_type = Regexp.last_match[:k_type]
390
+ v_type = Regexp.last_match[:v_type]
391
+ {}.tap do |hash|
392
+ value.each do |k, v|
393
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
394
+ end
395
+ end
396
+ else # model
397
+ # models (e.g. Pet) or oneOf
398
+ klass = CloudReactorAPIClient.const_get(type)
399
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
400
+ end
401
+ end
402
+
403
+ # Returns the string representation of the object
404
+ # @return [String] String presentation of the object
405
+ def to_s
406
+ to_hash.to_s
407
+ end
408
+
409
+ # to_body is an alias to to_hash (backward compatibility)
410
+ # @return [Hash] Returns the object in the form of hash
411
+ def to_body
412
+ to_hash
413
+ end
414
+
415
+ # Returns the object in the form of hash
416
+ # @return [Hash] Returns the object in the form of hash
417
+ def to_hash
418
+ hash = {}
419
+ self.class.attribute_map.each_pair do |attr, param|
420
+ value = self.send(attr)
421
+ if value.nil?
422
+ is_nullable = self.class.openapi_nullable.include?(attr)
423
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
424
+ end
425
+
426
+ hash[param] = _to_hash(value)
427
+ end
428
+ hash
429
+ end
430
+
431
+ # Outputs non-array value in the form of hash
432
+ # For object, use to_hash. Otherwise, just return the value
433
+ # @param [Object] value Any valid value
434
+ # @return [Hash] Returns the value in the form of hash
435
+ def _to_hash(value)
436
+ if value.is_a?(Array)
437
+ value.compact.map { |v| _to_hash(v) }
438
+ elsif value.is_a?(Hash)
439
+ {}.tap do |hash|
440
+ value.each { |k, v| hash[k] = _to_hash(v) }
441
+ end
442
+ elsif value.respond_to? :to_hash
443
+ value.to_hash
444
+ else
445
+ value
446
+ end
447
+ end
448
+ end
449
+ end