autosde_openapi_client 1.0.0 → 1.0.21

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