autosde_openapi_client 1.0.0

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 (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,448 @@
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 StorageSystemCreate
18
+ # auto_add_pools
19
+ attr_accessor :auto_add_pools
20
+
21
+ # auto_setup
22
+ attr_accessor :auto_setup
23
+
24
+ # chap_name
25
+ attr_accessor :chap_name
26
+
27
+ # chap_secret
28
+ attr_accessor :chap_secret
29
+
30
+ # component_state
31
+ attr_accessor :component_state
32
+
33
+ attr_accessor :iqn
34
+
35
+ # management_ip
36
+ attr_accessor :management_ip
37
+
38
+ # name
39
+ attr_accessor :name
40
+
41
+ # password
42
+ attr_accessor :password
43
+
44
+ # port_type
45
+ attr_accessor :port_type
46
+
47
+ # secondary_ip
48
+ attr_accessor :secondary_ip
49
+
50
+ # storage_array
51
+ attr_accessor :storage_array
52
+
53
+ # storage_driver
54
+ attr_accessor :storage_driver
55
+
56
+ # storage_family
57
+ attr_accessor :storage_family
58
+
59
+ attr_accessor :system_type
60
+
61
+ # user
62
+ attr_accessor :user
63
+
64
+ # wwpn
65
+ attr_accessor :wwpn
66
+
67
+ class EnumAttributeValidator
68
+ attr_reader :datatype
69
+ attr_reader :allowable_values
70
+
71
+ def initialize(datatype, allowable_values)
72
+ @allowable_values = allowable_values.map do |value|
73
+ case datatype.to_s
74
+ when /Integer/i
75
+ value.to_i
76
+ when /Float/i
77
+ value.to_f
78
+ else
79
+ value
80
+ end
81
+ end
82
+ end
83
+
84
+ def valid?(value)
85
+ !value || allowable_values.include?(value)
86
+ end
87
+ end
88
+
89
+ # Attribute mapping from ruby-style variable name to JSON key.
90
+ def self.attribute_map
91
+ {
92
+ :'auto_add_pools' => :'auto_add_pools',
93
+ :'auto_setup' => :'auto_setup',
94
+ :'chap_name' => :'chap_name',
95
+ :'chap_secret' => :'chap_secret',
96
+ :'component_state' => :'component_state',
97
+ :'iqn' => :'iqn',
98
+ :'management_ip' => :'management_ip',
99
+ :'name' => :'name',
100
+ :'password' => :'password',
101
+ :'port_type' => :'port_type',
102
+ :'secondary_ip' => :'secondary_ip',
103
+ :'storage_array' => :'storage_array',
104
+ :'storage_driver' => :'storage_driver',
105
+ :'storage_family' => :'storage_family',
106
+ :'system_type' => :'system_type',
107
+ :'user' => :'user',
108
+ :'wwpn' => :'wwpn'
109
+ }
110
+ end
111
+
112
+ # Attribute type mapping.
113
+ def self.openapi_types
114
+ {
115
+ :'auto_add_pools' => :'Boolean',
116
+ :'auto_setup' => :'Boolean',
117
+ :'chap_name' => :'String',
118
+ :'chap_secret' => :'String',
119
+ :'component_state' => :'String',
120
+ :'iqn' => :'String',
121
+ :'management_ip' => :'String',
122
+ :'name' => :'String',
123
+ :'password' => :'String',
124
+ :'port_type' => :'String',
125
+ :'secondary_ip' => :'String',
126
+ :'storage_array' => :'String',
127
+ :'storage_driver' => :'String',
128
+ :'storage_family' => :'String',
129
+ :'system_type' => :'SystemType',
130
+ :'user' => :'String',
131
+ :'wwpn' => :'String'
132
+ }
133
+ end
134
+
135
+ # List of attributes with nullable: true
136
+ def self.openapi_nullable
137
+ Set.new([
138
+ ])
139
+ end
140
+
141
+ # Initializes the object
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ def initialize(attributes = {})
144
+ if (!attributes.is_a?(Hash))
145
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::StorageSystemCreate` initialize method"
146
+ end
147
+
148
+ # check to see if the attribute exists and convert string to symbol for hash key
149
+ attributes = attributes.each_with_object({}) { |(k, v), h|
150
+ if (!self.class.attribute_map.key?(k.to_sym))
151
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::StorageSystemCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
152
+ end
153
+ h[k.to_sym] = v
154
+ }
155
+
156
+ if attributes.key?(:'auto_add_pools')
157
+ self.auto_add_pools = attributes[:'auto_add_pools']
158
+ else
159
+ self.auto_add_pools = false
160
+ end
161
+
162
+ if attributes.key?(:'auto_setup')
163
+ self.auto_setup = attributes[:'auto_setup']
164
+ else
165
+ self.auto_setup = false
166
+ end
167
+
168
+ if attributes.key?(:'chap_name')
169
+ self.chap_name = attributes[:'chap_name']
170
+ end
171
+
172
+ if attributes.key?(:'chap_secret')
173
+ self.chap_secret = attributes[:'chap_secret']
174
+ end
175
+
176
+ if attributes.key?(:'component_state')
177
+ self.component_state = attributes[:'component_state']
178
+ end
179
+
180
+ if attributes.key?(:'iqn')
181
+ self.iqn = attributes[:'iqn']
182
+ end
183
+
184
+ if attributes.key?(:'management_ip')
185
+ self.management_ip = attributes[:'management_ip']
186
+ end
187
+
188
+ if attributes.key?(:'name')
189
+ self.name = attributes[:'name']
190
+ end
191
+
192
+ if attributes.key?(:'password')
193
+ self.password = attributes[:'password']
194
+ end
195
+
196
+ if attributes.key?(:'port_type')
197
+ self.port_type = attributes[:'port_type']
198
+ end
199
+
200
+ if attributes.key?(:'secondary_ip')
201
+ self.secondary_ip = attributes[:'secondary_ip']
202
+ end
203
+
204
+ if attributes.key?(:'storage_array')
205
+ self.storage_array = attributes[:'storage_array']
206
+ end
207
+
208
+ if attributes.key?(:'storage_driver')
209
+ self.storage_driver = attributes[:'storage_driver']
210
+ end
211
+
212
+ if attributes.key?(:'storage_family')
213
+ self.storage_family = attributes[:'storage_family']
214
+ end
215
+
216
+ if attributes.key?(:'system_type')
217
+ self.system_type = attributes[:'system_type']
218
+ end
219
+
220
+ if attributes.key?(:'user')
221
+ self.user = attributes[:'user']
222
+ end
223
+
224
+ if attributes.key?(:'wwpn')
225
+ self.wwpn = attributes[:'wwpn']
226
+ end
227
+ end
228
+
229
+ # Show invalid properties with the reasons. Usually used together with valid?
230
+ # @return Array for valid properties with the reasons
231
+ def list_invalid_properties
232
+ invalid_properties = Array.new
233
+ if !@component_state.nil? && @component_state.to_s.length > 32
234
+ invalid_properties.push('invalid value for "component_state", the character length must be smaller than or equal to 32.')
235
+ end
236
+
237
+ if !@name.nil? && @name.to_s.length > 15
238
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 15.')
239
+ end
240
+
241
+ invalid_properties
242
+ end
243
+
244
+ # Check to see if the all the properties in the model are valid
245
+ # @return true if the model is valid
246
+ def valid?
247
+ component_state_validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
248
+ return false unless component_state_validator.valid?(@component_state)
249
+ return false if !@component_state.nil? && @component_state.to_s.length > 32
250
+ return false if !@name.nil? && @name.to_s.length > 15
251
+ port_type_validator = EnumAttributeValidator.new('String', ["ISCSI", "FC", "NVMeFC"])
252
+ return false unless port_type_validator.valid?(@port_type)
253
+ storage_family_validator = EnumAttributeValidator.new('String', ["", "ontap_7mode", "ontap_cluster"])
254
+ return false unless storage_family_validator.valid?(@storage_family)
255
+ true
256
+ end
257
+
258
+ # Custom attribute writer method checking allowed values (enum).
259
+ # @param [Object] component_state Object to be assigned
260
+ def component_state=(component_state)
261
+ validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
262
+ unless validator.valid?(component_state)
263
+ fail ArgumentError, "invalid value for \"component_state\", must be one of #{validator.allowable_values}."
264
+ end
265
+ @component_state = component_state
266
+ end
267
+
268
+ # Custom attribute writer method with validation
269
+ # @param [Object] name Value to be assigned
270
+ def name=(name)
271
+ if !name.nil? && name.to_s.length > 15
272
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 15.'
273
+ end
274
+
275
+ @name = name
276
+ end
277
+
278
+ # Custom attribute writer method checking allowed values (enum).
279
+ # @param [Object] port_type Object to be assigned
280
+ def port_type=(port_type)
281
+ validator = EnumAttributeValidator.new('String', ["ISCSI", "FC", "NVMeFC"])
282
+ unless validator.valid?(port_type)
283
+ fail ArgumentError, "invalid value for \"port_type\", must be one of #{validator.allowable_values}."
284
+ end
285
+ @port_type = port_type
286
+ end
287
+
288
+ # Custom attribute writer method checking allowed values (enum).
289
+ # @param [Object] storage_family Object to be assigned
290
+ def storage_family=(storage_family)
291
+ validator = EnumAttributeValidator.new('String', ["", "ontap_7mode", "ontap_cluster"])
292
+ unless validator.valid?(storage_family)
293
+ fail ArgumentError, "invalid value for \"storage_family\", must be one of #{validator.allowable_values}."
294
+ end
295
+ @storage_family = storage_family
296
+ end
297
+
298
+ # Checks equality by comparing each attribute.
299
+ # @param [Object] Object to be compared
300
+ def ==(o)
301
+ return true if self.equal?(o)
302
+ self.class == o.class &&
303
+ auto_add_pools == o.auto_add_pools &&
304
+ auto_setup == o.auto_setup &&
305
+ chap_name == o.chap_name &&
306
+ chap_secret == o.chap_secret &&
307
+ component_state == o.component_state &&
308
+ iqn == o.iqn &&
309
+ management_ip == o.management_ip &&
310
+ name == o.name &&
311
+ password == o.password &&
312
+ port_type == o.port_type &&
313
+ secondary_ip == o.secondary_ip &&
314
+ storage_array == o.storage_array &&
315
+ storage_driver == o.storage_driver &&
316
+ storage_family == o.storage_family &&
317
+ system_type == o.system_type &&
318
+ user == o.user &&
319
+ wwpn == o.wwpn
320
+ end
321
+
322
+ # @see the `==` method
323
+ # @param [Object] Object to be compared
324
+ def eql?(o)
325
+ self == o
326
+ end
327
+
328
+ # Calculates hash code according to all attributes.
329
+ # @return [Integer] Hash code
330
+ def hash
331
+ [auto_add_pools, auto_setup, chap_name, chap_secret, component_state, iqn, management_ip, name, password, port_type, secondary_ip, storage_array, storage_driver, storage_family, system_type, user, wwpn].hash
332
+ end
333
+
334
+ # Builds the object from hash
335
+ # @param [Hash] attributes Model attributes in the form of hash
336
+ # @return [Object] Returns the model itself
337
+ def self.build_from_hash(attributes)
338
+ new.build_from_hash(attributes)
339
+ end
340
+
341
+ # Builds the object from hash
342
+ # @param [Hash] attributes Model attributes in the form of hash
343
+ # @return [Object] Returns the model itself
344
+ def build_from_hash(attributes)
345
+ return nil unless attributes.is_a?(Hash)
346
+ self.class.openapi_types.each_pair do |key, type|
347
+ if type =~ /\AArray<(.*)>/i
348
+ # check to ensure the input is an array given that the attribute
349
+ # is documented as an array but the input is not
350
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
351
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
352
+ end
353
+ elsif !attributes[self.class.attribute_map[key]].nil?
354
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
355
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
356
+ end
357
+
358
+ self
359
+ end
360
+
361
+ # Deserializes the data based on type
362
+ # @param string type Data type
363
+ # @param string value Value to be deserialized
364
+ # @return [Object] Deserialized data
365
+ def _deserialize(type, value)
366
+ case type.to_sym
367
+ when :DateTime
368
+ DateTime.parse(value)
369
+ when :Date
370
+ Date.parse(value)
371
+ when :String
372
+ value.to_s
373
+ when :Integer
374
+ value.to_i
375
+ when :Float
376
+ value.to_f
377
+ when :Boolean
378
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
379
+ true
380
+ else
381
+ false
382
+ end
383
+ when :Object
384
+ # generic object (usually a Hash), return directly
385
+ value
386
+ when /\AArray<(?<inner_type>.+)>\z/
387
+ inner_type = Regexp.last_match[:inner_type]
388
+ value.map { |v| _deserialize(inner_type, v) }
389
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
390
+ k_type = Regexp.last_match[:k_type]
391
+ v_type = Regexp.last_match[:v_type]
392
+ {}.tap do |hash|
393
+ value.each do |k, v|
394
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
395
+ end
396
+ end
397
+ else # model
398
+ OpenapiClient.const_get(type).build_from_hash(value)
399
+ end
400
+ end
401
+
402
+ # Returns the string representation of the object
403
+ # @return [String] String presentation of the object
404
+ def to_s
405
+ to_hash.to_s
406
+ end
407
+
408
+ # to_body is an alias to to_hash (backward compatibility)
409
+ # @return [Hash] Returns the object in the form of hash
410
+ def to_body
411
+ to_hash
412
+ end
413
+
414
+ # Returns the object in the form of hash
415
+ # @return [Hash] Returns the object in the form of hash
416
+ def to_hash
417
+ hash = {}
418
+ self.class.attribute_map.each_pair do |attr, param|
419
+ value = self.send(attr)
420
+ if value.nil?
421
+ is_nullable = self.class.openapi_nullable.include?(attr)
422
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
423
+ end
424
+
425
+ hash[param] = _to_hash(value)
426
+ end
427
+ hash
428
+ end
429
+
430
+ # Outputs non-array value in the form of hash
431
+ # For object, use to_hash. Otherwise, just return the value
432
+ # @param [Object] value Any valid value
433
+ # @return [Hash] Returns the value in the form of hash
434
+ def _to_hash(value)
435
+ if value.is_a?(Array)
436
+ value.compact.map { |v| _to_hash(v) }
437
+ elsif value.is_a?(Hash)
438
+ {}.tap do |hash|
439
+ value.each { |k, v| hash[k] = _to_hash(v) }
440
+ end
441
+ elsif value.respond_to? :to_hash
442
+ value.to_hash
443
+ else
444
+ value
445
+ end
446
+ end
447
+ end
448
+ end
@@ -0,0 +1,321 @@
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 the storage system type.
17
+ class SystemType
18
+ # component_state
19
+ attr_accessor :component_state
20
+
21
+ # name
22
+ attr_accessor :name
23
+
24
+ # short_version
25
+ attr_accessor :short_version
26
+
27
+ # uuid
28
+ attr_accessor :uuid
29
+
30
+ # SystemType version
31
+ attr_accessor :version
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'component_state' => :'component_state',
59
+ :'name' => :'name',
60
+ :'short_version' => :'short_version',
61
+ :'uuid' => :'uuid',
62
+ :'version' => :'version'
63
+ }
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'component_state' => :'String',
70
+ :'name' => :'String',
71
+ :'short_version' => :'String',
72
+ :'uuid' => :'String',
73
+ :'version' => :'String'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::SystemType` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::SystemType`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'component_state')
99
+ self.component_state = attributes[:'component_state']
100
+ end
101
+
102
+ if attributes.key?(:'name')
103
+ self.name = attributes[:'name']
104
+ else
105
+ self.name = 'xiv'
106
+ end
107
+
108
+ if attributes.key?(:'short_version')
109
+ self.short_version = attributes[:'short_version']
110
+ end
111
+
112
+ if attributes.key?(:'uuid')
113
+ self.uuid = attributes[:'uuid']
114
+ end
115
+
116
+ if attributes.key?(:'version')
117
+ self.version = attributes[:'version']
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ invalid_properties = Array.new
125
+ if !@component_state.nil? && @component_state.to_s.length > 32
126
+ invalid_properties.push('invalid value for "component_state", the character length must be smaller than or equal to 32.')
127
+ end
128
+
129
+ if !@name.nil? && @name.to_s.length > 10
130
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 10.')
131
+ end
132
+
133
+ if !@short_version.nil? && @short_version.to_s.length > 255
134
+ invalid_properties.push('invalid value for "short_version", the character length must be smaller than or equal to 255.')
135
+ end
136
+
137
+ invalid_properties
138
+ end
139
+
140
+ # Check to see if the all the properties in the model are valid
141
+ # @return true if the model is valid
142
+ def valid?
143
+ component_state_validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
144
+ return false unless component_state_validator.valid?(@component_state)
145
+ return false if !@component_state.nil? && @component_state.to_s.length > 32
146
+ name_validator = EnumAttributeValidator.new('String', ["a_line", "xiv", "ds8000", "vmax", "netapp", "ds8x00", "svc"])
147
+ return false unless name_validator.valid?(@name)
148
+ return false if !@name.nil? && @name.to_s.length > 10
149
+ return false if !@short_version.nil? && @short_version.to_s.length > 255
150
+ true
151
+ end
152
+
153
+ # Custom attribute writer method checking allowed values (enum).
154
+ # @param [Object] component_state Object to be assigned
155
+ def component_state=(component_state)
156
+ validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
157
+ unless validator.valid?(component_state)
158
+ fail ArgumentError, "invalid value for \"component_state\", must be one of #{validator.allowable_values}."
159
+ end
160
+ @component_state = component_state
161
+ end
162
+
163
+ # Custom attribute writer method checking allowed values (enum).
164
+ # @param [Object] name Object to be assigned
165
+ def name=(name)
166
+ validator = EnumAttributeValidator.new('String', ["a_line", "xiv", "ds8000", "vmax", "netapp", "ds8x00", "svc"])
167
+ unless validator.valid?(name)
168
+ fail ArgumentError, "invalid value for \"name\", must be one of #{validator.allowable_values}."
169
+ end
170
+ @name = name
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] short_version Value to be assigned
175
+ def short_version=(short_version)
176
+ if !short_version.nil? && short_version.to_s.length > 255
177
+ fail ArgumentError, 'invalid value for "short_version", the character length must be smaller than or equal to 255.'
178
+ end
179
+
180
+ @short_version = short_version
181
+ end
182
+
183
+ # Checks equality by comparing each attribute.
184
+ # @param [Object] Object to be compared
185
+ def ==(o)
186
+ return true if self.equal?(o)
187
+ self.class == o.class &&
188
+ component_state == o.component_state &&
189
+ name == o.name &&
190
+ short_version == o.short_version &&
191
+ uuid == o.uuid &&
192
+ version == o.version
193
+ end
194
+
195
+ # @see the `==` method
196
+ # @param [Object] Object to be compared
197
+ def eql?(o)
198
+ self == o
199
+ end
200
+
201
+ # Calculates hash code according to all attributes.
202
+ # @return [Integer] Hash code
203
+ def hash
204
+ [component_state, name, short_version, uuid, version].hash
205
+ end
206
+
207
+ # Builds the object from hash
208
+ # @param [Hash] attributes Model attributes in the form of hash
209
+ # @return [Object] Returns the model itself
210
+ def self.build_from_hash(attributes)
211
+ new.build_from_hash(attributes)
212
+ end
213
+
214
+ # Builds the object from hash
215
+ # @param [Hash] attributes Model attributes in the form of hash
216
+ # @return [Object] Returns the model itself
217
+ def build_from_hash(attributes)
218
+ return nil unless attributes.is_a?(Hash)
219
+ self.class.openapi_types.each_pair do |key, type|
220
+ if type =~ /\AArray<(.*)>/i
221
+ # check to ensure the input is an array given that the attribute
222
+ # is documented as an array but the input is not
223
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
224
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
225
+ end
226
+ elsif !attributes[self.class.attribute_map[key]].nil?
227
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
228
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
229
+ end
230
+
231
+ self
232
+ end
233
+
234
+ # Deserializes the data based on type
235
+ # @param string type Data type
236
+ # @param string value Value to be deserialized
237
+ # @return [Object] Deserialized data
238
+ def _deserialize(type, value)
239
+ case type.to_sym
240
+ when :DateTime
241
+ DateTime.parse(value)
242
+ when :Date
243
+ Date.parse(value)
244
+ when :String
245
+ value.to_s
246
+ when :Integer
247
+ value.to_i
248
+ when :Float
249
+ value.to_f
250
+ when :Boolean
251
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
252
+ true
253
+ else
254
+ false
255
+ end
256
+ when :Object
257
+ # generic object (usually a Hash), return directly
258
+ value
259
+ when /\AArray<(?<inner_type>.+)>\z/
260
+ inner_type = Regexp.last_match[:inner_type]
261
+ value.map { |v| _deserialize(inner_type, v) }
262
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
263
+ k_type = Regexp.last_match[:k_type]
264
+ v_type = Regexp.last_match[:v_type]
265
+ {}.tap do |hash|
266
+ value.each do |k, v|
267
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
268
+ end
269
+ end
270
+ else # model
271
+ OpenapiClient.const_get(type).build_from_hash(value)
272
+ end
273
+ end
274
+
275
+ # Returns the string representation of the object
276
+ # @return [String] String presentation of the object
277
+ def to_s
278
+ to_hash.to_s
279
+ end
280
+
281
+ # to_body is an alias to to_hash (backward compatibility)
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_body
284
+ to_hash
285
+ end
286
+
287
+ # Returns the object in the form of hash
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_hash
290
+ hash = {}
291
+ self.class.attribute_map.each_pair do |attr, param|
292
+ value = self.send(attr)
293
+ if value.nil?
294
+ is_nullable = self.class.openapi_nullable.include?(attr)
295
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
296
+ end
297
+
298
+ hash[param] = _to_hash(value)
299
+ end
300
+ hash
301
+ end
302
+
303
+ # Outputs non-array value in the form of hash
304
+ # For object, use to_hash. Otherwise, just return the value
305
+ # @param [Object] value Any valid value
306
+ # @return [Hash] Returns the value in the form of hash
307
+ def _to_hash(value)
308
+ if value.is_a?(Array)
309
+ value.compact.map { |v| _to_hash(v) }
310
+ elsif value.is_a?(Hash)
311
+ {}.tap do |hash|
312
+ value.each { |k, v| hash[k] = _to_hash(v) }
313
+ end
314
+ elsif value.respond_to? :to_hash
315
+ value.to_hash
316
+ else
317
+ value
318
+ end
319
+ end
320
+ end
321
+ end