ibm_cloud_resource_controller 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
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,247 @@
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 list of resource aliases.
17
+ class ResourceAliasesList
18
+ # The URL for requesting the next page of results.
19
+ attr_accessor :next_url
20
+
21
+ # A list of resource aliases.
22
+ attr_accessor :resources
23
+
24
+ # The number of resource aliases in `resources`.
25
+ attr_accessor :rows_count
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'next_url' => :'next_url',
31
+ :'resources' => :'resources',
32
+ :'rows_count' => :'rows_count'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'next_url' => :'String',
40
+ :'resources' => :'Array<ResourceAlias>',
41
+ :'rows_count' => :'Integer'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudResourceController::ResourceAliasesList` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudResourceController::ResourceAliasesList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'next_url')
67
+ self.next_url = attributes[:'next_url']
68
+ end
69
+
70
+ if attributes.key?(:'resources')
71
+ if (value = attributes[:'resources']).is_a?(Array)
72
+ self.resources = value
73
+ end
74
+ end
75
+
76
+ if attributes.key?(:'rows_count')
77
+ self.rows_count = attributes[:'rows_count']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ if @next_url.nil?
86
+ invalid_properties.push('invalid value for "next_url", next_url cannot be nil.')
87
+ end
88
+
89
+ if @resources.nil?
90
+ invalid_properties.push('invalid value for "resources", resources cannot be nil.')
91
+ end
92
+
93
+ if @rows_count.nil?
94
+ invalid_properties.push('invalid value for "rows_count", rows_count cannot be nil.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return false if @next_url.nil?
104
+ return false if @resources.nil?
105
+ return false if @rows_count.nil?
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ next_url == o.next_url &&
115
+ resources == o.resources &&
116
+ rows_count == o.rows_count
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Integer] Hash code
127
+ def hash
128
+ [next_url, resources, rows_count].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def self.build_from_hash(attributes)
135
+ new.build_from_hash(attributes)
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ self.class.openapi_types.each_pair do |key, type|
144
+ if type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
+ self.send("#{key}=", nil)
154
+ end
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :DateTime
167
+ DateTime.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :Boolean
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ IbmCloudResourceController.const_get(type).build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+ end
247
+ end
@@ -0,0 +1,410 @@
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 binding.
17
+ class ResourceBinding
18
+ # The ID associated with the binding.
19
+ attr_accessor :id
20
+
21
+ # When you create a new binding, a globally unique identifier (GUID) is assigned. This GUID is a unique internal identifier managed by the resource controller that corresponds to the binding.
22
+ attr_accessor :guid
23
+
24
+ # The full Cloud Resource Name (CRN) associated with the binding. 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 binding, a relative URL path is created identifying the location of the binding.
28
+ attr_accessor :url
29
+
30
+ # The human-readable name of the binding.
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 CRN of resource alias associated to the binding.
40
+ attr_accessor :source_crn
41
+
42
+ # The CRN of target resource, e.g. application, in a specific environment.
43
+ attr_accessor :target_crn
44
+
45
+ # The role CRN.
46
+ attr_accessor :role
47
+
48
+ # The short ID of the binding in specific targeted environment, e.g. `service_binding_id` in a given IBM Cloud environment.
49
+ attr_accessor :region_binding_id
50
+
51
+ # The state of the binding.
52
+ attr_accessor :state
53
+
54
+ # The credentials for the binding. Additional key-value pairs are passed through from the resource brokers. For additional details, see the service’s documentation.
55
+ attr_accessor :credentials
56
+
57
+ # Specifies whether the binding’s credentials support IAM.
58
+ attr_accessor :iam_compatible
59
+
60
+ # The relative path to the resource alias that this binding is associated with.
61
+ attr_accessor :resource_alias_url
62
+
63
+ # The date when the binding was created.
64
+ attr_accessor :created_at
65
+
66
+ # The date when the binding was last updated.
67
+ attr_accessor :updated_at
68
+
69
+ # The date when the binding was deleted.
70
+ attr_accessor :deleted_at
71
+
72
+ # The subject who created the binding.
73
+ attr_accessor :created_by
74
+
75
+ # The subject who updated the binding.
76
+ attr_accessor :updated_by
77
+
78
+ # The subject who deleted the binding.
79
+ attr_accessor :deleted_by
80
+
81
+ # Attribute mapping from ruby-style variable name to JSON key.
82
+ def self.attribute_map
83
+ {
84
+ :'id' => :'id',
85
+ :'guid' => :'guid',
86
+ :'crn' => :'crn',
87
+ :'url' => :'url',
88
+ :'name' => :'name',
89
+ :'account_id' => :'account_id',
90
+ :'resource_group_id' => :'resource_group_id',
91
+ :'source_crn' => :'source_crn',
92
+ :'target_crn' => :'target_crn',
93
+ :'role' => :'role',
94
+ :'region_binding_id' => :'region_binding_id',
95
+ :'state' => :'state',
96
+ :'credentials' => :'credentials',
97
+ :'iam_compatible' => :'iam_compatible',
98
+ :'resource_alias_url' => :'resource_alias_url',
99
+ :'created_at' => :'created_at',
100
+ :'updated_at' => :'updated_at',
101
+ :'deleted_at' => :'deleted_at',
102
+ :'created_by' => :'created_by',
103
+ :'updated_by' => :'updated_by',
104
+ :'deleted_by' => :'deleted_by'
105
+ }
106
+ end
107
+
108
+ # Attribute type mapping.
109
+ def self.openapi_types
110
+ {
111
+ :'id' => :'String',
112
+ :'guid' => :'String',
113
+ :'crn' => :'String',
114
+ :'url' => :'String',
115
+ :'name' => :'String',
116
+ :'account_id' => :'String',
117
+ :'resource_group_id' => :'String',
118
+ :'source_crn' => :'String',
119
+ :'target_crn' => :'String',
120
+ :'role' => :'String',
121
+ :'region_binding_id' => :'String',
122
+ :'state' => :'String',
123
+ :'credentials' => :'Credentials',
124
+ :'iam_compatible' => :'Boolean',
125
+ :'resource_alias_url' => :'String',
126
+ :'created_at' => :'DateTime',
127
+ :'updated_at' => :'DateTime',
128
+ :'deleted_at' => :'DateTime',
129
+ :'created_by' => :'String',
130
+ :'updated_by' => :'String',
131
+ :'deleted_by' => :'String'
132
+ }
133
+ end
134
+
135
+ # List of attributes with nullable: true
136
+ def self.openapi_nullable
137
+ Set.new([
138
+ ])
139
+ end
140
+
141
+ # Initializes the object
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ def initialize(attributes = {})
144
+ if (!attributes.is_a?(Hash))
145
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudResourceController::ResourceBinding` initialize method"
146
+ end
147
+
148
+ # check to see if the attribute exists and convert string to symbol for hash key
149
+ attributes = attributes.each_with_object({}) { |(k, v), h|
150
+ if (!self.class.attribute_map.key?(k.to_sym))
151
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudResourceController::ResourceBinding`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
152
+ end
153
+ h[k.to_sym] = v
154
+ }
155
+
156
+ if attributes.key?(:'id')
157
+ self.id = attributes[:'id']
158
+ end
159
+
160
+ if attributes.key?(:'guid')
161
+ self.guid = attributes[:'guid']
162
+ end
163
+
164
+ if attributes.key?(:'crn')
165
+ self.crn = attributes[:'crn']
166
+ end
167
+
168
+ if attributes.key?(:'url')
169
+ self.url = attributes[:'url']
170
+ end
171
+
172
+ if attributes.key?(:'name')
173
+ self.name = attributes[:'name']
174
+ end
175
+
176
+ if attributes.key?(:'account_id')
177
+ self.account_id = attributes[:'account_id']
178
+ end
179
+
180
+ if attributes.key?(:'resource_group_id')
181
+ self.resource_group_id = attributes[:'resource_group_id']
182
+ end
183
+
184
+ if attributes.key?(:'source_crn')
185
+ self.source_crn = attributes[:'source_crn']
186
+ end
187
+
188
+ if attributes.key?(:'target_crn')
189
+ self.target_crn = attributes[:'target_crn']
190
+ end
191
+
192
+ if attributes.key?(:'role')
193
+ self.role = attributes[:'role']
194
+ end
195
+
196
+ if attributes.key?(:'region_binding_id')
197
+ self.region_binding_id = attributes[:'region_binding_id']
198
+ end
199
+
200
+ if attributes.key?(:'state')
201
+ self.state = attributes[:'state']
202
+ end
203
+
204
+ if attributes.key?(:'credentials')
205
+ self.credentials = attributes[:'credentials']
206
+ end
207
+
208
+ if attributes.key?(:'iam_compatible')
209
+ self.iam_compatible = attributes[:'iam_compatible']
210
+ end
211
+
212
+ if attributes.key?(:'resource_alias_url')
213
+ self.resource_alias_url = attributes[:'resource_alias_url']
214
+ end
215
+
216
+ if attributes.key?(:'created_at')
217
+ self.created_at = attributes[:'created_at']
218
+ end
219
+
220
+ if attributes.key?(:'updated_at')
221
+ self.updated_at = attributes[:'updated_at']
222
+ end
223
+
224
+ if attributes.key?(:'deleted_at')
225
+ self.deleted_at = attributes[:'deleted_at']
226
+ end
227
+
228
+ if attributes.key?(:'created_by')
229
+ self.created_by = attributes[:'created_by']
230
+ end
231
+
232
+ if attributes.key?(:'updated_by')
233
+ self.updated_by = attributes[:'updated_by']
234
+ end
235
+
236
+ if attributes.key?(:'deleted_by')
237
+ self.deleted_by = attributes[:'deleted_by']
238
+ end
239
+ end
240
+
241
+ # Show invalid properties with the reasons. Usually used together with valid?
242
+ # @return Array for valid properties with the reasons
243
+ def list_invalid_properties
244
+ invalid_properties = Array.new
245
+ invalid_properties
246
+ end
247
+
248
+ # Check to see if the all the properties in the model are valid
249
+ # @return true if the model is valid
250
+ def valid?
251
+ true
252
+ end
253
+
254
+ # Checks equality by comparing each attribute.
255
+ # @param [Object] Object to be compared
256
+ def ==(o)
257
+ return true if self.equal?(o)
258
+ self.class == o.class &&
259
+ id == o.id &&
260
+ guid == o.guid &&
261
+ crn == o.crn &&
262
+ url == o.url &&
263
+ name == o.name &&
264
+ account_id == o.account_id &&
265
+ resource_group_id == o.resource_group_id &&
266
+ source_crn == o.source_crn &&
267
+ target_crn == o.target_crn &&
268
+ role == o.role &&
269
+ region_binding_id == o.region_binding_id &&
270
+ state == o.state &&
271
+ credentials == o.credentials &&
272
+ iam_compatible == o.iam_compatible &&
273
+ resource_alias_url == o.resource_alias_url &&
274
+ created_at == o.created_at &&
275
+ updated_at == o.updated_at &&
276
+ deleted_at == o.deleted_at &&
277
+ created_by == o.created_by &&
278
+ updated_by == o.updated_by &&
279
+ deleted_by == o.deleted_by
280
+ end
281
+
282
+ # @see the `==` method
283
+ # @param [Object] Object to be compared
284
+ def eql?(o)
285
+ self == o
286
+ end
287
+
288
+ # Calculates hash code according to all attributes.
289
+ # @return [Integer] Hash code
290
+ def hash
291
+ [id, guid, crn, url, name, account_id, resource_group_id, source_crn, target_crn, role, region_binding_id, state, credentials, iam_compatible, resource_alias_url, created_at, updated_at, deleted_at, created_by, updated_by, deleted_by].hash
292
+ end
293
+
294
+ # Builds the object from hash
295
+ # @param [Hash] attributes Model attributes in the form of hash
296
+ # @return [Object] Returns the model itself
297
+ def self.build_from_hash(attributes)
298
+ new.build_from_hash(attributes)
299
+ end
300
+
301
+ # Builds the object from hash
302
+ # @param [Hash] attributes Model attributes in the form of hash
303
+ # @return [Object] Returns the model itself
304
+ def build_from_hash(attributes)
305
+ return nil unless attributes.is_a?(Hash)
306
+ self.class.openapi_types.each_pair do |key, type|
307
+ if type =~ /\AArray<(.*)>/i
308
+ # check to ensure the input is an array given that the attribute
309
+ # is documented as an array but the input is not
310
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
311
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
312
+ end
313
+ elsif !attributes[self.class.attribute_map[key]].nil?
314
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
315
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
316
+ self.send("#{key}=", nil)
317
+ end
318
+ end
319
+
320
+ self
321
+ end
322
+
323
+ # Deserializes the data based on type
324
+ # @param string type Data type
325
+ # @param string value Value to be deserialized
326
+ # @return [Object] Deserialized data
327
+ def _deserialize(type, value)
328
+ case type.to_sym
329
+ when :DateTime
330
+ DateTime.parse(value)
331
+ when :Date
332
+ Date.parse(value)
333
+ when :String
334
+ value.to_s
335
+ when :Integer
336
+ value.to_i
337
+ when :Float
338
+ value.to_f
339
+ when :Boolean
340
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
341
+ true
342
+ else
343
+ false
344
+ end
345
+ when :Object
346
+ # generic object (usually a Hash), return directly
347
+ value
348
+ when /\AArray<(?<inner_type>.+)>\z/
349
+ inner_type = Regexp.last_match[:inner_type]
350
+ value.map { |v| _deserialize(inner_type, v) }
351
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
352
+ k_type = Regexp.last_match[:k_type]
353
+ v_type = Regexp.last_match[:v_type]
354
+ {}.tap do |hash|
355
+ value.each do |k, v|
356
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
357
+ end
358
+ end
359
+ else # model
360
+ IbmCloudResourceController.const_get(type).build_from_hash(value)
361
+ end
362
+ end
363
+
364
+ # Returns the string representation of the object
365
+ # @return [String] String presentation of the object
366
+ def to_s
367
+ to_hash.to_s
368
+ end
369
+
370
+ # to_body is an alias to to_hash (backward compatibility)
371
+ # @return [Hash] Returns the object in the form of hash
372
+ def to_body
373
+ to_hash
374
+ end
375
+
376
+ # Returns the object in the form of hash
377
+ # @return [Hash] Returns the object in the form of hash
378
+ def to_hash
379
+ hash = {}
380
+ self.class.attribute_map.each_pair do |attr, param|
381
+ value = self.send(attr)
382
+ if value.nil?
383
+ is_nullable = self.class.openapi_nullable.include?(attr)
384
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
385
+ end
386
+
387
+ hash[param] = _to_hash(value)
388
+ end
389
+ hash
390
+ end
391
+
392
+ # Outputs non-array value in the form of hash
393
+ # For object, use to_hash. Otherwise, just return the value
394
+ # @param [Object] value Any valid value
395
+ # @return [Hash] Returns the value in the form of hash
396
+ def _to_hash(value)
397
+ if value.is_a?(Array)
398
+ value.compact.map { |v| _to_hash(v) }
399
+ elsif value.is_a?(Hash)
400
+ {}.tap do |hash|
401
+ value.each { |k, v| hash[k] = _to_hash(v) }
402
+ end
403
+ elsif value.respond_to? :to_hash
404
+ value.to_hash
405
+ else
406
+ value
407
+ end
408
+ end
409
+ end
410
+ end