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,302 @@
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 ApplicationLoadBalancerForwardingRule
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 :metadata
32
+
33
+
34
+ attr_accessor :properties
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+
40
+ :'id' => :'id',
41
+
42
+ :'type' => :'type',
43
+
44
+ :'href' => :'href',
45
+
46
+ :'metadata' => :'metadata',
47
+
48
+ :'properties' => :'properties'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+
61
+ :'id' => :'String',
62
+
63
+ :'type' => :'Type',
64
+
65
+ :'href' => :'String',
66
+
67
+ :'metadata' => :'DatacenterElementMetadata',
68
+
69
+ :'properties' => :'ApplicationLoadBalancerForwardingRuleProperties'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+
77
+
78
+
79
+
80
+
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Ionoscloud::ApplicationLoadBalancerForwardingRule` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!self.class.attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Ionoscloud::ApplicationLoadBalancerForwardingRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+
100
+ if attributes.key?(:'id')
101
+ self.id = attributes[:'id']
102
+ end
103
+
104
+
105
+ if attributes.key?(:'type')
106
+ self.type = attributes[:'type']
107
+ end
108
+
109
+
110
+ if attributes.key?(:'href')
111
+ self.href = attributes[:'href']
112
+ end
113
+
114
+
115
+ if attributes.key?(:'metadata')
116
+ self.metadata = attributes[:'metadata']
117
+ end
118
+
119
+
120
+ if attributes.key?(:'properties')
121
+ self.properties = attributes[:'properties']
122
+ end
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ invalid_properties = Array.new
129
+
130
+
131
+
132
+
133
+
134
+ if @properties.nil?
135
+ invalid_properties.push('invalid value for "properties", properties cannot be nil.')
136
+ end
137
+
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+
145
+
146
+
147
+
148
+
149
+ return false if @properties.nil?
150
+ true
151
+ end
152
+
153
+
154
+
155
+
156
+
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ id == o.id &&
164
+ type == o.type &&
165
+ href == o.href &&
166
+ metadata == o.metadata &&
167
+ properties == o.properties
168
+ end
169
+
170
+ # @see the `==` method
171
+ # @param [Object] Object to be compared
172
+ def eql?(o)
173
+ self == o
174
+ end
175
+
176
+ # Calculates hash code according to all attributes.
177
+ # @return [Integer] Hash code
178
+ def hash
179
+ [id, type, href, metadata, properties].hash
180
+ end
181
+
182
+ # Builds the object from hash
183
+ # @param [Hash] attributes Model attributes in the form of hash
184
+ # @return [Object] Returns the model itself
185
+ def self.build_from_hash(attributes)
186
+ new.build_from_hash(attributes)
187
+ end
188
+
189
+ # Builds the object from hash
190
+ # @param [Hash] attributes Model attributes in the form of hash
191
+ # @return [Object] Returns the model itself
192
+ def build_from_hash(attributes)
193
+ return nil unless attributes.is_a?(Hash)
194
+ self.class.openapi_types.each_pair do |key, type|
195
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
196
+ self.send("#{key}=", nil)
197
+ elsif type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
201
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
+ end
203
+ elsif !attributes[self.class.attribute_map[key]].nil?
204
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
205
+ end
206
+ end
207
+
208
+ self
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def _deserialize(type, value)
216
+ case type.to_sym
217
+ when :Time
218
+ Time.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :Boolean
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ # models (e.g. Pet) or oneOf
249
+ klass = Ionoscloud.const_get(type)
250
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
+ end
252
+ end
253
+
254
+ # Returns the string representation of the object
255
+ # @return [String] String presentation of the object
256
+ def to_s
257
+ to_hash.to_s
258
+ end
259
+
260
+ # to_body is an alias to to_hash (backward compatibility)
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_body
263
+ to_hash
264
+ end
265
+
266
+ # Returns the object in the form of hash
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_hash
269
+ hash = {}
270
+ self.class.attribute_map.each_pair do |attr, param|
271
+ value = self.send(attr)
272
+ if value.nil?
273
+ is_nullable = self.class.openapi_nullable.include?(attr)
274
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
+ end
276
+
277
+ hash[param] = _to_hash(value)
278
+ end
279
+ hash
280
+ end
281
+
282
+ # Outputs non-array value in the form of hash
283
+ # For object, use to_hash. Otherwise, just return the value
284
+ # @param [Object] value Any valid value
285
+ # @return [Hash] Returns the value in the form of hash
286
+ def _to_hash(value)
287
+ if value.is_a?(Array)
288
+ value.compact.map { |v| _to_hash(v) }
289
+ elsif value.is_a?(Hash)
290
+ {}.tap do |hash|
291
+ value.each { |k, v| hash[k] = _to_hash(v) }
292
+ end
293
+ elsif value.respond_to? :to_hash
294
+ value.to_hash
295
+ else
296
+ value
297
+ end
298
+ end
299
+
300
+ end
301
+
302
+ end
@@ -0,0 +1,389 @@
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 ApplicationLoadBalancerForwardingRuleProperties
18
+
19
+ # The name of the Application Load Balancer forwarding rule.
20
+ attr_accessor :name
21
+
22
+
23
+ # Balancing protocol
24
+ attr_accessor :protocol
25
+
26
+
27
+ # Listening (inbound) IP
28
+ attr_accessor :listener_ip
29
+
30
+
31
+ # Listening (inbound) port number; valid range is 1 to 65535.
32
+ attr_accessor :listener_port
33
+
34
+
35
+ # The maximum time in milliseconds to wait for the client to acknowledge or send data; default is 50,000 (50 seconds).
36
+ attr_accessor :client_timeout
37
+
38
+
39
+ # Array of items in the collection.
40
+ attr_accessor :server_certificates
41
+
42
+
43
+ # An array of items in the collection. The original order of rules is perserved during processing, except for Forward-type rules are processed after the rules with other action defined. The relative order of Forward-type rules is also preserved during the processing.
44
+ attr_accessor :http_rules
45
+
46
+ class EnumAttributeValidator
47
+ attr_reader :datatype
48
+ attr_reader :allowable_values
49
+
50
+ def initialize(datatype, allowable_values)
51
+ @allowable_values = allowable_values.map do |value|
52
+ case datatype.to_s
53
+ when /Integer/i
54
+ value.to_i
55
+ when /Float/i
56
+ value.to_f
57
+ else
58
+ value
59
+ end
60
+ end
61
+ end
62
+
63
+ def valid?(value)
64
+ !value || allowable_values.include?(value)
65
+ end
66
+ end
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ {
71
+
72
+ :'name' => :'name',
73
+
74
+ :'protocol' => :'protocol',
75
+
76
+ :'listener_ip' => :'listenerIp',
77
+
78
+ :'listener_port' => :'listenerPort',
79
+
80
+ :'client_timeout' => :'clientTimeout',
81
+
82
+ :'server_certificates' => :'serverCertificates',
83
+
84
+ :'http_rules' => :'httpRules'
85
+ }
86
+ end
87
+
88
+ # Returns all the JSON keys this model knows about
89
+ def self.acceptable_attributes
90
+ attribute_map.values
91
+ end
92
+
93
+ # Attribute type mapping.
94
+ def self.openapi_types
95
+ {
96
+
97
+ :'name' => :'String',
98
+
99
+ :'protocol' => :'String',
100
+
101
+ :'listener_ip' => :'String',
102
+
103
+ :'listener_port' => :'Integer',
104
+
105
+ :'client_timeout' => :'Integer',
106
+
107
+ :'server_certificates' => :'Array<String>',
108
+
109
+ :'http_rules' => :'Array<ApplicationLoadBalancerHttpRule>'
110
+ }
111
+ end
112
+
113
+ # List of attributes with nullable: true
114
+ def self.openapi_nullable
115
+ Set.new([
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ ])
124
+ end
125
+
126
+ # Initializes the object
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ def initialize(attributes = {})
129
+ if (!attributes.is_a?(Hash))
130
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Ionoscloud::ApplicationLoadBalancerForwardingRuleProperties` initialize method"
131
+ end
132
+
133
+ # check to see if the attribute exists and convert string to symbol for hash key
134
+ attributes = attributes.each_with_object({}) { |(k, v), h|
135
+ if (!self.class.attribute_map.key?(k.to_sym))
136
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Ionoscloud::ApplicationLoadBalancerForwardingRuleProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
137
+ end
138
+ h[k.to_sym] = v
139
+ }
140
+
141
+
142
+ if attributes.key?(:'name')
143
+ self.name = attributes[:'name']
144
+ end
145
+
146
+
147
+ if attributes.key?(:'protocol')
148
+ self.protocol = attributes[:'protocol']
149
+ end
150
+
151
+
152
+ if attributes.key?(:'listener_ip')
153
+ self.listener_ip = attributes[:'listener_ip']
154
+ end
155
+
156
+
157
+ if attributes.key?(:'listener_port')
158
+ self.listener_port = attributes[:'listener_port']
159
+ end
160
+
161
+
162
+ if attributes.key?(:'client_timeout')
163
+ self.client_timeout = attributes[:'client_timeout']
164
+ end
165
+
166
+
167
+ if attributes.key?(:'server_certificates') && (value = attributes[:'server_certificates']).is_a?(Array)
168
+ self.server_certificates = value
169
+ end
170
+
171
+
172
+ if attributes.key?(:'http_rules') && (value = attributes[:'http_rules']).is_a?(Array)
173
+ self.http_rules = value
174
+ end
175
+ end
176
+
177
+ # Show invalid properties with the reasons. Usually used together with valid?
178
+ # @return Array for valid properties with the reasons
179
+ def list_invalid_properties
180
+ invalid_properties = Array.new
181
+
182
+ if @name.nil?
183
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
184
+ end
185
+
186
+
187
+ if @protocol.nil?
188
+ invalid_properties.push('invalid value for "protocol", protocol cannot be nil.')
189
+ end
190
+
191
+
192
+ if @listener_ip.nil?
193
+ invalid_properties.push('invalid value for "listener_ip", listener_ip cannot be nil.')
194
+ end
195
+
196
+
197
+ if @listener_port.nil?
198
+ invalid_properties.push('invalid value for "listener_port", listener_port cannot be nil.')
199
+ end
200
+
201
+
202
+
203
+
204
+ invalid_properties
205
+ end
206
+
207
+ # Check to see if the all the properties in the model are valid
208
+ # @return true if the model is valid
209
+ def valid?
210
+
211
+ return false if @name.nil?
212
+
213
+ return false if @protocol.nil?
214
+ protocol_validator = EnumAttributeValidator.new('String', ["HTTP"])
215
+ return false unless protocol_validator.valid?(@protocol)
216
+
217
+ return false if @listener_ip.nil?
218
+
219
+ return false if @listener_port.nil?
220
+
221
+
222
+
223
+ true
224
+ end
225
+
226
+
227
+
228
+ # Custom attribute writer method checking allowed values (enum).
229
+ # @param [Object] protocol Object to be assigned
230
+ def protocol=(protocol)
231
+ validator = EnumAttributeValidator.new('String', ["HTTP"])
232
+ unless validator.valid?(protocol)
233
+ fail ArgumentError, "invalid value for \"protocol\", must be one of #{validator.allowable_values}."
234
+ end
235
+ @protocol = protocol
236
+ end
237
+
238
+
239
+
240
+
241
+
242
+
243
+ # Checks equality by comparing each attribute.
244
+ # @param [Object] Object to be compared
245
+ def ==(o)
246
+ return true if self.equal?(o)
247
+ self.class == o.class &&
248
+ name == o.name &&
249
+ protocol == o.protocol &&
250
+ listener_ip == o.listener_ip &&
251
+ listener_port == o.listener_port &&
252
+ client_timeout == o.client_timeout &&
253
+ server_certificates == o.server_certificates &&
254
+ http_rules == o.http_rules
255
+ end
256
+
257
+ # @see the `==` method
258
+ # @param [Object] Object to be compared
259
+ def eql?(o)
260
+ self == o
261
+ end
262
+
263
+ # Calculates hash code according to all attributes.
264
+ # @return [Integer] Hash code
265
+ def hash
266
+ [name, protocol, listener_ip, listener_port, client_timeout, server_certificates, http_rules].hash
267
+ end
268
+
269
+ # Builds the object from hash
270
+ # @param [Hash] attributes Model attributes in the form of hash
271
+ # @return [Object] Returns the model itself
272
+ def self.build_from_hash(attributes)
273
+ new.build_from_hash(attributes)
274
+ end
275
+
276
+ # Builds the object from hash
277
+ # @param [Hash] attributes Model attributes in the form of hash
278
+ # @return [Object] Returns the model itself
279
+ def build_from_hash(attributes)
280
+ return nil unless attributes.is_a?(Hash)
281
+ self.class.openapi_types.each_pair do |key, type|
282
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
283
+ self.send("#{key}=", nil)
284
+ elsif type =~ /\AArray<(.*)>/i
285
+ # check to ensure the input is an array given that the attribute
286
+ # is documented as an array but the input is not
287
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
288
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
289
+ end
290
+ elsif !attributes[self.class.attribute_map[key]].nil?
291
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
292
+ end
293
+ end
294
+
295
+ self
296
+ end
297
+
298
+ # Deserializes the data based on type
299
+ # @param string type Data type
300
+ # @param string value Value to be deserialized
301
+ # @return [Object] Deserialized data
302
+ def _deserialize(type, value)
303
+ case type.to_sym
304
+ when :Time
305
+ Time.parse(value)
306
+ when :Date
307
+ Date.parse(value)
308
+ when :String
309
+ value.to_s
310
+ when :Integer
311
+ value.to_i
312
+ when :Float
313
+ value.to_f
314
+ when :Boolean
315
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
316
+ true
317
+ else
318
+ false
319
+ end
320
+ when :Object
321
+ # generic object (usually a Hash), return directly
322
+ value
323
+ when /\AArray<(?<inner_type>.+)>\z/
324
+ inner_type = Regexp.last_match[:inner_type]
325
+ value.map { |v| _deserialize(inner_type, v) }
326
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
327
+ k_type = Regexp.last_match[:k_type]
328
+ v_type = Regexp.last_match[:v_type]
329
+ {}.tap do |hash|
330
+ value.each do |k, v|
331
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
332
+ end
333
+ end
334
+ else # model
335
+ # models (e.g. Pet) or oneOf
336
+ klass = Ionoscloud.const_get(type)
337
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
338
+ end
339
+ end
340
+
341
+ # Returns the string representation of the object
342
+ # @return [String] String presentation of the object
343
+ def to_s
344
+ to_hash.to_s
345
+ end
346
+
347
+ # to_body is an alias to to_hash (backward compatibility)
348
+ # @return [Hash] Returns the object in the form of hash
349
+ def to_body
350
+ to_hash
351
+ end
352
+
353
+ # Returns the object in the form of hash
354
+ # @return [Hash] Returns the object in the form of hash
355
+ def to_hash
356
+ hash = {}
357
+ self.class.attribute_map.each_pair do |attr, param|
358
+ value = self.send(attr)
359
+ if value.nil?
360
+ is_nullable = self.class.openapi_nullable.include?(attr)
361
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
362
+ end
363
+
364
+ hash[param] = _to_hash(value)
365
+ end
366
+ hash
367
+ end
368
+
369
+ # Outputs non-array value in the form of hash
370
+ # For object, use to_hash. Otherwise, just return the value
371
+ # @param [Object] value Any valid value
372
+ # @return [Hash] Returns the value in the form of hash
373
+ def _to_hash(value)
374
+ if value.is_a?(Array)
375
+ value.compact.map { |v| _to_hash(v) }
376
+ elsif value.is_a?(Hash)
377
+ {}.tap do |hash|
378
+ value.each { |k, v| hash[k] = _to_hash(v) }
379
+ end
380
+ elsif value.respond_to? :to_hash
381
+ value.to_hash
382
+ else
383
+ value
384
+ end
385
+ end
386
+
387
+ end
388
+
389
+ end