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,310 @@
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 CapabilityTranslationCreate
18
+ # abstract_capability_name
19
+ attr_accessor :abstract_capability_name
20
+
21
+ # default_value
22
+ attr_accessor :default_value
23
+
24
+ # native_capability_name
25
+ attr_accessor :native_capability_name
26
+
27
+ # published
28
+ attr_accessor :published
29
+
30
+ # system_type_id
31
+ attr_accessor :system_type_id
32
+
33
+ # Maximum value length is 32 characters.
34
+ attr_accessor :to_abstract_value_mapper
35
+
36
+ # Maximum value length is 32 characters.
37
+ attr_accessor :to_native_value_mapper
38
+
39
+ # uuid
40
+ attr_accessor :uuid
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'abstract_capability_name' => :'abstract_capability_name',
46
+ :'default_value' => :'default_value',
47
+ :'native_capability_name' => :'native_capability_name',
48
+ :'published' => :'published',
49
+ :'system_type_id' => :'system_type_id',
50
+ :'to_abstract_value_mapper' => :'to_abstract_value_mapper',
51
+ :'to_native_value_mapper' => :'to_native_value_mapper',
52
+ :'uuid' => :'uuid'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'abstract_capability_name' => :'String',
60
+ :'default_value' => :'String',
61
+ :'native_capability_name' => :'String',
62
+ :'published' => :'Boolean',
63
+ :'system_type_id' => :'String',
64
+ :'to_abstract_value_mapper' => :'String',
65
+ :'to_native_value_mapper' => :'String',
66
+ :'uuid' => :'String'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::CapabilityTranslationCreate` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if (!self.class.attribute_map.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::CapabilityTranslationCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ if attributes.key?(:'abstract_capability_name')
92
+ self.abstract_capability_name = attributes[:'abstract_capability_name']
93
+ end
94
+
95
+ if attributes.key?(:'default_value')
96
+ self.default_value = attributes[:'default_value']
97
+ else
98
+ self.default_value = ' '
99
+ end
100
+
101
+ if attributes.key?(:'native_capability_name')
102
+ self.native_capability_name = attributes[:'native_capability_name']
103
+ end
104
+
105
+ if attributes.key?(:'published')
106
+ self.published = attributes[:'published']
107
+ end
108
+
109
+ if attributes.key?(:'system_type_id')
110
+ self.system_type_id = attributes[:'system_type_id']
111
+ end
112
+
113
+ if attributes.key?(:'to_abstract_value_mapper')
114
+ self.to_abstract_value_mapper = attributes[:'to_abstract_value_mapper']
115
+ end
116
+
117
+ if attributes.key?(:'to_native_value_mapper')
118
+ self.to_native_value_mapper = attributes[:'to_native_value_mapper']
119
+ end
120
+
121
+ if attributes.key?(:'uuid')
122
+ self.uuid = attributes[:'uuid']
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ invalid_properties = Array.new
130
+ if !@to_abstract_value_mapper.nil? && @to_abstract_value_mapper.to_s.length > 32
131
+ invalid_properties.push('invalid value for "to_abstract_value_mapper", the character length must be smaller than or equal to 32.')
132
+ end
133
+
134
+ if !@to_native_value_mapper.nil? && @to_native_value_mapper.to_s.length > 32
135
+ invalid_properties.push('invalid value for "to_native_value_mapper", the character length must be smaller than or equal to 32.')
136
+ end
137
+
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ return false if !@to_abstract_value_mapper.nil? && @to_abstract_value_mapper.to_s.length > 32
145
+ return false if !@to_native_value_mapper.nil? && @to_native_value_mapper.to_s.length > 32
146
+ true
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] to_abstract_value_mapper Value to be assigned
151
+ def to_abstract_value_mapper=(to_abstract_value_mapper)
152
+ if !to_abstract_value_mapper.nil? && to_abstract_value_mapper.to_s.length > 32
153
+ fail ArgumentError, 'invalid value for "to_abstract_value_mapper", the character length must be smaller than or equal to 32.'
154
+ end
155
+
156
+ @to_abstract_value_mapper = to_abstract_value_mapper
157
+ end
158
+
159
+ # Custom attribute writer method with validation
160
+ # @param [Object] to_native_value_mapper Value to be assigned
161
+ def to_native_value_mapper=(to_native_value_mapper)
162
+ if !to_native_value_mapper.nil? && to_native_value_mapper.to_s.length > 32
163
+ fail ArgumentError, 'invalid value for "to_native_value_mapper", the character length must be smaller than or equal to 32.'
164
+ end
165
+
166
+ @to_native_value_mapper = to_native_value_mapper
167
+ end
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] Object to be compared
171
+ def ==(o)
172
+ return true if self.equal?(o)
173
+ self.class == o.class &&
174
+ abstract_capability_name == o.abstract_capability_name &&
175
+ default_value == o.default_value &&
176
+ native_capability_name == o.native_capability_name &&
177
+ published == o.published &&
178
+ system_type_id == o.system_type_id &&
179
+ to_abstract_value_mapper == o.to_abstract_value_mapper &&
180
+ to_native_value_mapper == o.to_native_value_mapper &&
181
+ uuid == o.uuid
182
+ end
183
+
184
+ # @see the `==` method
185
+ # @param [Object] Object to be compared
186
+ def eql?(o)
187
+ self == o
188
+ end
189
+
190
+ # Calculates hash code according to all attributes.
191
+ # @return [Integer] Hash code
192
+ def hash
193
+ [abstract_capability_name, default_value, native_capability_name, published, system_type_id, to_abstract_value_mapper, to_native_value_mapper, uuid].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ new.build_from_hash(attributes)
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ self.class.openapi_types.each_pair do |key, type|
209
+ if type =~ /\AArray<(.*)>/i
210
+ # check to ensure the input is an array given that the attribute
211
+ # is documented as an array but the input is not
212
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
213
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
214
+ end
215
+ elsif !attributes[self.class.attribute_map[key]].nil?
216
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
217
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
218
+ end
219
+
220
+ self
221
+ end
222
+
223
+ # Deserializes the data based on type
224
+ # @param string type Data type
225
+ # @param string value Value to be deserialized
226
+ # @return [Object] Deserialized data
227
+ def _deserialize(type, value)
228
+ case type.to_sym
229
+ when :DateTime
230
+ DateTime.parse(value)
231
+ when :Date
232
+ Date.parse(value)
233
+ when :String
234
+ value.to_s
235
+ when :Integer
236
+ value.to_i
237
+ when :Float
238
+ value.to_f
239
+ when :Boolean
240
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
241
+ true
242
+ else
243
+ false
244
+ end
245
+ when :Object
246
+ # generic object (usually a Hash), return directly
247
+ value
248
+ when /\AArray<(?<inner_type>.+)>\z/
249
+ inner_type = Regexp.last_match[:inner_type]
250
+ value.map { |v| _deserialize(inner_type, v) }
251
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
252
+ k_type = Regexp.last_match[:k_type]
253
+ v_type = Regexp.last_match[:v_type]
254
+ {}.tap do |hash|
255
+ value.each do |k, v|
256
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
257
+ end
258
+ end
259
+ else # model
260
+ OpenapiClient.const_get(type).build_from_hash(value)
261
+ end
262
+ end
263
+
264
+ # Returns the string representation of the object
265
+ # @return [String] String presentation of the object
266
+ def to_s
267
+ to_hash.to_s
268
+ end
269
+
270
+ # to_body is an alias to to_hash (backward compatibility)
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_body
273
+ to_hash
274
+ end
275
+
276
+ # Returns the object in the form of hash
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_hash
279
+ hash = {}
280
+ self.class.attribute_map.each_pair do |attr, param|
281
+ value = self.send(attr)
282
+ if value.nil?
283
+ is_nullable = self.class.openapi_nullable.include?(attr)
284
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
285
+ end
286
+
287
+ hash[param] = _to_hash(value)
288
+ end
289
+ hash
290
+ end
291
+
292
+ # Outputs non-array value in the form of hash
293
+ # For object, use to_hash. Otherwise, just return the value
294
+ # @param [Object] value Any valid value
295
+ # @return [Hash] Returns the value in the form of hash
296
+ def _to_hash(value)
297
+ if value.is_a?(Array)
298
+ value.compact.map { |v| _to_hash(v) }
299
+ elsif value.is_a?(Hash)
300
+ {}.tap do |hash|
301
+ value.each { |k, v| hash[k] = _to_hash(v) }
302
+ end
303
+ elsif value.respond_to? :to_hash
304
+ value.to_hash
305
+ else
306
+ value
307
+ end
308
+ end
309
+ end
310
+ 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
+ # doc-todo: what 'host' is this defining or being filled in for? Fill in host properties: name, UUID, management IP address, and IQN.
17
+ class Host
18
+ # component_state
19
+ attr_accessor :component_state
20
+
21
+ # description
22
+ attr_accessor :description
23
+
24
+ # io_groups
25
+ attr_accessor :io_groups
26
+
27
+ # management_ip
28
+ attr_accessor :management_ip
29
+
30
+ # The Virtual Host Name
31
+ attr_accessor :name
32
+
33
+ # os_type
34
+ attr_accessor :os_type
35
+
36
+ # uuid
37
+ attr_accessor :uuid
38
+
39
+ class EnumAttributeValidator
40
+ attr_reader :datatype
41
+ attr_reader :allowable_values
42
+
43
+ def initialize(datatype, allowable_values)
44
+ @allowable_values = allowable_values.map do |value|
45
+ case datatype.to_s
46
+ when /Integer/i
47
+ value.to_i
48
+ when /Float/i
49
+ value.to_f
50
+ else
51
+ value
52
+ end
53
+ end
54
+ end
55
+
56
+ def valid?(value)
57
+ !value || allowable_values.include?(value)
58
+ end
59
+ end
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'component_state' => :'component_state',
65
+ :'description' => :'description',
66
+ :'io_groups' => :'io_groups',
67
+ :'management_ip' => :'management_ip',
68
+ :'name' => :'name',
69
+ :'os_type' => :'os_type',
70
+ :'uuid' => :'uuid'
71
+ }
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.openapi_types
76
+ {
77
+ :'component_state' => :'String',
78
+ :'description' => :'String',
79
+ :'io_groups' => :'String',
80
+ :'management_ip' => :'String',
81
+ :'name' => :'String',
82
+ :'os_type' => :'String',
83
+ :'uuid' => :'String'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Host` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Host`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'component_state')
109
+ self.component_state = attributes[:'component_state']
110
+ end
111
+
112
+ if attributes.key?(:'description')
113
+ self.description = attributes[:'description']
114
+ end
115
+
116
+ if attributes.key?(:'io_groups')
117
+ self.io_groups = attributes[:'io_groups']
118
+ end
119
+
120
+ if attributes.key?(:'management_ip')
121
+ self.management_ip = attributes[:'management_ip']
122
+ end
123
+
124
+ if attributes.key?(:'name')
125
+ self.name = attributes[:'name']
126
+ end
127
+
128
+ if attributes.key?(:'os_type')
129
+ self.os_type = attributes[:'os_type']
130
+ else
131
+ self.os_type = 'Unknown'
132
+ end
133
+
134
+ if attributes.key?(:'uuid')
135
+ self.uuid = attributes[:'uuid']
136
+ end
137
+ end
138
+
139
+ # Show invalid properties with the reasons. Usually used together with valid?
140
+ # @return Array for valid properties with the reasons
141
+ def list_invalid_properties
142
+ invalid_properties = Array.new
143
+ if !@component_state.nil? && @component_state.to_s.length > 32
144
+ invalid_properties.push('invalid value for "component_state", the character length must be smaller than or equal to 32.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ component_state_validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
154
+ return false unless component_state_validator.valid?(@component_state)
155
+ return false if !@component_state.nil? && @component_state.to_s.length > 32
156
+ os_type_validator = EnumAttributeValidator.new('String', ["Linux", "Windows", "Unknown"])
157
+ return false unless os_type_validator.valid?(@os_type)
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method checking allowed values (enum).
162
+ # @param [Object] component_state Object to be assigned
163
+ def component_state=(component_state)
164
+ validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
165
+ unless validator.valid?(component_state)
166
+ fail ArgumentError, "invalid value for \"component_state\", must be one of #{validator.allowable_values}."
167
+ end
168
+ @component_state = component_state
169
+ end
170
+
171
+ # Custom attribute writer method checking allowed values (enum).
172
+ # @param [Object] os_type Object to be assigned
173
+ def os_type=(os_type)
174
+ validator = EnumAttributeValidator.new('String', ["Linux", "Windows", "Unknown"])
175
+ unless validator.valid?(os_type)
176
+ fail ArgumentError, "invalid value for \"os_type\", must be one of #{validator.allowable_values}."
177
+ end
178
+ @os_type = os_type
179
+ end
180
+
181
+ # Checks equality by comparing each attribute.
182
+ # @param [Object] Object to be compared
183
+ def ==(o)
184
+ return true if self.equal?(o)
185
+ self.class == o.class &&
186
+ component_state == o.component_state &&
187
+ description == o.description &&
188
+ io_groups == o.io_groups &&
189
+ management_ip == o.management_ip &&
190
+ name == o.name &&
191
+ os_type == o.os_type &&
192
+ uuid == o.uuid
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, description, io_groups, management_ip, name, os_type, uuid].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