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.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +13 -0
- data/.gitignore +13 -0
- data/.openapi-generator-ignore +23 -0
- data/.openapi-generator/VERSION +1 -0
- data/.rspec +3 -0
- data/.travis.yml +49 -0
- data/CHANGELOG.md +2 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +13 -0
- data/Gemfile +4 -6
- data/LICENSE +201 -0
- data/README.md +56 -120
- data/Rakefile +3 -7
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ibm_cloud_resource_controller.gemspec +34 -37
- data/lib/ibm_cloud_resource_controller.rb +9 -64
- data/lib/ibm_cloud_resource_controller/authenticators.rb +15 -0
- data/lib/ibm_cloud_resource_controller/common.rb +22 -0
- data/lib/ibm_cloud_resource_controller/resource_controller_v2.rb +982 -0
- data/lib/ibm_cloud_resource_controller/resource_manager_v2.rb +303 -0
- data/lib/ibm_cloud_resource_controller/version.rb +1 -13
- metadata +59 -145
- data/docs/Credentials.md +0 -25
- data/docs/ErrorReport.md +0 -23
- data/docs/PlanHistoryItem.md +0 -19
- data/docs/Reclamation.md +0 -45
- data/docs/ReclamationActionsPost.md +0 -19
- data/docs/ReclamationsList.md +0 -17
- data/docs/ResourceAlias.md +0 -57
- data/docs/ResourceAliasPatch.md +0 -17
- data/docs/ResourceAliasPost.md +0 -21
- data/docs/ResourceAliasesApi.md +0 -302
- data/docs/ResourceAliasesList.md +0 -21
- data/docs/ResourceBinding.md +0 -57
- data/docs/ResourceBindingPatch.md +0 -17
- data/docs/ResourceBindingPost.md +0 -25
- data/docs/ResourceBindingPostParameters.md +0 -17
- data/docs/ResourceBindingsApi.md +0 -300
- data/docs/ResourceBindingsList.md +0 -21
- data/docs/ResourceInstance.md +0 -81
- data/docs/ResourceInstancePatch.md +0 -23
- data/docs/ResourceInstancePost.md +0 -29
- data/docs/ResourceInstancesApi.md +0 -418
- data/docs/ResourceInstancesList.md +0 -21
- data/docs/ResourceKey.md +0 -53
- data/docs/ResourceKeyPatch.md +0 -17
- data/docs/ResourceKeyPost.md +0 -23
- data/docs/ResourceKeysApi.md +0 -298
- data/docs/ResourceKeysList.md +0 -21
- data/docs/ResourceReclamationsApi.md +0 -128
- data/git_push.sh +0 -58
- data/lib/ibm_cloud_resource_controller/api/resource_aliases_api.rb +0 -363
- data/lib/ibm_cloud_resource_controller/api/resource_bindings_api.rb +0 -360
- data/lib/ibm_cloud_resource_controller/api/resource_instances_api.rb +0 -493
- data/lib/ibm_cloud_resource_controller/api/resource_keys_api.rb +0 -357
- data/lib/ibm_cloud_resource_controller/api/resource_reclamations_api.rb +0 -156
- data/lib/ibm_cloud_resource_controller/api_client.rb +0 -388
- data/lib/ibm_cloud_resource_controller/api_error.rb +0 -57
- data/lib/ibm_cloud_resource_controller/configuration.rb +0 -248
- data/lib/ibm_cloud_resource_controller/models/credentials.rb +0 -250
- data/lib/ibm_cloud_resource_controller/models/error_report.rb +0 -240
- data/lib/ibm_cloud_resource_controller/models/plan_history_item.rb +0 -230
- data/lib/ibm_cloud_resource_controller/models/reclamation.rb +0 -352
- data/lib/ibm_cloud_resource_controller/models/reclamation_actions_post.rb +0 -220
- data/lib/ibm_cloud_resource_controller/models/reclamations_list.rb +0 -212
- data/lib/ibm_cloud_resource_controller/models/resource_alias.rb +0 -410
- data/lib/ibm_cloud_resource_controller/models/resource_alias_patch.rb +0 -236
- data/lib/ibm_cloud_resource_controller/models/resource_alias_post.rb +0 -266
- data/lib/ibm_cloud_resource_controller/models/resource_aliases_list.rb +0 -247
- data/lib/ibm_cloud_resource_controller/models/resource_binding.rb +0 -410
- data/lib/ibm_cloud_resource_controller/models/resource_binding_patch.rb +0 -236
- data/lib/ibm_cloud_resource_controller/models/resource_binding_post.rb +0 -278
- data/lib/ibm_cloud_resource_controller/models/resource_binding_post_parameters.rb +0 -210
- data/lib/ibm_cloud_resource_controller/models/resource_bindings_list.rb +0 -247
- data/lib/ibm_cloud_resource_controller/models/resource_instance.rb +0 -536
- data/lib/ibm_cloud_resource_controller/models/resource_instance_patch.rb +0 -259
- data/lib/ibm_cloud_resource_controller/models/resource_instance_post.rb +0 -317
- data/lib/ibm_cloud_resource_controller/models/resource_instances_list.rb +0 -247
- data/lib/ibm_cloud_resource_controller/models/resource_key.rb +0 -390
- data/lib/ibm_cloud_resource_controller/models/resource_key_patch.rb +0 -236
- data/lib/ibm_cloud_resource_controller/models/resource_key_post.rb +0 -251
- data/lib/ibm_cloud_resource_controller/models/resource_keys_list.rb +0 -247
- data/spec/api/resource_aliases_api_spec.rb +0 -104
- data/spec/api/resource_bindings_api_spec.rb +0 -103
- data/spec/api/resource_instances_api_spec.rb +0 -130
- data/spec/api/resource_keys_api_spec.rb +0 -102
- data/spec/api/resource_reclamations_api_spec.rb +0 -62
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/credentials_spec.rb +0 -65
- data/spec/models/error_report_spec.rb +0 -59
- data/spec/models/plan_history_item_spec.rb +0 -47
- data/spec/models/reclamation_actions_post_spec.rb +0 -47
- data/spec/models/reclamation_spec.rb +0 -125
- data/spec/models/reclamations_list_spec.rb +0 -41
- data/spec/models/resource_alias_patch_spec.rb +0 -41
- data/spec/models/resource_alias_post_spec.rb +0 -53
- data/spec/models/resource_alias_spec.rb +0 -143
- data/spec/models/resource_aliases_list_spec.rb +0 -53
- data/spec/models/resource_binding_patch_spec.rb +0 -41
- data/spec/models/resource_binding_post_parameters_spec.rb +0 -41
- data/spec/models/resource_binding_post_spec.rb +0 -65
- data/spec/models/resource_binding_spec.rb +0 -137
- data/spec/models/resource_bindings_list_spec.rb +0 -53
- data/spec/models/resource_instance_patch_spec.rb +0 -59
- data/spec/models/resource_instance_post_spec.rb +0 -77
- data/spec/models/resource_instance_spec.rb +0 -191
- data/spec/models/resource_instances_list_spec.rb +0 -53
- data/spec/models/resource_key_patch_spec.rb +0 -41
- data/spec/models/resource_key_post_spec.rb +0 -59
- data/spec/models/resource_key_spec.rb +0 -125
- data/spec/models/resource_keys_list_spec.rb +0 -53
- data/spec/spec_helper.rb +0 -111
@@ -1,250 +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
|
-
# The credentials for a resource.
|
17
|
-
class Credentials
|
18
|
-
# The API key for the credentials.
|
19
|
-
attr_accessor :apikey
|
20
|
-
|
21
|
-
# The optional description of the API key.
|
22
|
-
attr_accessor :iam_apikey_description
|
23
|
-
|
24
|
-
# The name of the API key.
|
25
|
-
attr_accessor :iam_apikey_name
|
26
|
-
|
27
|
-
# The Cloud Resource Name for the role of the credentials.
|
28
|
-
attr_accessor :iam_role_crn
|
29
|
-
|
30
|
-
# The Cloud Resource Name for the service ID of the credentials.
|
31
|
-
attr_accessor :iam_serviceid_crn
|
32
|
-
|
33
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
34
|
-
def self.attribute_map
|
35
|
-
{
|
36
|
-
:'apikey' => :'apikey',
|
37
|
-
:'iam_apikey_description' => :'iam_apikey_description',
|
38
|
-
:'iam_apikey_name' => :'iam_apikey_name',
|
39
|
-
:'iam_role_crn' => :'iam_role_crn',
|
40
|
-
:'iam_serviceid_crn' => :'iam_serviceid_crn'
|
41
|
-
}
|
42
|
-
end
|
43
|
-
|
44
|
-
# Attribute type mapping.
|
45
|
-
def self.openapi_types
|
46
|
-
{
|
47
|
-
:'apikey' => :'String',
|
48
|
-
:'iam_apikey_description' => :'String',
|
49
|
-
:'iam_apikey_name' => :'String',
|
50
|
-
:'iam_role_crn' => :'String',
|
51
|
-
:'iam_serviceid_crn' => :'String'
|
52
|
-
}
|
53
|
-
end
|
54
|
-
|
55
|
-
# List of attributes with nullable: true
|
56
|
-
def self.openapi_nullable
|
57
|
-
Set.new([
|
58
|
-
])
|
59
|
-
end
|
60
|
-
|
61
|
-
# Initializes the object
|
62
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
63
|
-
def initialize(attributes = {})
|
64
|
-
if (!attributes.is_a?(Hash))
|
65
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudResourceController::Credentials` initialize method"
|
66
|
-
end
|
67
|
-
|
68
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
69
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
70
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
71
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudResourceController::Credentials`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
72
|
-
end
|
73
|
-
h[k.to_sym] = v
|
74
|
-
}
|
75
|
-
|
76
|
-
if attributes.key?(:'apikey')
|
77
|
-
self.apikey = attributes[:'apikey']
|
78
|
-
end
|
79
|
-
|
80
|
-
if attributes.key?(:'iam_apikey_description')
|
81
|
-
self.iam_apikey_description = attributes[:'iam_apikey_description']
|
82
|
-
end
|
83
|
-
|
84
|
-
if attributes.key?(:'iam_apikey_name')
|
85
|
-
self.iam_apikey_name = attributes[:'iam_apikey_name']
|
86
|
-
end
|
87
|
-
|
88
|
-
if attributes.key?(:'iam_role_crn')
|
89
|
-
self.iam_role_crn = attributes[:'iam_role_crn']
|
90
|
-
end
|
91
|
-
|
92
|
-
if attributes.key?(:'iam_serviceid_crn')
|
93
|
-
self.iam_serviceid_crn = attributes[:'iam_serviceid_crn']
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
98
|
-
# @return Array for valid properties with the reasons
|
99
|
-
def list_invalid_properties
|
100
|
-
invalid_properties = Array.new
|
101
|
-
invalid_properties
|
102
|
-
end
|
103
|
-
|
104
|
-
# Check to see if the all the properties in the model are valid
|
105
|
-
# @return true if the model is valid
|
106
|
-
def valid?
|
107
|
-
true
|
108
|
-
end
|
109
|
-
|
110
|
-
# Checks equality by comparing each attribute.
|
111
|
-
# @param [Object] Object to be compared
|
112
|
-
def ==(o)
|
113
|
-
return true if self.equal?(o)
|
114
|
-
self.class == o.class &&
|
115
|
-
apikey == o.apikey &&
|
116
|
-
iam_apikey_description == o.iam_apikey_description &&
|
117
|
-
iam_apikey_name == o.iam_apikey_name &&
|
118
|
-
iam_role_crn == o.iam_role_crn &&
|
119
|
-
iam_serviceid_crn == o.iam_serviceid_crn
|
120
|
-
end
|
121
|
-
|
122
|
-
# @see the `==` method
|
123
|
-
# @param [Object] Object to be compared
|
124
|
-
def eql?(o)
|
125
|
-
self == o
|
126
|
-
end
|
127
|
-
|
128
|
-
# Calculates hash code according to all attributes.
|
129
|
-
# @return [Integer] Hash code
|
130
|
-
def hash
|
131
|
-
[apikey, iam_apikey_description, iam_apikey_name, iam_role_crn, iam_serviceid_crn].hash
|
132
|
-
end
|
133
|
-
|
134
|
-
# Builds the object from hash
|
135
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
-
# @return [Object] Returns the model itself
|
137
|
-
def self.build_from_hash(attributes)
|
138
|
-
new.build_from_hash(attributes)
|
139
|
-
end
|
140
|
-
|
141
|
-
# Builds the object from hash
|
142
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
-
# @return [Object] Returns the model itself
|
144
|
-
def build_from_hash(attributes)
|
145
|
-
return nil unless attributes.is_a?(Hash)
|
146
|
-
self.class.openapi_types.each_pair do |key, type|
|
147
|
-
if type =~ /\AArray<(.*)>/i
|
148
|
-
# check to ensure the input is an array given that the attribute
|
149
|
-
# is documented as an array but the input is not
|
150
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
151
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
152
|
-
end
|
153
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
154
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
155
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
156
|
-
self.send("#{key}=", nil)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
self
|
161
|
-
end
|
162
|
-
|
163
|
-
# Deserializes the data based on type
|
164
|
-
# @param string type Data type
|
165
|
-
# @param string value Value to be deserialized
|
166
|
-
# @return [Object] Deserialized data
|
167
|
-
def _deserialize(type, value)
|
168
|
-
case type.to_sym
|
169
|
-
when :DateTime
|
170
|
-
DateTime.parse(value)
|
171
|
-
when :Date
|
172
|
-
Date.parse(value)
|
173
|
-
when :String
|
174
|
-
value.to_s
|
175
|
-
when :Integer
|
176
|
-
value.to_i
|
177
|
-
when :Float
|
178
|
-
value.to_f
|
179
|
-
when :Boolean
|
180
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
-
true
|
182
|
-
else
|
183
|
-
false
|
184
|
-
end
|
185
|
-
when :Object
|
186
|
-
# generic object (usually a Hash), return directly
|
187
|
-
value
|
188
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
-
inner_type = Regexp.last_match[:inner_type]
|
190
|
-
value.map { |v| _deserialize(inner_type, v) }
|
191
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
-
k_type = Regexp.last_match[:k_type]
|
193
|
-
v_type = Regexp.last_match[:v_type]
|
194
|
-
{}.tap do |hash|
|
195
|
-
value.each do |k, v|
|
196
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
-
end
|
198
|
-
end
|
199
|
-
else # model
|
200
|
-
IbmCloudResourceController.const_get(type).build_from_hash(value)
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
# Returns the string representation of the object
|
205
|
-
# @return [String] String presentation of the object
|
206
|
-
def to_s
|
207
|
-
to_hash.to_s
|
208
|
-
end
|
209
|
-
|
210
|
-
# to_body is an alias to to_hash (backward compatibility)
|
211
|
-
# @return [Hash] Returns the object in the form of hash
|
212
|
-
def to_body
|
213
|
-
to_hash
|
214
|
-
end
|
215
|
-
|
216
|
-
# Returns the object in the form of hash
|
217
|
-
# @return [Hash] Returns the object in the form of hash
|
218
|
-
def to_hash
|
219
|
-
hash = {}
|
220
|
-
self.class.attribute_map.each_pair do |attr, param|
|
221
|
-
value = self.send(attr)
|
222
|
-
if value.nil?
|
223
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
224
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
225
|
-
end
|
226
|
-
|
227
|
-
hash[param] = _to_hash(value)
|
228
|
-
end
|
229
|
-
hash
|
230
|
-
end
|
231
|
-
|
232
|
-
# Outputs non-array value in the form of hash
|
233
|
-
# For object, use to_hash. Otherwise, just return the value
|
234
|
-
# @param [Object] value Any valid value
|
235
|
-
# @return [Hash] Returns the value in the form of hash
|
236
|
-
def _to_hash(value)
|
237
|
-
if value.is_a?(Array)
|
238
|
-
value.compact.map { |v| _to_hash(v) }
|
239
|
-
elsif value.is_a?(Hash)
|
240
|
-
{}.tap do |hash|
|
241
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
242
|
-
end
|
243
|
-
elsif value.respond_to? :to_hash
|
244
|
-
value.to_hash
|
245
|
-
else
|
246
|
-
value
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|
250
|
-
end
|
@@ -1,240 +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
|
-
# Description of an error that occurred in a service request.
|
17
|
-
class ErrorReport
|
18
|
-
# The error code encountered.
|
19
|
-
attr_accessor :error_code
|
20
|
-
|
21
|
-
# The error message.
|
22
|
-
attr_accessor :message
|
23
|
-
|
24
|
-
# The status code.
|
25
|
-
attr_accessor :status_code
|
26
|
-
|
27
|
-
# The transaction-id of the request.
|
28
|
-
attr_accessor :transaction_id
|
29
|
-
|
30
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
-
def self.attribute_map
|
32
|
-
{
|
33
|
-
:'error_code' => :'error_code',
|
34
|
-
:'message' => :'message',
|
35
|
-
:'status_code' => :'status_code',
|
36
|
-
:'transaction_id' => :'transaction_id'
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
|
-
# Attribute type mapping.
|
41
|
-
def self.openapi_types
|
42
|
-
{
|
43
|
-
:'error_code' => :'String',
|
44
|
-
:'message' => :'String',
|
45
|
-
:'status_code' => :'String',
|
46
|
-
:'transaction_id' => :'String'
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
# List of attributes with nullable: true
|
51
|
-
def self.openapi_nullable
|
52
|
-
Set.new([
|
53
|
-
])
|
54
|
-
end
|
55
|
-
|
56
|
-
# Initializes the object
|
57
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
-
def initialize(attributes = {})
|
59
|
-
if (!attributes.is_a?(Hash))
|
60
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudResourceController::ErrorReport` initialize method"
|
61
|
-
end
|
62
|
-
|
63
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
64
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
65
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
66
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudResourceController::ErrorReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
67
|
-
end
|
68
|
-
h[k.to_sym] = v
|
69
|
-
}
|
70
|
-
|
71
|
-
if attributes.key?(:'error_code')
|
72
|
-
self.error_code = attributes[:'error_code']
|
73
|
-
end
|
74
|
-
|
75
|
-
if attributes.key?(:'message')
|
76
|
-
self.message = attributes[:'message']
|
77
|
-
end
|
78
|
-
|
79
|
-
if attributes.key?(:'status_code')
|
80
|
-
self.status_code = attributes[:'status_code']
|
81
|
-
end
|
82
|
-
|
83
|
-
if attributes.key?(:'transaction_id')
|
84
|
-
self.transaction_id = attributes[:'transaction_id']
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
89
|
-
# @return Array for valid properties with the reasons
|
90
|
-
def list_invalid_properties
|
91
|
-
invalid_properties = Array.new
|
92
|
-
invalid_properties
|
93
|
-
end
|
94
|
-
|
95
|
-
# Check to see if the all the properties in the model are valid
|
96
|
-
# @return true if the model is valid
|
97
|
-
def valid?
|
98
|
-
true
|
99
|
-
end
|
100
|
-
|
101
|
-
# Checks equality by comparing each attribute.
|
102
|
-
# @param [Object] Object to be compared
|
103
|
-
def ==(o)
|
104
|
-
return true if self.equal?(o)
|
105
|
-
self.class == o.class &&
|
106
|
-
error_code == o.error_code &&
|
107
|
-
message == o.message &&
|
108
|
-
status_code == o.status_code &&
|
109
|
-
transaction_id == o.transaction_id
|
110
|
-
end
|
111
|
-
|
112
|
-
# @see the `==` method
|
113
|
-
# @param [Object] Object to be compared
|
114
|
-
def eql?(o)
|
115
|
-
self == o
|
116
|
-
end
|
117
|
-
|
118
|
-
# Calculates hash code according to all attributes.
|
119
|
-
# @return [Integer] Hash code
|
120
|
-
def hash
|
121
|
-
[error_code, message, status_code, transaction_id].hash
|
122
|
-
end
|
123
|
-
|
124
|
-
# Builds the object from hash
|
125
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
-
# @return [Object] Returns the model itself
|
127
|
-
def self.build_from_hash(attributes)
|
128
|
-
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
135
|
-
return nil unless attributes.is_a?(Hash)
|
136
|
-
self.class.openapi_types.each_pair do |key, type|
|
137
|
-
if type =~ /\AArray<(.*)>/i
|
138
|
-
# check to ensure the input is an array given that the attribute
|
139
|
-
# is documented as an array but the input is not
|
140
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
141
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
142
|
-
end
|
143
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
144
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
145
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
146
|
-
self.send("#{key}=", nil)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
self
|
151
|
-
end
|
152
|
-
|
153
|
-
# Deserializes the data based on type
|
154
|
-
# @param string type Data type
|
155
|
-
# @param string value Value to be deserialized
|
156
|
-
# @return [Object] Deserialized data
|
157
|
-
def _deserialize(type, value)
|
158
|
-
case type.to_sym
|
159
|
-
when :DateTime
|
160
|
-
DateTime.parse(value)
|
161
|
-
when :Date
|
162
|
-
Date.parse(value)
|
163
|
-
when :String
|
164
|
-
value.to_s
|
165
|
-
when :Integer
|
166
|
-
value.to_i
|
167
|
-
when :Float
|
168
|
-
value.to_f
|
169
|
-
when :Boolean
|
170
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
171
|
-
true
|
172
|
-
else
|
173
|
-
false
|
174
|
-
end
|
175
|
-
when :Object
|
176
|
-
# generic object (usually a Hash), return directly
|
177
|
-
value
|
178
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
179
|
-
inner_type = Regexp.last_match[:inner_type]
|
180
|
-
value.map { |v| _deserialize(inner_type, v) }
|
181
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
182
|
-
k_type = Regexp.last_match[:k_type]
|
183
|
-
v_type = Regexp.last_match[:v_type]
|
184
|
-
{}.tap do |hash|
|
185
|
-
value.each do |k, v|
|
186
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
else # model
|
190
|
-
IbmCloudResourceController.const_get(type).build_from_hash(value)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
# Returns the string representation of the object
|
195
|
-
# @return [String] String presentation of the object
|
196
|
-
def to_s
|
197
|
-
to_hash.to_s
|
198
|
-
end
|
199
|
-
|
200
|
-
# to_body is an alias to to_hash (backward compatibility)
|
201
|
-
# @return [Hash] Returns the object in the form of hash
|
202
|
-
def to_body
|
203
|
-
to_hash
|
204
|
-
end
|
205
|
-
|
206
|
-
# Returns the object in the form of hash
|
207
|
-
# @return [Hash] Returns the object in the form of hash
|
208
|
-
def to_hash
|
209
|
-
hash = {}
|
210
|
-
self.class.attribute_map.each_pair do |attr, param|
|
211
|
-
value = self.send(attr)
|
212
|
-
if value.nil?
|
213
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
214
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
215
|
-
end
|
216
|
-
|
217
|
-
hash[param] = _to_hash(value)
|
218
|
-
end
|
219
|
-
hash
|
220
|
-
end
|
221
|
-
|
222
|
-
# Outputs non-array value in the form of hash
|
223
|
-
# For object, use to_hash. Otherwise, just return the value
|
224
|
-
# @param [Object] value Any valid value
|
225
|
-
# @return [Hash] Returns the value in the form of hash
|
226
|
-
def _to_hash(value)
|
227
|
-
if value.is_a?(Array)
|
228
|
-
value.compact.map { |v| _to_hash(v) }
|
229
|
-
elsif value.is_a?(Hash)
|
230
|
-
{}.tap do |hash|
|
231
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
232
|
-
end
|
233
|
-
elsif value.respond_to? :to_hash
|
234
|
-
value.to_hash
|
235
|
-
else
|
236
|
-
value
|
237
|
-
end
|
238
|
-
end
|
239
|
-
end
|
240
|
-
end
|