autosde_openapi_client 1.0.46 → 1.0.50

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -0
  3. data/docs/HostCluster.md +34 -0
  4. data/docs/HostClusterApi.md +276 -0
  5. data/docs/HostClusterCreate.md +30 -0
  6. data/docs/HostClusterMembership.md +24 -0
  7. data/docs/HostClusterMembershipApi.md +276 -0
  8. data/docs/HostClusterVolumeMapping.md +26 -0
  9. data/docs/HostClusterVolumeMappingApi.md +276 -0
  10. data/docs/HostClusterVolumeMappingCreate.md +24 -0
  11. data/docs/HostClusterVolumeMappingResponse.md +26 -0
  12. data/docs/VolumeCreate.md +2 -0
  13. data/lib/autosde_openapi_client/api/host_cluster_api.rb +254 -0
  14. data/lib/autosde_openapi_client/api/host_cluster_membership_api.rb +254 -0
  15. data/lib/autosde_openapi_client/api/host_cluster_volume_mapping_api.rb +254 -0
  16. data/lib/autosde_openapi_client/models/host_cluster.rb +397 -0
  17. data/lib/autosde_openapi_client/models/host_cluster_create.rb +338 -0
  18. data/lib/autosde_openapi_client/models/host_cluster_membership.rb +287 -0
  19. data/lib/autosde_openapi_client/models/host_cluster_volume_mapping.rb +299 -0
  20. data/lib/autosde_openapi_client/models/host_cluster_volume_mapping_create.rb +291 -0
  21. data/lib/autosde_openapi_client/models/host_cluster_volume_mapping_response.rb +301 -0
  22. data/lib/autosde_openapi_client/models/volume_create.rb +13 -1
  23. data/lib/autosde_openapi_client/version.rb +2 -2
  24. data/lib/autosde_openapi_client.rb +9 -0
  25. data/spec/api/host_cluster_api_spec.rb +74 -0
  26. data/spec/api/host_cluster_membership_api_spec.rb +74 -0
  27. data/spec/api/host_cluster_volume_mapping_api_spec.rb +74 -0
  28. data/spec/models/host_cluster_create_spec.rb +70 -0
  29. data/spec/models/host_cluster_membership_spec.rb +56 -0
  30. data/spec/models/host_cluster_spec.rb +86 -0
  31. data/spec/models/host_cluster_volume_mapping_create_spec.rb +56 -0
  32. data/spec/models/host_cluster_volume_mapping_response_spec.rb +62 -0
  33. data/spec/models/host_cluster_volume_mapping_spec.rb +62 -0
  34. data/spec/models/volume_create_spec.rb +6 -0
  35. metadata +91 -55
@@ -0,0 +1,397 @@
1
+ =begin
2
+ #Site Manager API
3
+
4
+ #Site Manager API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: autosde@il.ibm.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AutosdeOpenapiClient
17
+ # HostCluster
18
+ class HostCluster
19
+ # component_state
20
+ attr_accessor :component_state
21
+
22
+ # name
23
+ attr_accessor :name
24
+
25
+ # owner_id
26
+ attr_accessor :owner_id
27
+
28
+ # owner_name
29
+ attr_accessor :owner_name
30
+
31
+ # protocol
32
+ attr_accessor :protocol
33
+
34
+ # status
35
+ attr_accessor :status
36
+
37
+ attr_accessor :storage_system
38
+
39
+ # uuid
40
+ attr_accessor :uuid
41
+
42
+ attr_accessor :volumes
43
+
44
+ class EnumAttributeValidator
45
+ attr_reader :datatype
46
+ attr_reader :allowable_values
47
+
48
+ def initialize(datatype, allowable_values)
49
+ @allowable_values = allowable_values.map do |value|
50
+ case datatype.to_s
51
+ when /Integer/i
52
+ value.to_i
53
+ when /Float/i
54
+ value.to_f
55
+ else
56
+ value
57
+ end
58
+ end
59
+ end
60
+
61
+ def valid?(value)
62
+ !value || allowable_values.include?(value)
63
+ end
64
+ end
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'component_state' => :'component_state',
70
+ :'name' => :'name',
71
+ :'owner_id' => :'owner_id',
72
+ :'owner_name' => :'owner_name',
73
+ :'protocol' => :'protocol',
74
+ :'status' => :'status',
75
+ :'storage_system' => :'storage_system',
76
+ :'uuid' => :'uuid',
77
+ :'volumes' => :'volumes'
78
+ }
79
+ end
80
+
81
+ # Returns all the JSON keys this model knows about
82
+ def self.acceptable_attributes
83
+ attribute_map.values
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.openapi_types
88
+ {
89
+ :'component_state' => :'String',
90
+ :'name' => :'String',
91
+ :'owner_id' => :'String',
92
+ :'owner_name' => :'String',
93
+ :'protocol' => :'String',
94
+ :'status' => :'String',
95
+ :'storage_system' => :'StorageSystem',
96
+ :'uuid' => :'String',
97
+ :'volumes' => :'Volume'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ ])
105
+ end
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ def initialize(attributes = {})
110
+ if (!attributes.is_a?(Hash))
111
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AutosdeOpenapiClient::HostCluster` initialize method"
112
+ end
113
+
114
+ # check to see if the attribute exists and convert string to symbol for hash key
115
+ attributes = attributes.each_with_object({}) { |(k, v), h|
116
+ if (!self.class.attribute_map.key?(k.to_sym))
117
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AutosdeOpenapiClient::HostCluster`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
118
+ end
119
+ h[k.to_sym] = v
120
+ }
121
+
122
+ if attributes.key?(:'component_state')
123
+ self.component_state = attributes[:'component_state']
124
+ end
125
+
126
+ if attributes.key?(:'name')
127
+ self.name = attributes[:'name']
128
+ end
129
+
130
+ if attributes.key?(:'owner_id')
131
+ self.owner_id = attributes[:'owner_id']
132
+ end
133
+
134
+ if attributes.key?(:'owner_name')
135
+ self.owner_name = attributes[:'owner_name']
136
+ end
137
+
138
+ if attributes.key?(:'protocol')
139
+ self.protocol = attributes[:'protocol']
140
+ end
141
+
142
+ if attributes.key?(:'status')
143
+ self.status = attributes[:'status']
144
+ end
145
+
146
+ if attributes.key?(:'storage_system')
147
+ self.storage_system = attributes[:'storage_system']
148
+ end
149
+
150
+ if attributes.key?(:'uuid')
151
+ self.uuid = attributes[:'uuid']
152
+ end
153
+
154
+ if attributes.key?(:'volumes')
155
+ self.volumes = attributes[:'volumes']
156
+ end
157
+ end
158
+
159
+ # Show invalid properties with the reasons. Usually used together with valid?
160
+ # @return Array for valid properties with the reasons
161
+ def list_invalid_properties
162
+ invalid_properties = Array.new
163
+ if !@component_state.nil? && @component_state.to_s.length > 32
164
+ invalid_properties.push('invalid value for "component_state", the character length must be smaller than or equal to 32.')
165
+ end
166
+
167
+ if !@name.nil? && @name.to_s.length > 15
168
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 15.')
169
+ end
170
+
171
+ if !@owner_id.nil? && @owner_id.to_s.length > 15
172
+ invalid_properties.push('invalid value for "owner_id", the character length must be smaller than or equal to 15.')
173
+ end
174
+
175
+ if !@owner_name.nil? && @owner_name.to_s.length > 15
176
+ invalid_properties.push('invalid value for "owner_name", the character length must be smaller than or equal to 15.')
177
+ end
178
+
179
+ if !@protocol.nil? && @protocol.to_s.length > 15
180
+ invalid_properties.push('invalid value for "protocol", the character length must be smaller than or equal to 15.')
181
+ end
182
+
183
+ invalid_properties
184
+ end
185
+
186
+ # Check to see if the all the properties in the model are valid
187
+ # @return true if the model is valid
188
+ def valid?
189
+ component_state_validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
190
+ return false unless component_state_validator.valid?(@component_state)
191
+ return false if !@component_state.nil? && @component_state.to_s.length > 32
192
+ return false if !@name.nil? && @name.to_s.length > 15
193
+ return false if !@owner_id.nil? && @owner_id.to_s.length > 15
194
+ return false if !@owner_name.nil? && @owner_name.to_s.length > 15
195
+ return false if !@protocol.nil? && @protocol.to_s.length > 15
196
+ true
197
+ end
198
+
199
+ # Custom attribute writer method checking allowed values (enum).
200
+ # @param [Object] component_state Object to be assigned
201
+ def component_state=(component_state)
202
+ validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
203
+ unless validator.valid?(component_state)
204
+ fail ArgumentError, "invalid value for \"component_state\", must be one of #{validator.allowable_values}."
205
+ end
206
+ @component_state = component_state
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] name Value to be assigned
211
+ def name=(name)
212
+ if !name.nil? && name.to_s.length > 15
213
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 15.'
214
+ end
215
+
216
+ @name = name
217
+ end
218
+
219
+ # Custom attribute writer method with validation
220
+ # @param [Object] owner_id Value to be assigned
221
+ def owner_id=(owner_id)
222
+ if !owner_id.nil? && owner_id.to_s.length > 15
223
+ fail ArgumentError, 'invalid value for "owner_id", the character length must be smaller than or equal to 15.'
224
+ end
225
+
226
+ @owner_id = owner_id
227
+ end
228
+
229
+ # Custom attribute writer method with validation
230
+ # @param [Object] owner_name Value to be assigned
231
+ def owner_name=(owner_name)
232
+ if !owner_name.nil? && owner_name.to_s.length > 15
233
+ fail ArgumentError, 'invalid value for "owner_name", the character length must be smaller than or equal to 15.'
234
+ end
235
+
236
+ @owner_name = owner_name
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] protocol Value to be assigned
241
+ def protocol=(protocol)
242
+ if !protocol.nil? && protocol.to_s.length > 15
243
+ fail ArgumentError, 'invalid value for "protocol", the character length must be smaller than or equal to 15.'
244
+ end
245
+
246
+ @protocol = protocol
247
+ end
248
+
249
+ # Checks equality by comparing each attribute.
250
+ # @param [Object] Object to be compared
251
+ def ==(o)
252
+ return true if self.equal?(o)
253
+ self.class == o.class &&
254
+ component_state == o.component_state &&
255
+ name == o.name &&
256
+ owner_id == o.owner_id &&
257
+ owner_name == o.owner_name &&
258
+ protocol == o.protocol &&
259
+ status == o.status &&
260
+ storage_system == o.storage_system &&
261
+ uuid == o.uuid &&
262
+ volumes == o.volumes
263
+ end
264
+
265
+ # @see the `==` method
266
+ # @param [Object] Object to be compared
267
+ def eql?(o)
268
+ self == o
269
+ end
270
+
271
+ # Calculates hash code according to all attributes.
272
+ # @return [Integer] Hash code
273
+ def hash
274
+ [component_state, name, owner_id, owner_name, protocol, status, storage_system, uuid, volumes].hash
275
+ end
276
+
277
+ # Builds the object from hash
278
+ # @param [Hash] attributes Model attributes in the form of hash
279
+ # @return [Object] Returns the model itself
280
+ def self.build_from_hash(attributes)
281
+ new.build_from_hash(attributes)
282
+ end
283
+
284
+ # Builds the object from hash
285
+ # @param [Hash] attributes Model attributes in the form of hash
286
+ # @return [Object] Returns the model itself
287
+ def build_from_hash(attributes)
288
+ return nil unless attributes.is_a?(Hash)
289
+ self.class.openapi_types.each_pair do |key, type|
290
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
291
+ self.send("#{key}=", nil)
292
+ elsif type =~ /\AArray<(.*)>/i
293
+ # check to ensure the input is an array given that the attribute
294
+ # is documented as an array but the input is not
295
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
296
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
297
+ end
298
+ elsif !attributes[self.class.attribute_map[key]].nil?
299
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
300
+ end
301
+ end
302
+
303
+ self
304
+ end
305
+
306
+ # Deserializes the data based on type
307
+ # @param string type Data type
308
+ # @param string value Value to be deserialized
309
+ # @return [Object] Deserialized data
310
+ def _deserialize(type, value)
311
+ case type.to_sym
312
+ when :Time
313
+ Time.parse(value)
314
+ when :Date
315
+ Date.parse(value)
316
+ when :String
317
+ value.to_s
318
+ when :Integer
319
+ value.to_i
320
+ when :Float
321
+ value.to_f
322
+ when :Boolean
323
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
324
+ true
325
+ else
326
+ false
327
+ end
328
+ when :Object
329
+ # generic object (usually a Hash), return directly
330
+ value
331
+ when /\AArray<(?<inner_type>.+)>\z/
332
+ inner_type = Regexp.last_match[:inner_type]
333
+ value.map { |v| _deserialize(inner_type, v) }
334
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
335
+ k_type = Regexp.last_match[:k_type]
336
+ v_type = Regexp.last_match[:v_type]
337
+ {}.tap do |hash|
338
+ value.each do |k, v|
339
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
340
+ end
341
+ end
342
+ else # model
343
+ # models (e.g. Pet) or oneOf
344
+ klass = AutosdeOpenapiClient.const_get(type)
345
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
346
+ end
347
+ end
348
+
349
+ # Returns the string representation of the object
350
+ # @return [String] String presentation of the object
351
+ def to_s
352
+ to_hash.to_s
353
+ end
354
+
355
+ # to_body is an alias to to_hash (backward compatibility)
356
+ # @return [Hash] Returns the object in the form of hash
357
+ def to_body
358
+ to_hash
359
+ end
360
+
361
+ # Returns the object in the form of hash
362
+ # @return [Hash] Returns the object in the form of hash
363
+ def to_hash
364
+ hash = {}
365
+ self.class.attribute_map.each_pair do |attr, param|
366
+ value = self.send(attr)
367
+ if value.nil?
368
+ is_nullable = self.class.openapi_nullable.include?(attr)
369
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
370
+ end
371
+
372
+ hash[param] = _to_hash(value)
373
+ end
374
+ hash
375
+ end
376
+
377
+ # Outputs non-array value in the form of hash
378
+ # For object, use to_hash. Otherwise, just return the value
379
+ # @param [Object] value Any valid value
380
+ # @return [Hash] Returns the value in the form of hash
381
+ def _to_hash(value)
382
+ if value.is_a?(Array)
383
+ value.compact.map { |v| _to_hash(v) }
384
+ elsif value.is_a?(Hash)
385
+ {}.tap do |hash|
386
+ value.each { |k, v| hash[k] = _to_hash(v) }
387
+ end
388
+ elsif value.respond_to? :to_hash
389
+ value.to_hash
390
+ else
391
+ value
392
+ end
393
+ end
394
+
395
+ end
396
+
397
+ end
@@ -0,0 +1,338 @@
1
+ =begin
2
+ #Site Manager API
3
+
4
+ #Site Manager API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: autosde@il.ibm.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AutosdeOpenapiClient
17
+ # TODO add description
18
+ class HostClusterCreate
19
+ # name
20
+ attr_accessor :name
21
+
22
+ # owner_id
23
+ attr_accessor :owner_id
24
+
25
+ # owner_name
26
+ attr_accessor :owner_name
27
+
28
+ # protocol
29
+ attr_accessor :protocol
30
+
31
+ # status
32
+ attr_accessor :status
33
+
34
+ attr_accessor :storage_system
35
+
36
+ attr_accessor :volumes
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'name' => :'name',
42
+ :'owner_id' => :'owner_id',
43
+ :'owner_name' => :'owner_name',
44
+ :'protocol' => :'protocol',
45
+ :'status' => :'status',
46
+ :'storage_system' => :'storage_system',
47
+ :'volumes' => :'volumes'
48
+ }
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ def self.acceptable_attributes
53
+ attribute_map.values
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'name' => :'String',
60
+ :'owner_id' => :'String',
61
+ :'owner_name' => :'String',
62
+ :'protocol' => :'String',
63
+ :'status' => :'String',
64
+ :'storage_system' => :'StorageSystem',
65
+ :'volumes' => :'Volume'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AutosdeOpenapiClient::HostClusterCreate` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AutosdeOpenapiClient::HostClusterCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'name')
91
+ self.name = attributes[:'name']
92
+ end
93
+
94
+ if attributes.key?(:'owner_id')
95
+ self.owner_id = attributes[:'owner_id']
96
+ end
97
+
98
+ if attributes.key?(:'owner_name')
99
+ self.owner_name = attributes[:'owner_name']
100
+ end
101
+
102
+ if attributes.key?(:'protocol')
103
+ self.protocol = attributes[:'protocol']
104
+ end
105
+
106
+ if attributes.key?(:'status')
107
+ self.status = attributes[:'status']
108
+ end
109
+
110
+ if attributes.key?(:'storage_system')
111
+ self.storage_system = attributes[:'storage_system']
112
+ end
113
+
114
+ if attributes.key?(:'volumes')
115
+ self.volumes = attributes[:'volumes']
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ invalid_properties = Array.new
123
+ if !@name.nil? && @name.to_s.length > 15
124
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 15.')
125
+ end
126
+
127
+ if !@owner_id.nil? && @owner_id.to_s.length > 15
128
+ invalid_properties.push('invalid value for "owner_id", the character length must be smaller than or equal to 15.')
129
+ end
130
+
131
+ if !@owner_name.nil? && @owner_name.to_s.length > 15
132
+ invalid_properties.push('invalid value for "owner_name", the character length must be smaller than or equal to 15.')
133
+ end
134
+
135
+ if !@protocol.nil? && @protocol.to_s.length > 15
136
+ invalid_properties.push('invalid value for "protocol", the character length must be smaller than or equal to 15.')
137
+ end
138
+
139
+ invalid_properties
140
+ end
141
+
142
+ # Check to see if the all the properties in the model are valid
143
+ # @return true if the model is valid
144
+ def valid?
145
+ return false if !@name.nil? && @name.to_s.length > 15
146
+ return false if !@owner_id.nil? && @owner_id.to_s.length > 15
147
+ return false if !@owner_name.nil? && @owner_name.to_s.length > 15
148
+ return false if !@protocol.nil? && @protocol.to_s.length > 15
149
+ true
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] name Value to be assigned
154
+ def name=(name)
155
+ if !name.nil? && name.to_s.length > 15
156
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 15.'
157
+ end
158
+
159
+ @name = name
160
+ end
161
+
162
+ # Custom attribute writer method with validation
163
+ # @param [Object] owner_id Value to be assigned
164
+ def owner_id=(owner_id)
165
+ if !owner_id.nil? && owner_id.to_s.length > 15
166
+ fail ArgumentError, 'invalid value for "owner_id", the character length must be smaller than or equal to 15.'
167
+ end
168
+
169
+ @owner_id = owner_id
170
+ end
171
+
172
+ # Custom attribute writer method with validation
173
+ # @param [Object] owner_name Value to be assigned
174
+ def owner_name=(owner_name)
175
+ if !owner_name.nil? && owner_name.to_s.length > 15
176
+ fail ArgumentError, 'invalid value for "owner_name", the character length must be smaller than or equal to 15.'
177
+ end
178
+
179
+ @owner_name = owner_name
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] protocol Value to be assigned
184
+ def protocol=(protocol)
185
+ if !protocol.nil? && protocol.to_s.length > 15
186
+ fail ArgumentError, 'invalid value for "protocol", the character length must be smaller than or equal to 15.'
187
+ end
188
+
189
+ @protocol = protocol
190
+ end
191
+
192
+ # Checks equality by comparing each attribute.
193
+ # @param [Object] Object to be compared
194
+ def ==(o)
195
+ return true if self.equal?(o)
196
+ self.class == o.class &&
197
+ name == o.name &&
198
+ owner_id == o.owner_id &&
199
+ owner_name == o.owner_name &&
200
+ protocol == o.protocol &&
201
+ status == o.status &&
202
+ storage_system == o.storage_system &&
203
+ volumes == o.volumes
204
+ end
205
+
206
+ # @see the `==` method
207
+ # @param [Object] Object to be compared
208
+ def eql?(o)
209
+ self == o
210
+ end
211
+
212
+ # Calculates hash code according to all attributes.
213
+ # @return [Integer] Hash code
214
+ def hash
215
+ [name, owner_id, owner_name, protocol, status, storage_system, volumes].hash
216
+ end
217
+
218
+ # Builds the object from hash
219
+ # @param [Hash] attributes Model attributes in the form of hash
220
+ # @return [Object] Returns the model itself
221
+ def self.build_from_hash(attributes)
222
+ new.build_from_hash(attributes)
223
+ end
224
+
225
+ # Builds the object from hash
226
+ # @param [Hash] attributes Model attributes in the form of hash
227
+ # @return [Object] Returns the model itself
228
+ def build_from_hash(attributes)
229
+ return nil unless attributes.is_a?(Hash)
230
+ self.class.openapi_types.each_pair do |key, type|
231
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
232
+ self.send("#{key}=", nil)
233
+ elsif type =~ /\AArray<(.*)>/i
234
+ # check to ensure the input is an array given that the attribute
235
+ # is documented as an array but the input is not
236
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
237
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
238
+ end
239
+ elsif !attributes[self.class.attribute_map[key]].nil?
240
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
241
+ end
242
+ end
243
+
244
+ self
245
+ end
246
+
247
+ # Deserializes the data based on type
248
+ # @param string type Data type
249
+ # @param string value Value to be deserialized
250
+ # @return [Object] Deserialized data
251
+ def _deserialize(type, value)
252
+ case type.to_sym
253
+ when :Time
254
+ Time.parse(value)
255
+ when :Date
256
+ Date.parse(value)
257
+ when :String
258
+ value.to_s
259
+ when :Integer
260
+ value.to_i
261
+ when :Float
262
+ value.to_f
263
+ when :Boolean
264
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
265
+ true
266
+ else
267
+ false
268
+ end
269
+ when :Object
270
+ # generic object (usually a Hash), return directly
271
+ value
272
+ when /\AArray<(?<inner_type>.+)>\z/
273
+ inner_type = Regexp.last_match[:inner_type]
274
+ value.map { |v| _deserialize(inner_type, v) }
275
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
276
+ k_type = Regexp.last_match[:k_type]
277
+ v_type = Regexp.last_match[:v_type]
278
+ {}.tap do |hash|
279
+ value.each do |k, v|
280
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
281
+ end
282
+ end
283
+ else # model
284
+ # models (e.g. Pet) or oneOf
285
+ klass = AutosdeOpenapiClient.const_get(type)
286
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
287
+ end
288
+ end
289
+
290
+ # Returns the string representation of the object
291
+ # @return [String] String presentation of the object
292
+ def to_s
293
+ to_hash.to_s
294
+ end
295
+
296
+ # to_body is an alias to to_hash (backward compatibility)
297
+ # @return [Hash] Returns the object in the form of hash
298
+ def to_body
299
+ to_hash
300
+ end
301
+
302
+ # Returns the object in the form of hash
303
+ # @return [Hash] Returns the object in the form of hash
304
+ def to_hash
305
+ hash = {}
306
+ self.class.attribute_map.each_pair do |attr, param|
307
+ value = self.send(attr)
308
+ if value.nil?
309
+ is_nullable = self.class.openapi_nullable.include?(attr)
310
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
311
+ end
312
+
313
+ hash[param] = _to_hash(value)
314
+ end
315
+ hash
316
+ end
317
+
318
+ # Outputs non-array value in the form of hash
319
+ # For object, use to_hash. Otherwise, just return the value
320
+ # @param [Object] value Any valid value
321
+ # @return [Hash] Returns the value in the form of hash
322
+ def _to_hash(value)
323
+ if value.is_a?(Array)
324
+ value.compact.map { |v| _to_hash(v) }
325
+ elsif value.is_a?(Hash)
326
+ {}.tap do |hash|
327
+ value.each { |k, v| hash[k] = _to_hash(v) }
328
+ end
329
+ elsif value.respond_to? :to_hash
330
+ value.to_hash
331
+ else
332
+ value
333
+ end
334
+ end
335
+
336
+ end
337
+
338
+ end