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
@@ -35,10 +35,6 @@ module Ionoscloud
35
35
  attr_accessor :viable_node_pool_versions
36
36
 
37
37
 
38
- # The indicator if the cluster is public or private. Be aware that setting it to false is currently in beta phase.
39
- attr_accessor :public
40
-
41
-
42
38
  # Access to the K8s API server is restricted to these CIDRs. Traffic, internal to the cluster, is not affected by this restriction. If no allowlist is specified, access is not restricted. If an IP without subnet mask is provided, the default value is used: 32 for IPv4 and 128 for IPv6.
43
39
  attr_accessor :api_subnet_allow_list
44
40
 
@@ -60,8 +56,6 @@ module Ionoscloud
60
56
 
61
57
  :'viable_node_pool_versions' => :'viableNodePoolVersions',
62
58
 
63
- :'public' => :'public',
64
-
65
59
  :'api_subnet_allow_list' => :'apiSubnetAllowList',
66
60
 
67
61
  :'s3_buckets' => :'s3Buckets'
@@ -87,8 +81,6 @@ module Ionoscloud
87
81
 
88
82
  :'viable_node_pool_versions' => :'Array<String>',
89
83
 
90
- :'public' => :'Boolean',
91
-
92
84
  :'api_subnet_allow_list' => :'Array<String>',
93
85
 
94
86
  :'s3_buckets' => :'Array<S3Bucket>'
@@ -105,7 +97,6 @@ module Ionoscloud
105
97
 
106
98
 
107
99
 
108
-
109
100
  ])
110
101
  end
111
102
 
@@ -150,13 +141,6 @@ module Ionoscloud
150
141
  end
151
142
 
152
143
 
153
- if attributes.key?(:'public')
154
- self.public = attributes[:'public']
155
- else
156
- self.public = true
157
- end
158
-
159
-
160
144
  if attributes.key?(:'api_subnet_allow_list') && (value = attributes[:'api_subnet_allow_list']).is_a?(Array)
161
145
  self.api_subnet_allow_list = value
162
146
  end
@@ -182,7 +166,6 @@ module Ionoscloud
182
166
 
183
167
 
184
168
 
185
-
186
169
  invalid_properties
187
170
  end
188
171
 
@@ -197,7 +180,6 @@ module Ionoscloud
197
180
 
198
181
 
199
182
 
200
-
201
183
  true
202
184
  end
203
185
 
@@ -208,7 +190,6 @@ module Ionoscloud
208
190
 
209
191
 
210
192
 
211
-
212
193
  # Checks equality by comparing each attribute.
213
194
  # @param [Object] Object to be compared
214
195
  def ==(o)
@@ -219,7 +200,6 @@ module Ionoscloud
219
200
  maintenance_window == o.maintenance_window &&
220
201
  available_upgrade_versions == o.available_upgrade_versions &&
221
202
  viable_node_pool_versions == o.viable_node_pool_versions &&
222
- public == o.public &&
223
203
  api_subnet_allow_list == o.api_subnet_allow_list &&
224
204
  s3_buckets == o.s3_buckets
225
205
  end
@@ -233,7 +213,7 @@ module Ionoscloud
233
213
  # Calculates hash code according to all attributes.
234
214
  # @return [Integer] Hash code
235
215
  def hash
236
- [name, k8s_version, maintenance_window, available_upgrade_versions, viable_node_pool_versions, public, api_subnet_allow_list, s3_buckets].hash
216
+ [name, k8s_version, maintenance_window, available_upgrade_versions, viable_node_pool_versions, api_subnet_allow_list, s3_buckets].hash
237
217
  end
238
218
 
239
219
  # Builds the object from hash
@@ -27,10 +27,6 @@ module Ionoscloud
27
27
  attr_accessor :maintenance_window
28
28
 
29
29
 
30
- # The indicator if the cluster is public or private. Be aware that setting it to false is currently in beta phase.
31
- attr_accessor :public
32
-
33
-
34
30
  # Access to the K8s API server is restricted to these CIDRs. Traffic, internal to the cluster, is not affected by this restriction. If no allowlist is specified, access is not restricted. If an IP without subnet mask is provided, the default value is used: 32 for IPv4 and 128 for IPv6.
35
31
  attr_accessor :api_subnet_allow_list
36
32
 
@@ -48,8 +44,6 @@ module Ionoscloud
48
44
 
49
45
  :'maintenance_window' => :'maintenanceWindow',
50
46
 
51
- :'public' => :'public',
52
-
53
47
  :'api_subnet_allow_list' => :'apiSubnetAllowList',
54
48
 
55
49
  :'s3_buckets' => :'s3Buckets'
@@ -71,8 +65,6 @@ module Ionoscloud
71
65
 
72
66
  :'maintenance_window' => :'KubernetesMaintenanceWindow',
73
67
 
74
- :'public' => :'Boolean',
75
-
76
68
  :'api_subnet_allow_list' => :'Array<String>',
77
69
 
78
70
  :'s3_buckets' => :'Array<S3Bucket>'
@@ -87,7 +79,6 @@ module Ionoscloud
87
79
 
88
80
 
89
81
 
90
-
91
82
  ])
92
83
  end
93
84
 
@@ -122,13 +113,6 @@ module Ionoscloud
122
113
  end
123
114
 
124
115
 
125
- if attributes.key?(:'public')
126
- self.public = attributes[:'public']
127
- else
128
- self.public = true
129
- end
130
-
131
-
132
116
  if attributes.key?(:'api_subnet_allow_list') && (value = attributes[:'api_subnet_allow_list']).is_a?(Array)
133
117
  self.api_subnet_allow_list = value
134
118
  end
@@ -152,7 +136,6 @@ module Ionoscloud
152
136
 
153
137
 
154
138
 
155
-
156
139
  invalid_properties
157
140
  end
158
141
 
@@ -165,7 +148,6 @@ module Ionoscloud
165
148
 
166
149
 
167
150
 
168
-
169
151
  true
170
152
  end
171
153
 
@@ -174,7 +156,6 @@ module Ionoscloud
174
156
 
175
157
 
176
158
 
177
-
178
159
  # Checks equality by comparing each attribute.
179
160
  # @param [Object] Object to be compared
180
161
  def ==(o)
@@ -183,7 +164,6 @@ module Ionoscloud
183
164
  name == o.name &&
184
165
  k8s_version == o.k8s_version &&
185
166
  maintenance_window == o.maintenance_window &&
186
- public == o.public &&
187
167
  api_subnet_allow_list == o.api_subnet_allow_list &&
188
168
  s3_buckets == o.s3_buckets
189
169
  end
@@ -197,7 +177,7 @@ module Ionoscloud
197
177
  # Calculates hash code according to all attributes.
198
178
  # @return [Integer] Hash code
199
179
  def hash
200
- [name, k8s_version, maintenance_window, public, api_subnet_allow_list, s3_buckets].hash
180
+ [name, k8s_version, maintenance_window, api_subnet_allow_list, s3_buckets].hash
201
181
  end
202
182
 
203
183
  # Builds the object from hash
@@ -81,10 +81,6 @@ module Ionoscloud
81
81
  # List of available versions for upgrading the node pool.
82
82
  attr_accessor :available_upgrade_versions
83
83
 
84
-
85
- # Public IP address for the gateway performing source NAT for the node pool's nodes belonging to a private cluster. Required only if the node pool belongs to a private cluster.
86
- attr_accessor :gateway_ip
87
-
88
84
  class EnumAttributeValidator
89
85
  attr_reader :datatype
90
86
  attr_reader :allowable_values
@@ -143,9 +139,7 @@ module Ionoscloud
143
139
 
144
140
  :'public_ips' => :'publicIps',
145
141
 
146
- :'available_upgrade_versions' => :'availableUpgradeVersions',
147
-
148
- :'gateway_ip' => :'gatewayIp'
142
+ :'available_upgrade_versions' => :'availableUpgradeVersions'
149
143
  }
150
144
  end
151
145
 
@@ -190,9 +184,7 @@ module Ionoscloud
190
184
 
191
185
  :'public_ips' => :'Array<String>',
192
186
 
193
- :'available_upgrade_versions' => :'Array<String>',
194
-
195
- :'gateway_ip' => :'String'
187
+ :'available_upgrade_versions' => :'Array<String>'
196
188
  }
197
189
  end
198
190
 
@@ -216,7 +208,6 @@ module Ionoscloud
216
208
 
217
209
 
218
210
 
219
-
220
211
  ])
221
212
  end
222
213
 
@@ -319,11 +310,6 @@ module Ionoscloud
319
310
  if attributes.key?(:'available_upgrade_versions') && (value = attributes[:'available_upgrade_versions']).is_a?(Array)
320
311
  self.available_upgrade_versions = value
321
312
  end
322
-
323
-
324
- if attributes.key?(:'gateway_ip')
325
- self.gateway_ip = attributes[:'gateway_ip']
326
- end
327
313
  end
328
314
 
329
315
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -383,7 +369,6 @@ module Ionoscloud
383
369
 
384
370
 
385
371
 
386
-
387
372
  invalid_properties
388
373
  end
389
374
 
@@ -420,7 +405,6 @@ module Ionoscloud
420
405
 
421
406
 
422
407
 
423
-
424
408
  true
425
409
  end
426
410
 
@@ -461,7 +445,6 @@ module Ionoscloud
461
445
 
462
446
 
463
447
 
464
-
465
448
  # Checks equality by comparing each attribute.
466
449
  # @param [Object] Object to be compared
467
450
  def ==(o)
@@ -483,8 +466,7 @@ module Ionoscloud
483
466
  labels == o.labels &&
484
467
  annotations == o.annotations &&
485
468
  public_ips == o.public_ips &&
486
- available_upgrade_versions == o.available_upgrade_versions &&
487
- gateway_ip == o.gateway_ip
469
+ available_upgrade_versions == o.available_upgrade_versions
488
470
  end
489
471
 
490
472
  # @see the `==` method
@@ -496,7 +478,7 @@ module Ionoscloud
496
478
  # Calculates hash code according to all attributes.
497
479
  # @return [Integer] Hash code
498
480
  def hash
499
- [name, datacenter_id, node_count, cpu_family, cores_count, ram_size, availability_zone, storage_type, storage_size, k8s_version, maintenance_window, auto_scaling, lans, labels, annotations, public_ips, available_upgrade_versions, gateway_ip].hash
481
+ [name, datacenter_id, node_count, cpu_family, cores_count, ram_size, availability_zone, storage_type, storage_size, k8s_version, maintenance_window, auto_scaling, lans, labels, annotations, public_ips, available_upgrade_versions].hash
500
482
  end
501
483
 
502
484
  # Builds the object from hash
@@ -77,10 +77,6 @@ module Ionoscloud
77
77
  # Optional array of reserved public IP addresses to be used by the nodes. IPs must be from same location as the data center used for the node pool. The array must contain one more IP than the maximum possible number of nodes (nodeCount+1 for fixed number of nodes or maxNodeCount+1 when auto scaling is used). The extra IP is used when the nodes are rebuilt.
78
78
  attr_accessor :public_ips
79
79
 
80
-
81
- # Public IP address for the gateway performing source NAT for the node pool's nodes belonging to a private cluster. Required only if the node pool belongs to a private cluster.
82
- attr_accessor :gateway_ip
83
-
84
80
  class EnumAttributeValidator
85
81
  attr_reader :datatype
86
82
  attr_reader :allowable_values
@@ -137,9 +133,7 @@ module Ionoscloud
137
133
 
138
134
  :'annotations' => :'annotations',
139
135
 
140
- :'public_ips' => :'publicIps',
141
-
142
- :'gateway_ip' => :'gatewayIp'
136
+ :'public_ips' => :'publicIps'
143
137
  }
144
138
  end
145
139
 
@@ -182,9 +176,7 @@ module Ionoscloud
182
176
 
183
177
  :'annotations' => :'Hash<String, String>',
184
178
 
185
- :'public_ips' => :'Array<String>',
186
-
187
- :'gateway_ip' => :'String'
179
+ :'public_ips' => :'Array<String>'
188
180
  }
189
181
  end
190
182
 
@@ -207,7 +199,6 @@ module Ionoscloud
207
199
 
208
200
 
209
201
 
210
-
211
202
  ])
212
203
  end
213
204
 
@@ -305,11 +296,6 @@ module Ionoscloud
305
296
  if attributes.key?(:'public_ips') && (value = attributes[:'public_ips']).is_a?(Array)
306
297
  self.public_ips = value
307
298
  end
308
-
309
-
310
- if attributes.key?(:'gateway_ip')
311
- self.gateway_ip = attributes[:'gateway_ip']
312
- end
313
299
  end
314
300
 
315
301
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -368,7 +354,6 @@ module Ionoscloud
368
354
 
369
355
 
370
356
 
371
-
372
357
  invalid_properties
373
358
  end
374
359
 
@@ -404,7 +389,6 @@ module Ionoscloud
404
389
 
405
390
 
406
391
 
407
-
408
392
  true
409
393
  end
410
394
 
@@ -444,7 +428,6 @@ module Ionoscloud
444
428
 
445
429
 
446
430
 
447
-
448
431
  # Checks equality by comparing each attribute.
449
432
  # @param [Object] Object to be compared
450
433
  def ==(o)
@@ -465,8 +448,7 @@ module Ionoscloud
465
448
  lans == o.lans &&
466
449
  labels == o.labels &&
467
450
  annotations == o.annotations &&
468
- public_ips == o.public_ips &&
469
- gateway_ip == o.gateway_ip
451
+ public_ips == o.public_ips
470
452
  end
471
453
 
472
454
  # @see the `==` method
@@ -478,7 +460,7 @@ module Ionoscloud
478
460
  # Calculates hash code according to all attributes.
479
461
  # @return [Integer] Hash code
480
462
  def hash
481
- [name, datacenter_id, node_count, cpu_family, cores_count, ram_size, availability_zone, storage_type, storage_size, k8s_version, maintenance_window, auto_scaling, lans, labels, annotations, public_ips, gateway_ip].hash
463
+ [name, datacenter_id, node_count, cpu_family, cores_count, ram_size, availability_zone, storage_type, storage_size, k8s_version, maintenance_window, auto_scaling, lans, labels, annotations, public_ips].hash
482
464
  end
483
465
 
484
466
  # Builds the object from hash
@@ -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 TargetGroup
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' => :'TargetGroupProperties'
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::TargetGroup` 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::TargetGroup`. 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