ibm_cloud_resource_controller 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +148 -0
- data/Rakefile +10 -0
- data/docs/Credentials.md +25 -0
- data/docs/ErrorReport.md +23 -0
- data/docs/PlanHistoryItem.md +19 -0
- data/docs/Reclamation.md +45 -0
- data/docs/ReclamationActionsPost.md +19 -0
- data/docs/ReclamationsList.md +17 -0
- data/docs/ResourceAlias.md +57 -0
- data/docs/ResourceAliasPatch.md +17 -0
- data/docs/ResourceAliasPost.md +21 -0
- data/docs/ResourceAliasesApi.md +302 -0
- data/docs/ResourceAliasesList.md +21 -0
- data/docs/ResourceBinding.md +57 -0
- data/docs/ResourceBindingPatch.md +17 -0
- data/docs/ResourceBindingPost.md +25 -0
- data/docs/ResourceBindingPostParameters.md +17 -0
- data/docs/ResourceBindingsApi.md +300 -0
- data/docs/ResourceBindingsList.md +21 -0
- data/docs/ResourceInstance.md +81 -0
- data/docs/ResourceInstancePatch.md +23 -0
- data/docs/ResourceInstancePost.md +29 -0
- data/docs/ResourceInstancesApi.md +418 -0
- data/docs/ResourceInstancesList.md +21 -0
- data/docs/ResourceKey.md +53 -0
- data/docs/ResourceKeyPatch.md +17 -0
- data/docs/ResourceKeyPost.md +23 -0
- data/docs/ResourceKeysApi.md +298 -0
- data/docs/ResourceKeysList.md +21 -0
- data/docs/ResourceReclamationsApi.md +128 -0
- data/git_push.sh +58 -0
- data/ibm_cloud_resource_controller.gemspec +38 -0
- data/lib/ibm_cloud_resource_controller.rb +67 -0
- data/lib/ibm_cloud_resource_controller/api/resource_aliases_api.rb +363 -0
- data/lib/ibm_cloud_resource_controller/api/resource_bindings_api.rb +360 -0
- data/lib/ibm_cloud_resource_controller/api/resource_instances_api.rb +493 -0
- data/lib/ibm_cloud_resource_controller/api/resource_keys_api.rb +357 -0
- data/lib/ibm_cloud_resource_controller/api/resource_reclamations_api.rb +156 -0
- data/lib/ibm_cloud_resource_controller/api_client.rb +388 -0
- data/lib/ibm_cloud_resource_controller/api_error.rb +57 -0
- data/lib/ibm_cloud_resource_controller/configuration.rb +248 -0
- data/lib/ibm_cloud_resource_controller/models/credentials.rb +250 -0
- data/lib/ibm_cloud_resource_controller/models/error_report.rb +240 -0
- data/lib/ibm_cloud_resource_controller/models/plan_history_item.rb +230 -0
- data/lib/ibm_cloud_resource_controller/models/reclamation.rb +352 -0
- data/lib/ibm_cloud_resource_controller/models/reclamation_actions_post.rb +220 -0
- data/lib/ibm_cloud_resource_controller/models/reclamations_list.rb +212 -0
- data/lib/ibm_cloud_resource_controller/models/resource_alias.rb +410 -0
- data/lib/ibm_cloud_resource_controller/models/resource_alias_patch.rb +236 -0
- data/lib/ibm_cloud_resource_controller/models/resource_alias_post.rb +266 -0
- data/lib/ibm_cloud_resource_controller/models/resource_aliases_list.rb +247 -0
- data/lib/ibm_cloud_resource_controller/models/resource_binding.rb +410 -0
- data/lib/ibm_cloud_resource_controller/models/resource_binding_patch.rb +236 -0
- data/lib/ibm_cloud_resource_controller/models/resource_binding_post.rb +278 -0
- data/lib/ibm_cloud_resource_controller/models/resource_binding_post_parameters.rb +210 -0
- data/lib/ibm_cloud_resource_controller/models/resource_bindings_list.rb +247 -0
- data/lib/ibm_cloud_resource_controller/models/resource_instance.rb +536 -0
- data/lib/ibm_cloud_resource_controller/models/resource_instance_patch.rb +259 -0
- data/lib/ibm_cloud_resource_controller/models/resource_instance_post.rb +317 -0
- data/lib/ibm_cloud_resource_controller/models/resource_instances_list.rb +247 -0
- data/lib/ibm_cloud_resource_controller/models/resource_key.rb +390 -0
- data/lib/ibm_cloud_resource_controller/models/resource_key_patch.rb +236 -0
- data/lib/ibm_cloud_resource_controller/models/resource_key_post.rb +251 -0
- data/lib/ibm_cloud_resource_controller/models/resource_keys_list.rb +247 -0
- data/lib/ibm_cloud_resource_controller/version.rb +15 -0
- data/spec/api/resource_aliases_api_spec.rb +104 -0
- data/spec/api/resource_bindings_api_spec.rb +103 -0
- data/spec/api/resource_instances_api_spec.rb +130 -0
- data/spec/api/resource_keys_api_spec.rb +102 -0
- data/spec/api/resource_reclamations_api_spec.rb +62 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/credentials_spec.rb +65 -0
- data/spec/models/error_report_spec.rb +59 -0
- data/spec/models/plan_history_item_spec.rb +47 -0
- data/spec/models/reclamation_actions_post_spec.rb +47 -0
- data/spec/models/reclamation_spec.rb +125 -0
- data/spec/models/reclamations_list_spec.rb +41 -0
- data/spec/models/resource_alias_patch_spec.rb +41 -0
- data/spec/models/resource_alias_post_spec.rb +53 -0
- data/spec/models/resource_alias_spec.rb +143 -0
- data/spec/models/resource_aliases_list_spec.rb +53 -0
- data/spec/models/resource_binding_patch_spec.rb +41 -0
- data/spec/models/resource_binding_post_parameters_spec.rb +41 -0
- data/spec/models/resource_binding_post_spec.rb +65 -0
- data/spec/models/resource_binding_spec.rb +137 -0
- data/spec/models/resource_bindings_list_spec.rb +53 -0
- data/spec/models/resource_instance_patch_spec.rb +59 -0
- data/spec/models/resource_instance_post_spec.rb +77 -0
- data/spec/models/resource_instance_spec.rb +191 -0
- data/spec/models/resource_instances_list_spec.rb +53 -0
- data/spec/models/resource_key_patch_spec.rb +41 -0
- data/spec/models/resource_key_post_spec.rb +59 -0
- data/spec/models/resource_key_spec.rb +125 -0
- data/spec/models/resource_keys_list_spec.rb +53 -0
- data/spec/spec_helper.rb +111 -0
- metadata +211 -0
|
@@ -0,0 +1,230 @@
|
|
|
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
|
+
# An element of the plan history of the instance.
|
|
17
|
+
class PlanHistoryItem
|
|
18
|
+
# The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog.
|
|
19
|
+
attr_accessor :resource_plan_id
|
|
20
|
+
|
|
21
|
+
# The date on which the plan was changed.
|
|
22
|
+
attr_accessor :start_date
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'resource_plan_id' => :'resource_plan_id',
|
|
28
|
+
:'start_date' => :'start_date'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Attribute type mapping.
|
|
33
|
+
def self.openapi_types
|
|
34
|
+
{
|
|
35
|
+
:'resource_plan_id' => :'String',
|
|
36
|
+
:'start_date' => :'DateTime'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# List of attributes with nullable: true
|
|
41
|
+
def self.openapi_nullable
|
|
42
|
+
Set.new([
|
|
43
|
+
])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Initializes the object
|
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
if (!attributes.is_a?(Hash))
|
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudResourceController::PlanHistoryItem` initialize method"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudResourceController::PlanHistoryItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
57
|
+
end
|
|
58
|
+
h[k.to_sym] = v
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'resource_plan_id')
|
|
62
|
+
self.resource_plan_id = attributes[:'resource_plan_id']
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
if attributes.key?(:'start_date')
|
|
66
|
+
self.start_date = attributes[:'start_date']
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
71
|
+
# @return Array for valid properties with the reasons
|
|
72
|
+
def list_invalid_properties
|
|
73
|
+
invalid_properties = Array.new
|
|
74
|
+
if @resource_plan_id.nil?
|
|
75
|
+
invalid_properties.push('invalid value for "resource_plan_id", resource_plan_id cannot be nil.')
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
if @start_date.nil?
|
|
79
|
+
invalid_properties.push('invalid value for "start_date", start_date cannot be nil.')
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
invalid_properties
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Check to see if the all the properties in the model are valid
|
|
86
|
+
# @return true if the model is valid
|
|
87
|
+
def valid?
|
|
88
|
+
return false if @resource_plan_id.nil?
|
|
89
|
+
return false if @start_date.nil?
|
|
90
|
+
true
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Checks equality by comparing each attribute.
|
|
94
|
+
# @param [Object] Object to be compared
|
|
95
|
+
def ==(o)
|
|
96
|
+
return true if self.equal?(o)
|
|
97
|
+
self.class == o.class &&
|
|
98
|
+
resource_plan_id == o.resource_plan_id &&
|
|
99
|
+
start_date == o.start_date
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# @see the `==` method
|
|
103
|
+
# @param [Object] Object to be compared
|
|
104
|
+
def eql?(o)
|
|
105
|
+
self == o
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Calculates hash code according to all attributes.
|
|
109
|
+
# @return [Integer] Hash code
|
|
110
|
+
def hash
|
|
111
|
+
[resource_plan_id, start_date].hash
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Builds the object from hash
|
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
116
|
+
# @return [Object] Returns the model itself
|
|
117
|
+
def self.build_from_hash(attributes)
|
|
118
|
+
new.build_from_hash(attributes)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Builds the object from hash
|
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
123
|
+
# @return [Object] Returns the model itself
|
|
124
|
+
def build_from_hash(attributes)
|
|
125
|
+
return nil unless attributes.is_a?(Hash)
|
|
126
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
127
|
+
if type =~ /\AArray<(.*)>/i
|
|
128
|
+
# check to ensure the input is an array given that the attribute
|
|
129
|
+
# is documented as an array but the input is not
|
|
130
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
131
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
132
|
+
end
|
|
133
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
134
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
135
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
136
|
+
self.send("#{key}=", nil)
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
self
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Deserializes the data based on type
|
|
144
|
+
# @param string type Data type
|
|
145
|
+
# @param string value Value to be deserialized
|
|
146
|
+
# @return [Object] Deserialized data
|
|
147
|
+
def _deserialize(type, value)
|
|
148
|
+
case type.to_sym
|
|
149
|
+
when :DateTime
|
|
150
|
+
DateTime.parse(value)
|
|
151
|
+
when :Date
|
|
152
|
+
Date.parse(value)
|
|
153
|
+
when :String
|
|
154
|
+
value.to_s
|
|
155
|
+
when :Integer
|
|
156
|
+
value.to_i
|
|
157
|
+
when :Float
|
|
158
|
+
value.to_f
|
|
159
|
+
when :Boolean
|
|
160
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
161
|
+
true
|
|
162
|
+
else
|
|
163
|
+
false
|
|
164
|
+
end
|
|
165
|
+
when :Object
|
|
166
|
+
# generic object (usually a Hash), return directly
|
|
167
|
+
value
|
|
168
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
169
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
170
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
171
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
172
|
+
k_type = Regexp.last_match[:k_type]
|
|
173
|
+
v_type = Regexp.last_match[:v_type]
|
|
174
|
+
{}.tap do |hash|
|
|
175
|
+
value.each do |k, v|
|
|
176
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
else # model
|
|
180
|
+
IbmCloudResourceController.const_get(type).build_from_hash(value)
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Returns the string representation of the object
|
|
185
|
+
# @return [String] String presentation of the object
|
|
186
|
+
def to_s
|
|
187
|
+
to_hash.to_s
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
|
192
|
+
def to_body
|
|
193
|
+
to_hash
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Returns the object in the form of hash
|
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
|
198
|
+
def to_hash
|
|
199
|
+
hash = {}
|
|
200
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
201
|
+
value = self.send(attr)
|
|
202
|
+
if value.nil?
|
|
203
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
204
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
hash[param] = _to_hash(value)
|
|
208
|
+
end
|
|
209
|
+
hash
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Outputs non-array value in the form of hash
|
|
213
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
214
|
+
# @param [Object] value Any valid value
|
|
215
|
+
# @return [Hash] Returns the value in the form of hash
|
|
216
|
+
def _to_hash(value)
|
|
217
|
+
if value.is_a?(Array)
|
|
218
|
+
value.compact.map { |v| _to_hash(v) }
|
|
219
|
+
elsif value.is_a?(Hash)
|
|
220
|
+
{}.tap do |hash|
|
|
221
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
222
|
+
end
|
|
223
|
+
elsif value.respond_to? :to_hash
|
|
224
|
+
value.to_hash
|
|
225
|
+
else
|
|
226
|
+
value
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
end
|
|
@@ -0,0 +1,352 @@
|
|
|
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 reclamation.
|
|
17
|
+
class Reclamation
|
|
18
|
+
# The ID associated with the reclamation.
|
|
19
|
+
attr_accessor :id
|
|
20
|
+
|
|
21
|
+
# The short ID of the entity for the reclamation.
|
|
22
|
+
attr_accessor :entity_id
|
|
23
|
+
|
|
24
|
+
# The short ID of the entity type for the reclamation.
|
|
25
|
+
attr_accessor :entity_type_id
|
|
26
|
+
|
|
27
|
+
# 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).
|
|
28
|
+
attr_accessor :entity_crn
|
|
29
|
+
|
|
30
|
+
# The short ID of the resource instance.
|
|
31
|
+
attr_accessor :resource_instance_id
|
|
32
|
+
|
|
33
|
+
# The short ID of the resource group.
|
|
34
|
+
attr_accessor :resource_group_id
|
|
35
|
+
|
|
36
|
+
# An alpha-numeric value identifying the account ID.
|
|
37
|
+
attr_accessor :account_id
|
|
38
|
+
|
|
39
|
+
# The short ID of policy for the reclamation.
|
|
40
|
+
attr_accessor :policy_id
|
|
41
|
+
|
|
42
|
+
# The state of the reclamation.
|
|
43
|
+
attr_accessor :state
|
|
44
|
+
|
|
45
|
+
# The target time that the reclamation retention period end.
|
|
46
|
+
attr_accessor :target_time
|
|
47
|
+
|
|
48
|
+
# The custom properties of the reclamation.
|
|
49
|
+
attr_accessor :custom_properties
|
|
50
|
+
|
|
51
|
+
# The date when the reclamation was created.
|
|
52
|
+
attr_accessor :created_at
|
|
53
|
+
|
|
54
|
+
# The subject who created the reclamation.
|
|
55
|
+
attr_accessor :created_by
|
|
56
|
+
|
|
57
|
+
# The date when the reclamation was last updated.
|
|
58
|
+
attr_accessor :updated_at
|
|
59
|
+
|
|
60
|
+
# The subject who updated the reclamation.
|
|
61
|
+
attr_accessor :updated_by
|
|
62
|
+
|
|
63
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
64
|
+
def self.attribute_map
|
|
65
|
+
{
|
|
66
|
+
:'id' => :'id',
|
|
67
|
+
:'entity_id' => :'entity_id',
|
|
68
|
+
:'entity_type_id' => :'entity_type_id',
|
|
69
|
+
:'entity_crn' => :'entity_crn',
|
|
70
|
+
:'resource_instance_id' => :'resource_instance_id',
|
|
71
|
+
:'resource_group_id' => :'resource_group_id',
|
|
72
|
+
:'account_id' => :'account_id',
|
|
73
|
+
:'policy_id' => :'policy_id',
|
|
74
|
+
:'state' => :'state',
|
|
75
|
+
:'target_time' => :'target_time',
|
|
76
|
+
:'custom_properties' => :'custom_properties',
|
|
77
|
+
:'created_at' => :'created_at',
|
|
78
|
+
:'created_by' => :'created_by',
|
|
79
|
+
:'updated_at' => :'updated_at',
|
|
80
|
+
:'updated_by' => :'updated_by'
|
|
81
|
+
}
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Attribute type mapping.
|
|
85
|
+
def self.openapi_types
|
|
86
|
+
{
|
|
87
|
+
:'id' => :'String',
|
|
88
|
+
:'entity_id' => :'String',
|
|
89
|
+
:'entity_type_id' => :'String',
|
|
90
|
+
:'entity_crn' => :'String',
|
|
91
|
+
:'resource_instance_id' => :'String',
|
|
92
|
+
:'resource_group_id' => :'String',
|
|
93
|
+
:'account_id' => :'String',
|
|
94
|
+
:'policy_id' => :'String',
|
|
95
|
+
:'state' => :'String',
|
|
96
|
+
:'target_time' => :'String',
|
|
97
|
+
:'custom_properties' => :'Hash<String, Object>',
|
|
98
|
+
:'created_at' => :'DateTime',
|
|
99
|
+
:'created_by' => :'String',
|
|
100
|
+
:'updated_at' => :'DateTime',
|
|
101
|
+
:'updated_by' => :'String'
|
|
102
|
+
}
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# List of attributes with nullable: true
|
|
106
|
+
def self.openapi_nullable
|
|
107
|
+
Set.new([
|
|
108
|
+
])
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Initializes the object
|
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
113
|
+
def initialize(attributes = {})
|
|
114
|
+
if (!attributes.is_a?(Hash))
|
|
115
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudResourceController::Reclamation` initialize method"
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
119
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
120
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
121
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudResourceController::Reclamation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
122
|
+
end
|
|
123
|
+
h[k.to_sym] = v
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'id')
|
|
127
|
+
self.id = attributes[:'id']
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'entity_id')
|
|
131
|
+
self.entity_id = attributes[:'entity_id']
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'entity_type_id')
|
|
135
|
+
self.entity_type_id = attributes[:'entity_type_id']
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if attributes.key?(:'entity_crn')
|
|
139
|
+
self.entity_crn = attributes[:'entity_crn']
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if attributes.key?(:'resource_instance_id')
|
|
143
|
+
self.resource_instance_id = attributes[:'resource_instance_id']
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if attributes.key?(:'resource_group_id')
|
|
147
|
+
self.resource_group_id = attributes[:'resource_group_id']
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if attributes.key?(:'account_id')
|
|
151
|
+
self.account_id = attributes[:'account_id']
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if attributes.key?(:'policy_id')
|
|
155
|
+
self.policy_id = attributes[:'policy_id']
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if attributes.key?(:'state')
|
|
159
|
+
self.state = attributes[:'state']
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if attributes.key?(:'target_time')
|
|
163
|
+
self.target_time = attributes[:'target_time']
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if attributes.key?(:'custom_properties')
|
|
167
|
+
if (value = attributes[:'custom_properties']).is_a?(Hash)
|
|
168
|
+
self.custom_properties = value
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
if attributes.key?(:'created_at')
|
|
173
|
+
self.created_at = attributes[:'created_at']
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
if attributes.key?(:'created_by')
|
|
177
|
+
self.created_by = attributes[:'created_by']
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
if attributes.key?(:'updated_at')
|
|
181
|
+
self.updated_at = attributes[:'updated_at']
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
if attributes.key?(:'updated_by')
|
|
185
|
+
self.updated_by = attributes[:'updated_by']
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
190
|
+
# @return Array for valid properties with the reasons
|
|
191
|
+
def list_invalid_properties
|
|
192
|
+
invalid_properties = Array.new
|
|
193
|
+
invalid_properties
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Check to see if the all the properties in the model are valid
|
|
197
|
+
# @return true if the model is valid
|
|
198
|
+
def valid?
|
|
199
|
+
true
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Checks equality by comparing each attribute.
|
|
203
|
+
# @param [Object] Object to be compared
|
|
204
|
+
def ==(o)
|
|
205
|
+
return true if self.equal?(o)
|
|
206
|
+
self.class == o.class &&
|
|
207
|
+
id == o.id &&
|
|
208
|
+
entity_id == o.entity_id &&
|
|
209
|
+
entity_type_id == o.entity_type_id &&
|
|
210
|
+
entity_crn == o.entity_crn &&
|
|
211
|
+
resource_instance_id == o.resource_instance_id &&
|
|
212
|
+
resource_group_id == o.resource_group_id &&
|
|
213
|
+
account_id == o.account_id &&
|
|
214
|
+
policy_id == o.policy_id &&
|
|
215
|
+
state == o.state &&
|
|
216
|
+
target_time == o.target_time &&
|
|
217
|
+
custom_properties == o.custom_properties &&
|
|
218
|
+
created_at == o.created_at &&
|
|
219
|
+
created_by == o.created_by &&
|
|
220
|
+
updated_at == o.updated_at &&
|
|
221
|
+
updated_by == o.updated_by
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# @see the `==` method
|
|
225
|
+
# @param [Object] Object to be compared
|
|
226
|
+
def eql?(o)
|
|
227
|
+
self == o
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Calculates hash code according to all attributes.
|
|
231
|
+
# @return [Integer] Hash code
|
|
232
|
+
def hash
|
|
233
|
+
[id, entity_id, entity_type_id, entity_crn, resource_instance_id, resource_group_id, account_id, policy_id, state, target_time, custom_properties, created_at, created_by, updated_at, updated_by].hash
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Builds the object from hash
|
|
237
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
238
|
+
# @return [Object] Returns the model itself
|
|
239
|
+
def self.build_from_hash(attributes)
|
|
240
|
+
new.build_from_hash(attributes)
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Builds the object from hash
|
|
244
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
245
|
+
# @return [Object] Returns the model itself
|
|
246
|
+
def build_from_hash(attributes)
|
|
247
|
+
return nil unless attributes.is_a?(Hash)
|
|
248
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
249
|
+
if type =~ /\AArray<(.*)>/i
|
|
250
|
+
# check to ensure the input is an array given that the attribute
|
|
251
|
+
# is documented as an array but the input is not
|
|
252
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
253
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
254
|
+
end
|
|
255
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
256
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
257
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
258
|
+
self.send("#{key}=", nil)
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
self
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# Deserializes the data based on type
|
|
266
|
+
# @param string type Data type
|
|
267
|
+
# @param string value Value to be deserialized
|
|
268
|
+
# @return [Object] Deserialized data
|
|
269
|
+
def _deserialize(type, value)
|
|
270
|
+
case type.to_sym
|
|
271
|
+
when :DateTime
|
|
272
|
+
DateTime.parse(value)
|
|
273
|
+
when :Date
|
|
274
|
+
Date.parse(value)
|
|
275
|
+
when :String
|
|
276
|
+
value.to_s
|
|
277
|
+
when :Integer
|
|
278
|
+
value.to_i
|
|
279
|
+
when :Float
|
|
280
|
+
value.to_f
|
|
281
|
+
when :Boolean
|
|
282
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
283
|
+
true
|
|
284
|
+
else
|
|
285
|
+
false
|
|
286
|
+
end
|
|
287
|
+
when :Object
|
|
288
|
+
# generic object (usually a Hash), return directly
|
|
289
|
+
value
|
|
290
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
291
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
292
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
293
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
294
|
+
k_type = Regexp.last_match[:k_type]
|
|
295
|
+
v_type = Regexp.last_match[:v_type]
|
|
296
|
+
{}.tap do |hash|
|
|
297
|
+
value.each do |k, v|
|
|
298
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
else # model
|
|
302
|
+
IbmCloudResourceController.const_get(type).build_from_hash(value)
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# Returns the string representation of the object
|
|
307
|
+
# @return [String] String presentation of the object
|
|
308
|
+
def to_s
|
|
309
|
+
to_hash.to_s
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
313
|
+
# @return [Hash] Returns the object in the form of hash
|
|
314
|
+
def to_body
|
|
315
|
+
to_hash
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
# Returns the object in the form of hash
|
|
319
|
+
# @return [Hash] Returns the object in the form of hash
|
|
320
|
+
def to_hash
|
|
321
|
+
hash = {}
|
|
322
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
323
|
+
value = self.send(attr)
|
|
324
|
+
if value.nil?
|
|
325
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
326
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
hash[param] = _to_hash(value)
|
|
330
|
+
end
|
|
331
|
+
hash
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# Outputs non-array value in the form of hash
|
|
335
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
336
|
+
# @param [Object] value Any valid value
|
|
337
|
+
# @return [Hash] Returns the value in the form of hash
|
|
338
|
+
def _to_hash(value)
|
|
339
|
+
if value.is_a?(Array)
|
|
340
|
+
value.compact.map { |v| _to_hash(v) }
|
|
341
|
+
elsif value.is_a?(Hash)
|
|
342
|
+
{}.tap do |hash|
|
|
343
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
344
|
+
end
|
|
345
|
+
elsif value.respond_to? :to_hash
|
|
346
|
+
value.to_hash
|
|
347
|
+
else
|
|
348
|
+
value
|
|
349
|
+
end
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
end
|