ionoscloud 5.0.1 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +65 -0
  3. data/docs/AttachedVolumes.md +1 -1
  4. data/docs/Cdroms.md +1 -1
  5. data/docs/DefaultApi.md +6 -1
  6. data/docs/ImageProperties.md +5 -1
  7. data/docs/IpBlockProperties.md +1 -1
  8. data/docs/IpConsumer.md +5 -1
  9. data/docs/KubernetesApi.md +12 -12
  10. data/docs/KubernetesClusterForPost.md +28 -0
  11. data/docs/KubernetesClusterForPut.md +28 -0
  12. data/docs/KubernetesClusterProperties.md +5 -1
  13. data/docs/KubernetesClusterPropertiesForPost.md +26 -0
  14. data/docs/{KubernetesClusterPropertiesForPostAndPut.md → KubernetesClusterPropertiesForPut.md} +3 -3
  15. data/docs/KubernetesNodePoolForPost.md +26 -0
  16. data/docs/KubernetesNodePoolProperties.md +1 -1
  17. data/docs/KubernetesNodePoolPropertiesForPost.md +1 -1
  18. data/docs/KubernetesNodePoolPropertiesForPut.md +0 -14
  19. data/docs/KubernetesNodeProperties.md +3 -1
  20. data/docs/Nics.md +1 -1
  21. data/docs/README.md +3 -3
  22. data/docs/RequestApi.md +22 -6
  23. data/docs/S3KeyProperties.md +2 -2
  24. data/docs/UserManagementApi.md +7 -7
  25. data/docs/UserPost.md +18 -0
  26. data/docs/UserProperties.md +0 -2
  27. data/docs/UserPropertiesPost.md +32 -0
  28. data/docs/UserPropertiesPut.md +30 -0
  29. data/docs/UserPut.md +20 -0
  30. data/docs/VolumeProperties.md +1 -1
  31. data/docs/summary.md +17 -1
  32. data/lib/ionoscloud.rb +9 -1
  33. data/lib/ionoscloud/api/_api.rb +1 -1
  34. data/lib/ionoscloud/api/kubernetes_api.rb +11 -11
  35. data/lib/ionoscloud/api/request_api.rb +30 -6
  36. data/lib/ionoscloud/api/user_management_api.rb +8 -8
  37. data/lib/ionoscloud/api_client.rb +13 -14
  38. data/lib/ionoscloud/configuration.rb +2 -2
  39. data/lib/ionoscloud/models/datacenter_properties.rb +0 -22
  40. data/lib/ionoscloud/models/image_properties.rb +38 -4
  41. data/lib/ionoscloud/models/ip_consumer.rb +22 -4
  42. data/lib/ionoscloud/models/kubernetes_cluster_for_post.rb +303 -0
  43. data/lib/ionoscloud/models/kubernetes_cluster_for_put.rb +303 -0
  44. data/lib/ionoscloud/models/kubernetes_cluster_properties.rb +26 -4
  45. data/lib/ionoscloud/models/kubernetes_cluster_properties_for_post.rb +263 -0
  46. data/lib/ionoscloud/models/{kubernetes_cluster_properties_for_post_and_put.rb → kubernetes_cluster_properties_for_put.rb} +4 -4
  47. data/lib/ionoscloud/models/kubernetes_node_pool_for_post.rb +294 -0
  48. data/lib/ionoscloud/models/kubernetes_node_pool_properties.rb +1 -1
  49. data/lib/ionoscloud/models/kubernetes_node_pool_properties_for_post.rb +1 -1
  50. data/lib/ionoscloud/models/kubernetes_node_pool_properties_for_put.rb +1 -152
  51. data/lib/ionoscloud/models/kubernetes_node_properties.rb +11 -6
  52. data/lib/ionoscloud/models/location_properties.rb +0 -22
  53. data/lib/ionoscloud/models/s3_key_properties.rb +2 -2
  54. data/lib/ionoscloud/models/user_post.rb +221 -0
  55. data/lib/ionoscloud/models/user_properties.rb +1 -11
  56. data/lib/ionoscloud/models/user_properties_post.rb +287 -0
  57. data/lib/ionoscloud/models/user_properties_put.rb +277 -0
  58. data/lib/ionoscloud/models/user_put.rb +231 -0
  59. data/lib/ionoscloud/models/volume_properties.rb +1 -1
  60. data/lib/ionoscloud/version.rb +1 -1
  61. data/spec/api/kubernetes_api_spec.rb +4 -4
  62. data/spec/api/request_api_spec.rb +11 -3
  63. data/spec/api/user_management_api_spec.rb +2 -2
  64. data/spec/models/datacenter_properties_spec.rb +0 -4
  65. data/spec/models/image_properties_spec.rb +16 -0
  66. data/spec/models/ip_consumer_spec.rb +12 -0
  67. data/spec/models/kubernetes_cluster_for_post_spec.rb +68 -0
  68. data/spec/models/kubernetes_cluster_for_put_spec.rb +68 -0
  69. data/spec/models/kubernetes_cluster_properties_for_post_spec.rb +58 -0
  70. data/spec/models/{kubernetes_cluster_properties_for_post_and_put_spec.rb → kubernetes_cluster_properties_for_put_spec.rb} +6 -6
  71. data/spec/models/kubernetes_cluster_properties_spec.rb +12 -0
  72. data/spec/models/kubernetes_node_pool_for_post_spec.rb +62 -0
  73. data/spec/models/kubernetes_node_pool_properties_for_put_spec.rb +0 -50
  74. data/spec/models/kubernetes_node_properties_spec.rb +6 -0
  75. data/spec/models/location_properties_spec.rb +0 -4
  76. data/spec/models/user_post_spec.rb +34 -0
  77. data/spec/models/user_properties_post_spec.rb +76 -0
  78. data/spec/models/user_properties_put_spec.rb +70 -0
  79. data/spec/models/user_properties_spec.rb +0 -6
  80. data/spec/models/user_put_spec.rb +40 -0
  81. metadata +157 -124
@@ -0,0 +1,303 @@
1
+ =begin
2
+ #CLOUD API
3
+
4
+ #An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive.
5
+
6
+ The version of the OpenAPI document: 5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Ionoscloud
17
+ class KubernetesClusterForPut
18
+ # The resource's unique identifier.
19
+ attr_accessor :id
20
+
21
+ # The type of object
22
+ attr_accessor :type
23
+
24
+ # URL to the object representation (absolute path)
25
+ attr_accessor :href
26
+
27
+ attr_accessor :metadata
28
+
29
+ attr_accessor :properties
30
+
31
+ attr_accessor :entities
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'id' => :'id',
59
+ :'type' => :'type',
60
+ :'href' => :'href',
61
+ :'metadata' => :'metadata',
62
+ :'properties' => :'properties',
63
+ :'entities' => :'entities'
64
+ }
65
+ end
66
+
67
+ # Returns all the JSON keys this model knows about
68
+ def self.acceptable_attributes
69
+ attribute_map.values
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'id' => :'String',
76
+ :'type' => :'String',
77
+ :'href' => :'String',
78
+ :'metadata' => :'DatacenterElementMetadata',
79
+ :'properties' => :'KubernetesClusterPropertiesForPut',
80
+ :'entities' => :'KubernetesClusterEntities'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ ])
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Ionoscloud::KubernetesClusterForPut` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!self.class.attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Ionoscloud::KubernetesClusterForPut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'id')
106
+ self.id = attributes[:'id']
107
+ end
108
+
109
+ if attributes.key?(:'type')
110
+ self.type = attributes[:'type']
111
+ end
112
+
113
+ if attributes.key?(:'href')
114
+ self.href = attributes[:'href']
115
+ end
116
+
117
+ if attributes.key?(:'metadata')
118
+ self.metadata = attributes[:'metadata']
119
+ end
120
+
121
+ if attributes.key?(:'properties')
122
+ self.properties = attributes[:'properties']
123
+ end
124
+
125
+ if attributes.key?(:'entities')
126
+ self.entities = attributes[:'entities']
127
+ end
128
+ end
129
+
130
+ # Show invalid properties with the reasons. Usually used together with valid?
131
+ # @return Array for valid properties with the reasons
132
+ def list_invalid_properties
133
+ invalid_properties = Array.new
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
+ type_validator = EnumAttributeValidator.new('String', ["k8s"])
145
+ return false unless type_validator.valid?(@type)
146
+ return false if @properties.nil?
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method checking allowed values (enum).
151
+ # @param [Object] type Object to be assigned
152
+ def type=(type)
153
+ validator = EnumAttributeValidator.new('String', ["k8s"])
154
+ unless validator.valid?(type)
155
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
156
+ end
157
+ @type = type
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ id == o.id &&
166
+ type == o.type &&
167
+ href == o.href &&
168
+ metadata == o.metadata &&
169
+ properties == o.properties &&
170
+ entities == o.entities
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [id, type, href, metadata, properties, entities].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ new.build_from_hash(attributes)
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ self.class.openapi_types.each_pair do |key, type|
198
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
199
+ self.send("#{key}=", nil)
200
+ elsif type =~ /\AArray<(.*)>/i
201
+ # check to ensure the input is an array given that the attribute
202
+ # is documented as an array but the input is not
203
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
204
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
205
+ end
206
+ elsif !attributes[self.class.attribute_map[key]].nil?
207
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
208
+ end
209
+ end
210
+
211
+ self
212
+ end
213
+
214
+ # Deserializes the data based on type
215
+ # @param string type Data type
216
+ # @param string value Value to be deserialized
217
+ # @return [Object] Deserialized data
218
+ def _deserialize(type, value)
219
+ case type.to_sym
220
+ when :Time
221
+ Time.parse(value)
222
+ when :Date
223
+ Date.parse(value)
224
+ when :String
225
+ value.to_s
226
+ when :Integer
227
+ value.to_i
228
+ when :Float
229
+ value.to_f
230
+ when :Boolean
231
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
232
+ true
233
+ else
234
+ false
235
+ end
236
+ when :Object
237
+ # generic object (usually a Hash), return directly
238
+ value
239
+ when /\AArray<(?<inner_type>.+)>\z/
240
+ inner_type = Regexp.last_match[:inner_type]
241
+ value.map { |v| _deserialize(inner_type, v) }
242
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
243
+ k_type = Regexp.last_match[:k_type]
244
+ v_type = Regexp.last_match[:v_type]
245
+ {}.tap do |hash|
246
+ value.each do |k, v|
247
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
+ end
249
+ end
250
+ else # model
251
+ # models (e.g. Pet) or oneOf
252
+ klass = Ionoscloud.const_get(type)
253
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ if value.nil?
276
+ is_nullable = self.class.openapi_nullable.include?(attr)
277
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
278
+ end
279
+
280
+ hash[param] = _to_hash(value)
281
+ end
282
+ hash
283
+ end
284
+
285
+ # Outputs non-array value in the form of hash
286
+ # For object, use to_hash. Otherwise, just return the value
287
+ # @param [Object] value Any valid value
288
+ # @return [Hash] Returns the value in the form of hash
289
+ def _to_hash(value)
290
+ if value.is_a?(Array)
291
+ value.compact.map { |v| _to_hash(v) }
292
+ elsif value.is_a?(Hash)
293
+ {}.tap do |hash|
294
+ value.each { |k, v| hash[k] = _to_hash(v) }
295
+ end
296
+ elsif value.respond_to? :to_hash
297
+ value.to_hash
298
+ else
299
+ value
300
+ end
301
+ end
302
+ end
303
+ end
@@ -29,6 +29,12 @@ module Ionoscloud
29
29
  # List of versions that may be used for node pools under this cluster
30
30
  attr_accessor :viable_node_pool_versions
31
31
 
32
+ # The indicator if the cluster is public or private. Be aware that setting it to false is currently in beta phase.
33
+ attr_accessor :public
34
+
35
+ # The IP address of the gateway used by the cluster. This is mandatory when `public` is set to `false` and should not be provided otherwise.
36
+ attr_accessor :gateway_ip
37
+
32
38
  # Attribute mapping from ruby-style variable name to JSON key.
33
39
  def self.attribute_map
34
40
  {
@@ -36,7 +42,9 @@ module Ionoscloud
36
42
  :'k8s_version' => :'k8sVersion',
37
43
  :'maintenance_window' => :'maintenanceWindow',
38
44
  :'available_upgrade_versions' => :'availableUpgradeVersions',
39
- :'viable_node_pool_versions' => :'viableNodePoolVersions'
45
+ :'viable_node_pool_versions' => :'viableNodePoolVersions',
46
+ :'public' => :'public',
47
+ :'gateway_ip' => :'gatewayIp'
40
48
  }
41
49
  end
42
50
 
@@ -52,7 +60,9 @@ module Ionoscloud
52
60
  :'k8s_version' => :'String',
53
61
  :'maintenance_window' => :'KubernetesMaintenanceWindow',
54
62
  :'available_upgrade_versions' => :'Array<String>',
55
- :'viable_node_pool_versions' => :'Array<String>'
63
+ :'viable_node_pool_versions' => :'Array<String>',
64
+ :'public' => :'Boolean',
65
+ :'gateway_ip' => :'String'
56
66
  }
57
67
  end
58
68
 
@@ -100,6 +110,16 @@ module Ionoscloud
100
110
  self.viable_node_pool_versions = value
101
111
  end
102
112
  end
113
+
114
+ if attributes.key?(:'public')
115
+ self.public = attributes[:'public']
116
+ else
117
+ self.public = true
118
+ end
119
+
120
+ if attributes.key?(:'gateway_ip')
121
+ self.gateway_ip = attributes[:'gateway_ip']
122
+ end
103
123
  end
104
124
 
105
125
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -129,7 +149,9 @@ module Ionoscloud
129
149
  k8s_version == o.k8s_version &&
130
150
  maintenance_window == o.maintenance_window &&
131
151
  available_upgrade_versions == o.available_upgrade_versions &&
132
- viable_node_pool_versions == o.viable_node_pool_versions
152
+ viable_node_pool_versions == o.viable_node_pool_versions &&
153
+ public == o.public &&
154
+ gateway_ip == o.gateway_ip
133
155
  end
134
156
 
135
157
  # @see the `==` method
@@ -141,7 +163,7 @@ module Ionoscloud
141
163
  # Calculates hash code according to all attributes.
142
164
  # @return [Integer] Hash code
143
165
  def hash
144
- [name, k8s_version, maintenance_window, available_upgrade_versions, viable_node_pool_versions].hash
166
+ [name, k8s_version, maintenance_window, available_upgrade_versions, viable_node_pool_versions, public, gateway_ip].hash
145
167
  end
146
168
 
147
169
  # Builds the object from hash
@@ -0,0 +1,263 @@
1
+ =begin
2
+ #CLOUD API
3
+
4
+ #An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive.
5
+
6
+ The version of the OpenAPI document: 5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Ionoscloud
17
+ class KubernetesClusterPropertiesForPost
18
+ # A Kubernetes Cluster Name. Valid Kubernetes Cluster name must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
19
+ attr_accessor :name
20
+
21
+ # The kubernetes version in which a cluster is running. This imposes restrictions on what kubernetes versions can be run in a cluster's nodepools. Additionally, not all kubernetes versions are viable upgrade targets for all prior versions.
22
+ attr_accessor :k8s_version
23
+
24
+ attr_accessor :maintenance_window
25
+
26
+ # The indicator if the cluster is public or private. Be aware that setting it to false is currently in beta phase.
27
+ attr_accessor :public
28
+
29
+ # The IP address of the gateway used by the cluster. This is mandatory when `public` is set to `false` and should not be provided otherwise.
30
+ attr_accessor :gateway_ip
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'name' => :'name',
36
+ :'k8s_version' => :'k8sVersion',
37
+ :'maintenance_window' => :'maintenanceWindow',
38
+ :'public' => :'public',
39
+ :'gateway_ip' => :'gatewayIp'
40
+ }
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ attribute_map.values
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'name' => :'String',
52
+ :'k8s_version' => :'String',
53
+ :'maintenance_window' => :'KubernetesMaintenanceWindow',
54
+ :'public' => :'Boolean',
55
+ :'gateway_ip' => :'String'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Ionoscloud::KubernetesClusterPropertiesForPost` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Ionoscloud::KubernetesClusterPropertiesForPost`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'name')
81
+ self.name = attributes[:'name']
82
+ end
83
+
84
+ if attributes.key?(:'k8s_version')
85
+ self.k8s_version = attributes[:'k8s_version']
86
+ end
87
+
88
+ if attributes.key?(:'maintenance_window')
89
+ self.maintenance_window = attributes[:'maintenance_window']
90
+ end
91
+
92
+ if attributes.key?(:'public')
93
+ self.public = attributes[:'public']
94
+ else
95
+ self.public = true
96
+ end
97
+
98
+ if attributes.key?(:'gateway_ip')
99
+ self.gateway_ip = attributes[:'gateway_ip']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ if @name.nil?
108
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
109
+ end
110
+
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ return false if @name.nil?
118
+ true
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ name == o.name &&
127
+ k8s_version == o.k8s_version &&
128
+ maintenance_window == o.maintenance_window &&
129
+ public == o.public &&
130
+ gateway_ip == o.gateway_ip
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [name, k8s_version, maintenance_window, public, gateway_ip].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ new.build_from_hash(attributes)
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.openapi_types.each_pair do |key, type|
158
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
159
+ self.send("#{key}=", nil)
160
+ elsif type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
164
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
165
+ end
166
+ elsif !attributes[self.class.attribute_map[key]].nil?
167
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ end
169
+ end
170
+
171
+ self
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def _deserialize(type, value)
179
+ case type.to_sym
180
+ when :Time
181
+ Time.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :Boolean
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ # models (e.g. Pet) or oneOf
212
+ klass = Ionoscloud.const_get(type)
213
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
214
+ end
215
+ end
216
+
217
+ # Returns the string representation of the object
218
+ # @return [String] String presentation of the object
219
+ def to_s
220
+ to_hash.to_s
221
+ end
222
+
223
+ # to_body is an alias to to_hash (backward compatibility)
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_body
226
+ to_hash
227
+ end
228
+
229
+ # Returns the object in the form of hash
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = self.send(attr)
235
+ if value.nil?
236
+ is_nullable = self.class.openapi_nullable.include?(attr)
237
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
238
+ end
239
+
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+ end
263
+ end