ibm_cloud_resource_controller 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.bumpversion.cfg +13 -0
  3. data/.gitignore +13 -0
  4. data/.openapi-generator-ignore +23 -0
  5. data/.openapi-generator/VERSION +1 -0
  6. data/.rspec +3 -0
  7. data/.travis.yml +49 -0
  8. data/CHANGELOG.md +2 -0
  9. data/CODE_OF_CONDUCT.md +76 -0
  10. data/CONTRIBUTING.md +13 -0
  11. data/Gemfile +4 -6
  12. data/LICENSE +201 -0
  13. data/README.md +56 -120
  14. data/Rakefile +3 -7
  15. data/bin/console +14 -0
  16. data/bin/setup +8 -0
  17. data/ibm_cloud_resource_controller.gemspec +34 -37
  18. data/lib/ibm_cloud_resource_controller.rb +9 -64
  19. data/lib/ibm_cloud_resource_controller/authenticators.rb +15 -0
  20. data/lib/ibm_cloud_resource_controller/common.rb +22 -0
  21. data/lib/ibm_cloud_resource_controller/resource_controller_v2.rb +982 -0
  22. data/lib/ibm_cloud_resource_controller/resource_manager_v2.rb +303 -0
  23. data/lib/ibm_cloud_resource_controller/version.rb +1 -13
  24. metadata +59 -145
  25. data/docs/Credentials.md +0 -25
  26. data/docs/ErrorReport.md +0 -23
  27. data/docs/PlanHistoryItem.md +0 -19
  28. data/docs/Reclamation.md +0 -45
  29. data/docs/ReclamationActionsPost.md +0 -19
  30. data/docs/ReclamationsList.md +0 -17
  31. data/docs/ResourceAlias.md +0 -57
  32. data/docs/ResourceAliasPatch.md +0 -17
  33. data/docs/ResourceAliasPost.md +0 -21
  34. data/docs/ResourceAliasesApi.md +0 -302
  35. data/docs/ResourceAliasesList.md +0 -21
  36. data/docs/ResourceBinding.md +0 -57
  37. data/docs/ResourceBindingPatch.md +0 -17
  38. data/docs/ResourceBindingPost.md +0 -25
  39. data/docs/ResourceBindingPostParameters.md +0 -17
  40. data/docs/ResourceBindingsApi.md +0 -300
  41. data/docs/ResourceBindingsList.md +0 -21
  42. data/docs/ResourceInstance.md +0 -81
  43. data/docs/ResourceInstancePatch.md +0 -23
  44. data/docs/ResourceInstancePost.md +0 -29
  45. data/docs/ResourceInstancesApi.md +0 -418
  46. data/docs/ResourceInstancesList.md +0 -21
  47. data/docs/ResourceKey.md +0 -53
  48. data/docs/ResourceKeyPatch.md +0 -17
  49. data/docs/ResourceKeyPost.md +0 -23
  50. data/docs/ResourceKeysApi.md +0 -298
  51. data/docs/ResourceKeysList.md +0 -21
  52. data/docs/ResourceReclamationsApi.md +0 -128
  53. data/git_push.sh +0 -58
  54. data/lib/ibm_cloud_resource_controller/api/resource_aliases_api.rb +0 -363
  55. data/lib/ibm_cloud_resource_controller/api/resource_bindings_api.rb +0 -360
  56. data/lib/ibm_cloud_resource_controller/api/resource_instances_api.rb +0 -493
  57. data/lib/ibm_cloud_resource_controller/api/resource_keys_api.rb +0 -357
  58. data/lib/ibm_cloud_resource_controller/api/resource_reclamations_api.rb +0 -156
  59. data/lib/ibm_cloud_resource_controller/api_client.rb +0 -388
  60. data/lib/ibm_cloud_resource_controller/api_error.rb +0 -57
  61. data/lib/ibm_cloud_resource_controller/configuration.rb +0 -248
  62. data/lib/ibm_cloud_resource_controller/models/credentials.rb +0 -250
  63. data/lib/ibm_cloud_resource_controller/models/error_report.rb +0 -240
  64. data/lib/ibm_cloud_resource_controller/models/plan_history_item.rb +0 -230
  65. data/lib/ibm_cloud_resource_controller/models/reclamation.rb +0 -352
  66. data/lib/ibm_cloud_resource_controller/models/reclamation_actions_post.rb +0 -220
  67. data/lib/ibm_cloud_resource_controller/models/reclamations_list.rb +0 -212
  68. data/lib/ibm_cloud_resource_controller/models/resource_alias.rb +0 -410
  69. data/lib/ibm_cloud_resource_controller/models/resource_alias_patch.rb +0 -236
  70. data/lib/ibm_cloud_resource_controller/models/resource_alias_post.rb +0 -266
  71. data/lib/ibm_cloud_resource_controller/models/resource_aliases_list.rb +0 -247
  72. data/lib/ibm_cloud_resource_controller/models/resource_binding.rb +0 -410
  73. data/lib/ibm_cloud_resource_controller/models/resource_binding_patch.rb +0 -236
  74. data/lib/ibm_cloud_resource_controller/models/resource_binding_post.rb +0 -278
  75. data/lib/ibm_cloud_resource_controller/models/resource_binding_post_parameters.rb +0 -210
  76. data/lib/ibm_cloud_resource_controller/models/resource_bindings_list.rb +0 -247
  77. data/lib/ibm_cloud_resource_controller/models/resource_instance.rb +0 -536
  78. data/lib/ibm_cloud_resource_controller/models/resource_instance_patch.rb +0 -259
  79. data/lib/ibm_cloud_resource_controller/models/resource_instance_post.rb +0 -317
  80. data/lib/ibm_cloud_resource_controller/models/resource_instances_list.rb +0 -247
  81. data/lib/ibm_cloud_resource_controller/models/resource_key.rb +0 -390
  82. data/lib/ibm_cloud_resource_controller/models/resource_key_patch.rb +0 -236
  83. data/lib/ibm_cloud_resource_controller/models/resource_key_post.rb +0 -251
  84. data/lib/ibm_cloud_resource_controller/models/resource_keys_list.rb +0 -247
  85. data/spec/api/resource_aliases_api_spec.rb +0 -104
  86. data/spec/api/resource_bindings_api_spec.rb +0 -103
  87. data/spec/api/resource_instances_api_spec.rb +0 -130
  88. data/spec/api/resource_keys_api_spec.rb +0 -102
  89. data/spec/api/resource_reclamations_api_spec.rb +0 -62
  90. data/spec/api_client_spec.rb +0 -226
  91. data/spec/configuration_spec.rb +0 -42
  92. data/spec/models/credentials_spec.rb +0 -65
  93. data/spec/models/error_report_spec.rb +0 -59
  94. data/spec/models/plan_history_item_spec.rb +0 -47
  95. data/spec/models/reclamation_actions_post_spec.rb +0 -47
  96. data/spec/models/reclamation_spec.rb +0 -125
  97. data/spec/models/reclamations_list_spec.rb +0 -41
  98. data/spec/models/resource_alias_patch_spec.rb +0 -41
  99. data/spec/models/resource_alias_post_spec.rb +0 -53
  100. data/spec/models/resource_alias_spec.rb +0 -143
  101. data/spec/models/resource_aliases_list_spec.rb +0 -53
  102. data/spec/models/resource_binding_patch_spec.rb +0 -41
  103. data/spec/models/resource_binding_post_parameters_spec.rb +0 -41
  104. data/spec/models/resource_binding_post_spec.rb +0 -65
  105. data/spec/models/resource_binding_spec.rb +0 -137
  106. data/spec/models/resource_bindings_list_spec.rb +0 -53
  107. data/spec/models/resource_instance_patch_spec.rb +0 -59
  108. data/spec/models/resource_instance_post_spec.rb +0 -77
  109. data/spec/models/resource_instance_spec.rb +0 -191
  110. data/spec/models/resource_instances_list_spec.rb +0 -53
  111. data/spec/models/resource_key_patch_spec.rb +0 -41
  112. data/spec/models/resource_key_post_spec.rb +0 -59
  113. data/spec/models/resource_key_spec.rb +0 -125
  114. data/spec/models/resource_keys_list_spec.rb +0 -53
  115. data/spec/spec_helper.rb +0 -111
@@ -1,536 +0,0 @@
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