ionoscloud 6.0.1 → 6.1.1

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/docs/CHANGELOG.md +28 -0
  4. data/docs/api/ApplicationLoadBalancersApi.md +1586 -0
  5. data/docs/api/ServersApi.md +3 -1
  6. data/docs/api/TargetGroupsApi.md +516 -0
  7. data/docs/models/ApplicationLoadBalancer.md +28 -0
  8. data/docs/models/ApplicationLoadBalancerEntities.md +18 -0
  9. data/docs/models/ApplicationLoadBalancerForwardingRule.md +26 -0
  10. data/docs/models/ApplicationLoadBalancerForwardingRuleProperties.md +30 -0
  11. data/docs/models/ApplicationLoadBalancerForwardingRulePut.md +24 -0
  12. data/docs/models/ApplicationLoadBalancerForwardingRules.md +30 -0
  13. data/docs/models/ApplicationLoadBalancerHttpRule.md +34 -0
  14. data/docs/models/ApplicationLoadBalancerHttpRuleCondition.md +26 -0
  15. data/docs/models/ApplicationLoadBalancerProperties.md +26 -0
  16. data/docs/models/ApplicationLoadBalancerPut.md +24 -0
  17. data/docs/models/ApplicationLoadBalancers.md +30 -0
  18. data/docs/models/GroupProperties.md +3 -1
  19. data/docs/models/KubernetesClusterProperties.md +0 -2
  20. data/docs/models/KubernetesClusterPropertiesForPost.md +0 -2
  21. data/docs/models/KubernetesNodePoolProperties.md +1 -3
  22. data/docs/models/KubernetesNodePoolPropertiesForPost.md +1 -3
  23. data/docs/models/TargetGroup.md +26 -0
  24. data/docs/models/TargetGroupHealthCheck.md +22 -0
  25. data/docs/models/TargetGroupHttpHealthCheck.md +28 -0
  26. data/docs/models/TargetGroupProperties.md +28 -0
  27. data/docs/models/TargetGroupPut.md +24 -0
  28. data/docs/models/TargetGroupTarget.md +26 -0
  29. data/docs/models/TargetGroups.md +30 -0
  30. data/docs/models/VolumeProperties.md +3 -1
  31. data/lib/ionoscloud/api/application_load_balancers_api.rb +1690 -0
  32. data/lib/ionoscloud/api/servers_api.rb +3 -0
  33. data/lib/ionoscloud/api/target_groups_api.rb +530 -0
  34. data/lib/ionoscloud/api_client.rb +1 -1
  35. data/lib/ionoscloud/configuration.rb +11 -26
  36. data/lib/ionoscloud/models/application_load_balancer.rb +319 -0
  37. data/lib/ionoscloud/models/application_load_balancer_entities.rb +226 -0
  38. data/lib/ionoscloud/models/application_load_balancer_forwarding_rule.rb +302 -0
  39. data/lib/ionoscloud/models/application_load_balancer_forwarding_rule_properties.rb +389 -0
  40. data/lib/ionoscloud/models/application_load_balancer_forwarding_rule_put.rb +285 -0
  41. data/lib/ionoscloud/models/application_load_balancer_forwarding_rules.rb +334 -0
  42. data/lib/ionoscloud/models/application_load_balancer_http_rule.rb +427 -0
  43. data/lib/ionoscloud/models/application_load_balancer_http_rule_condition.rb +355 -0
  44. data/lib/ionoscloud/models/application_load_balancer_properties.rb +314 -0
  45. data/lib/ionoscloud/models/application_load_balancer_put.rb +285 -0
  46. data/lib/ionoscloud/models/application_load_balancers.rb +334 -0
  47. data/lib/ionoscloud/models/group_properties.rb +22 -4
  48. data/lib/ionoscloud/models/kubernetes_cluster_properties.rb +1 -21
  49. data/lib/ionoscloud/models/kubernetes_cluster_properties_for_post.rb +1 -21
  50. data/lib/ionoscloud/models/kubernetes_node_pool_properties.rb +4 -22
  51. data/lib/ionoscloud/models/kubernetes_node_pool_properties_for_post.rb +4 -22
  52. data/lib/ionoscloud/models/target_group.rb +302 -0
  53. data/lib/ionoscloud/models/target_group_health_check.rb +263 -0
  54. data/lib/ionoscloud/models/target_group_http_health_check.rb +373 -0
  55. data/lib/ionoscloud/models/target_group_properties.rb +376 -0
  56. data/lib/ionoscloud/models/target_group_put.rb +285 -0
  57. data/lib/ionoscloud/models/target_group_target.rb +314 -0
  58. data/lib/ionoscloud/models/target_groups.rb +334 -0
  59. data/lib/ionoscloud/models/volume_properties.rb +36 -4
  60. data/lib/ionoscloud/version.rb +1 -1
  61. data/lib/ionoscloud.rb +20 -0
  62. metadata +45 -6
  63. data/lib/test_driver.rb +0 -119
@@ -0,0 +1,376 @@
1
+ =begin
2
+ #CLOUD API
3
+
4
+ #IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on.
5
+
6
+ The version of the OpenAPI document: 6.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Ionoscloud
17
+ class TargetGroupProperties
18
+
19
+ # The name of the target group.
20
+ attr_accessor :name
21
+
22
+
23
+ # Balancing algorithm
24
+ attr_accessor :algorithm
25
+
26
+
27
+ # Balancing protocol
28
+ attr_accessor :protocol
29
+
30
+
31
+ # Array of items in the collection.
32
+ attr_accessor :targets
33
+
34
+
35
+ attr_accessor :health_check
36
+
37
+
38
+ attr_accessor :http_health_check
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+
66
+ :'name' => :'name',
67
+
68
+ :'algorithm' => :'algorithm',
69
+
70
+ :'protocol' => :'protocol',
71
+
72
+ :'targets' => :'targets',
73
+
74
+ :'health_check' => :'healthCheck',
75
+
76
+ :'http_health_check' => :'httpHealthCheck'
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
+
89
+ :'name' => :'String',
90
+
91
+ :'algorithm' => :'String',
92
+
93
+ :'protocol' => :'String',
94
+
95
+ :'targets' => :'Array<TargetGroupTarget>',
96
+
97
+ :'health_check' => :'TargetGroupHealthCheck',
98
+
99
+ :'http_health_check' => :'TargetGroupHttpHealthCheck'
100
+ }
101
+ end
102
+
103
+ # List of attributes with nullable: true
104
+ def self.openapi_nullable
105
+ Set.new([
106
+
107
+
108
+
109
+
110
+
111
+
112
+ ])
113
+ end
114
+
115
+ # Initializes the object
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ def initialize(attributes = {})
118
+ if (!attributes.is_a?(Hash))
119
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Ionoscloud::TargetGroupProperties` initialize method"
120
+ end
121
+
122
+ # check to see if the attribute exists and convert string to symbol for hash key
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!self.class.attribute_map.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Ionoscloud::TargetGroupProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+
131
+ if attributes.key?(:'name')
132
+ self.name = attributes[:'name']
133
+ end
134
+
135
+
136
+ if attributes.key?(:'algorithm')
137
+ self.algorithm = attributes[:'algorithm']
138
+ end
139
+
140
+
141
+ if attributes.key?(:'protocol')
142
+ self.protocol = attributes[:'protocol']
143
+ end
144
+
145
+
146
+ if attributes.key?(:'targets') && (value = attributes[:'targets']).is_a?(Array)
147
+ self.targets = value
148
+ end
149
+
150
+
151
+ if attributes.key?(:'health_check')
152
+ self.health_check = attributes[:'health_check']
153
+ end
154
+
155
+
156
+ if attributes.key?(:'http_health_check')
157
+ self.http_health_check = attributes[:'http_health_check']
158
+ end
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properties with the reasons
163
+ def list_invalid_properties
164
+ invalid_properties = Array.new
165
+
166
+ if @name.nil?
167
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
168
+ end
169
+
170
+
171
+ if @algorithm.nil?
172
+ invalid_properties.push('invalid value for "algorithm", algorithm cannot be nil.')
173
+ end
174
+
175
+
176
+ if @protocol.nil?
177
+ invalid_properties.push('invalid value for "protocol", protocol cannot be nil.')
178
+ end
179
+
180
+
181
+
182
+
183
+ invalid_properties
184
+ end
185
+
186
+ # Check to see if the all the properties in the model are valid
187
+ # @return true if the model is valid
188
+ def valid?
189
+
190
+ return false if @name.nil?
191
+
192
+ return false if @algorithm.nil?
193
+ algorithm_validator = EnumAttributeValidator.new('String', ["ROUND_ROBIN", "LEAST_CONNECTION", "RANDOM", "SOURCE_IP"])
194
+ return false unless algorithm_validator.valid?(@algorithm)
195
+
196
+ return false if @protocol.nil?
197
+ protocol_validator = EnumAttributeValidator.new('String', ["HTTP"])
198
+ return false unless protocol_validator.valid?(@protocol)
199
+
200
+
201
+
202
+ true
203
+ end
204
+
205
+
206
+
207
+ # Custom attribute writer method checking allowed values (enum).
208
+ # @param [Object] algorithm Object to be assigned
209
+ def algorithm=(algorithm)
210
+ validator = EnumAttributeValidator.new('String', ["ROUND_ROBIN", "LEAST_CONNECTION", "RANDOM", "SOURCE_IP"])
211
+ unless validator.valid?(algorithm)
212
+ fail ArgumentError, "invalid value for \"algorithm\", must be one of #{validator.allowable_values}."
213
+ end
214
+ @algorithm = algorithm
215
+ end
216
+
217
+
218
+ # Custom attribute writer method checking allowed values (enum).
219
+ # @param [Object] protocol Object to be assigned
220
+ def protocol=(protocol)
221
+ validator = EnumAttributeValidator.new('String', ["HTTP"])
222
+ unless validator.valid?(protocol)
223
+ fail ArgumentError, "invalid value for \"protocol\", must be one of #{validator.allowable_values}."
224
+ end
225
+ @protocol = protocol
226
+ end
227
+
228
+
229
+
230
+
231
+ # Checks equality by comparing each attribute.
232
+ # @param [Object] Object to be compared
233
+ def ==(o)
234
+ return true if self.equal?(o)
235
+ self.class == o.class &&
236
+ name == o.name &&
237
+ algorithm == o.algorithm &&
238
+ protocol == o.protocol &&
239
+ targets == o.targets &&
240
+ health_check == o.health_check &&
241
+ http_health_check == o.http_health_check
242
+ end
243
+
244
+ # @see the `==` method
245
+ # @param [Object] Object to be compared
246
+ def eql?(o)
247
+ self == o
248
+ end
249
+
250
+ # Calculates hash code according to all attributes.
251
+ # @return [Integer] Hash code
252
+ def hash
253
+ [name, algorithm, protocol, targets, health_check, http_health_check].hash
254
+ end
255
+
256
+ # Builds the object from hash
257
+ # @param [Hash] attributes Model attributes in the form of hash
258
+ # @return [Object] Returns the model itself
259
+ def self.build_from_hash(attributes)
260
+ new.build_from_hash(attributes)
261
+ end
262
+
263
+ # Builds the object from hash
264
+ # @param [Hash] attributes Model attributes in the form of hash
265
+ # @return [Object] Returns the model itself
266
+ def build_from_hash(attributes)
267
+ return nil unless attributes.is_a?(Hash)
268
+ self.class.openapi_types.each_pair do |key, type|
269
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
270
+ self.send("#{key}=", nil)
271
+ elsif type =~ /\AArray<(.*)>/i
272
+ # check to ensure the input is an array given that the attribute
273
+ # is documented as an array but the input is not
274
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
275
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
276
+ end
277
+ elsif !attributes[self.class.attribute_map[key]].nil?
278
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
279
+ end
280
+ end
281
+
282
+ self
283
+ end
284
+
285
+ # Deserializes the data based on type
286
+ # @param string type Data type
287
+ # @param string value Value to be deserialized
288
+ # @return [Object] Deserialized data
289
+ def _deserialize(type, value)
290
+ case type.to_sym
291
+ when :Time
292
+ Time.parse(value)
293
+ when :Date
294
+ Date.parse(value)
295
+ when :String
296
+ value.to_s
297
+ when :Integer
298
+ value.to_i
299
+ when :Float
300
+ value.to_f
301
+ when :Boolean
302
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
303
+ true
304
+ else
305
+ false
306
+ end
307
+ when :Object
308
+ # generic object (usually a Hash), return directly
309
+ value
310
+ when /\AArray<(?<inner_type>.+)>\z/
311
+ inner_type = Regexp.last_match[:inner_type]
312
+ value.map { |v| _deserialize(inner_type, v) }
313
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
314
+ k_type = Regexp.last_match[:k_type]
315
+ v_type = Regexp.last_match[:v_type]
316
+ {}.tap do |hash|
317
+ value.each do |k, v|
318
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
319
+ end
320
+ end
321
+ else # model
322
+ # models (e.g. Pet) or oneOf
323
+ klass = Ionoscloud.const_get(type)
324
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
325
+ end
326
+ end
327
+
328
+ # Returns the string representation of the object
329
+ # @return [String] String presentation of the object
330
+ def to_s
331
+ to_hash.to_s
332
+ end
333
+
334
+ # to_body is an alias to to_hash (backward compatibility)
335
+ # @return [Hash] Returns the object in the form of hash
336
+ def to_body
337
+ to_hash
338
+ end
339
+
340
+ # Returns the object in the form of hash
341
+ # @return [Hash] Returns the object in the form of hash
342
+ def to_hash
343
+ hash = {}
344
+ self.class.attribute_map.each_pair do |attr, param|
345
+ value = self.send(attr)
346
+ if value.nil?
347
+ is_nullable = self.class.openapi_nullable.include?(attr)
348
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
349
+ end
350
+
351
+ hash[param] = _to_hash(value)
352
+ end
353
+ hash
354
+ end
355
+
356
+ # Outputs non-array value in the form of hash
357
+ # For object, use to_hash. Otherwise, just return the value
358
+ # @param [Object] value Any valid value
359
+ # @return [Hash] Returns the value in the form of hash
360
+ def _to_hash(value)
361
+ if value.is_a?(Array)
362
+ value.compact.map { |v| _to_hash(v) }
363
+ elsif value.is_a?(Hash)
364
+ {}.tap do |hash|
365
+ value.each { |k, v| hash[k] = _to_hash(v) }
366
+ end
367
+ elsif value.respond_to? :to_hash
368
+ value.to_hash
369
+ else
370
+ value
371
+ end
372
+ end
373
+
374
+ end
375
+
376
+ end
@@ -0,0 +1,285 @@
1
+ =begin
2
+ #CLOUD API
3
+
4
+ #IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on.
5
+
6
+ The version of the OpenAPI document: 6.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Ionoscloud
17
+ class TargetGroupPut
18
+
19
+ # The resource's unique identifier.
20
+ attr_accessor :id
21
+
22
+
23
+ # The type of object that has been created.
24
+ attr_accessor :type
25
+
26
+
27
+ # URL to the object representation (absolute path).
28
+ attr_accessor :href
29
+
30
+
31
+ attr_accessor :properties
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+
37
+ :'id' => :'id',
38
+
39
+ :'type' => :'type',
40
+
41
+ :'href' => :'href',
42
+
43
+ :'properties' => :'properties'
44
+ }
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+
56
+ :'id' => :'String',
57
+
58
+ :'type' => :'Type',
59
+
60
+ :'href' => :'String',
61
+
62
+ :'properties' => :'TargetGroupProperties'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+
70
+
71
+
72
+
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Ionoscloud::TargetGroupPut` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if (!self.class.attribute_map.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Ionoscloud::TargetGroupPut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+
92
+ if attributes.key?(:'id')
93
+ self.id = attributes[:'id']
94
+ end
95
+
96
+
97
+ if attributes.key?(:'type')
98
+ self.type = attributes[:'type']
99
+ end
100
+
101
+
102
+ if attributes.key?(:'href')
103
+ self.href = attributes[:'href']
104
+ end
105
+
106
+
107
+ if attributes.key?(:'properties')
108
+ self.properties = attributes[:'properties']
109
+ end
110
+ end
111
+
112
+ # Show invalid properties with the reasons. Usually used together with valid?
113
+ # @return Array for valid properties with the reasons
114
+ def list_invalid_properties
115
+ invalid_properties = Array.new
116
+
117
+
118
+
119
+
120
+ if @properties.nil?
121
+ invalid_properties.push('invalid value for "properties", properties cannot be nil.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+
131
+
132
+
133
+
134
+ return false if @properties.nil?
135
+ true
136
+ end
137
+
138
+
139
+
140
+
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ id == o.id &&
148
+ type == o.type &&
149
+ href == o.href &&
150
+ properties == o.properties
151
+ end
152
+
153
+ # @see the `==` method
154
+ # @param [Object] Object to be compared
155
+ def eql?(o)
156
+ self == o
157
+ end
158
+
159
+ # Calculates hash code according to all attributes.
160
+ # @return [Integer] Hash code
161
+ def hash
162
+ [id, type, href, properties].hash
163
+ end
164
+
165
+ # Builds the object from hash
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ # @return [Object] Returns the model itself
168
+ def self.build_from_hash(attributes)
169
+ new.build_from_hash(attributes)
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ self.class.openapi_types.each_pair do |key, type|
178
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
179
+ self.send("#{key}=", nil)
180
+ elsif type =~ /\AArray<(.*)>/i
181
+ # check to ensure the input is an array given that the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
184
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
185
+ end
186
+ elsif !attributes[self.class.attribute_map[key]].nil?
187
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
188
+ end
189
+ end
190
+
191
+ self
192
+ end
193
+
194
+ # Deserializes the data based on type
195
+ # @param string type Data type
196
+ # @param string value Value to be deserialized
197
+ # @return [Object] Deserialized data
198
+ def _deserialize(type, value)
199
+ case type.to_sym
200
+ when :Time
201
+ Time.parse(value)
202
+ when :Date
203
+ Date.parse(value)
204
+ when :String
205
+ value.to_s
206
+ when :Integer
207
+ value.to_i
208
+ when :Float
209
+ value.to_f
210
+ when :Boolean
211
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
212
+ true
213
+ else
214
+ false
215
+ end
216
+ when :Object
217
+ # generic object (usually a Hash), return directly
218
+ value
219
+ when /\AArray<(?<inner_type>.+)>\z/
220
+ inner_type = Regexp.last_match[:inner_type]
221
+ value.map { |v| _deserialize(inner_type, v) }
222
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
223
+ k_type = Regexp.last_match[:k_type]
224
+ v_type = Regexp.last_match[:v_type]
225
+ {}.tap do |hash|
226
+ value.each do |k, v|
227
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
228
+ end
229
+ end
230
+ else # model
231
+ # models (e.g. Pet) or oneOf
232
+ klass = Ionoscloud.const_get(type)
233
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
234
+ end
235
+ end
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_hash (backward compatibility)
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_body
246
+ to_hash
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ if value.nil?
256
+ is_nullable = self.class.openapi_nullable.include?(attr)
257
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
+ end
259
+
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ # Outputs non-array value in the form of hash
266
+ # For object, use to_hash. Otherwise, just return the value
267
+ # @param [Object] value Any valid value
268
+ # @return [Hash] Returns the value in the form of hash
269
+ def _to_hash(value)
270
+ if value.is_a?(Array)
271
+ value.compact.map { |v| _to_hash(v) }
272
+ elsif value.is_a?(Hash)
273
+ {}.tap do |hash|
274
+ value.each { |k, v| hash[k] = _to_hash(v) }
275
+ end
276
+ elsif value.respond_to? :to_hash
277
+ value.to_hash
278
+ else
279
+ value
280
+ end
281
+ end
282
+
283
+ end
284
+
285
+ end