ruby-linstor-client 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/codegen.sh +1 -1
  4. data/generator/custom/one_of_drbd_volume_luks_volume_storage_nvme_volme_writecache_volume.rb +1 -1
  5. data/generator/custom/one_of_drbd_volume_luks_volume_storage_nvme_volme_writecache_volume_cache_volume.rb +11 -0
  6. data/lib/ruby-linstor-client/api/developers_api.rb +923 -103
  7. data/lib/ruby-linstor-client/api_client.rb +2 -2
  8. data/lib/ruby-linstor-client/api_error.rb +2 -2
  9. data/lib/ruby-linstor-client/configuration.rb +2 -2
  10. data/lib/ruby-linstor-client/models/api_call_rc.rb +2 -2
  11. data/lib/ruby-linstor-client/models/auto_place_request.rb +2 -2
  12. data/lib/ruby-linstor-client/models/auto_select_filter.rb +25 -3
  13. data/lib/ruby-linstor-client/models/cache_resource.rb +220 -0
  14. data/lib/ruby-linstor-client/models/cache_volume.rb +276 -0
  15. data/lib/ruby-linstor-client/models/candidate.rb +2 -2
  16. data/lib/ruby-linstor-client/models/controller_config.rb +272 -0
  17. data/lib/ruby-linstor-client/models/controller_config_config.rb +218 -0
  18. data/lib/ruby-linstor-client/models/controller_config_db.rb +263 -0
  19. data/lib/ruby-linstor-client/models/controller_config_db_etcd.rb +227 -0
  20. data/lib/ruby-linstor-client/models/controller_config_debug.rb +218 -0
  21. data/lib/ruby-linstor-client/models/controller_config_http.rb +236 -0
  22. data/lib/ruby-linstor-client/models/controller_config_https.rb +236 -0
  23. data/lib/ruby-linstor-client/models/controller_config_ldap.rb +263 -0
  24. data/lib/ruby-linstor-client/models/controller_config_log.rb +315 -0
  25. data/lib/ruby-linstor-client/models/controller_props_modify.rb +2 -2
  26. data/lib/ruby-linstor-client/models/controller_version.rb +2 -2
  27. data/lib/ruby-linstor-client/models/drbd_connection.rb +262 -0
  28. data/lib/ruby-linstor-client/models/drbd_proxy_enable.rb +2 -2
  29. data/lib/ruby-linstor-client/models/drbd_proxy_modify.rb +2 -2
  30. data/lib/ruby-linstor-client/models/drbd_resource.rb +35 -6
  31. data/lib/ruby-linstor-client/models/drbd_resource_definition_layer.rb +2 -2
  32. data/lib/ruby-linstor-client/models/drbd_volume.rb +2 -2
  33. data/lib/ruby-linstor-client/models/drbd_volume_definition.rb +2 -2
  34. data/lib/ruby-linstor-client/models/error_report.rb +87 -7
  35. data/lib/ruby-linstor-client/models/error_report_delete.rb +273 -0
  36. data/lib/ruby-linstor-client/models/event_may_promote_change.rb +237 -0
  37. data/lib/ruby-linstor-client/models/key_value_store.rb +2 -2
  38. data/lib/ruby-linstor-client/models/key_value_store_modify.rb +2 -2
  39. data/lib/ruby-linstor-client/models/layer_type.rb +4 -2
  40. data/lib/ruby-linstor-client/models/log_level.rb +40 -0
  41. data/lib/ruby-linstor-client/models/luks_resource.rb +2 -2
  42. data/lib/ruby-linstor-client/models/luks_volume.rb +2 -2
  43. data/lib/ruby-linstor-client/models/max_volume_sizes.rb +2 -2
  44. data/lib/ruby-linstor-client/models/net_interface.rb +2 -2
  45. data/lib/ruby-linstor-client/models/node.rb +4 -4
  46. data/lib/ruby-linstor-client/models/node_modify.rb +2 -2
  47. data/lib/ruby-linstor-client/models/nvme_resource.rb +2 -2
  48. data/lib/ruby-linstor-client/models/nvme_volume.rb +2 -2
  49. data/lib/ruby-linstor-client/models/one_of_drbd_volume_luks_volume_storage_nvme_volme_writecache_volume.rb +1 -1
  50. data/lib/ruby-linstor-client/models/one_of_drbd_volume_luks_volume_storage_nvme_volme_writecache_volume_cache_volume.rb +11 -0
  51. data/lib/ruby-linstor-client/models/openflex_resource.rb +229 -0
  52. data/lib/ruby-linstor-client/models/openflex_resource_definition_layer.rb +227 -0
  53. data/lib/ruby-linstor-client/models/openflex_volume.rb +256 -0
  54. data/lib/ruby-linstor-client/models/pass_phrase_create.rb +2 -2
  55. data/lib/ruby-linstor-client/models/physical_storage.rb +2 -2
  56. data/lib/ruby-linstor-client/models/physical_storage_create.rb +2 -2
  57. data/lib/ruby-linstor-client/models/physical_storage_device.rb +2 -2
  58. data/lib/ruby-linstor-client/models/physical_storage_storage_pool_create.rb +2 -2
  59. data/lib/ruby-linstor-client/models/provider_kind.rb +3 -2
  60. data/lib/ruby-linstor-client/models/resource.rb +16 -6
  61. data/lib/ruby-linstor-client/models/resource_connection.rb +2 -2
  62. data/lib/ruby-linstor-client/models/resource_connection_modify.rb +2 -2
  63. data/lib/ruby-linstor-client/models/resource_create.rb +2 -2
  64. data/lib/ruby-linstor-client/models/resource_definition.rb +2 -2
  65. data/lib/ruby-linstor-client/models/resource_definition_create.rb +2 -2
  66. data/lib/ruby-linstor-client/models/resource_definition_layer.rb +3 -3
  67. data/lib/ruby-linstor-client/models/resource_definition_modify.rb +16 -6
  68. data/lib/ruby-linstor-client/models/resource_group.rb +2 -2
  69. data/lib/ruby-linstor-client/models/resource_group_modify.rb +2 -2
  70. data/lib/ruby-linstor-client/models/resource_group_spawn.rb +22 -3
  71. data/lib/ruby-linstor-client/models/resource_layer.rb +24 -6
  72. data/lib/ruby-linstor-client/models/resource_modify.rb +2 -2
  73. data/lib/ruby-linstor-client/models/resource_state.rb +2 -2
  74. data/lib/ruby-linstor-client/models/resource_with_volumes.rb +13 -3
  75. data/lib/ruby-linstor-client/models/resource_with_volumes_all_of.rb +2 -2
  76. data/lib/ruby-linstor-client/models/satellite_config.rb +272 -0
  77. data/lib/ruby-linstor-client/models/satellite_config_log.rb +245 -0
  78. data/lib/ruby-linstor-client/models/satellite_config_net.rb +236 -0
  79. data/lib/ruby-linstor-client/models/snapshot.rb +17 -6
  80. data/lib/ruby-linstor-client/models/snapshot_node.rb +261 -0
  81. data/lib/ruby-linstor-client/models/snapshot_restore.rb +2 -2
  82. data/lib/ruby-linstor-client/models/snapshot_shipping.rb +259 -0
  83. data/lib/ruby-linstor-client/models/snapshot_shipping_status.rb +279 -0
  84. data/lib/ruby-linstor-client/models/snapshot_volume_definition.rb +2 -2
  85. data/lib/ruby-linstor-client/models/storage_pool.rb +2 -2
  86. data/lib/ruby-linstor-client/models/storage_pool_definition.rb +2 -2
  87. data/lib/ruby-linstor-client/models/storage_pool_definition_modify.rb +2 -2
  88. data/lib/ruby-linstor-client/models/storage_resource.rb +2 -2
  89. data/lib/ruby-linstor-client/models/storage_volume.rb +2 -2
  90. data/lib/ruby-linstor-client/models/volume.rb +2 -2
  91. data/lib/ruby-linstor-client/models/volume_definition.rb +2 -2
  92. data/lib/ruby-linstor-client/models/volume_definition_create.rb +2 -2
  93. data/lib/ruby-linstor-client/models/volume_definition_layer.rb +2 -2
  94. data/lib/ruby-linstor-client/models/volume_definition_modify.rb +2 -2
  95. data/lib/ruby-linstor-client/models/volume_group.rb +2 -2
  96. data/lib/ruby-linstor-client/models/volume_group_modify.rb +2 -2
  97. data/lib/ruby-linstor-client/models/volume_layer.rb +3 -3
  98. data/lib/ruby-linstor-client/models/volume_modify.rb +2 -2
  99. data/lib/ruby-linstor-client/models/volume_state.rb +2 -2
  100. data/lib/ruby-linstor-client/models/writecache_resource.rb +2 -2
  101. data/lib/ruby-linstor-client/models/writecache_volume.rb +2 -2
  102. data/lib/ruby-linstor-client/version.rb +3 -3
  103. data/lib/ruby-linstor-client.rb +26 -2
  104. data/pkg/ruby-linstor-client-1.0.0.gem +0 -0
  105. data/spec/api_client_spec.rb +2 -2
  106. data/spec/configuration_spec.rb +2 -2
  107. data/spec/models/cache_resource_spec.rb +34 -0
  108. data/spec/models/cache_volume_spec.rb +70 -0
  109. data/spec/models/controller_config_config_spec.rb +34 -0
  110. data/spec/models/controller_config_db_etcd_spec.rb +40 -0
  111. data/spec/models/controller_config_db_spec.rb +64 -0
  112. data/spec/models/controller_config_debug_spec.rb +34 -0
  113. data/spec/models/controller_config_http_spec.rb +46 -0
  114. data/spec/models/controller_config_https_spec.rb +46 -0
  115. data/spec/models/controller_config_ldap_spec.rb +64 -0
  116. data/spec/models/controller_config_log_spec.rb +80 -0
  117. data/spec/models/controller_config_spec.rb +70 -0
  118. data/spec/models/drbd_connection_spec.rb +44 -0
  119. data/spec/models/error_report_delete_spec.rb +64 -0
  120. data/spec/models/event_may_promote_change_spec.rb +46 -0
  121. data/spec/models/log_level_spec.rb +28 -0
  122. data/spec/models/openflex_resource_definition_layer_spec.rb +40 -0
  123. data/spec/models/openflex_resource_spec.rb +40 -0
  124. data/spec/models/openflex_volume_spec.rb +58 -0
  125. data/spec/models/satellite_config_log_spec.rb +52 -0
  126. data/spec/models/satellite_config_net_spec.rb +46 -0
  127. data/spec/models/satellite_config_spec.rb +70 -0
  128. data/spec/models/snapshot_node_spec.rb +58 -0
  129. data/spec/models/snapshot_shipping_spec.rb +52 -0
  130. data/spec/models/snapshot_shipping_status_spec.rb +56 -0
  131. data/spec/spec_helper.rb +2 -2
  132. metadata +77 -3
@@ -0,0 +1,11 @@
1
+ module LinstorClient
2
+ class OneOfDrbdVolumeLUKSVolumeStorageVolumeNVMEVolumeWritecacheVolume
3
+ def self.build_from_hash(attributes)
4
+ if attributes.key?(:drbd_volume_definition)
5
+ DrbdVolume.build_from_hash(attributes)
6
+ else
7
+ StorageVolume.build_from_hash(attributes)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,229 @@
1
+ =begin
2
+ #Linstor REST API
3
+
4
+ #Linstor REST API V1 The V1 rest api of Linstor should stay compatible and only additions are made to the API, If there are breaking changes or redesigned a new major REST API version will be issued. Server runs per default on port `3370` on `::` ipv6 and ipv4. To change the bind address or port you can use the following linstor client commands: ``` linstor controller set-property REST/bindAddress 127.0.0.1 linstor controller set-property REST/port 8080 ``` After setting this properties restart the controller and the new values should be used. Changelog: * 1.5.0 - Added etcd.prefix to ControllerConfigDbEtcd parameters * 1.4.0 - Added promotion_score and may_promote to DrbdResource object - Added /v1/error-reports DELETE method, to delete a range of error reports or single ones - Added SSE (Server Sent Events) url /v1/events/drbd/promotion * 1.3.0 - Added /v1/view/snapshot-shippings * 1.2.0 - Added optional AutoSelectFilter to resource-group/spawn - Added /v1/nodes/{node}/config, that allows you to get and set the satellite config - Added /v1/sos-report to create bug reports you can send to linbit - Added new fields to the ErrorReport object - Added /v1/resource-definitions/{resource}/snapshot-shipping - Allow to modify the resource group in Resource definitions - Added createTimestamp to Resource and Snapshot - Added default value (null) for AutoPlaceRequest's layer_list * 1.1.0 - Added /v1/view/snapshots for a faster all in one snapshot list - Filter lists by properties: - /v1/nodes - /v1/resource-definitions - /v1/resource-groups - /v1/view/storage-pools - /v1/view/resources * 1.0.16 - Added CacheResource and CacheVolume schemas - AutSelectFilter arrays are now null per default * 1.0.15 - Added connections map to the DRBD resource layer data - Added support for Openflex * 1.0.14 - Added /v1/controller/config, that gives you the controller config information * 1.0.13 - Fixed broken volume definition modify `flags` handling - Added flags to volume groups (create/modify) * 1.0.12 - Added WritecacheResource and WritecacheVolume schemas. - Removed support for swordfish - Added `with_storage_pool` to PhysicalStorageCreate post request, allowing to create linstor storage pools too - Added `gross` flag for volume-definition size - Added flags to VolumeDefinitionModify (so that `gross` flag can be changed) - Added query-max-volume-size to resource-groups * 1.0.11 - Added /v1/physical-storage endpoint, that lets you query and create lvm/zfs pools - Extended Node with list of supported providers and layers as well as lists of reasons for unsupported providers and layers * 1.0.10 - Added `reports` array field to Volume object, contains ApiCallRcs for problems - Changed `ResourceDefinitions` can now include `VolumeDefinitions` in `volume_definitions` field - Added various filter query parameters * 1.0.9 - Added supports_snapshots to StoragePool * 1.0.8 - Added /v1/resource-groups - Added /v1/resource-groups/{rscgrp}/volume-groups - Moved AutoSelectFilter::place_count default indirectly to create resource implementation - Added diskless_on_remaining to AutoSelectFilter - Changed /v1/view/resources return type to ResourceWithVolumes ResourceWithVolumes is now a child type of Resource (removed volumes from Resource) * 1.0.7 - Added ext_meta_stor_pool to DrbdVolume - Added is_active field to the NetInterface type * 1.0.6 - Added /v1/resource-definitions/{rscName}/resources/{nodeName}/volumes/{vlmnr} PUT * 1.0.5 - Added `reports` field to StoragePool object * 1.0.4 - Added /v1/view/storage-pools overview path - Added uuid fields for objects * 1.0.3 - Added /v1/view/resources overview path - documentation schema extraction * 1.0.2 - Added /v1/storage-pool-definitions object path - added NVME layer object type * 1.0.1 - Documentation review and updates - no functional changes * 1.0.0 - Initial REST API v1
5
+
6
+ The version of the OpenAPI document: 1.5.0
7
+ Contact: rene.peinthor@linbit.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LinstorClient
17
+ class OpenflexResource
18
+ attr_accessor :openflex_resource_definition
19
+
20
+ attr_accessor :openflex_volumes
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'openflex_resource_definition' => :'openflex_resource_definition',
26
+ :'openflex_volumes' => :'openflex_volumes'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'openflex_resource_definition' => :'OpenflexResourceDefinitionLayer',
39
+ :'openflex_volumes' => :'Array<OpenflexVolume>'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LinstorClient::OpenflexResource` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LinstorClient::OpenflexResource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'openflex_resource_definition')
65
+ self.openflex_resource_definition = attributes[:'openflex_resource_definition']
66
+ end
67
+
68
+ if attributes.key?(:'openflex_volumes')
69
+ if (value = attributes[:'openflex_volumes']).is_a?(Array)
70
+ self.openflex_volumes = value
71
+ end
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ openflex_resource_definition == o.openflex_resource_definition &&
94
+ openflex_volumes == o.openflex_volumes
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [openflex_resource_definition, openflex_volumes].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ new.build_from_hash(attributes)
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.openapi_types.each_pair do |key, type|
122
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
123
+ self.send("#{key}=", nil)
124
+ elsif type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :Time
145
+ Time.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :Boolean
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ # models (e.g. Pet) or oneOf
176
+ klass = LinstorClient.const_get(type)
177
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+
227
+ end
228
+
229
+ end
@@ -0,0 +1,227 @@
1
+ =begin
2
+ #Linstor REST API
3
+
4
+ #Linstor REST API V1 The V1 rest api of Linstor should stay compatible and only additions are made to the API, If there are breaking changes or redesigned a new major REST API version will be issued. Server runs per default on port `3370` on `::` ipv6 and ipv4. To change the bind address or port you can use the following linstor client commands: ``` linstor controller set-property REST/bindAddress 127.0.0.1 linstor controller set-property REST/port 8080 ``` After setting this properties restart the controller and the new values should be used. Changelog: * 1.5.0 - Added etcd.prefix to ControllerConfigDbEtcd parameters * 1.4.0 - Added promotion_score and may_promote to DrbdResource object - Added /v1/error-reports DELETE method, to delete a range of error reports or single ones - Added SSE (Server Sent Events) url /v1/events/drbd/promotion * 1.3.0 - Added /v1/view/snapshot-shippings * 1.2.0 - Added optional AutoSelectFilter to resource-group/spawn - Added /v1/nodes/{node}/config, that allows you to get and set the satellite config - Added /v1/sos-report to create bug reports you can send to linbit - Added new fields to the ErrorReport object - Added /v1/resource-definitions/{resource}/snapshot-shipping - Allow to modify the resource group in Resource definitions - Added createTimestamp to Resource and Snapshot - Added default value (null) for AutoPlaceRequest's layer_list * 1.1.0 - Added /v1/view/snapshots for a faster all in one snapshot list - Filter lists by properties: - /v1/nodes - /v1/resource-definitions - /v1/resource-groups - /v1/view/storage-pools - /v1/view/resources * 1.0.16 - Added CacheResource and CacheVolume schemas - AutSelectFilter arrays are now null per default * 1.0.15 - Added connections map to the DRBD resource layer data - Added support for Openflex * 1.0.14 - Added /v1/controller/config, that gives you the controller config information * 1.0.13 - Fixed broken volume definition modify `flags` handling - Added flags to volume groups (create/modify) * 1.0.12 - Added WritecacheResource and WritecacheVolume schemas. - Removed support for swordfish - Added `with_storage_pool` to PhysicalStorageCreate post request, allowing to create linstor storage pools too - Added `gross` flag for volume-definition size - Added flags to VolumeDefinitionModify (so that `gross` flag can be changed) - Added query-max-volume-size to resource-groups * 1.0.11 - Added /v1/physical-storage endpoint, that lets you query and create lvm/zfs pools - Extended Node with list of supported providers and layers as well as lists of reasons for unsupported providers and layers * 1.0.10 - Added `reports` array field to Volume object, contains ApiCallRcs for problems - Changed `ResourceDefinitions` can now include `VolumeDefinitions` in `volume_definitions` field - Added various filter query parameters * 1.0.9 - Added supports_snapshots to StoragePool * 1.0.8 - Added /v1/resource-groups - Added /v1/resource-groups/{rscgrp}/volume-groups - Moved AutoSelectFilter::place_count default indirectly to create resource implementation - Added diskless_on_remaining to AutoSelectFilter - Changed /v1/view/resources return type to ResourceWithVolumes ResourceWithVolumes is now a child type of Resource (removed volumes from Resource) * 1.0.7 - Added ext_meta_stor_pool to DrbdVolume - Added is_active field to the NetInterface type * 1.0.6 - Added /v1/resource-definitions/{rscName}/resources/{nodeName}/volumes/{vlmnr} PUT * 1.0.5 - Added `reports` field to StoragePool object * 1.0.4 - Added /v1/view/storage-pools overview path - Added uuid fields for objects * 1.0.3 - Added /v1/view/resources overview path - documentation schema extraction * 1.0.2 - Added /v1/storage-pool-definitions object path - added NVME layer object type * 1.0.1 - Documentation review and updates - no functional changes * 1.0.0 - Initial REST API v1
5
+
6
+ The version of the OpenAPI document: 1.5.0
7
+ Contact: rene.peinthor@linbit.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LinstorClient
17
+ class OpenflexResourceDefinitionLayer
18
+ attr_accessor :resource_name_suffix
19
+
20
+ attr_accessor :nqn
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'resource_name_suffix' => :'resource_name_suffix',
26
+ :'nqn' => :'nqn'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'resource_name_suffix' => :'String',
39
+ :'nqn' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LinstorClient::OpenflexResourceDefinitionLayer` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LinstorClient::OpenflexResourceDefinitionLayer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'resource_name_suffix')
65
+ self.resource_name_suffix = attributes[:'resource_name_suffix']
66
+ end
67
+
68
+ if attributes.key?(:'nqn')
69
+ self.nqn = attributes[:'nqn']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ resource_name_suffix == o.resource_name_suffix &&
92
+ nqn == o.nqn
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [resource_name_suffix, nqn].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
121
+ self.send("#{key}=", nil)
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :Time
143
+ Time.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ # models (e.g. Pet) or oneOf
174
+ klass = LinstorClient.const_get(type)
175
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+
227
+ end