ionoscloud-dbaas-postgres 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +70 -0
  4. data/LICENSE +201 -0
  5. data/README.md +65 -0
  6. data/Rakefile +10 -0
  7. data/docs/README.md +163 -0
  8. data/docs/api/BackupsApi.md +232 -0
  9. data/docs/api/ClustersApi.md +540 -0
  10. data/docs/api/LogsApi.md +91 -0
  11. data/docs/api/MetadataApi.md +153 -0
  12. data/docs/api/RestoresApi.md +84 -0
  13. data/docs/models/APIVersion.md +20 -0
  14. data/docs/models/BackupLocation.md +15 -0
  15. data/docs/models/BackupMetadata.md +20 -0
  16. data/docs/models/BackupResponse.md +24 -0
  17. data/docs/models/ClusterBackup.md +26 -0
  18. data/docs/models/ClusterBackupList.md +28 -0
  19. data/docs/models/ClusterBackupListAllOf.md +22 -0
  20. data/docs/models/ClusterList.md +28 -0
  21. data/docs/models/ClusterListAllOf.md +22 -0
  22. data/docs/models/ClusterLogs.md +18 -0
  23. data/docs/models/ClusterLogsInstances.md +20 -0
  24. data/docs/models/ClusterLogsMessages.md +20 -0
  25. data/docs/models/ClusterProperties.md +40 -0
  26. data/docs/models/ClusterResponse.md +24 -0
  27. data/docs/models/Connection.md +22 -0
  28. data/docs/models/CreateClusterProperties.md +42 -0
  29. data/docs/models/CreateClusterRequest.md +20 -0
  30. data/docs/models/CreateRestoreRequest.md +20 -0
  31. data/docs/models/DBUser.md +20 -0
  32. data/docs/models/DayOfTheWeek.md +15 -0
  33. data/docs/models/ErrorMessage.md +20 -0
  34. data/docs/models/ErrorResponse.md +20 -0
  35. data/docs/models/Location.md +15 -0
  36. data/docs/models/MaintenanceWindow.md +20 -0
  37. data/docs/models/Metadata.md +30 -0
  38. data/docs/models/Pagination.md +22 -0
  39. data/docs/models/PaginationLinks.md +22 -0
  40. data/docs/models/PatchClusterProperties.md +32 -0
  41. data/docs/models/PatchClusterRequest.md +20 -0
  42. data/docs/models/PostgresVersionList.md +18 -0
  43. data/docs/models/PostgresVersionListData.md +18 -0
  44. data/docs/models/ResourceType.md +15 -0
  45. data/docs/models/State.md +15 -0
  46. data/docs/models/StorageType.md +15 -0
  47. data/docs/models/SynchronizationMode.md +15 -0
  48. data/docs/summary.md +50 -0
  49. data/git_push.sh +58 -0
  50. data/ionoscloud-dbaas-postgres.gemspec +38 -0
  51. data/lib/ionoscloud-dbaas-postgres/api/backups_api.rb +205 -0
  52. data/lib/ionoscloud-dbaas-postgres/api/clusters_api.rb +464 -0
  53. data/lib/ionoscloud-dbaas-postgres/api/logs_api.rb +102 -0
  54. data/lib/ionoscloud-dbaas-postgres/api/metadata_api.rb +136 -0
  55. data/lib/ionoscloud-dbaas-postgres/api/restores_api.rb +93 -0
  56. data/lib/ionoscloud-dbaas-postgres/api_client.rb +471 -0
  57. data/lib/ionoscloud-dbaas-postgres/api_error.rb +57 -0
  58. data/lib/ionoscloud-dbaas-postgres/configuration.rb +291 -0
  59. data/lib/ionoscloud-dbaas-postgres/models/api_version.rb +227 -0
  60. data/lib/ionoscloud-dbaas-postgres/models/backup_location.rb +36 -0
  61. data/lib/ionoscloud-dbaas-postgres/models/backup_metadata.rb +229 -0
  62. data/lib/ionoscloud-dbaas-postgres/models/backup_response.rb +247 -0
  63. data/lib/ionoscloud-dbaas-postgres/models/cluster_backup.rb +260 -0
  64. data/lib/ionoscloud-dbaas-postgres/models/cluster_backup_list.rb +305 -0
  65. data/lib/ionoscloud-dbaas-postgres/models/cluster_backup_list_all_of.rb +237 -0
  66. data/lib/ionoscloud-dbaas-postgres/models/cluster_list.rb +305 -0
  67. data/lib/ionoscloud-dbaas-postgres/models/cluster_list_all_of.rb +237 -0
  68. data/lib/ionoscloud-dbaas-postgres/models/cluster_logs.rb +219 -0
  69. data/lib/ionoscloud-dbaas-postgres/models/cluster_logs_instances.rb +228 -0
  70. data/lib/ionoscloud-dbaas-postgres/models/cluster_logs_messages.rb +227 -0
  71. data/lib/ionoscloud-dbaas-postgres/models/cluster_properties.rb +417 -0
  72. data/lib/ionoscloud-dbaas-postgres/models/cluster_response.rb +247 -0
  73. data/lib/ionoscloud-dbaas-postgres/models/connection.rb +255 -0
  74. data/lib/ionoscloud-dbaas-postgres/models/create_cluster_properties.rb +501 -0
  75. data/lib/ionoscloud-dbaas-postgres/models/create_cluster_request.rb +228 -0
  76. data/lib/ionoscloud-dbaas-postgres/models/create_restore_request.rb +235 -0
  77. data/lib/ionoscloud-dbaas-postgres/models/day_of_the_week.rb +42 -0
  78. data/lib/ionoscloud-dbaas-postgres/models/db_user.rb +239 -0
  79. data/lib/ionoscloud-dbaas-postgres/models/error_message.rb +229 -0
  80. data/lib/ionoscloud-dbaas-postgres/models/error_response.rb +228 -0
  81. data/lib/ionoscloud-dbaas-postgres/models/location.rb +41 -0
  82. data/lib/ionoscloud-dbaas-postgres/models/maintenance_window.rb +238 -0
  83. data/lib/ionoscloud-dbaas-postgres/models/metadata.rb +275 -0
  84. data/lib/ionoscloud-dbaas-postgres/models/pagination.rb +268 -0
  85. data/lib/ionoscloud-dbaas-postgres/models/pagination_links.rb +240 -0
  86. data/lib/ionoscloud-dbaas-postgres/models/patch_cluster_properties.rb +381 -0
  87. data/lib/ionoscloud-dbaas-postgres/models/patch_cluster_request.rb +228 -0
  88. data/lib/ionoscloud-dbaas-postgres/models/postgres_version_list.rb +219 -0
  89. data/lib/ionoscloud-dbaas-postgres/models/postgres_version_list_data.rb +218 -0
  90. data/lib/ionoscloud-dbaas-postgres/models/resource_type.rb +38 -0
  91. data/lib/ionoscloud-dbaas-postgres/models/state.rb +40 -0
  92. data/lib/ionoscloud-dbaas-postgres/models/storage_type.rb +37 -0
  93. data/lib/ionoscloud-dbaas-postgres/models/synchronization_mode.rb +38 -0
  94. data/lib/ionoscloud-dbaas-postgres/version.rb +15 -0
  95. data/lib/ionoscloud-dbaas-postgres.rb +79 -0
  96. data/lib/test_driver.rb +119 -0
  97. data/sonar-project.properties +12 -0
  98. data/spec/api_client_spec.rb +226 -0
  99. data/spec/configuration_spec.rb +42 -0
  100. data/spec/spec_helper.rb +111 -0
  101. metadata +190 -0
@@ -0,0 +1,381 @@
1
+ =begin
2
+ #IONOS DBaaS REST API
3
+
4
+ #An enterprise-grade Database is provided as a Service (DBaaS) 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 create additional database clusters or modify existing ones. 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: 0.0.1
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 IonoscloudDbaasPostgres
17
+ # Properties of the payload to change a cluster
18
+ class PatchClusterProperties
19
+ # The number of CPU cores per instance.
20
+ attr_accessor :cores
21
+
22
+ # The amount of memory per instance in megabytes. Has to be a multiple of 1024.
23
+ attr_accessor :ram
24
+
25
+ # The amount of storage per instance in megabytes.
26
+ attr_accessor :storage_size
27
+
28
+ attr_accessor :connections
29
+
30
+ # The friendly name of your cluster.
31
+ attr_accessor :display_name
32
+
33
+ attr_accessor :maintenance_window
34
+
35
+ # The PostgreSQL version of your cluster.
36
+ attr_accessor :postgres_version
37
+
38
+ # The total number of instances in the cluster (one master and n-1 standbys).
39
+ attr_accessor :instances
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'cores' => :'cores',
45
+ :'ram' => :'ram',
46
+ :'storage_size' => :'storageSize',
47
+ :'connections' => :'connections',
48
+ :'display_name' => :'displayName',
49
+ :'maintenance_window' => :'maintenanceWindow',
50
+ :'postgres_version' => :'postgresVersion',
51
+ :'instances' => :'instances'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'cores' => :'Integer',
64
+ :'ram' => :'Integer',
65
+ :'storage_size' => :'Integer',
66
+ :'connections' => :'Array<Connection>',
67
+ :'display_name' => :'String',
68
+ :'maintenance_window' => :'MaintenanceWindow',
69
+ :'postgres_version' => :'String',
70
+ :'instances' => :'Integer'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IonoscloudDbaasPostgres::PatchClusterProperties` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IonoscloudDbaasPostgres::PatchClusterProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'cores')
96
+ self.cores = attributes[:'cores']
97
+ end
98
+
99
+ if attributes.key?(:'ram')
100
+ self.ram = attributes[:'ram']
101
+ end
102
+
103
+ if attributes.key?(:'storage_size')
104
+ self.storage_size = attributes[:'storage_size']
105
+ end
106
+
107
+ if attributes.key?(:'connections') && (value = attributes[:'connections']).is_a?(Array)
108
+ self.connections = value
109
+ end
110
+
111
+ if attributes.key?(:'display_name')
112
+ self.display_name = attributes[:'display_name']
113
+ end
114
+
115
+ if attributes.key?(:'maintenance_window')
116
+ self.maintenance_window = attributes[:'maintenance_window']
117
+ end
118
+
119
+ if attributes.key?(:'postgres_version')
120
+ self.postgres_version = attributes[:'postgres_version']
121
+ end
122
+
123
+ if attributes.key?(:'instances')
124
+ self.instances = attributes[:'instances']
125
+ end
126
+ end
127
+
128
+ # Show invalid properties with the reasons. Usually used together with valid?
129
+ # @return Array for valid properties with the reasons
130
+ def list_invalid_properties
131
+ invalid_properties = Array.new
132
+ if !@cores.nil? && @cores < 1
133
+ invalid_properties.push('invalid value for "cores", must be greater than or equal to 1.')
134
+ end
135
+
136
+ if !@ram.nil? && @ram < 2048
137
+ invalid_properties.push('invalid value for "ram", must be greater than or equal to 2048.')
138
+ end
139
+
140
+ if !@storage_size.nil? && @storage_size < 2048
141
+ invalid_properties.push('invalid value for "storage_size", must be greater than or equal to 2048.')
142
+ end
143
+
144
+ if !@connections.nil? && @connections.length > 1
145
+ invalid_properties.push('invalid value for "connections", number of items must be less than or equal to 1.')
146
+ end
147
+
148
+ if !@connections.nil? && @connections.length < 0
149
+ invalid_properties.push('invalid value for "connections", number of items must be greater than or equal to 0.')
150
+ end
151
+
152
+ if !@instances.nil? && @instances > 5
153
+ invalid_properties.push('invalid value for "instances", must be smaller than or equal to 5.')
154
+ end
155
+
156
+ if !@instances.nil? && @instances < 1
157
+ invalid_properties.push('invalid value for "instances", must be greater than or equal to 1.')
158
+ end
159
+
160
+ invalid_properties
161
+ end
162
+
163
+ # Check to see if the all the properties in the model are valid
164
+ # @return true if the model is valid
165
+ def valid?
166
+ return false if !@cores.nil? && @cores < 1
167
+ return false if !@ram.nil? && @ram < 2048
168
+ return false if !@storage_size.nil? && @storage_size < 2048
169
+ return false if !@connections.nil? && @connections.length > 1
170
+ return false if !@connections.nil? && @connections.length < 0
171
+ return false if !@instances.nil? && @instances > 5
172
+ return false if !@instances.nil? && @instances < 1
173
+ true
174
+ end
175
+
176
+ # Custom attribute writer method with validation
177
+ # @param [Object] cores Value to be assigned
178
+ def cores=(cores)
179
+ if !cores.nil? && cores < 1
180
+ fail ArgumentError, 'invalid value for "cores", must be greater than or equal to 1.'
181
+ end
182
+
183
+ @cores = cores
184
+ end
185
+
186
+ # Custom attribute writer method with validation
187
+ # @param [Object] ram Value to be assigned
188
+ def ram=(ram)
189
+ if !ram.nil? && ram < 2048
190
+ fail ArgumentError, 'invalid value for "ram", must be greater than or equal to 2048.'
191
+ end
192
+
193
+ @ram = ram
194
+ end
195
+
196
+ # Custom attribute writer method with validation
197
+ # @param [Object] storage_size Value to be assigned
198
+ def storage_size=(storage_size)
199
+ if !storage_size.nil? && storage_size < 2048
200
+ fail ArgumentError, 'invalid value for "storage_size", must be greater than or equal to 2048.'
201
+ end
202
+
203
+ @storage_size = storage_size
204
+ end
205
+
206
+ # Custom attribute writer method with validation
207
+ # @param [Object] connections Value to be assigned
208
+ def connections=(connections)
209
+ if !connections.nil? && connections.length > 1
210
+ fail ArgumentError, 'invalid value for "connections", number of items must be less than or equal to 1.'
211
+ end
212
+
213
+ if !connections.nil? && connections.length < 0
214
+ fail ArgumentError, 'invalid value for "connections", number of items must be greater than or equal to 0.'
215
+ end
216
+
217
+ @connections = connections
218
+ end
219
+
220
+ # Custom attribute writer method with validation
221
+ # @param [Object] instances Value to be assigned
222
+ def instances=(instances)
223
+ if !instances.nil? && instances > 5
224
+ fail ArgumentError, 'invalid value for "instances", must be smaller than or equal to 5.'
225
+ end
226
+
227
+ if !instances.nil? && instances < 1
228
+ fail ArgumentError, 'invalid value for "instances", must be greater than or equal to 1.'
229
+ end
230
+
231
+ @instances = instances
232
+ end
233
+
234
+ # Checks equality by comparing each attribute.
235
+ # @param [Object] Object to be compared
236
+ def ==(o)
237
+ return true if self.equal?(o)
238
+ self.class == o.class &&
239
+ cores == o.cores &&
240
+ ram == o.ram &&
241
+ storage_size == o.storage_size &&
242
+ connections == o.connections &&
243
+ display_name == o.display_name &&
244
+ maintenance_window == o.maintenance_window &&
245
+ postgres_version == o.postgres_version &&
246
+ instances == o.instances
247
+ end
248
+
249
+ # @see the `==` method
250
+ # @param [Object] Object to be compared
251
+ def eql?(o)
252
+ self == o
253
+ end
254
+
255
+ # Calculates hash code according to all attributes.
256
+ # @return [Integer] Hash code
257
+ def hash
258
+ [cores, ram, storage_size, connections, display_name, maintenance_window, postgres_version, instances].hash
259
+ end
260
+
261
+ # Builds the object from hash
262
+ # @param [Hash] attributes Model attributes in the form of hash
263
+ # @return [Object] Returns the model itself
264
+ def self.build_from_hash(attributes)
265
+ new.build_from_hash(attributes)
266
+ end
267
+
268
+ # Builds the object from hash
269
+ # @param [Hash] attributes Model attributes in the form of hash
270
+ # @return [Object] Returns the model itself
271
+ def build_from_hash(attributes)
272
+ return nil unless attributes.is_a?(Hash)
273
+ self.class.openapi_types.each_pair do |key, type|
274
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
275
+ self.send("#{key}=", nil)
276
+ elsif type =~ /\AArray<(.*)>/i
277
+ # check to ensure the input is an array given that the attribute
278
+ # is documented as an array but the input is not
279
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
280
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
281
+ end
282
+ elsif !attributes[self.class.attribute_map[key]].nil?
283
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
284
+ end
285
+ end
286
+
287
+ self
288
+ end
289
+
290
+ # Deserializes the data based on type
291
+ # @param string type Data type
292
+ # @param string value Value to be deserialized
293
+ # @return [Object] Deserialized data
294
+ def _deserialize(type, value)
295
+ case type.to_sym
296
+ when :Time
297
+ Time.parse(value)
298
+ when :Date
299
+ Date.parse(value)
300
+ when :String
301
+ value.to_s
302
+ when :Integer
303
+ value.to_i
304
+ when :Float
305
+ value.to_f
306
+ when :Boolean
307
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
308
+ true
309
+ else
310
+ false
311
+ end
312
+ when :Object
313
+ # generic object (usually a Hash), return directly
314
+ value
315
+ when /\AArray<(?<inner_type>.+)>\z/
316
+ inner_type = Regexp.last_match[:inner_type]
317
+ value.map { |v| _deserialize(inner_type, v) }
318
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
319
+ k_type = Regexp.last_match[:k_type]
320
+ v_type = Regexp.last_match[:v_type]
321
+ {}.tap do |hash|
322
+ value.each do |k, v|
323
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
324
+ end
325
+ end
326
+ else # model
327
+ # models (e.g. Pet) or oneOf
328
+ klass = IonoscloudDbaasPostgres.const_get(type)
329
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
330
+ end
331
+ end
332
+
333
+ # Returns the string representation of the object
334
+ # @return [String] String presentation of the object
335
+ def to_s
336
+ to_hash.to_s
337
+ end
338
+
339
+ # to_body is an alias to to_hash (backward compatibility)
340
+ # @return [Hash] Returns the object in the form of hash
341
+ def to_body
342
+ to_hash
343
+ end
344
+
345
+ # Returns the object in the form of hash
346
+ # @return [Hash] Returns the object in the form of hash
347
+ def to_hash
348
+ hash = {}
349
+ self.class.attribute_map.each_pair do |attr, param|
350
+ value = self.send(attr)
351
+ if value.nil?
352
+ is_nullable = self.class.openapi_nullable.include?(attr)
353
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
354
+ end
355
+
356
+ hash[param] = _to_hash(value)
357
+ end
358
+ hash
359
+ end
360
+
361
+ # Outputs non-array value in the form of hash
362
+ # For object, use to_hash. Otherwise, just return the value
363
+ # @param [Object] value Any valid value
364
+ # @return [Hash] Returns the value in the form of hash
365
+ def _to_hash(value)
366
+ if value.is_a?(Array)
367
+ value.compact.map { |v| _to_hash(v) }
368
+ elsif value.is_a?(Hash)
369
+ {}.tap do |hash|
370
+ value.each { |k, v| hash[k] = _to_hash(v) }
371
+ end
372
+ elsif value.respond_to? :to_hash
373
+ value.to_hash
374
+ else
375
+ value
376
+ end
377
+ end
378
+
379
+ end
380
+
381
+ end
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #IONOS DBaaS REST API
3
+
4
+ #An enterprise-grade Database is provided as a Service (DBaaS) 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 create additional database clusters or modify existing ones. 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: 0.0.1
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 IonoscloudDbaasPostgres
17
+ # Request payload to change a cluster
18
+ class PatchClusterRequest
19
+ attr_accessor :metadata
20
+
21
+ attr_accessor :properties
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'metadata' => :'metadata',
27
+ :'properties' => :'properties'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'metadata' => :'Metadata',
40
+ :'properties' => :'PatchClusterProperties'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IonoscloudDbaasPostgres::PatchClusterRequest` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IonoscloudDbaasPostgres::PatchClusterRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'metadata')
66
+ self.metadata = attributes[:'metadata']
67
+ end
68
+
69
+ if attributes.key?(:'properties')
70
+ self.properties = attributes[:'properties']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ metadata == o.metadata &&
93
+ properties == o.properties
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [metadata, properties].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ new.build_from_hash(attributes)
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ self.class.openapi_types.each_pair do |key, type|
121
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
122
+ self.send("#{key}=", nil)
123
+ elsif type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :Time
144
+ Time.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :Boolean
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ # models (e.g. Pet) or oneOf
175
+ klass = IonoscloudDbaasPostgres.const_get(type)
176
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+
226
+ end
227
+
228
+ end