pnap_network_storage_api 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -8
  3. data/VERSION +1 -1
  4. data/docs/StorageNetwork.md +2 -0
  5. data/docs/StorageNetworkCreate.md +3 -1
  6. data/docs/StorageNetworkVolumeCreate.md +3 -1
  7. data/docs/StorageNetworksApi.md +146 -76
  8. data/docs/TagAssignment.md +26 -0
  9. data/docs/TagAssignmentRequest.md +20 -0
  10. data/docs/Volume.md +5 -1
  11. data/docs/VolumeCreate.md +3 -1
  12. data/lib/pnap_network_storage_api/api/storage_networks_api.rb +187 -88
  13. data/lib/pnap_network_storage_api/api_client.rb +24 -21
  14. data/lib/pnap_network_storage_api/api_error.rb +2 -1
  15. data/lib/pnap_network_storage_api/configuration.rb +28 -9
  16. data/lib/pnap_network_storage_api/models/error.rb +16 -19
  17. data/lib/pnap_network_storage_api/models/nfs_permissions.rb +14 -19
  18. data/lib/pnap_network_storage_api/models/nfs_permissions_create.rb +14 -19
  19. data/lib/pnap_network_storage_api/models/nfs_permissions_update.rb +14 -19
  20. data/lib/pnap_network_storage_api/models/permissions.rb +14 -19
  21. data/lib/pnap_network_storage_api/models/permissions_create.rb +14 -19
  22. data/lib/pnap_network_storage_api/models/permissions_update.rb +14 -19
  23. data/lib/pnap_network_storage_api/models/status.rb +8 -4
  24. data/lib/pnap_network_storage_api/models/storage_network.rb +47 -20
  25. data/lib/pnap_network_storage_api/models/storage_network_create.rb +78 -24
  26. data/lib/pnap_network_storage_api/models/storage_network_update.rb +36 -22
  27. data/lib/pnap_network_storage_api/models/storage_network_volume_create.rb +57 -27
  28. data/lib/pnap_network_storage_api/models/tag_assignment.rb +311 -0
  29. data/lib/pnap_network_storage_api/models/tag_assignment_request.rb +233 -0
  30. data/lib/pnap_network_storage_api/models/volume.rb +62 -23
  31. data/lib/pnap_network_storage_api/models/volume_create.rb +57 -27
  32. data/lib/pnap_network_storage_api/models/volume_update.rb +48 -26
  33. data/lib/pnap_network_storage_api/version.rb +1 -1
  34. data/lib/pnap_network_storage_api.rb +3 -1
  35. data/pnap_network_storage_api.gemspec +2 -2
  36. data/spec/api/storage_networks_api_spec.rb +70 -15
  37. data/spec/models/error_spec.rb +6 -4
  38. data/spec/models/nfs_permissions_create_spec.rb +9 -7
  39. data/spec/models/nfs_permissions_spec.rb +9 -7
  40. data/spec/models/nfs_permissions_update_spec.rb +9 -7
  41. data/spec/models/permissions_create_spec.rb +5 -3
  42. data/spec/models/permissions_spec.rb +5 -3
  43. data/spec/models/permissions_update_spec.rb +5 -3
  44. data/spec/models/status_spec.rb +4 -2
  45. data/spec/models/storage_network_create_spec.rb +14 -6
  46. data/spec/models/storage_network_spec.rb +19 -11
  47. data/spec/models/storage_network_update_spec.rb +6 -4
  48. data/spec/models/storage_network_volume_create_spec.rb +14 -6
  49. data/spec/models/tag_assignment_request_spec.rb +42 -0
  50. data/spec/models/tag_assignment_spec.rb +64 -0
  51. data/spec/models/volume_create_spec.rb +20 -6
  52. data/spec/models/volume_spec.rb +32 -12
  53. data/spec/models/volume_update_spec.rb +29 -3
  54. data/spec/spec_helper.rb +1 -1
  55. metadata +20 -16
  56. data/spec/api_client_spec.rb +0 -226
  57. data/spec/configuration_spec.rb +0 -42
@@ -0,0 +1,233 @@
1
+ =begin
2
+ #Network Storage API
3
+
4
+ #Create, list, edit, and delete storage networks with the Network Storage API. Use storage networks to expand storage capacity on a private network. <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/bare-metal-cloud-storage' target='_blank'>here</a> </span> <br> <b>All URLs are relative to (https://api.phoenixnap.com/network-storage/v1/)</b>
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module NetworkStorageApi
17
+ # Tag request to assign to resource.
18
+ class TagAssignmentRequest
19
+ # The name of the tag. Tag names are case-sensitive, and should be composed of a maximum of 100 characters including UTF-8 Unicode letters, numbers, and the following symbols: '-', '_'. Regex: [A-zÀ-ú0-9_-]{1,100}.
20
+ attr_accessor :name
21
+
22
+ # The value of the tag assigned to the resource. Tag values are case-sensitive, and should be composed of a maximum of 100 characters including UTF-8 Unicode letters, numbers, and the following symbols: '-', '_'. Regex: [A-zÀ-ú0-9_-]{1,100}.
23
+ attr_accessor :value
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'name' => :'name',
29
+ :'value' => :'value'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'name' => :'String',
42
+ :'value' => :'String'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `NetworkStorageApi::TagAssignmentRequest` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::TagAssignmentRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'name')
68
+ self.name = attributes[:'name']
69
+ else
70
+ self.name = nil
71
+ end
72
+
73
+ if attributes.key?(:'value')
74
+ self.value = attributes[:'value']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
82
+ invalid_properties = Array.new
83
+ if @name.nil?
84
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
85
+ end
86
+
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
94
+ return false if @name.nil?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ name == o.name &&
104
+ value == o.value
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [name, value].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ attributes = attributes.transform_keys(&:to_sym)
125
+ transformed_hash = {}
126
+ openapi_types.each_pair do |key, type|
127
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = nil
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[attribute_map[key]].is_a?(Array)
133
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
134
+ end
135
+ elsif !attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
137
+ end
138
+ end
139
+ new(transformed_hash)
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def self._deserialize(type, value)
147
+ case type.to_sym
148
+ when :Time
149
+ Time.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :Boolean
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ # models (e.g. Pet) or oneOf
180
+ klass = NetworkStorageApi.const_get(type)
181
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ if value.nil?
204
+ is_nullable = self.class.openapi_nullable.include?(attr)
205
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
206
+ end
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map { |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end
230
+
231
+ end
232
+
233
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -44,8 +44,36 @@ module NetworkStorageApi
44
44
 
45
45
  attr_accessor :created_on
46
46
 
47
+ # Date and time of the initial request for volume deletion.
48
+ attr_accessor :delete_requested_on
49
+
47
50
  attr_accessor :permissions
48
51
 
52
+ # The tags assigned if any.
53
+ attr_accessor :tags
54
+
55
+ class EnumAttributeValidator
56
+ attr_reader :datatype
57
+ attr_reader :allowable_values
58
+
59
+ def initialize(datatype, allowable_values)
60
+ @allowable_values = allowable_values.map do |value|
61
+ case datatype.to_s
62
+ when /Integer/i
63
+ value.to_i
64
+ when /Float/i
65
+ value.to_f
66
+ else
67
+ value
68
+ end
69
+ end
70
+ end
71
+
72
+ def valid?(value)
73
+ !value || allowable_values.include?(value)
74
+ end
75
+ end
76
+
49
77
  # Attribute mapping from ruby-style variable name to JSON key.
50
78
  def self.attribute_map
51
79
  {
@@ -59,7 +87,9 @@ module NetworkStorageApi
59
87
  :'protocol' => :'protocol',
60
88
  :'status' => :'status',
61
89
  :'created_on' => :'createdOn',
62
- :'permissions' => :'permissions'
90
+ :'delete_requested_on' => :'deleteRequestedOn',
91
+ :'permissions' => :'permissions',
92
+ :'tags' => :'tags'
63
93
  }
64
94
  end
65
95
 
@@ -81,7 +111,9 @@ module NetworkStorageApi
81
111
  :'protocol' => :'String',
82
112
  :'status' => :'Status',
83
113
  :'created_on' => :'Time',
84
- :'permissions' => :'Permissions'
114
+ :'delete_requested_on' => :'Time',
115
+ :'permissions' => :'Permissions',
116
+ :'tags' => :'Array<TagAssignment>'
85
117
  }
86
118
  end
87
119
 
@@ -146,14 +178,25 @@ module NetworkStorageApi
146
178
  self.created_on = attributes[:'created_on']
147
179
  end
148
180
 
181
+ if attributes.key?(:'delete_requested_on')
182
+ self.delete_requested_on = attributes[:'delete_requested_on']
183
+ end
184
+
149
185
  if attributes.key?(:'permissions')
150
186
  self.permissions = attributes[:'permissions']
151
187
  end
188
+
189
+ if attributes.key?(:'tags')
190
+ if (value = attributes[:'tags']).is_a?(Array)
191
+ self.tags = value
192
+ end
193
+ end
152
194
  end
153
195
 
154
196
  # Show invalid properties with the reasons. Usually used together with valid?
155
197
  # @return Array for valid properties with the reasons
156
198
  def list_invalid_properties
199
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
157
200
  invalid_properties = Array.new
158
201
  invalid_properties
159
202
  end
@@ -161,6 +204,7 @@ module NetworkStorageApi
161
204
  # Check to see if the all the properties in the model are valid
162
205
  # @return true if the model is valid
163
206
  def valid?
207
+ warn '[DEPRECATED] the `valid?` method is obsolete'
164
208
  true
165
209
  end
166
210
 
@@ -179,7 +223,9 @@ module NetworkStorageApi
179
223
  protocol == o.protocol &&
180
224
  status == o.status &&
181
225
  created_on == o.created_on &&
182
- permissions == o.permissions
226
+ delete_requested_on == o.delete_requested_on &&
227
+ permissions == o.permissions &&
228
+ tags == o.tags
183
229
  end
184
230
 
185
231
  # @see the `==` method
@@ -191,44 +237,37 @@ module NetworkStorageApi
191
237
  # Calculates hash code according to all attributes.
192
238
  # @return [Integer] Hash code
193
239
  def hash
194
- [id, name, description, path, path_suffix, capacity_in_gb, used_capacity_in_gb, protocol, status, created_on, permissions].hash
240
+ [id, name, description, path, path_suffix, capacity_in_gb, used_capacity_in_gb, protocol, status, created_on, delete_requested_on, permissions, tags].hash
195
241
  end
196
242
 
197
243
  # Builds the object from hash
198
244
  # @param [Hash] attributes Model attributes in the form of hash
199
245
  # @return [Object] Returns the model itself
200
246
  def self.build_from_hash(attributes)
201
- new.build_from_hash(attributes)
202
- end
203
-
204
- # Builds the object from hash
205
- # @param [Hash] attributes Model attributes in the form of hash
206
- # @return [Object] Returns the model itself
207
- def build_from_hash(attributes)
208
247
  return nil unless attributes.is_a?(Hash)
209
248
  attributes = attributes.transform_keys(&:to_sym)
210
- self.class.openapi_types.each_pair do |key, type|
211
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
212
- self.send("#{key}=", nil)
249
+ transformed_hash = {}
250
+ openapi_types.each_pair do |key, type|
251
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
252
+ transformed_hash["#{key}"] = nil
213
253
  elsif type =~ /\AArray<(.*)>/i
214
254
  # check to ensure the input is an array given that the attribute
215
255
  # is documented as an array but the input is not
216
- if attributes[self.class.attribute_map[key]].is_a?(Array)
217
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
256
+ if attributes[attribute_map[key]].is_a?(Array)
257
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
218
258
  end
219
- elsif !attributes[self.class.attribute_map[key]].nil?
220
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
259
+ elsif !attributes[attribute_map[key]].nil?
260
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
221
261
  end
222
262
  end
223
-
224
- self
263
+ new(transformed_hash)
225
264
  end
226
265
 
227
266
  # Deserializes the data based on type
228
267
  # @param string type Data type
229
268
  # @param string value Value to be deserialized
230
269
  # @return [Object] Deserialized data
231
- def _deserialize(type, value)
270
+ def self._deserialize(type, value)
232
271
  case type.to_sym
233
272
  when :Time
234
273
  Time.parse(value)
@@ -263,7 +302,7 @@ module NetworkStorageApi
263
302
  else # model
264
303
  # models (e.g. Pet) or oneOf
265
304
  klass = NetworkStorageApi.const_get(type)
266
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
305
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
267
306
  end
268
307
  end
269
308
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0
9
+ OpenAPI Generator version: 7.2.0
10
10
 
11
11
  =end
12
12
 
@@ -30,6 +30,9 @@ module NetworkStorageApi
30
30
 
31
31
  attr_accessor :permissions
32
32
 
33
+ # Tags to set to the resource. To create a new tag or list all the existing tags that you can use, refer to [Tags API](https://developers.phoenixnap.com/docs/tags/1/overview).
34
+ attr_accessor :tags
35
+
33
36
  # Attribute mapping from ruby-style variable name to JSON key.
34
37
  def self.attribute_map
35
38
  {
@@ -37,7 +40,8 @@ module NetworkStorageApi
37
40
  :'description' => :'description',
38
41
  :'path_suffix' => :'pathSuffix',
39
42
  :'capacity_in_gb' => :'capacityInGb',
40
- :'permissions' => :'permissions'
43
+ :'permissions' => :'permissions',
44
+ :'tags' => :'tags'
41
45
  }
42
46
  end
43
47
 
@@ -53,7 +57,8 @@ module NetworkStorageApi
53
57
  :'description' => :'String',
54
58
  :'path_suffix' => :'String',
55
59
  :'capacity_in_gb' => :'Integer',
56
- :'permissions' => :'PermissionsCreate'
60
+ :'permissions' => :'PermissionsCreate',
61
+ :'tags' => :'Array<TagAssignmentRequest>'
57
62
  }
58
63
  end
59
64
 
@@ -80,6 +85,8 @@ module NetworkStorageApi
80
85
 
81
86
  if attributes.key?(:'name')
82
87
  self.name = attributes[:'name']
88
+ else
89
+ self.name = nil
83
90
  end
84
91
 
85
92
  if attributes.key?(:'description')
@@ -92,16 +99,25 @@ module NetworkStorageApi
92
99
 
93
100
  if attributes.key?(:'capacity_in_gb')
94
101
  self.capacity_in_gb = attributes[:'capacity_in_gb']
102
+ else
103
+ self.capacity_in_gb = nil
95
104
  end
96
105
 
97
106
  if attributes.key?(:'permissions')
98
107
  self.permissions = attributes[:'permissions']
99
108
  end
109
+
110
+ if attributes.key?(:'tags')
111
+ if (value = attributes[:'tags']).is_a?(Array)
112
+ self.tags = value
113
+ end
114
+ end
100
115
  end
101
116
 
102
117
  # Show invalid properties with the reasons. Usually used together with valid?
103
118
  # @return Array for valid properties with the reasons
104
119
  def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
105
121
  invalid_properties = Array.new
106
122
  if @name.nil?
107
123
  invalid_properties.push('invalid value for "name", name cannot be nil.')
@@ -115,6 +131,11 @@ module NetworkStorageApi
115
131
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
116
132
  end
117
133
 
134
+ pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
135
+ if @name !~ pattern
136
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
137
+ end
138
+
118
139
  if !@description.nil? && @description.to_s.length > 250
119
140
  invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
120
141
  end
@@ -146,9 +167,11 @@ module NetworkStorageApi
146
167
  # Check to see if the all the properties in the model are valid
147
168
  # @return true if the model is valid
148
169
  def valid?
170
+ warn '[DEPRECATED] the `valid?` method is obsolete'
149
171
  return false if @name.nil?
150
172
  return false if @name.to_s.length > 100
151
173
  return false if @name.to_s.length < 1
174
+ return false if @name !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
152
175
  return false if !@description.nil? && @description.to_s.length > 250
153
176
  return false if !@path_suffix.nil? && @path_suffix.to_s.length > 27
154
177
  return false if !@path_suffix.nil? && @path_suffix.to_s.length < 0
@@ -173,13 +196,22 @@ module NetworkStorageApi
173
196
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
174
197
  end
175
198
 
199
+ pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
200
+ if name !~ pattern
201
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
202
+ end
203
+
176
204
  @name = name
177
205
  end
178
206
 
179
207
  # Custom attribute writer method with validation
180
208
  # @param [Object] description Value to be assigned
181
209
  def description=(description)
182
- if !description.nil? && description.to_s.length > 250
210
+ if description.nil?
211
+ fail ArgumentError, 'description cannot be nil'
212
+ end
213
+
214
+ if description.to_s.length > 250
183
215
  fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
184
216
  end
185
217
 
@@ -189,16 +221,20 @@ module NetworkStorageApi
189
221
  # Custom attribute writer method with validation
190
222
  # @param [Object] path_suffix Value to be assigned
191
223
  def path_suffix=(path_suffix)
192
- if !path_suffix.nil? && path_suffix.to_s.length > 27
224
+ if path_suffix.nil?
225
+ fail ArgumentError, 'path_suffix cannot be nil'
226
+ end
227
+
228
+ if path_suffix.to_s.length > 27
193
229
  fail ArgumentError, 'invalid value for "path_suffix", the character length must be smaller than or equal to 27.'
194
230
  end
195
231
 
196
- if !path_suffix.nil? && path_suffix.to_s.length < 0
232
+ if path_suffix.to_s.length < 0
197
233
  fail ArgumentError, 'invalid value for "path_suffix", the character length must be great than or equal to 0.'
198
234
  end
199
235
 
200
236
  pattern = Regexp.new(/^(\/[\w-]+)+$|^$/)
201
- if !path_suffix.nil? && path_suffix !~ pattern
237
+ if path_suffix !~ pattern
202
238
  fail ArgumentError, "invalid value for \"path_suffix\", must conform to the pattern #{pattern}."
203
239
  end
204
240
 
@@ -228,7 +264,8 @@ module NetworkStorageApi
228
264
  description == o.description &&
229
265
  path_suffix == o.path_suffix &&
230
266
  capacity_in_gb == o.capacity_in_gb &&
231
- permissions == o.permissions
267
+ permissions == o.permissions &&
268
+ tags == o.tags
232
269
  end
233
270
 
234
271
  # @see the `==` method
@@ -240,44 +277,37 @@ module NetworkStorageApi
240
277
  # Calculates hash code according to all attributes.
241
278
  # @return [Integer] Hash code
242
279
  def hash
243
- [name, description, path_suffix, capacity_in_gb, permissions].hash
280
+ [name, description, path_suffix, capacity_in_gb, permissions, tags].hash
244
281
  end
245
282
 
246
283
  # Builds the object from hash
247
284
  # @param [Hash] attributes Model attributes in the form of hash
248
285
  # @return [Object] Returns the model itself
249
286
  def self.build_from_hash(attributes)
250
- new.build_from_hash(attributes)
251
- end
252
-
253
- # Builds the object from hash
254
- # @param [Hash] attributes Model attributes in the form of hash
255
- # @return [Object] Returns the model itself
256
- def build_from_hash(attributes)
257
287
  return nil unless attributes.is_a?(Hash)
258
288
  attributes = attributes.transform_keys(&:to_sym)
259
- self.class.openapi_types.each_pair do |key, type|
260
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
261
- self.send("#{key}=", nil)
289
+ transformed_hash = {}
290
+ openapi_types.each_pair do |key, type|
291
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
292
+ transformed_hash["#{key}"] = nil
262
293
  elsif type =~ /\AArray<(.*)>/i
263
294
  # check to ensure the input is an array given that the attribute
264
295
  # is documented as an array but the input is not
265
- if attributes[self.class.attribute_map[key]].is_a?(Array)
266
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
296
+ if attributes[attribute_map[key]].is_a?(Array)
297
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
267
298
  end
268
- elsif !attributes[self.class.attribute_map[key]].nil?
269
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
299
+ elsif !attributes[attribute_map[key]].nil?
300
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
270
301
  end
271
302
  end
272
-
273
- self
303
+ new(transformed_hash)
274
304
  end
275
305
 
276
306
  # Deserializes the data based on type
277
307
  # @param string type Data type
278
308
  # @param string value Value to be deserialized
279
309
  # @return [Object] Deserialized data
280
- def _deserialize(type, value)
310
+ def self._deserialize(type, value)
281
311
  case type.to_sym
282
312
  when :Time
283
313
  Time.parse(value)
@@ -312,7 +342,7 @@ module NetworkStorageApi
312
342
  else # model
313
343
  # models (e.g. Pet) or oneOf
314
344
  klass = NetworkStorageApi.const_get(type)
315
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
345
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
316
346
  end
317
347
  end
318
348