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,247 +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 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
@@ -1,410 +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 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