ibm_cloud_resource_controller 1.0.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 (99) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +148 -0
  4. data/Rakefile +10 -0
  5. data/docs/Credentials.md +25 -0
  6. data/docs/ErrorReport.md +23 -0
  7. data/docs/PlanHistoryItem.md +19 -0
  8. data/docs/Reclamation.md +45 -0
  9. data/docs/ReclamationActionsPost.md +19 -0
  10. data/docs/ReclamationsList.md +17 -0
  11. data/docs/ResourceAlias.md +57 -0
  12. data/docs/ResourceAliasPatch.md +17 -0
  13. data/docs/ResourceAliasPost.md +21 -0
  14. data/docs/ResourceAliasesApi.md +302 -0
  15. data/docs/ResourceAliasesList.md +21 -0
  16. data/docs/ResourceBinding.md +57 -0
  17. data/docs/ResourceBindingPatch.md +17 -0
  18. data/docs/ResourceBindingPost.md +25 -0
  19. data/docs/ResourceBindingPostParameters.md +17 -0
  20. data/docs/ResourceBindingsApi.md +300 -0
  21. data/docs/ResourceBindingsList.md +21 -0
  22. data/docs/ResourceInstance.md +81 -0
  23. data/docs/ResourceInstancePatch.md +23 -0
  24. data/docs/ResourceInstancePost.md +29 -0
  25. data/docs/ResourceInstancesApi.md +418 -0
  26. data/docs/ResourceInstancesList.md +21 -0
  27. data/docs/ResourceKey.md +53 -0
  28. data/docs/ResourceKeyPatch.md +17 -0
  29. data/docs/ResourceKeyPost.md +23 -0
  30. data/docs/ResourceKeysApi.md +298 -0
  31. data/docs/ResourceKeysList.md +21 -0
  32. data/docs/ResourceReclamationsApi.md +128 -0
  33. data/git_push.sh +58 -0
  34. data/ibm_cloud_resource_controller.gemspec +38 -0
  35. data/lib/ibm_cloud_resource_controller.rb +67 -0
  36. data/lib/ibm_cloud_resource_controller/api/resource_aliases_api.rb +363 -0
  37. data/lib/ibm_cloud_resource_controller/api/resource_bindings_api.rb +360 -0
  38. data/lib/ibm_cloud_resource_controller/api/resource_instances_api.rb +493 -0
  39. data/lib/ibm_cloud_resource_controller/api/resource_keys_api.rb +357 -0
  40. data/lib/ibm_cloud_resource_controller/api/resource_reclamations_api.rb +156 -0
  41. data/lib/ibm_cloud_resource_controller/api_client.rb +388 -0
  42. data/lib/ibm_cloud_resource_controller/api_error.rb +57 -0
  43. data/lib/ibm_cloud_resource_controller/configuration.rb +248 -0
  44. data/lib/ibm_cloud_resource_controller/models/credentials.rb +250 -0
  45. data/lib/ibm_cloud_resource_controller/models/error_report.rb +240 -0
  46. data/lib/ibm_cloud_resource_controller/models/plan_history_item.rb +230 -0
  47. data/lib/ibm_cloud_resource_controller/models/reclamation.rb +352 -0
  48. data/lib/ibm_cloud_resource_controller/models/reclamation_actions_post.rb +220 -0
  49. data/lib/ibm_cloud_resource_controller/models/reclamations_list.rb +212 -0
  50. data/lib/ibm_cloud_resource_controller/models/resource_alias.rb +410 -0
  51. data/lib/ibm_cloud_resource_controller/models/resource_alias_patch.rb +236 -0
  52. data/lib/ibm_cloud_resource_controller/models/resource_alias_post.rb +266 -0
  53. data/lib/ibm_cloud_resource_controller/models/resource_aliases_list.rb +247 -0
  54. data/lib/ibm_cloud_resource_controller/models/resource_binding.rb +410 -0
  55. data/lib/ibm_cloud_resource_controller/models/resource_binding_patch.rb +236 -0
  56. data/lib/ibm_cloud_resource_controller/models/resource_binding_post.rb +278 -0
  57. data/lib/ibm_cloud_resource_controller/models/resource_binding_post_parameters.rb +210 -0
  58. data/lib/ibm_cloud_resource_controller/models/resource_bindings_list.rb +247 -0
  59. data/lib/ibm_cloud_resource_controller/models/resource_instance.rb +536 -0
  60. data/lib/ibm_cloud_resource_controller/models/resource_instance_patch.rb +259 -0
  61. data/lib/ibm_cloud_resource_controller/models/resource_instance_post.rb +317 -0
  62. data/lib/ibm_cloud_resource_controller/models/resource_instances_list.rb +247 -0
  63. data/lib/ibm_cloud_resource_controller/models/resource_key.rb +390 -0
  64. data/lib/ibm_cloud_resource_controller/models/resource_key_patch.rb +236 -0
  65. data/lib/ibm_cloud_resource_controller/models/resource_key_post.rb +251 -0
  66. data/lib/ibm_cloud_resource_controller/models/resource_keys_list.rb +247 -0
  67. data/lib/ibm_cloud_resource_controller/version.rb +15 -0
  68. data/spec/api/resource_aliases_api_spec.rb +104 -0
  69. data/spec/api/resource_bindings_api_spec.rb +103 -0
  70. data/spec/api/resource_instances_api_spec.rb +130 -0
  71. data/spec/api/resource_keys_api_spec.rb +102 -0
  72. data/spec/api/resource_reclamations_api_spec.rb +62 -0
  73. data/spec/api_client_spec.rb +226 -0
  74. data/spec/configuration_spec.rb +42 -0
  75. data/spec/models/credentials_spec.rb +65 -0
  76. data/spec/models/error_report_spec.rb +59 -0
  77. data/spec/models/plan_history_item_spec.rb +47 -0
  78. data/spec/models/reclamation_actions_post_spec.rb +47 -0
  79. data/spec/models/reclamation_spec.rb +125 -0
  80. data/spec/models/reclamations_list_spec.rb +41 -0
  81. data/spec/models/resource_alias_patch_spec.rb +41 -0
  82. data/spec/models/resource_alias_post_spec.rb +53 -0
  83. data/spec/models/resource_alias_spec.rb +143 -0
  84. data/spec/models/resource_aliases_list_spec.rb +53 -0
  85. data/spec/models/resource_binding_patch_spec.rb +41 -0
  86. data/spec/models/resource_binding_post_parameters_spec.rb +41 -0
  87. data/spec/models/resource_binding_post_spec.rb +65 -0
  88. data/spec/models/resource_binding_spec.rb +137 -0
  89. data/spec/models/resource_bindings_list_spec.rb +53 -0
  90. data/spec/models/resource_instance_patch_spec.rb +59 -0
  91. data/spec/models/resource_instance_post_spec.rb +77 -0
  92. data/spec/models/resource_instance_spec.rb +191 -0
  93. data/spec/models/resource_instances_list_spec.rb +53 -0
  94. data/spec/models/resource_key_patch_spec.rb +41 -0
  95. data/spec/models/resource_key_post_spec.rb +59 -0
  96. data/spec/models/resource_key_spec.rb +125 -0
  97. data/spec/models/resource_keys_list_spec.rb +53 -0
  98. data/spec/spec_helper.rb +111 -0
  99. metadata +211 -0
@@ -0,0 +1,536 @@
1
+ =begin
2
+ #IBM Cloud Resource Controller API
3
+
4
+ #Manage lifecycle of your Cloud resources using Resource Controller APIs. Resources are provisioned globally in an account scope. Supports asynchronous provisioning of resources. Enables consumption of a global resource through a Cloud Foundry space in any region.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0-beta2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module IbmCloudResourceController
16
+ # A resource instance.
17
+ class ResourceInstance
18
+ # The ID associated with the instance.
19
+ attr_accessor :id
20
+
21
+ # When you create a new resource, a globally unique identifier (GUID) is assigned. This GUID is a unique internal identifier managed by the resource controller that corresponds to the instance.
22
+ attr_accessor :guid
23
+
24
+ # The full Cloud Resource Name (CRN) associated with the instance. For more information about this format, see [Cloud Resource Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
25
+ attr_accessor :crn
26
+
27
+ # When you provision a new resource, a relative URL path is created identifying the location of the instance.
28
+ attr_accessor :url
29
+
30
+ # The human-readable name of the instance.
31
+ attr_accessor :name
32
+
33
+ # An alpha-numeric value identifying the account ID.
34
+ attr_accessor :account_id
35
+
36
+ # The short ID of the resource group.
37
+ attr_accessor :resource_group_id
38
+
39
+ # The long ID (full CRN) of the resource group.
40
+ attr_accessor :resource_group_crn
41
+
42
+ # The unique ID of the offering. This value is provided by and stored in the global catalog.
43
+ attr_accessor :resource_id
44
+
45
+ # The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog.
46
+ attr_accessor :resource_plan_id
47
+
48
+ # The full deployment CRN as defined in the global catalog. The Cloud Resource Name (CRN) of the deployment location where the instance is provisioned.
49
+ attr_accessor :target_crn
50
+
51
+ # The current configuration parameters of the instance.
52
+ attr_accessor :parameters
53
+
54
+ # The current state of the instance. For example, if the instance is deleted, it will return removed.
55
+ attr_accessor :state
56
+
57
+ # The type of the instance, e.g. `service_instance`.
58
+ attr_accessor :type
59
+
60
+ # The sub-type of instance, e.g. `cfaas`.
61
+ attr_accessor :sub_type
62
+
63
+ # A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region instance delete call.
64
+ attr_accessor :allow_cleanup
65
+
66
+ # A boolean that dictates if the resource instance is locked or not.
67
+ attr_accessor :locked
68
+
69
+ # The status of the last operation requested on the instance.
70
+ attr_accessor :last_operation
71
+
72
+ # The resource-broker-provided URL to access administrative features of the instance.
73
+ attr_accessor :dashboard_url
74
+
75
+ # The plan history of the instance.
76
+ attr_accessor :plan_history
77
+
78
+ # The relative path to the resource aliases for the instance.
79
+ attr_accessor :resource_aliases_url
80
+
81
+ # The relative path to the resource bindings for the instance.
82
+ attr_accessor :resource_bindings_url
83
+
84
+ # The relative path to the resource keys for the instance.
85
+ attr_accessor :resource_keys_url
86
+
87
+ # The date when the instance was created.
88
+ attr_accessor :created_at
89
+
90
+ # The subject who created the instance.
91
+ attr_accessor :created_by
92
+
93
+ # The date when the instance was last updated.
94
+ attr_accessor :updated_at
95
+
96
+ # The subject who updated the instance.
97
+ attr_accessor :updated_by
98
+
99
+ # The date when the instance was deleted.
100
+ attr_accessor :deleted_at
101
+
102
+ # The subject who deleted the instance.
103
+ attr_accessor :deleted_by
104
+
105
+ # The date when the instance was scheduled for reclamation.
106
+ attr_accessor :scheduled_reclaim_at
107
+
108
+ # The subject who initiated the instance reclamation.
109
+ attr_accessor :scheduled_reclaim_by
110
+
111
+ # The date when the instance under reclamation was restored.
112
+ attr_accessor :restored_at
113
+
114
+ # The subject who restored the instance back from reclamation.
115
+ attr_accessor :restored_by
116
+
117
+ # Attribute mapping from ruby-style variable name to JSON key.
118
+ def self.attribute_map
119
+ {
120
+ :'id' => :'id',
121
+ :'guid' => :'guid',
122
+ :'crn' => :'crn',
123
+ :'url' => :'url',
124
+ :'name' => :'name',
125
+ :'account_id' => :'account_id',
126
+ :'resource_group_id' => :'resource_group_id',
127
+ :'resource_group_crn' => :'resource_group_crn',
128
+ :'resource_id' => :'resource_id',
129
+ :'resource_plan_id' => :'resource_plan_id',
130
+ :'target_crn' => :'target_crn',
131
+ :'parameters' => :'parameters',
132
+ :'state' => :'state',
133
+ :'type' => :'type',
134
+ :'sub_type' => :'sub_type',
135
+ :'allow_cleanup' => :'allow_cleanup',
136
+ :'locked' => :'locked',
137
+ :'last_operation' => :'last_operation',
138
+ :'dashboard_url' => :'dashboard_url',
139
+ :'plan_history' => :'plan_history',
140
+ :'resource_aliases_url' => :'resource_aliases_url',
141
+ :'resource_bindings_url' => :'resource_bindings_url',
142
+ :'resource_keys_url' => :'resource_keys_url',
143
+ :'created_at' => :'created_at',
144
+ :'created_by' => :'created_by',
145
+ :'updated_at' => :'updated_at',
146
+ :'updated_by' => :'updated_by',
147
+ :'deleted_at' => :'deleted_at',
148
+ :'deleted_by' => :'deleted_by',
149
+ :'scheduled_reclaim_at' => :'scheduled_reclaim_at',
150
+ :'scheduled_reclaim_by' => :'scheduled_reclaim_by',
151
+ :'restored_at' => :'restored_at',
152
+ :'restored_by' => :'restored_by'
153
+ }
154
+ end
155
+
156
+ # Attribute type mapping.
157
+ def self.openapi_types
158
+ {
159
+ :'id' => :'String',
160
+ :'guid' => :'String',
161
+ :'crn' => :'String',
162
+ :'url' => :'String',
163
+ :'name' => :'String',
164
+ :'account_id' => :'String',
165
+ :'resource_group_id' => :'String',
166
+ :'resource_group_crn' => :'String',
167
+ :'resource_id' => :'String',
168
+ :'resource_plan_id' => :'String',
169
+ :'target_crn' => :'String',
170
+ :'parameters' => :'Hash<String, Object>',
171
+ :'state' => :'String',
172
+ :'type' => :'String',
173
+ :'sub_type' => :'String',
174
+ :'allow_cleanup' => :'Boolean',
175
+ :'locked' => :'Boolean',
176
+ :'last_operation' => :'Hash<String, Object>',
177
+ :'dashboard_url' => :'String',
178
+ :'plan_history' => :'Array<PlanHistoryItem>',
179
+ :'resource_aliases_url' => :'String',
180
+ :'resource_bindings_url' => :'String',
181
+ :'resource_keys_url' => :'String',
182
+ :'created_at' => :'DateTime',
183
+ :'created_by' => :'String',
184
+ :'updated_at' => :'DateTime',
185
+ :'updated_by' => :'String',
186
+ :'deleted_at' => :'DateTime',
187
+ :'deleted_by' => :'String',
188
+ :'scheduled_reclaim_at' => :'DateTime',
189
+ :'scheduled_reclaim_by' => :'String',
190
+ :'restored_at' => :'DateTime',
191
+ :'restored_by' => :'String'
192
+ }
193
+ end
194
+
195
+ # List of attributes with nullable: true
196
+ def self.openapi_nullable
197
+ Set.new([
198
+ ])
199
+ end
200
+
201
+ # Initializes the object
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ def initialize(attributes = {})
204
+ if (!attributes.is_a?(Hash))
205
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudResourceController::ResourceInstance` initialize method"
206
+ end
207
+
208
+ # check to see if the attribute exists and convert string to symbol for hash key
209
+ attributes = attributes.each_with_object({}) { |(k, v), h|
210
+ if (!self.class.attribute_map.key?(k.to_sym))
211
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudResourceController::ResourceInstance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
212
+ end
213
+ h[k.to_sym] = v
214
+ }
215
+
216
+ if attributes.key?(:'id')
217
+ self.id = attributes[:'id']
218
+ end
219
+
220
+ if attributes.key?(:'guid')
221
+ self.guid = attributes[:'guid']
222
+ end
223
+
224
+ if attributes.key?(:'crn')
225
+ self.crn = attributes[:'crn']
226
+ end
227
+
228
+ if attributes.key?(:'url')
229
+ self.url = attributes[:'url']
230
+ end
231
+
232
+ if attributes.key?(:'name')
233
+ self.name = attributes[:'name']
234
+ end
235
+
236
+ if attributes.key?(:'account_id')
237
+ self.account_id = attributes[:'account_id']
238
+ end
239
+
240
+ if attributes.key?(:'resource_group_id')
241
+ self.resource_group_id = attributes[:'resource_group_id']
242
+ end
243
+
244
+ if attributes.key?(:'resource_group_crn')
245
+ self.resource_group_crn = attributes[:'resource_group_crn']
246
+ end
247
+
248
+ if attributes.key?(:'resource_id')
249
+ self.resource_id = attributes[:'resource_id']
250
+ end
251
+
252
+ if attributes.key?(:'resource_plan_id')
253
+ self.resource_plan_id = attributes[:'resource_plan_id']
254
+ end
255
+
256
+ if attributes.key?(:'target_crn')
257
+ self.target_crn = attributes[:'target_crn']
258
+ end
259
+
260
+ if attributes.key?(:'parameters')
261
+ if (value = attributes[:'parameters']).is_a?(Hash)
262
+ self.parameters = value
263
+ end
264
+ end
265
+
266
+ if attributes.key?(:'state')
267
+ self.state = attributes[:'state']
268
+ end
269
+
270
+ if attributes.key?(:'type')
271
+ self.type = attributes[:'type']
272
+ end
273
+
274
+ if attributes.key?(:'sub_type')
275
+ self.sub_type = attributes[:'sub_type']
276
+ end
277
+
278
+ if attributes.key?(:'allow_cleanup')
279
+ self.allow_cleanup = attributes[:'allow_cleanup']
280
+ end
281
+
282
+ if attributes.key?(:'locked')
283
+ self.locked = attributes[:'locked']
284
+ end
285
+
286
+ if attributes.key?(:'last_operation')
287
+ if (value = attributes[:'last_operation']).is_a?(Hash)
288
+ self.last_operation = value
289
+ end
290
+ end
291
+
292
+ if attributes.key?(:'dashboard_url')
293
+ self.dashboard_url = attributes[:'dashboard_url']
294
+ end
295
+
296
+ if attributes.key?(:'plan_history')
297
+ if (value = attributes[:'plan_history']).is_a?(Array)
298
+ self.plan_history = value
299
+ end
300
+ end
301
+
302
+ if attributes.key?(:'resource_aliases_url')
303
+ self.resource_aliases_url = attributes[:'resource_aliases_url']
304
+ end
305
+
306
+ if attributes.key?(:'resource_bindings_url')
307
+ self.resource_bindings_url = attributes[:'resource_bindings_url']
308
+ end
309
+
310
+ if attributes.key?(:'resource_keys_url')
311
+ self.resource_keys_url = attributes[:'resource_keys_url']
312
+ end
313
+
314
+ if attributes.key?(:'created_at')
315
+ self.created_at = attributes[:'created_at']
316
+ end
317
+
318
+ if attributes.key?(:'created_by')
319
+ self.created_by = attributes[:'created_by']
320
+ end
321
+
322
+ if attributes.key?(:'updated_at')
323
+ self.updated_at = attributes[:'updated_at']
324
+ end
325
+
326
+ if attributes.key?(:'updated_by')
327
+ self.updated_by = attributes[:'updated_by']
328
+ end
329
+
330
+ if attributes.key?(:'deleted_at')
331
+ self.deleted_at = attributes[:'deleted_at']
332
+ end
333
+
334
+ if attributes.key?(:'deleted_by')
335
+ self.deleted_by = attributes[:'deleted_by']
336
+ end
337
+
338
+ if attributes.key?(:'scheduled_reclaim_at')
339
+ self.scheduled_reclaim_at = attributes[:'scheduled_reclaim_at']
340
+ end
341
+
342
+ if attributes.key?(:'scheduled_reclaim_by')
343
+ self.scheduled_reclaim_by = attributes[:'scheduled_reclaim_by']
344
+ end
345
+
346
+ if attributes.key?(:'restored_at')
347
+ self.restored_at = attributes[:'restored_at']
348
+ end
349
+
350
+ if attributes.key?(:'restored_by')
351
+ self.restored_by = attributes[:'restored_by']
352
+ end
353
+ end
354
+
355
+ # Show invalid properties with the reasons. Usually used together with valid?
356
+ # @return Array for valid properties with the reasons
357
+ def list_invalid_properties
358
+ invalid_properties = Array.new
359
+ invalid_properties
360
+ end
361
+
362
+ # Check to see if the all the properties in the model are valid
363
+ # @return true if the model is valid
364
+ def valid?
365
+ true
366
+ end
367
+
368
+ # Checks equality by comparing each attribute.
369
+ # @param [Object] Object to be compared
370
+ def ==(o)
371
+ return true if self.equal?(o)
372
+ self.class == o.class &&
373
+ id == o.id &&
374
+ guid == o.guid &&
375
+ crn == o.crn &&
376
+ url == o.url &&
377
+ name == o.name &&
378
+ account_id == o.account_id &&
379
+ resource_group_id == o.resource_group_id &&
380
+ resource_group_crn == o.resource_group_crn &&
381
+ resource_id == o.resource_id &&
382
+ resource_plan_id == o.resource_plan_id &&
383
+ target_crn == o.target_crn &&
384
+ parameters == o.parameters &&
385
+ state == o.state &&
386
+ type == o.type &&
387
+ sub_type == o.sub_type &&
388
+ allow_cleanup == o.allow_cleanup &&
389
+ locked == o.locked &&
390
+ last_operation == o.last_operation &&
391
+ dashboard_url == o.dashboard_url &&
392
+ plan_history == o.plan_history &&
393
+ resource_aliases_url == o.resource_aliases_url &&
394
+ resource_bindings_url == o.resource_bindings_url &&
395
+ resource_keys_url == o.resource_keys_url &&
396
+ created_at == o.created_at &&
397
+ created_by == o.created_by &&
398
+ updated_at == o.updated_at &&
399
+ updated_by == o.updated_by &&
400
+ deleted_at == o.deleted_at &&
401
+ deleted_by == o.deleted_by &&
402
+ scheduled_reclaim_at == o.scheduled_reclaim_at &&
403
+ scheduled_reclaim_by == o.scheduled_reclaim_by &&
404
+ restored_at == o.restored_at &&
405
+ restored_by == o.restored_by
406
+ end
407
+
408
+ # @see the `==` method
409
+ # @param [Object] Object to be compared
410
+ def eql?(o)
411
+ self == o
412
+ end
413
+
414
+ # Calculates hash code according to all attributes.
415
+ # @return [Integer] Hash code
416
+ def hash
417
+ [id, guid, crn, url, name, account_id, resource_group_id, resource_group_crn, resource_id, resource_plan_id, target_crn, parameters, state, type, sub_type, allow_cleanup, locked, last_operation, dashboard_url, plan_history, resource_aliases_url, resource_bindings_url, resource_keys_url, created_at, created_by, updated_at, updated_by, deleted_at, deleted_by, scheduled_reclaim_at, scheduled_reclaim_by, restored_at, restored_by].hash
418
+ end
419
+
420
+ # Builds the object from hash
421
+ # @param [Hash] attributes Model attributes in the form of hash
422
+ # @return [Object] Returns the model itself
423
+ def self.build_from_hash(attributes)
424
+ new.build_from_hash(attributes)
425
+ end
426
+
427
+ # Builds the object from hash
428
+ # @param [Hash] attributes Model attributes in the form of hash
429
+ # @return [Object] Returns the model itself
430
+ def build_from_hash(attributes)
431
+ return nil unless attributes.is_a?(Hash)
432
+ self.class.openapi_types.each_pair do |key, type|
433
+ if type =~ /\AArray<(.*)>/i
434
+ # check to ensure the input is an array given that the attribute
435
+ # is documented as an array but the input is not
436
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
437
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
438
+ end
439
+ elsif !attributes[self.class.attribute_map[key]].nil?
440
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
441
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
442
+ self.send("#{key}=", nil)
443
+ end
444
+ end
445
+
446
+ self
447
+ end
448
+
449
+ # Deserializes the data based on type
450
+ # @param string type Data type
451
+ # @param string value Value to be deserialized
452
+ # @return [Object] Deserialized data
453
+ def _deserialize(type, value)
454
+ case type.to_sym
455
+ when :DateTime
456
+ DateTime.parse(value)
457
+ when :Date
458
+ Date.parse(value)
459
+ when :String
460
+ value.to_s
461
+ when :Integer
462
+ value.to_i
463
+ when :Float
464
+ value.to_f
465
+ when :Boolean
466
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
467
+ true
468
+ else
469
+ false
470
+ end
471
+ when :Object
472
+ # generic object (usually a Hash), return directly
473
+ value
474
+ when /\AArray<(?<inner_type>.+)>\z/
475
+ inner_type = Regexp.last_match[:inner_type]
476
+ value.map { |v| _deserialize(inner_type, v) }
477
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
478
+ k_type = Regexp.last_match[:k_type]
479
+ v_type = Regexp.last_match[:v_type]
480
+ {}.tap do |hash|
481
+ value.each do |k, v|
482
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
483
+ end
484
+ end
485
+ else # model
486
+ IbmCloudResourceController.const_get(type).build_from_hash(value)
487
+ end
488
+ end
489
+
490
+ # Returns the string representation of the object
491
+ # @return [String] String presentation of the object
492
+ def to_s
493
+ to_hash.to_s
494
+ end
495
+
496
+ # to_body is an alias to to_hash (backward compatibility)
497
+ # @return [Hash] Returns the object in the form of hash
498
+ def to_body
499
+ to_hash
500
+ end
501
+
502
+ # Returns the object in the form of hash
503
+ # @return [Hash] Returns the object in the form of hash
504
+ def to_hash
505
+ hash = {}
506
+ self.class.attribute_map.each_pair do |attr, param|
507
+ value = self.send(attr)
508
+ if value.nil?
509
+ is_nullable = self.class.openapi_nullable.include?(attr)
510
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
511
+ end
512
+
513
+ hash[param] = _to_hash(value)
514
+ end
515
+ hash
516
+ end
517
+
518
+ # Outputs non-array value in the form of hash
519
+ # For object, use to_hash. Otherwise, just return the value
520
+ # @param [Object] value Any valid value
521
+ # @return [Hash] Returns the value in the form of hash
522
+ def _to_hash(value)
523
+ if value.is_a?(Array)
524
+ value.compact.map { |v| _to_hash(v) }
525
+ elsif value.is_a?(Hash)
526
+ {}.tap do |hash|
527
+ value.each { |k, v| hash[k] = _to_hash(v) }
528
+ end
529
+ elsif value.respond_to? :to_hash
530
+ value.to_hash
531
+ else
532
+ value
533
+ end
534
+ end
535
+ end
536
+ end