autosde_openapi_client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +207 -0
  4. data/Rakefile +10 -0
  5. data/autosde_openapi_client.gemspec +39 -0
  6. data/docs/AbstractCapability.md +19 -0
  7. data/docs/AbstractCapabilityApi.md +204 -0
  8. data/docs/Account.md +21 -0
  9. data/docs/AccountApi.md +256 -0
  10. data/docs/AccountPostRequest.md +19 -0
  11. data/docs/AccountPostResponse.md +23 -0
  12. data/docs/Address.md +31 -0
  13. data/docs/AddressApi.md +204 -0
  14. data/docs/AddressCreate.md +31 -0
  15. data/docs/AuthResponse.md +17 -0
  16. data/docs/Authentication.md +19 -0
  17. data/docs/AuthenticationApi.md +53 -0
  18. data/docs/AutoSDEProject.md +55 -0
  19. data/docs/AutoSDEProjectApi.md +204 -0
  20. data/docs/AutoSDERole.md +19 -0
  21. data/docs/AutoSDERoleApi.md +204 -0
  22. data/docs/CapabilityTranslation.md +35 -0
  23. data/docs/CapabilityTranslationApi.md +204 -0
  24. data/docs/CapabilityTranslationCreate.md +31 -0
  25. data/docs/Host.md +29 -0
  26. data/docs/HostApi.md +204 -0
  27. data/docs/HostCreate.md +39 -0
  28. data/docs/HostVolumeConnection.md +23 -0
  29. data/docs/HostVolumeConnectionApi.md +204 -0
  30. data/docs/HostVolumeConnectionCreate.md +21 -0
  31. data/docs/NativeCapability.md +23 -0
  32. data/docs/NativeCapabilityApi.md +204 -0
  33. data/docs/Profile.md +25 -0
  34. data/docs/ProfileApi.md +204 -0
  35. data/docs/ProvisioningStrategy.md +19 -0
  36. data/docs/ProvisioningStrategyApi.md +204 -0
  37. data/docs/Service.md +35 -0
  38. data/docs/ServiceAbstractCapabilityValue.md +21 -0
  39. data/docs/ServiceApi.md +256 -0
  40. data/docs/ServiceCreate.md +33 -0
  41. data/docs/ServiceResourceAttachment.md +23 -0
  42. data/docs/ServiceResourceAttachmentApi.md +204 -0
  43. data/docs/StorageResource.md +33 -0
  44. data/docs/StorageResourceApi.md +256 -0
  45. data/docs/StorageResourceCreate.md +31 -0
  46. data/docs/StorageResourceResponse.md +33 -0
  47. data/docs/StorageSystem.md +29 -0
  48. data/docs/StorageSystemApi.md +204 -0
  49. data/docs/StorageSystemCreate.md +49 -0
  50. data/docs/SystemType.md +25 -0
  51. data/docs/SystemTypeApi.md +204 -0
  52. data/docs/SystemTypeCreate.md +27 -0
  53. data/docs/Volume.md +31 -0
  54. data/docs/VolumeApi.md +256 -0
  55. data/docs/VolumeCreate.md +27 -0
  56. data/docs/VolumeResponse.md +31 -0
  57. data/docs/VolumeSafeDelete.md +21 -0
  58. data/docs/VolumeSafeDeleteApi.md +204 -0
  59. data/docs/VolumeSafeDeleteCreate.md +17 -0
  60. data/docs/VolumeUpdate.md +17 -0
  61. data/git_push.sh +58 -0
  62. data/lib/autosde_openapi_client.rb +94 -0
  63. data/lib/autosde_openapi_client/api/abstract_capability_api.rb +250 -0
  64. data/lib/autosde_openapi_client/api/account_api.rb +316 -0
  65. data/lib/autosde_openapi_client/api/address_api.rb +250 -0
  66. data/lib/autosde_openapi_client/api/authentication_api.rb +82 -0
  67. data/lib/autosde_openapi_client/api/auto_sde_project_api.rb +250 -0
  68. data/lib/autosde_openapi_client/api/auto_sde_role_api.rb +250 -0
  69. data/lib/autosde_openapi_client/api/capability_translation_api.rb +250 -0
  70. data/lib/autosde_openapi_client/api/host_api.rb +250 -0
  71. data/lib/autosde_openapi_client/api/host_volume_connection_api.rb +250 -0
  72. data/lib/autosde_openapi_client/api/native_capability_api.rb +250 -0
  73. data/lib/autosde_openapi_client/api/profile_api.rb +250 -0
  74. data/lib/autosde_openapi_client/api/provisioning_strategy_api.rb +250 -0
  75. data/lib/autosde_openapi_client/api/service_api.rb +316 -0
  76. data/lib/autosde_openapi_client/api/service_resource_attachment_api.rb +250 -0
  77. data/lib/autosde_openapi_client/api/storage_resource_api.rb +316 -0
  78. data/lib/autosde_openapi_client/api/storage_system_api.rb +250 -0
  79. data/lib/autosde_openapi_client/api/system_type_api.rb +250 -0
  80. data/lib/autosde_openapi_client/api/volume_api.rb +316 -0
  81. data/lib/autosde_openapi_client/api/volume_safe_delete_api.rb +250 -0
  82. data/lib/autosde_openapi_client/api_client.rb +388 -0
  83. data/lib/autosde_openapi_client/api_error.rb +57 -0
  84. data/lib/autosde_openapi_client/configuration.rb +266 -0
  85. data/lib/autosde_openapi_client/models/abstract_capability.rb +218 -0
  86. data/lib/autosde_openapi_client/models/account.rb +228 -0
  87. data/lib/autosde_openapi_client/models/account_post_request.rb +218 -0
  88. data/lib/autosde_openapi_client/models/account_post_response.rb +238 -0
  89. data/lib/autosde_openapi_client/models/address.rb +328 -0
  90. data/lib/autosde_openapi_client/models/address_create.rb +330 -0
  91. data/lib/autosde_openapi_client/models/auth_response.rb +208 -0
  92. data/lib/autosde_openapi_client/models/authentication.rb +218 -0
  93. data/lib/autosde_openapi_client/models/auto_sde_project.rb +398 -0
  94. data/lib/autosde_openapi_client/models/auto_sde_role.rb +218 -0
  95. data/lib/autosde_openapi_client/models/capability_translation.rb +328 -0
  96. data/lib/autosde_openapi_client/models/capability_translation_create.rb +310 -0
  97. data/lib/autosde_openapi_client/models/host.rb +321 -0
  98. data/lib/autosde_openapi_client/models/host_create.rb +382 -0
  99. data/lib/autosde_openapi_client/models/host_volume_connection.rb +275 -0
  100. data/lib/autosde_openapi_client/models/host_volume_connection_create.rb +265 -0
  101. data/lib/autosde_openapi_client/models/native_capability.rb +239 -0
  102. data/lib/autosde_openapi_client/models/profile.rb +283 -0
  103. data/lib/autosde_openapi_client/models/provisioning_strategy.rb +257 -0
  104. data/lib/autosde_openapi_client/models/service.rb +339 -0
  105. data/lib/autosde_openapi_client/models/service_abstract_capability_value.rb +227 -0
  106. data/lib/autosde_openapi_client/models/service_create.rb +327 -0
  107. data/lib/autosde_openapi_client/models/service_resource_attachment.rb +238 -0
  108. data/lib/autosde_openapi_client/models/storage_resource.rb +342 -0
  109. data/lib/autosde_openapi_client/models/storage_resource_create.rb +333 -0
  110. data/lib/autosde_openapi_client/models/storage_resource_response.rb +343 -0
  111. data/lib/autosde_openapi_client/models/storage_system.rb +333 -0
  112. data/lib/autosde_openapi_client/models/storage_system_create.rb +448 -0
  113. data/lib/autosde_openapi_client/models/system_type.rb +321 -0
  114. data/lib/autosde_openapi_client/models/system_type_create.rb +333 -0
  115. data/lib/autosde_openapi_client/models/volume.rb +316 -0
  116. data/lib/autosde_openapi_client/models/volume_create.rb +299 -0
  117. data/lib/autosde_openapi_client/models/volume_response.rb +318 -0
  118. data/lib/autosde_openapi_client/models/volume_safe_delete.rb +227 -0
  119. data/lib/autosde_openapi_client/models/volume_safe_delete_create.rb +207 -0
  120. data/lib/autosde_openapi_client/models/volume_update.rb +208 -0
  121. data/lib/autosde_openapi_client/version.rb +15 -0
  122. data/site_manager_oas.json +3992 -0
  123. data/spec/api/abstract_capability_api_spec.rb +74 -0
  124. data/spec/api/account_api_spec.rb +85 -0
  125. data/spec/api/address_api_spec.rb +74 -0
  126. data/spec/api/authentication_api_spec.rb +45 -0
  127. data/spec/api/auto_sde_project_api_spec.rb +74 -0
  128. data/spec/api/auto_sde_role_api_spec.rb +74 -0
  129. data/spec/api/capability_translation_api_spec.rb +74 -0
  130. data/spec/api/host_api_spec.rb +74 -0
  131. data/spec/api/host_volume_connection_api_spec.rb +74 -0
  132. data/spec/api/native_capability_api_spec.rb +74 -0
  133. data/spec/api/profile_api_spec.rb +74 -0
  134. data/spec/api/provisioning_strategy_api_spec.rb +74 -0
  135. data/spec/api/service_api_spec.rb +85 -0
  136. data/spec/api/service_resource_attachment_api_spec.rb +74 -0
  137. data/spec/api/storage_resource_api_spec.rb +85 -0
  138. data/spec/api/storage_system_api_spec.rb +74 -0
  139. data/spec/api/system_type_api_spec.rb +74 -0
  140. data/spec/api/volume_api_spec.rb +85 -0
  141. data/spec/api/volume_safe_delete_api_spec.rb +74 -0
  142. data/spec/api_client_spec.rb +226 -0
  143. data/spec/configuration_spec.rb +42 -0
  144. data/spec/models/abstract_capability_spec.rb +47 -0
  145. data/spec/models/account_post_request_spec.rb +47 -0
  146. data/spec/models/account_post_response_spec.rb +59 -0
  147. data/spec/models/account_spec.rb +53 -0
  148. data/spec/models/address_create_spec.rb +91 -0
  149. data/spec/models/address_spec.rb +91 -0
  150. data/spec/models/auth_response_spec.rb +41 -0
  151. data/spec/models/authentication_spec.rb +47 -0
  152. data/spec/models/auto_sde_project_spec.rb +155 -0
  153. data/spec/models/auto_sde_role_spec.rb +47 -0
  154. data/spec/models/capability_translation_create_spec.rb +83 -0
  155. data/spec/models/capability_translation_spec.rb +95 -0
  156. data/spec/models/host_create_spec.rb +119 -0
  157. data/spec/models/host_spec.rb +85 -0
  158. data/spec/models/host_volume_connection_create_spec.rb +57 -0
  159. data/spec/models/host_volume_connection_spec.rb +63 -0
  160. data/spec/models/native_capability_spec.rb +59 -0
  161. data/spec/models/profile_spec.rb +69 -0
  162. data/spec/models/provisioning_strategy_spec.rb +51 -0
  163. data/spec/models/service_abstract_capability_value_spec.rb +53 -0
  164. data/spec/models/service_create_spec.rb +93 -0
  165. data/spec/models/service_resource_attachment_spec.rb +59 -0
  166. data/spec/models/service_spec.rb +99 -0
  167. data/spec/models/storage_resource_create_spec.rb +91 -0
  168. data/spec/models/storage_resource_response_spec.rb +97 -0
  169. data/spec/models/storage_resource_spec.rb +97 -0
  170. data/spec/models/storage_system_create_spec.rb +149 -0
  171. data/spec/models/storage_system_spec.rb +85 -0
  172. data/spec/models/system_type_create_spec.rb +79 -0
  173. data/spec/models/system_type_spec.rb +73 -0
  174. data/spec/models/volume_create_spec.rb +75 -0
  175. data/spec/models/volume_response_spec.rb +87 -0
  176. data/spec/models/volume_safe_delete_create_spec.rb +41 -0
  177. data/spec/models/volume_safe_delete_spec.rb +53 -0
  178. data/spec/models/volume_spec.rb +87 -0
  179. data/spec/models/volume_update_spec.rb +41 -0
  180. data/spec/spec_helper.rb +111 -0
  181. metadata +340 -0
@@ -0,0 +1,343 @@
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: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OpenapiClient
16
+ # TODO add description
17
+ class StorageResourceResponse
18
+ # advanced_attributes_map
19
+ attr_accessor :advanced_attributes_map
20
+
21
+ # component_state
22
+ attr_accessor :component_state
23
+
24
+ # logical_free
25
+ attr_accessor :logical_free
26
+
27
+ # The Total logical capacity of this resource (gb)
28
+ attr_accessor :logical_total
29
+
30
+ # name
31
+ attr_accessor :name
32
+
33
+ # Pool (or slice) name
34
+ attr_accessor :pool_name
35
+
36
+ # protocol
37
+ attr_accessor :protocol
38
+
39
+ # !!uuid of storage_system
40
+ attr_accessor :storage_system
41
+
42
+ # uuid
43
+ attr_accessor :uuid
44
+
45
+ class EnumAttributeValidator
46
+ attr_reader :datatype
47
+ attr_reader :allowable_values
48
+
49
+ def initialize(datatype, allowable_values)
50
+ @allowable_values = allowable_values.map do |value|
51
+ case datatype.to_s
52
+ when /Integer/i
53
+ value.to_i
54
+ when /Float/i
55
+ value.to_f
56
+ else
57
+ value
58
+ end
59
+ end
60
+ end
61
+
62
+ def valid?(value)
63
+ !value || allowable_values.include?(value)
64
+ end
65
+ end
66
+
67
+ # Attribute mapping from ruby-style variable name to JSON key.
68
+ def self.attribute_map
69
+ {
70
+ :'advanced_attributes_map' => :'advanced_attributes_map',
71
+ :'component_state' => :'component_state',
72
+ :'logical_free' => :'logical_free',
73
+ :'logical_total' => :'logical_total',
74
+ :'name' => :'name',
75
+ :'pool_name' => :'pool_name',
76
+ :'protocol' => :'protocol',
77
+ :'storage_system' => :'storage_system',
78
+ :'uuid' => :'uuid'
79
+ }
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'advanced_attributes_map' => :'String',
86
+ :'component_state' => :'String',
87
+ :'logical_free' => :'Integer',
88
+ :'logical_total' => :'Integer',
89
+ :'name' => :'String',
90
+ :'pool_name' => :'String',
91
+ :'protocol' => :'String',
92
+ :'storage_system' => :'String',
93
+ :'uuid' => :'String'
94
+ }
95
+ end
96
+
97
+ # List of attributes with nullable: true
98
+ def self.openapi_nullable
99
+ Set.new([
100
+ ])
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ if (!attributes.is_a?(Hash))
107
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::StorageResourceResponse` initialize method"
108
+ end
109
+
110
+ # check to see if the attribute exists and convert string to symbol for hash key
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!self.class.attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::StorageResourceResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'advanced_attributes_map')
119
+ self.advanced_attributes_map = attributes[:'advanced_attributes_map']
120
+ end
121
+
122
+ if attributes.key?(:'component_state')
123
+ self.component_state = attributes[:'component_state']
124
+ end
125
+
126
+ if attributes.key?(:'logical_free')
127
+ self.logical_free = attributes[:'logical_free']
128
+ else
129
+ self.logical_free = 0
130
+ end
131
+
132
+ if attributes.key?(:'logical_total')
133
+ self.logical_total = attributes[:'logical_total']
134
+ else
135
+ self.logical_total = 0
136
+ end
137
+
138
+ if attributes.key?(:'name')
139
+ self.name = attributes[:'name']
140
+ end
141
+
142
+ if attributes.key?(:'pool_name')
143
+ self.pool_name = attributes[:'pool_name']
144
+ end
145
+
146
+ if attributes.key?(:'protocol')
147
+ self.protocol = attributes[:'protocol']
148
+ end
149
+
150
+ if attributes.key?(:'storage_system')
151
+ self.storage_system = attributes[:'storage_system']
152
+ end
153
+
154
+ if attributes.key?(:'uuid')
155
+ self.uuid = attributes[:'uuid']
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
+ invalid_properties
168
+ end
169
+
170
+ # Check to see if the all the properties in the model are valid
171
+ # @return true if the model is valid
172
+ def valid?
173
+ component_state_validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
174
+ return false unless component_state_validator.valid?(@component_state)
175
+ return false if !@component_state.nil? && @component_state.to_s.length > 32
176
+ protocol_validator = EnumAttributeValidator.new('String', ["fc", "iscsi"])
177
+ return false unless protocol_validator.valid?(@protocol)
178
+ true
179
+ end
180
+
181
+ # Custom attribute writer method checking allowed values (enum).
182
+ # @param [Object] component_state Object to be assigned
183
+ def component_state=(component_state)
184
+ validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
185
+ unless validator.valid?(component_state)
186
+ fail ArgumentError, "invalid value for \"component_state\", must be one of #{validator.allowable_values}."
187
+ end
188
+ @component_state = component_state
189
+ end
190
+
191
+ # Custom attribute writer method checking allowed values (enum).
192
+ # @param [Object] protocol Object to be assigned
193
+ def protocol=(protocol)
194
+ validator = EnumAttributeValidator.new('String', ["fc", "iscsi"])
195
+ unless validator.valid?(protocol)
196
+ fail ArgumentError, "invalid value for \"protocol\", must be one of #{validator.allowable_values}."
197
+ end
198
+ @protocol = protocol
199
+ end
200
+
201
+ # Checks equality by comparing each attribute.
202
+ # @param [Object] Object to be compared
203
+ def ==(o)
204
+ return true if self.equal?(o)
205
+ self.class == o.class &&
206
+ advanced_attributes_map == o.advanced_attributes_map &&
207
+ component_state == o.component_state &&
208
+ logical_free == o.logical_free &&
209
+ logical_total == o.logical_total &&
210
+ name == o.name &&
211
+ pool_name == o.pool_name &&
212
+ protocol == o.protocol &&
213
+ storage_system == o.storage_system &&
214
+ uuid == o.uuid
215
+ end
216
+
217
+ # @see the `==` method
218
+ # @param [Object] Object to be compared
219
+ def eql?(o)
220
+ self == o
221
+ end
222
+
223
+ # Calculates hash code according to all attributes.
224
+ # @return [Integer] Hash code
225
+ def hash
226
+ [advanced_attributes_map, component_state, logical_free, logical_total, name, pool_name, protocol, storage_system, uuid].hash
227
+ end
228
+
229
+ # Builds the object from hash
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ # @return [Object] Returns the model itself
232
+ def self.build_from_hash(attributes)
233
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
240
+ return nil unless attributes.is_a?(Hash)
241
+ self.class.openapi_types.each_pair do |key, type|
242
+ if type =~ /\AArray<(.*)>/i
243
+ # check to ensure the input is an array given that the attribute
244
+ # is documented as an array but the input is not
245
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
246
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
247
+ end
248
+ elsif !attributes[self.class.attribute_map[key]].nil?
249
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
250
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
251
+ end
252
+
253
+ self
254
+ end
255
+
256
+ # Deserializes the data based on type
257
+ # @param string type Data type
258
+ # @param string value Value to be deserialized
259
+ # @return [Object] Deserialized data
260
+ def _deserialize(type, value)
261
+ case type.to_sym
262
+ when :DateTime
263
+ DateTime.parse(value)
264
+ when :Date
265
+ Date.parse(value)
266
+ when :String
267
+ value.to_s
268
+ when :Integer
269
+ value.to_i
270
+ when :Float
271
+ value.to_f
272
+ when :Boolean
273
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
274
+ true
275
+ else
276
+ false
277
+ end
278
+ when :Object
279
+ # generic object (usually a Hash), return directly
280
+ value
281
+ when /\AArray<(?<inner_type>.+)>\z/
282
+ inner_type = Regexp.last_match[:inner_type]
283
+ value.map { |v| _deserialize(inner_type, v) }
284
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
285
+ k_type = Regexp.last_match[:k_type]
286
+ v_type = Regexp.last_match[:v_type]
287
+ {}.tap do |hash|
288
+ value.each do |k, v|
289
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
290
+ end
291
+ end
292
+ else # model
293
+ OpenapiClient.const_get(type).build_from_hash(value)
294
+ end
295
+ end
296
+
297
+ # Returns the string representation of the object
298
+ # @return [String] String presentation of the object
299
+ def to_s
300
+ to_hash.to_s
301
+ end
302
+
303
+ # to_body is an alias to to_hash (backward compatibility)
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_body
306
+ to_hash
307
+ end
308
+
309
+ # Returns the object in the form of hash
310
+ # @return [Hash] Returns the object in the form of hash
311
+ def to_hash
312
+ hash = {}
313
+ self.class.attribute_map.each_pair do |attr, param|
314
+ value = self.send(attr)
315
+ if value.nil?
316
+ is_nullable = self.class.openapi_nullable.include?(attr)
317
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
318
+ end
319
+
320
+ hash[param] = _to_hash(value)
321
+ end
322
+ hash
323
+ end
324
+
325
+ # Outputs non-array value in the form of hash
326
+ # For object, use to_hash. Otherwise, just return the value
327
+ # @param [Object] value Any valid value
328
+ # @return [Hash] Returns the value in the form of hash
329
+ def _to_hash(value)
330
+ if value.is_a?(Array)
331
+ value.compact.map { |v| _to_hash(v) }
332
+ elsif value.is_a?(Hash)
333
+ {}.tap do |hash|
334
+ value.each { |k, v| hash[k] = _to_hash(v) }
335
+ end
336
+ elsif value.respond_to? :to_hash
337
+ value.to_hash
338
+ else
339
+ value
340
+ end
341
+ end
342
+ end
343
+ end
@@ -0,0 +1,333 @@
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: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OpenapiClient
16
+ # Use to define storage system properties.
17
+ class StorageSystem
18
+ # component_state
19
+ attr_accessor :component_state
20
+
21
+ # management_ip
22
+ attr_accessor :management_ip
23
+
24
+ # name
25
+ attr_accessor :name
26
+
27
+ # storage_array
28
+ attr_accessor :storage_array
29
+
30
+ # storage_family
31
+ attr_accessor :storage_family
32
+
33
+ attr_accessor :system_type
34
+
35
+ # uuid
36
+ attr_accessor :uuid
37
+
38
+ class EnumAttributeValidator
39
+ attr_reader :datatype
40
+ attr_reader :allowable_values
41
+
42
+ def initialize(datatype, allowable_values)
43
+ @allowable_values = allowable_values.map do |value|
44
+ case datatype.to_s
45
+ when /Integer/i
46
+ value.to_i
47
+ when /Float/i
48
+ value.to_f
49
+ else
50
+ value
51
+ end
52
+ end
53
+ end
54
+
55
+ def valid?(value)
56
+ !value || allowable_values.include?(value)
57
+ end
58
+ end
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'component_state' => :'component_state',
64
+ :'management_ip' => :'management_ip',
65
+ :'name' => :'name',
66
+ :'storage_array' => :'storage_array',
67
+ :'storage_family' => :'storage_family',
68
+ :'system_type' => :'system_type',
69
+ :'uuid' => :'uuid'
70
+ }
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'component_state' => :'String',
77
+ :'management_ip' => :'String',
78
+ :'name' => :'String',
79
+ :'storage_array' => :'String',
80
+ :'storage_family' => :'String',
81
+ :'system_type' => :'SystemType',
82
+ :'uuid' => :'String'
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([
89
+ ])
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if (!attributes.is_a?(Hash))
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::StorageSystem` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if (!self.class.attribute_map.key?(k.to_sym))
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::StorageSystem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:'component_state')
108
+ self.component_state = attributes[:'component_state']
109
+ end
110
+
111
+ if attributes.key?(:'management_ip')
112
+ self.management_ip = attributes[:'management_ip']
113
+ end
114
+
115
+ if attributes.key?(:'name')
116
+ self.name = attributes[:'name']
117
+ end
118
+
119
+ if attributes.key?(:'storage_array')
120
+ self.storage_array = attributes[:'storage_array']
121
+ end
122
+
123
+ if attributes.key?(:'storage_family')
124
+ self.storage_family = attributes[:'storage_family']
125
+ end
126
+
127
+ if attributes.key?(:'system_type')
128
+ self.system_type = attributes[:'system_type']
129
+ end
130
+
131
+ if attributes.key?(:'uuid')
132
+ self.uuid = attributes[:'uuid']
133
+ end
134
+ end
135
+
136
+ # Show invalid properties with the reasons. Usually used together with valid?
137
+ # @return Array for valid properties with the reasons
138
+ def list_invalid_properties
139
+ invalid_properties = Array.new
140
+ if !@component_state.nil? && @component_state.to_s.length > 32
141
+ invalid_properties.push('invalid value for "component_state", the character length must be smaller than or equal to 32.')
142
+ end
143
+
144
+ if !@name.nil? && @name.to_s.length > 15
145
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 15.')
146
+ end
147
+
148
+ invalid_properties
149
+ end
150
+
151
+ # Check to see if the all the properties in the model are valid
152
+ # @return true if the model is valid
153
+ def valid?
154
+ component_state_validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
155
+ return false unless component_state_validator.valid?(@component_state)
156
+ return false if !@component_state.nil? && @component_state.to_s.length > 32
157
+ return false if !@name.nil? && @name.to_s.length > 15
158
+ storage_family_validator = EnumAttributeValidator.new('String', ["", "ontap_7mode", "ontap_cluster"])
159
+ return false unless storage_family_validator.valid?(@storage_family)
160
+ true
161
+ end
162
+
163
+ # Custom attribute writer method checking allowed values (enum).
164
+ # @param [Object] component_state Object to be assigned
165
+ def component_state=(component_state)
166
+ validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
167
+ unless validator.valid?(component_state)
168
+ fail ArgumentError, "invalid value for \"component_state\", must be one of #{validator.allowable_values}."
169
+ end
170
+ @component_state = component_state
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] name Value to be assigned
175
+ def name=(name)
176
+ if !name.nil? && name.to_s.length > 15
177
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 15.'
178
+ end
179
+
180
+ @name = name
181
+ end
182
+
183
+ # Custom attribute writer method checking allowed values (enum).
184
+ # @param [Object] storage_family Object to be assigned
185
+ def storage_family=(storage_family)
186
+ validator = EnumAttributeValidator.new('String', ["", "ontap_7mode", "ontap_cluster"])
187
+ unless validator.valid?(storage_family)
188
+ fail ArgumentError, "invalid value for \"storage_family\", must be one of #{validator.allowable_values}."
189
+ end
190
+ @storage_family = storage_family
191
+ end
192
+
193
+ # Checks equality by comparing each attribute.
194
+ # @param [Object] Object to be compared
195
+ def ==(o)
196
+ return true if self.equal?(o)
197
+ self.class == o.class &&
198
+ component_state == o.component_state &&
199
+ management_ip == o.management_ip &&
200
+ name == o.name &&
201
+ storage_array == o.storage_array &&
202
+ storage_family == o.storage_family &&
203
+ system_type == o.system_type &&
204
+ uuid == o.uuid
205
+ end
206
+
207
+ # @see the `==` method
208
+ # @param [Object] Object to be compared
209
+ def eql?(o)
210
+ self == o
211
+ end
212
+
213
+ # Calculates hash code according to all attributes.
214
+ # @return [Integer] Hash code
215
+ def hash
216
+ [component_state, management_ip, name, storage_array, storage_family, system_type, uuid].hash
217
+ end
218
+
219
+ # Builds the object from hash
220
+ # @param [Hash] attributes Model attributes in the form of hash
221
+ # @return [Object] Returns the model itself
222
+ def self.build_from_hash(attributes)
223
+ new.build_from_hash(attributes)
224
+ end
225
+
226
+ # Builds the object from hash
227
+ # @param [Hash] attributes Model attributes in the form of hash
228
+ # @return [Object] Returns the model itself
229
+ def build_from_hash(attributes)
230
+ return nil unless attributes.is_a?(Hash)
231
+ self.class.openapi_types.each_pair do |key, type|
232
+ if type =~ /\AArray<(.*)>/i
233
+ # check to ensure the input is an array given that the attribute
234
+ # is documented as an array but the input is not
235
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
236
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
237
+ end
238
+ elsif !attributes[self.class.attribute_map[key]].nil?
239
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
240
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
241
+ end
242
+
243
+ self
244
+ end
245
+
246
+ # Deserializes the data based on type
247
+ # @param string type Data type
248
+ # @param string value Value to be deserialized
249
+ # @return [Object] Deserialized data
250
+ def _deserialize(type, value)
251
+ case type.to_sym
252
+ when :DateTime
253
+ DateTime.parse(value)
254
+ when :Date
255
+ Date.parse(value)
256
+ when :String
257
+ value.to_s
258
+ when :Integer
259
+ value.to_i
260
+ when :Float
261
+ value.to_f
262
+ when :Boolean
263
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
264
+ true
265
+ else
266
+ false
267
+ end
268
+ when :Object
269
+ # generic object (usually a Hash), return directly
270
+ value
271
+ when /\AArray<(?<inner_type>.+)>\z/
272
+ inner_type = Regexp.last_match[:inner_type]
273
+ value.map { |v| _deserialize(inner_type, v) }
274
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
275
+ k_type = Regexp.last_match[:k_type]
276
+ v_type = Regexp.last_match[:v_type]
277
+ {}.tap do |hash|
278
+ value.each do |k, v|
279
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
280
+ end
281
+ end
282
+ else # model
283
+ OpenapiClient.const_get(type).build_from_hash(value)
284
+ end
285
+ end
286
+
287
+ # Returns the string representation of the object
288
+ # @return [String] String presentation of the object
289
+ def to_s
290
+ to_hash.to_s
291
+ end
292
+
293
+ # to_body is an alias to to_hash (backward compatibility)
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_body
296
+ to_hash
297
+ end
298
+
299
+ # Returns the object in the form of hash
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_hash
302
+ hash = {}
303
+ self.class.attribute_map.each_pair do |attr, param|
304
+ value = self.send(attr)
305
+ if value.nil?
306
+ is_nullable = self.class.openapi_nullable.include?(attr)
307
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
308
+ end
309
+
310
+ hash[param] = _to_hash(value)
311
+ end
312
+ hash
313
+ end
314
+
315
+ # Outputs non-array value in the form of hash
316
+ # For object, use to_hash. Otherwise, just return the value
317
+ # @param [Object] value Any valid value
318
+ # @return [Hash] Returns the value in the form of hash
319
+ def _to_hash(value)
320
+ if value.is_a?(Array)
321
+ value.compact.map { |v| _to_hash(v) }
322
+ elsif value.is_a?(Hash)
323
+ {}.tap do |hash|
324
+ value.each { |k, v| hash[k] = _to_hash(v) }
325
+ end
326
+ elsif value.respond_to? :to_hash
327
+ value.to_hash
328
+ else
329
+ value
330
+ end
331
+ end
332
+ end
333
+ end