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