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