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,501 @@
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 with all data needed to create a new PostgreSQL cluster.
18
+ class CreateClusterProperties
19
+ # The PostgreSQL version of your cluster.
20
+ attr_accessor :postgres_version
21
+
22
+ # The total number of instances in the cluster (one master and n-1 standbys).
23
+ attr_accessor :instances
24
+
25
+ # The number of CPU cores per instance.
26
+ attr_accessor :cores
27
+
28
+ # The amount of memory per instance in megabytes. Has to be a multiple of 1024.
29
+ attr_accessor :ram
30
+
31
+ # The amount of storage per instance in megabytes.
32
+ attr_accessor :storage_size
33
+
34
+ attr_accessor :storage_type
35
+
36
+ attr_accessor :connections
37
+
38
+ attr_accessor :location
39
+
40
+ # The friendly name of your cluster.
41
+ attr_accessor :display_name
42
+
43
+ attr_accessor :maintenance_window
44
+
45
+ attr_accessor :credentials
46
+
47
+ attr_accessor :synchronization_mode
48
+
49
+ attr_accessor :from_backup
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'postgres_version' => :'postgresVersion',
55
+ :'instances' => :'instances',
56
+ :'cores' => :'cores',
57
+ :'ram' => :'ram',
58
+ :'storage_size' => :'storageSize',
59
+ :'storage_type' => :'storageType',
60
+ :'connections' => :'connections',
61
+ :'location' => :'location',
62
+ :'display_name' => :'displayName',
63
+ :'maintenance_window' => :'maintenanceWindow',
64
+ :'credentials' => :'credentials',
65
+ :'synchronization_mode' => :'synchronizationMode',
66
+ :'from_backup' => :'fromBackup'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'postgres_version' => :'String',
79
+ :'instances' => :'Integer',
80
+ :'cores' => :'Integer',
81
+ :'ram' => :'Integer',
82
+ :'storage_size' => :'Integer',
83
+ :'storage_type' => :'StorageType',
84
+ :'connections' => :'Array<Connection>',
85
+ :'location' => :'Location',
86
+ :'display_name' => :'String',
87
+ :'maintenance_window' => :'MaintenanceWindow',
88
+ :'credentials' => :'DBUser',
89
+ :'synchronization_mode' => :'SynchronizationMode',
90
+ :'from_backup' => :'CreateRestoreRequest'
91
+ }
92
+ end
93
+
94
+ # List of attributes with nullable: true
95
+ def self.openapi_nullable
96
+ Set.new([
97
+ ])
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ if (!attributes.is_a?(Hash))
104
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IonoscloudDbaasPostgres::CreateClusterProperties` initialize method"
105
+ end
106
+
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!self.class.attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IonoscloudDbaasPostgres::CreateClusterProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'postgres_version')
116
+ self.postgres_version = attributes[:'postgres_version']
117
+ end
118
+
119
+ if attributes.key?(:'instances')
120
+ self.instances = attributes[:'instances']
121
+ end
122
+
123
+ if attributes.key?(:'cores')
124
+ self.cores = attributes[:'cores']
125
+ end
126
+
127
+ if attributes.key?(:'ram')
128
+ self.ram = attributes[:'ram']
129
+ end
130
+
131
+ if attributes.key?(:'storage_size')
132
+ self.storage_size = attributes[:'storage_size']
133
+ end
134
+
135
+ if attributes.key?(:'storage_type')
136
+ self.storage_type = attributes[:'storage_type']
137
+ end
138
+
139
+ if attributes.key?(:'connections') && (value = attributes[:'connections']).is_a?(Array)
140
+ self.connections = value
141
+ end
142
+
143
+ if attributes.key?(:'location')
144
+ self.location = attributes[:'location']
145
+ end
146
+
147
+ if attributes.key?(:'display_name')
148
+ self.display_name = attributes[:'display_name']
149
+ end
150
+
151
+ if attributes.key?(:'maintenance_window')
152
+ self.maintenance_window = attributes[:'maintenance_window']
153
+ end
154
+
155
+ if attributes.key?(:'credentials')
156
+ self.credentials = attributes[:'credentials']
157
+ end
158
+
159
+ if attributes.key?(:'synchronization_mode')
160
+ self.synchronization_mode = attributes[:'synchronization_mode']
161
+ end
162
+
163
+ if attributes.key?(:'from_backup')
164
+ self.from_backup = attributes[:'from_backup']
165
+ end
166
+ end
167
+
168
+ # Show invalid properties with the reasons. Usually used together with valid?
169
+ # @return Array for valid properties with the reasons
170
+ def list_invalid_properties
171
+ invalid_properties = Array.new
172
+ if @postgres_version.nil?
173
+ invalid_properties.push('invalid value for "postgres_version", postgres_version cannot be nil.')
174
+ end
175
+
176
+ if @instances.nil?
177
+ invalid_properties.push('invalid value for "instances", instances cannot be nil.')
178
+ end
179
+
180
+ if @instances > 5
181
+ invalid_properties.push('invalid value for "instances", must be smaller than or equal to 5.')
182
+ end
183
+
184
+ if @instances < 1
185
+ invalid_properties.push('invalid value for "instances", must be greater than or equal to 1.')
186
+ end
187
+
188
+ if @cores.nil?
189
+ invalid_properties.push('invalid value for "cores", cores cannot be nil.')
190
+ end
191
+
192
+ if @cores < 1
193
+ invalid_properties.push('invalid value for "cores", must be greater than or equal to 1.')
194
+ end
195
+
196
+ if @ram.nil?
197
+ invalid_properties.push('invalid value for "ram", ram cannot be nil.')
198
+ end
199
+
200
+ if @ram < 2048
201
+ invalid_properties.push('invalid value for "ram", must be greater than or equal to 2048.')
202
+ end
203
+
204
+ if @storage_size.nil?
205
+ invalid_properties.push('invalid value for "storage_size", storage_size cannot be nil.')
206
+ end
207
+
208
+ if @storage_size < 2048
209
+ invalid_properties.push('invalid value for "storage_size", must be greater than or equal to 2048.')
210
+ end
211
+
212
+ if @storage_type.nil?
213
+ invalid_properties.push('invalid value for "storage_type", storage_type cannot be nil.')
214
+ end
215
+
216
+ if @connections.nil?
217
+ invalid_properties.push('invalid value for "connections", connections cannot be nil.')
218
+ end
219
+
220
+ if @connections.length > 1
221
+ invalid_properties.push('invalid value for "connections", number of items must be less than or equal to 1.')
222
+ end
223
+
224
+ if @connections.length < 1
225
+ invalid_properties.push('invalid value for "connections", number of items must be greater than or equal to 1.')
226
+ end
227
+
228
+ if @location.nil?
229
+ invalid_properties.push('invalid value for "location", location cannot be nil.')
230
+ end
231
+
232
+ if @display_name.nil?
233
+ invalid_properties.push('invalid value for "display_name", display_name cannot be nil.')
234
+ end
235
+
236
+ if @credentials.nil?
237
+ invalid_properties.push('invalid value for "credentials", credentials cannot be nil.')
238
+ end
239
+
240
+ if @synchronization_mode.nil?
241
+ invalid_properties.push('invalid value for "synchronization_mode", synchronization_mode cannot be nil.')
242
+ end
243
+
244
+ invalid_properties
245
+ end
246
+
247
+ # Check to see if the all the properties in the model are valid
248
+ # @return true if the model is valid
249
+ def valid?
250
+ return false if @postgres_version.nil?
251
+ return false if @instances.nil?
252
+ return false if @instances > 5
253
+ return false if @instances < 1
254
+ return false if @cores.nil?
255
+ return false if @cores < 1
256
+ return false if @ram.nil?
257
+ return false if @ram < 2048
258
+ return false if @storage_size.nil?
259
+ return false if @storage_size < 2048
260
+ return false if @storage_type.nil?
261
+ return false if @connections.nil?
262
+ return false if @connections.length > 1
263
+ return false if @connections.length < 1
264
+ return false if @location.nil?
265
+ return false if @display_name.nil?
266
+ return false if @credentials.nil?
267
+ return false if @synchronization_mode.nil?
268
+ true
269
+ end
270
+
271
+ # Custom attribute writer method with validation
272
+ # @param [Object] instances Value to be assigned
273
+ def instances=(instances)
274
+ if instances.nil?
275
+ fail ArgumentError, 'instances cannot be nil'
276
+ end
277
+
278
+ if instances > 5
279
+ fail ArgumentError, 'invalid value for "instances", must be smaller than or equal to 5.'
280
+ end
281
+
282
+ if instances < 1
283
+ fail ArgumentError, 'invalid value for "instances", must be greater than or equal to 1.'
284
+ end
285
+
286
+ @instances = instances
287
+ end
288
+
289
+ # Custom attribute writer method with validation
290
+ # @param [Object] cores Value to be assigned
291
+ def cores=(cores)
292
+ if cores.nil?
293
+ fail ArgumentError, 'cores cannot be nil'
294
+ end
295
+
296
+ if cores < 1
297
+ fail ArgumentError, 'invalid value for "cores", must be greater than or equal to 1.'
298
+ end
299
+
300
+ @cores = cores
301
+ end
302
+
303
+ # Custom attribute writer method with validation
304
+ # @param [Object] ram Value to be assigned
305
+ def ram=(ram)
306
+ if ram.nil?
307
+ fail ArgumentError, 'ram cannot be nil'
308
+ end
309
+
310
+ if ram < 2048
311
+ fail ArgumentError, 'invalid value for "ram", must be greater than or equal to 2048.'
312
+ end
313
+
314
+ @ram = ram
315
+ end
316
+
317
+ # Custom attribute writer method with validation
318
+ # @param [Object] storage_size Value to be assigned
319
+ def storage_size=(storage_size)
320
+ if storage_size.nil?
321
+ fail ArgumentError, 'storage_size cannot be nil'
322
+ end
323
+
324
+ if storage_size < 2048
325
+ fail ArgumentError, 'invalid value for "storage_size", must be greater than or equal to 2048.'
326
+ end
327
+
328
+ @storage_size = storage_size
329
+ end
330
+
331
+ # Custom attribute writer method with validation
332
+ # @param [Object] connections Value to be assigned
333
+ def connections=(connections)
334
+ if connections.nil?
335
+ fail ArgumentError, 'connections cannot be nil'
336
+ end
337
+
338
+ if connections.length > 1
339
+ fail ArgumentError, 'invalid value for "connections", number of items must be less than or equal to 1.'
340
+ end
341
+
342
+ if connections.length < 1
343
+ fail ArgumentError, 'invalid value for "connections", number of items must be greater than or equal to 1.'
344
+ end
345
+
346
+ @connections = connections
347
+ end
348
+
349
+ # Checks equality by comparing each attribute.
350
+ # @param [Object] Object to be compared
351
+ def ==(o)
352
+ return true if self.equal?(o)
353
+ self.class == o.class &&
354
+ postgres_version == o.postgres_version &&
355
+ instances == o.instances &&
356
+ cores == o.cores &&
357
+ ram == o.ram &&
358
+ storage_size == o.storage_size &&
359
+ storage_type == o.storage_type &&
360
+ connections == o.connections &&
361
+ location == o.location &&
362
+ display_name == o.display_name &&
363
+ maintenance_window == o.maintenance_window &&
364
+ credentials == o.credentials &&
365
+ synchronization_mode == o.synchronization_mode &&
366
+ from_backup == o.from_backup
367
+ end
368
+
369
+ # @see the `==` method
370
+ # @param [Object] Object to be compared
371
+ def eql?(o)
372
+ self == o
373
+ end
374
+
375
+ # Calculates hash code according to all attributes.
376
+ # @return [Integer] Hash code
377
+ def hash
378
+ [postgres_version, instances, cores, ram, storage_size, storage_type, connections, location, display_name, maintenance_window, credentials, synchronization_mode, from_backup].hash
379
+ end
380
+
381
+ # Builds the object from hash
382
+ # @param [Hash] attributes Model attributes in the form of hash
383
+ # @return [Object] Returns the model itself
384
+ def self.build_from_hash(attributes)
385
+ new.build_from_hash(attributes)
386
+ end
387
+
388
+ # Builds the object from hash
389
+ # @param [Hash] attributes Model attributes in the form of hash
390
+ # @return [Object] Returns the model itself
391
+ def build_from_hash(attributes)
392
+ return nil unless attributes.is_a?(Hash)
393
+ self.class.openapi_types.each_pair do |key, type|
394
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
395
+ self.send("#{key}=", nil)
396
+ elsif type =~ /\AArray<(.*)>/i
397
+ # check to ensure the input is an array given that the attribute
398
+ # is documented as an array but the input is not
399
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
400
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
401
+ end
402
+ elsif !attributes[self.class.attribute_map[key]].nil?
403
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
404
+ end
405
+ end
406
+
407
+ self
408
+ end
409
+
410
+ # Deserializes the data based on type
411
+ # @param string type Data type
412
+ # @param string value Value to be deserialized
413
+ # @return [Object] Deserialized data
414
+ def _deserialize(type, value)
415
+ case type.to_sym
416
+ when :Time
417
+ Time.parse(value)
418
+ when :Date
419
+ Date.parse(value)
420
+ when :String
421
+ value.to_s
422
+ when :Integer
423
+ value.to_i
424
+ when :Float
425
+ value.to_f
426
+ when :Boolean
427
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
428
+ true
429
+ else
430
+ false
431
+ end
432
+ when :Object
433
+ # generic object (usually a Hash), return directly
434
+ value
435
+ when /\AArray<(?<inner_type>.+)>\z/
436
+ inner_type = Regexp.last_match[:inner_type]
437
+ value.map { |v| _deserialize(inner_type, v) }
438
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
439
+ k_type = Regexp.last_match[:k_type]
440
+ v_type = Regexp.last_match[:v_type]
441
+ {}.tap do |hash|
442
+ value.each do |k, v|
443
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
444
+ end
445
+ end
446
+ else # model
447
+ # models (e.g. Pet) or oneOf
448
+ klass = IonoscloudDbaasPostgres.const_get(type)
449
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
450
+ end
451
+ end
452
+
453
+ # Returns the string representation of the object
454
+ # @return [String] String presentation of the object
455
+ def to_s
456
+ to_hash.to_s
457
+ end
458
+
459
+ # to_body is an alias to to_hash (backward compatibility)
460
+ # @return [Hash] Returns the object in the form of hash
461
+ def to_body
462
+ to_hash
463
+ end
464
+
465
+ # Returns the object in the form of hash
466
+ # @return [Hash] Returns the object in the form of hash
467
+ def to_hash
468
+ hash = {}
469
+ self.class.attribute_map.each_pair do |attr, param|
470
+ value = self.send(attr)
471
+ if value.nil?
472
+ is_nullable = self.class.openapi_nullable.include?(attr)
473
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
474
+ end
475
+
476
+ hash[param] = _to_hash(value)
477
+ end
478
+ hash
479
+ end
480
+
481
+ # Outputs non-array value in the form of hash
482
+ # For object, use to_hash. Otherwise, just return the value
483
+ # @param [Object] value Any valid value
484
+ # @return [Hash] Returns the value in the form of hash
485
+ def _to_hash(value)
486
+ if value.is_a?(Array)
487
+ value.compact.map { |v| _to_hash(v) }
488
+ elsif value.is_a?(Hash)
489
+ {}.tap do |hash|
490
+ value.each { |k, v| hash[k] = _to_hash(v) }
491
+ end
492
+ elsif value.respond_to? :to_hash
493
+ value.to_hash
494
+ else
495
+ value
496
+ end
497
+ end
498
+
499
+ end
500
+
501
+ end