ibm_cloud_power 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +68 -0
  3. data/LICENSE.txt +202 -0
  4. data/README.md +56 -10
  5. data/docs/CloudConnection.md +41 -0
  6. data/docs/CloudConnectionCreate.md +23 -0
  7. data/docs/CloudConnectionEndpointClassic.md +19 -0
  8. data/docs/CloudConnectionEndpointGRE.md +19 -0
  9. data/docs/CloudConnectionEndpointVPC.md +19 -0
  10. data/docs/CloudConnectionGRETunnel.md +21 -0
  11. data/docs/CloudConnectionSpeed.md +16 -0
  12. data/docs/CloudConnectionUpdate.md +27 -0
  13. data/docs/CloudConnectionVPC.md +19 -0
  14. data/docs/CloudConnectionVirtualPrivateClouds.md +17 -0
  15. data/docs/CloudConnectionVirtualPrivateCloudsVirtualPrivateClouds.md +23 -0
  16. data/docs/CloudConnections.md +17 -0
  17. data/docs/CreateDataVolume.md +6 -6
  18. data/docs/CreateImage.md +3 -3
  19. data/docs/Image.md +2 -0
  20. data/docs/ImageReference.md +2 -0
  21. data/docs/MaximumStorageAllocation.md +21 -0
  22. data/docs/MultiVolumesCreate.md +6 -4
  23. data/docs/Network.md +1 -1
  24. data/docs/NetworkPort.md +2 -0
  25. data/docs/NetworkReference.md +1 -1
  26. data/docs/PCloudCloudConnectionsApi.md +394 -0
  27. data/docs/PCloudEventsApi.md +2 -2
  28. data/docs/PCloudImagesApi.md +104 -6
  29. data/docs/PCloudPVMInstancesApi.md +60 -5
  30. data/docs/PCloudPlacementGroupsApi.md +298 -0
  31. data/docs/PCloudStorageCapacityApi.md +196 -0
  32. data/docs/PCloudVolumesApi.md +344 -0
  33. data/docs/PVMInstance.md +3 -1
  34. data/docs/PVMInstanceCreate.md +5 -3
  35. data/docs/PlacementGroup.md +23 -0
  36. data/docs/PlacementGroupCreate.md +19 -0
  37. data/docs/PlacementGroupServer.md +17 -0
  38. data/docs/PlacementGroups.md +17 -0
  39. data/docs/SAPCreate.md +1 -1
  40. data/docs/StoragePoolCapacity.md +23 -0
  41. data/docs/StoragePoolsCapacity.md +19 -0
  42. data/docs/StorageTypeCapacity.md +21 -0
  43. data/docs/StorageTypesCapacity.md +19 -0
  44. data/docs/Volume.md +2 -0
  45. data/docs/VolumeReference.md +2 -0
  46. data/docs/VolumesCloneAsyncRequest.md +1 -1
  47. data/docs/VolumesCloneCancel.md +1 -1
  48. data/docs/VolumesCloneDetail.md +1 -1
  49. data/docs/VolumesCloneExecute.md +1 -1
  50. data/lib/ibm_cloud_power.rb +24 -0
  51. data/lib/ibm_cloud_power/api/p_cloud_cloud_connections_api.rb +560 -0
  52. data/lib/ibm_cloud_power/api/p_cloud_events_api.rb +2 -2
  53. data/lib/ibm_cloud_power/api/p_cloud_images_api.rb +133 -4
  54. data/lib/ibm_cloud_power/api/p_cloud_placement_groups_api.rb +430 -0
  55. data/lib/ibm_cloud_power/api/p_cloud_pvm_instances_api.rb +82 -5
  56. data/lib/ibm_cloud_power/api/p_cloud_storage_capacity_api.rb +274 -0
  57. data/lib/ibm_cloud_power/api/p_cloud_volumes_api.rb +477 -0
  58. data/lib/ibm_cloud_power/models/cloud_connection.rb +379 -0
  59. data/lib/ibm_cloud_power/models/cloud_connection_create.rb +249 -0
  60. data/lib/ibm_cloud_power/models/cloud_connection_endpoint_classic.rb +218 -0
  61. data/lib/ibm_cloud_power/models/cloud_connection_endpoint_gre.rb +221 -0
  62. data/lib/ibm_cloud_power/models/cloud_connection_endpoint_vpc.rb +221 -0
  63. data/lib/ibm_cloud_power/models/cloud_connection_gre_tunnel.rb +239 -0
  64. data/lib/ibm_cloud_power/models/cloud_connection_speed.rb +42 -0
  65. data/lib/ibm_cloud_power/models/cloud_connection_update.rb +257 -0
  66. data/lib/ibm_cloud_power/models/cloud_connection_virtual_private_clouds.rb +216 -0
  67. data/lib/ibm_cloud_power/models/cloud_connection_virtual_private_clouds_virtual_private_clouds.rb +259 -0
  68. data/lib/ibm_cloud_power/models/cloud_connection_vpc.rb +224 -0
  69. data/lib/ibm_cloud_power/models/cloud_connections.rb +216 -0
  70. data/lib/ibm_cloud_power/models/create_data_volume.rb +17 -17
  71. data/lib/ibm_cloud_power/models/create_image.rb +3 -3
  72. data/lib/ibm_cloud_power/models/image.rb +16 -1
  73. data/lib/ibm_cloud_power/models/image_reference.rb +16 -1
  74. data/lib/ibm_cloud_power/models/maximum_storage_allocation.rb +245 -0
  75. data/lib/ibm_cloud_power/models/multi_volumes_create.rb +17 -7
  76. data/lib/ibm_cloud_power/models/network.rb +1 -1
  77. data/lib/ibm_cloud_power/models/network_port.rb +11 -1
  78. data/lib/ibm_cloud_power/models/network_reference.rb +1 -1
  79. data/lib/ibm_cloud_power/models/placement_group.rb +295 -0
  80. data/lib/ibm_cloud_power/models/placement_group_create.rb +263 -0
  81. data/lib/ibm_cloud_power/models/placement_group_server.rb +214 -0
  82. data/lib/ibm_cloud_power/models/placement_groups.rb +216 -0
  83. data/lib/ibm_cloud_power/models/pvm_instance.rb +17 -5
  84. data/lib/ibm_cloud_power/models/pvm_instance_create.rb +16 -6
  85. data/lib/ibm_cloud_power/models/pvm_instance_reference.rb +2 -2
  86. data/lib/ibm_cloud_power/models/sap_create.rb +1 -1
  87. data/lib/ibm_cloud_power/models/storage_pool_capacity.rb +245 -0
  88. data/lib/ibm_cloud_power/models/storage_pools_capacity.rb +220 -0
  89. data/lib/ibm_cloud_power/models/storage_type_capacity.rb +231 -0
  90. data/lib/ibm_cloud_power/models/storage_types_capacity.rb +220 -0
  91. data/lib/ibm_cloud_power/models/volume.rb +11 -1
  92. data/lib/ibm_cloud_power/models/volume_reference.rb +11 -1
  93. data/lib/ibm_cloud_power/models/volumes_clone_async_request.rb +1 -1
  94. data/lib/ibm_cloud_power/models/volumes_clone_cancel.rb +1 -1
  95. data/lib/ibm_cloud_power/models/volumes_clone_detail.rb +1 -1
  96. data/lib/ibm_cloud_power/models/volumes_clone_execute.rb +1 -1
  97. data/lib/ibm_cloud_power/version.rb +1 -1
  98. data/spec/api/p_cloud_cloud_connections_api_spec.rb +132 -0
  99. data/spec/api/p_cloud_placement_groups_api_spec.rb +108 -0
  100. data/spec/api/p_cloud_storage_capacity_api_spec.rb +81 -0
  101. data/spec/models/cloud_connection_create_spec.rb +59 -0
  102. data/spec/models/cloud_connection_endpoint_classic_spec.rb +47 -0
  103. data/spec/models/cloud_connection_endpoint_gre_spec.rb +47 -0
  104. data/spec/models/cloud_connection_endpoint_vpc_spec.rb +47 -0
  105. data/spec/models/cloud_connection_gre_tunnel_spec.rb +53 -0
  106. data/spec/models/cloud_connection_spec.rb +113 -0
  107. data/spec/models/cloud_connection_speed_spec.rb +35 -0
  108. data/spec/models/cloud_connection_update_spec.rb +71 -0
  109. data/spec/models/cloud_connection_virtual_private_clouds_spec.rb +41 -0
  110. data/spec/models/cloud_connection_virtual_private_clouds_virtual_private_clouds_spec.rb +59 -0
  111. data/spec/models/cloud_connection_vpc_spec.rb +47 -0
  112. data/spec/models/cloud_connections_spec.rb +41 -0
  113. data/spec/models/maximum_storage_allocation_spec.rb +53 -0
  114. data/spec/models/placement_group_create_spec.rb +51 -0
  115. data/spec/models/placement_group_server_spec.rb +41 -0
  116. data/spec/models/placement_group_spec.rb +63 -0
  117. data/spec/models/placement_groups_spec.rb +41 -0
  118. data/spec/models/storage_pool_capacity_spec.rb +59 -0
  119. data/spec/models/storage_pools_capacity_spec.rb +47 -0
  120. data/spec/models/storage_type_capacity_spec.rb +53 -0
  121. data/spec/models/storage_types_capacity_spec.rb +47 -0
  122. metadata +130 -32
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #Power Cloud API
3
+
4
+ #IBM Power Cloud API for Power Hardware / Infrastructure
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: kylej@us.ibm.com
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 IbmCloudPower
16
+ class CloudConnectionVirtualPrivateClouds
17
+ # list of available virtual private clouds
18
+ attr_accessor :virtual_private_clouds
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'virtual_private_clouds' => :'virtualPrivateClouds'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'virtual_private_clouds' => :'Array<CloudConnectionVirtualPrivateCloudsVirtualPrivateClouds>'
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::CloudConnectionVirtualPrivateClouds` initialize method"
45
+ end
46
+
47
+ # check to see if the attribute exists and convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h|
49
+ if (!self.class.attribute_map.key?(k.to_sym))
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudPower::CloudConnectionVirtualPrivateClouds`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ end
52
+ h[k.to_sym] = v
53
+ }
54
+
55
+ if attributes.key?(:'virtual_private_clouds')
56
+ if (value = attributes[:'virtual_private_clouds']).is_a?(Array)
57
+ self.virtual_private_clouds = value
58
+ end
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ if @virtual_private_clouds.nil?
67
+ invalid_properties.push('invalid value for "virtual_private_clouds", virtual_private_clouds cannot be nil.')
68
+ end
69
+
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return false if @virtual_private_clouds.nil?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ virtual_private_clouds == o.virtual_private_clouds
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [virtual_private_clouds].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ self.class.openapi_types.each_pair do |key, type|
113
+ if type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
117
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
122
+ self.send("#{key}=", nil)
123
+ end
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :DateTime
136
+ DateTime.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ IbmCloudPower.const_get(type).build_from_hash(value)
167
+ end
168
+ end
169
+
170
+ # Returns the string representation of the object
171
+ # @return [String] String presentation of the object
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # to_body is an alias to to_hash (backward compatibility)
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_body
179
+ to_hash
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = self.send(attr)
188
+ if value.nil?
189
+ is_nullable = self.class.openapi_nullable.include?(attr)
190
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
191
+ end
192
+
193
+ hash[param] = _to_hash(value)
194
+ end
195
+ hash
196
+ end
197
+
198
+ # Outputs non-array value in the form of hash
199
+ # For object, use to_hash. Otherwise, just return the value
200
+ # @param [Object] value Any valid value
201
+ # @return [Hash] Returns the value in the form of hash
202
+ def _to_hash(value)
203
+ if value.is_a?(Array)
204
+ value.compact.map { |v| _to_hash(v) }
205
+ elsif value.is_a?(Hash)
206
+ {}.tap do |hash|
207
+ value.each { |k, v| hash[k] = _to_hash(v) }
208
+ end
209
+ elsif value.respond_to? :to_hash
210
+ value.to_hash
211
+ else
212
+ value
213
+ end
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,259 @@
1
+ =begin
2
+ #Power Cloud API
3
+
4
+ #IBM Power Cloud API for Power Hardware / Infrastructure
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: kylej@us.ibm.com
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 IbmCloudPower
16
+ class CloudConnectionVirtualPrivateCloudsVirtualPrivateClouds
17
+ # indicates if vpc uses classic architecture
18
+ attr_accessor :classic_access
19
+
20
+ # CRN of the specific service
21
+ attr_accessor :vpc_id
22
+
23
+ # name for the vpc
24
+ attr_accessor :name
25
+
26
+ # status of this vpc
27
+ attr_accessor :status
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'classic_access' => :'classicAccess',
33
+ :'vpc_id' => :'vpcID',
34
+ :'name' => :'name',
35
+ :'status' => :'status'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'classic_access' => :'Boolean',
43
+ :'vpc_id' => :'String',
44
+ :'name' => :'String',
45
+ :'status' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::CloudConnectionVirtualPrivateCloudsVirtualPrivateClouds` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudPower::CloudConnectionVirtualPrivateCloudsVirtualPrivateClouds`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'classic_access')
71
+ self.classic_access = attributes[:'classic_access']
72
+ end
73
+
74
+ if attributes.key?(:'vpc_id')
75
+ self.vpc_id = attributes[:'vpc_id']
76
+ end
77
+
78
+ if attributes.key?(:'name')
79
+ self.name = attributes[:'name']
80
+ end
81
+
82
+ if attributes.key?(:'status')
83
+ self.status = attributes[:'status']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ if @classic_access.nil?
92
+ invalid_properties.push('invalid value for "classic_access", classic_access cannot be nil.')
93
+ end
94
+
95
+ if @vpc_id.nil?
96
+ invalid_properties.push('invalid value for "vpc_id", vpc_id cannot be nil.')
97
+ end
98
+
99
+ if @name.nil?
100
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
101
+ end
102
+
103
+ if @status.nil?
104
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
105
+ end
106
+
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ return false if @classic_access.nil?
114
+ return false if @vpc_id.nil?
115
+ return false if @name.nil?
116
+ return false if @status.nil?
117
+ true
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ classic_access == o.classic_access &&
126
+ vpc_id == o.vpc_id &&
127
+ name == o.name &&
128
+ status == o.status
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [classic_access, vpc_id, name, status].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ new.build_from_hash(attributes)
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def build_from_hash(attributes)
154
+ return nil unless attributes.is_a?(Hash)
155
+ self.class.openapi_types.each_pair do |key, type|
156
+ if type =~ /\AArray<(.*)>/i
157
+ # check to ensure the input is an array given that the attribute
158
+ # is documented as an array but the input is not
159
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
160
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
161
+ end
162
+ elsif !attributes[self.class.attribute_map[key]].nil?
163
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
164
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
165
+ self.send("#{key}=", nil)
166
+ end
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ IbmCloudPower.const_get(type).build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+ end
259
+ end