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
@@ -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
 
@@ -66,6 +66,7 @@ module NetworkStorageApi
66
66
  # Show invalid properties with the reasons. Usually used together with valid?
67
67
  # @return Array for valid properties with the reasons
68
68
  def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
69
70
  invalid_properties = Array.new
70
71
  invalid_properties
71
72
  end
@@ -73,6 +74,7 @@ module NetworkStorageApi
73
74
  # Check to see if the all the properties in the model are valid
74
75
  # @return true if the model is valid
75
76
  def valid?
77
+ warn '[DEPRECATED] the `valid?` method is obsolete'
76
78
  true
77
79
  end
78
80
 
@@ -100,37 +102,30 @@ module NetworkStorageApi
100
102
  # @param [Hash] attributes Model attributes in the form of hash
101
103
  # @return [Object] Returns the model itself
102
104
  def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
105
  return nil unless attributes.is_a?(Hash)
111
106
  attributes = attributes.transform_keys(&:to_sym)
112
- self.class.openapi_types.each_pair do |key, type|
113
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
- self.send("#{key}=", nil)
107
+ transformed_hash = {}
108
+ openapi_types.each_pair do |key, type|
109
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
110
+ transformed_hash["#{key}"] = nil
115
111
  elsif type =~ /\AArray<(.*)>/i
116
112
  # check to ensure the input is an array given that the attribute
117
113
  # is documented as an array but the input is not
118
- if attributes[self.class.attribute_map[key]].is_a?(Array)
119
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ if attributes[attribute_map[key]].is_a?(Array)
115
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
120
116
  end
121
- elsif !attributes[self.class.attribute_map[key]].nil?
122
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
123
119
  end
124
120
  end
125
-
126
- self
121
+ new(transformed_hash)
127
122
  end
128
123
 
129
124
  # Deserializes the data based on type
130
125
  # @param string type Data type
131
126
  # @param string value Value to be deserialized
132
127
  # @return [Object] Deserialized data
133
- def _deserialize(type, value)
128
+ def self._deserialize(type, value)
134
129
  case type.to_sym
135
130
  when :Time
136
131
  Time.parse(value)
@@ -165,7 +160,7 @@ module NetworkStorageApi
165
160
  else # model
166
161
  # models (e.g. Pet) or oneOf
167
162
  klass = NetworkStorageApi.const_get(type)
168
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
164
  end
170
165
  end
171
166
 
@@ -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
 
@@ -17,8 +17,13 @@ module NetworkStorageApi
17
17
  class Status
18
18
  READY = "READY".freeze
19
19
  BUSY = "BUSY".freeze
20
+ DELETING = "DELETING".freeze
20
21
  ERROR = "ERROR".freeze
21
22
 
23
+ def self.all_vars
24
+ @all_vars ||= [READY, BUSY, DELETING, ERROR].freeze
25
+ end
26
+
22
27
  # Builds the enum from string
23
28
  # @param [String] The enum value in the form of the string
24
29
  # @return [String] The enum value
@@ -30,9 +35,8 @@ module NetworkStorageApi
30
35
  # @param [String] The enum value in the form of the string
31
36
  # @return [String] The enum value
32
37
  def build_from_hash(value)
33
- constantValues = Status.constants.select { |c| Status::const_get(c) == value }
34
- raise "Invalid ENUM value #{value} for class #Status" if constantValues.empty?
35
- value
38
+ return value if Status.all_vars.include?(value)
39
+ raise "Invalid ENUM value #{value} for class #Status"
36
40
  end
37
41
  end
38
42
  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
 
@@ -39,9 +39,34 @@ module NetworkStorageApi
39
39
  # Date and time when this storage network was created.
40
40
  attr_accessor :created_on
41
41
 
42
+ # Date and time of the initial request for storage network deletion.
43
+ attr_accessor :delete_requested_on
44
+
42
45
  # Volume for a storage network.
43
46
  attr_accessor :volumes
44
47
 
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
45
70
  # Attribute mapping from ruby-style variable name to JSON key.
46
71
  def self.attribute_map
47
72
  {
@@ -53,6 +78,7 @@ module NetworkStorageApi
53
78
  :'network_id' => :'networkId',
54
79
  :'ips' => :'ips',
55
80
  :'created_on' => :'createdOn',
81
+ :'delete_requested_on' => :'deleteRequestedOn',
56
82
  :'volumes' => :'volumes'
57
83
  }
58
84
  end
@@ -73,6 +99,7 @@ module NetworkStorageApi
73
99
  :'network_id' => :'String',
74
100
  :'ips' => :'Array<String>',
75
101
  :'created_on' => :'Time',
102
+ :'delete_requested_on' => :'Time',
76
103
  :'volumes' => :'Array<Volume>'
77
104
  }
78
105
  end
@@ -132,6 +159,10 @@ module NetworkStorageApi
132
159
  self.created_on = attributes[:'created_on']
133
160
  end
134
161
 
162
+ if attributes.key?(:'delete_requested_on')
163
+ self.delete_requested_on = attributes[:'delete_requested_on']
164
+ end
165
+
135
166
  if attributes.key?(:'volumes')
136
167
  if (value = attributes[:'volumes']).is_a?(Array)
137
168
  self.volumes = value
@@ -142,6 +173,7 @@ module NetworkStorageApi
142
173
  # Show invalid properties with the reasons. Usually used together with valid?
143
174
  # @return Array for valid properties with the reasons
144
175
  def list_invalid_properties
176
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
145
177
  invalid_properties = Array.new
146
178
  invalid_properties
147
179
  end
@@ -149,6 +181,7 @@ module NetworkStorageApi
149
181
  # Check to see if the all the properties in the model are valid
150
182
  # @return true if the model is valid
151
183
  def valid?
184
+ warn '[DEPRECATED] the `valid?` method is obsolete'
152
185
  true
153
186
  end
154
187
 
@@ -165,6 +198,7 @@ module NetworkStorageApi
165
198
  network_id == o.network_id &&
166
199
  ips == o.ips &&
167
200
  created_on == o.created_on &&
201
+ delete_requested_on == o.delete_requested_on &&
168
202
  volumes == o.volumes
169
203
  end
170
204
 
@@ -177,44 +211,37 @@ module NetworkStorageApi
177
211
  # Calculates hash code according to all attributes.
178
212
  # @return [Integer] Hash code
179
213
  def hash
180
- [id, name, description, status, location, network_id, ips, created_on, volumes].hash
214
+ [id, name, description, status, location, network_id, ips, created_on, delete_requested_on, volumes].hash
181
215
  end
182
216
 
183
217
  # Builds the object from hash
184
218
  # @param [Hash] attributes Model attributes in the form of hash
185
219
  # @return [Object] Returns the model itself
186
220
  def self.build_from_hash(attributes)
187
- new.build_from_hash(attributes)
188
- end
189
-
190
- # Builds the object from hash
191
- # @param [Hash] attributes Model attributes in the form of hash
192
- # @return [Object] Returns the model itself
193
- def build_from_hash(attributes)
194
221
  return nil unless attributes.is_a?(Hash)
195
222
  attributes = attributes.transform_keys(&:to_sym)
196
- self.class.openapi_types.each_pair do |key, type|
197
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
198
- self.send("#{key}=", nil)
223
+ transformed_hash = {}
224
+ openapi_types.each_pair do |key, type|
225
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
226
+ transformed_hash["#{key}"] = nil
199
227
  elsif type =~ /\AArray<(.*)>/i
200
228
  # check to ensure the input is an array given that the attribute
201
229
  # is documented as an array but the input is not
202
- if attributes[self.class.attribute_map[key]].is_a?(Array)
203
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
230
+ if attributes[attribute_map[key]].is_a?(Array)
231
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
204
232
  end
205
- elsif !attributes[self.class.attribute_map[key]].nil?
206
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
233
+ elsif !attributes[attribute_map[key]].nil?
234
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
207
235
  end
208
236
  end
209
-
210
- self
237
+ new(transformed_hash)
211
238
  end
212
239
 
213
240
  # Deserializes the data based on type
214
241
  # @param string type Data type
215
242
  # @param string value Value to be deserialized
216
243
  # @return [Object] Deserialized data
217
- def _deserialize(type, value)
244
+ def self._deserialize(type, value)
218
245
  case type.to_sym
219
246
  when :Time
220
247
  Time.parse(value)
@@ -249,7 +276,7 @@ module NetworkStorageApi
249
276
  else # model
250
277
  # models (e.g. Pet) or oneOf
251
278
  klass = NetworkStorageApi.const_get(type)
252
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
279
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
253
280
  end
254
281
  end
255
282
 
@@ -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
 
@@ -28,13 +28,17 @@ module NetworkStorageApi
28
28
  # Volume to be created alongside storage. Currently only 1 volume is supported.
29
29
  attr_accessor :volumes
30
30
 
31
+ # Custom Client VLAN that the Storage Network will be set to.
32
+ attr_accessor :client_vlan
33
+
31
34
  # Attribute mapping from ruby-style variable name to JSON key.
32
35
  def self.attribute_map
33
36
  {
34
37
  :'name' => :'name',
35
38
  :'description' => :'description',
36
39
  :'location' => :'location',
37
- :'volumes' => :'volumes'
40
+ :'volumes' => :'volumes',
41
+ :'client_vlan' => :'clientVlan'
38
42
  }
39
43
  end
40
44
 
@@ -49,7 +53,8 @@ module NetworkStorageApi
49
53
  :'name' => :'String',
50
54
  :'description' => :'String',
51
55
  :'location' => :'String',
52
- :'volumes' => :'Array<StorageNetworkVolumeCreate>'
56
+ :'volumes' => :'Array<StorageNetworkVolumeCreate>',
57
+ :'client_vlan' => :'Integer'
53
58
  }
54
59
  end
55
60
 
@@ -76,6 +81,8 @@ module NetworkStorageApi
76
81
 
77
82
  if attributes.key?(:'name')
78
83
  self.name = attributes[:'name']
84
+ else
85
+ self.name = nil
79
86
  end
80
87
 
81
88
  if attributes.key?(:'description')
@@ -84,18 +91,27 @@ module NetworkStorageApi
84
91
 
85
92
  if attributes.key?(:'location')
86
93
  self.location = attributes[:'location']
94
+ else
95
+ self.location = nil
87
96
  end
88
97
 
89
98
  if attributes.key?(:'volumes')
90
99
  if (value = attributes[:'volumes']).is_a?(Array)
91
100
  self.volumes = value
92
101
  end
102
+ else
103
+ self.volumes = nil
104
+ end
105
+
106
+ if attributes.key?(:'client_vlan')
107
+ self.client_vlan = attributes[:'client_vlan']
93
108
  end
94
109
  end
95
110
 
96
111
  # Show invalid properties with the reasons. Usually used together with valid?
97
112
  # @return Array for valid properties with the reasons
98
113
  def list_invalid_properties
114
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
115
  invalid_properties = Array.new
100
116
  if @name.nil?
101
117
  invalid_properties.push('invalid value for "name", name cannot be nil.')
@@ -109,6 +125,11 @@ module NetworkStorageApi
109
125
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
110
126
  end
111
127
 
128
+ pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
129
+ if @name !~ pattern
130
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
131
+ end
132
+
112
133
  if !@description.nil? && @description.to_s.length > 250
113
134
  invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
114
135
  end
@@ -129,20 +150,32 @@ module NetworkStorageApi
129
150
  invalid_properties.push('invalid value for "volumes", number of items must be greater than or equal to 1.')
130
151
  end
131
152
 
153
+ if !@client_vlan.nil? && @client_vlan > 4094
154
+ invalid_properties.push('invalid value for "client_vlan", must be smaller than or equal to 4094.')
155
+ end
156
+
157
+ if !@client_vlan.nil? && @client_vlan < 2
158
+ invalid_properties.push('invalid value for "client_vlan", must be greater than or equal to 2.')
159
+ end
160
+
132
161
  invalid_properties
133
162
  end
134
163
 
135
164
  # Check to see if the all the properties in the model are valid
136
165
  # @return true if the model is valid
137
166
  def valid?
167
+ warn '[DEPRECATED] the `valid?` method is obsolete'
138
168
  return false if @name.nil?
139
169
  return false if @name.to_s.length > 100
140
170
  return false if @name.to_s.length < 1
171
+ return false if @name !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
141
172
  return false if !@description.nil? && @description.to_s.length > 250
142
173
  return false if @location.nil?
143
174
  return false if @volumes.nil?
144
175
  return false if @volumes.length > 1
145
176
  return false if @volumes.length < 1
177
+ return false if !@client_vlan.nil? && @client_vlan > 4094
178
+ return false if !@client_vlan.nil? && @client_vlan < 2
146
179
  true
147
180
  end
148
181
 
@@ -161,13 +194,22 @@ module NetworkStorageApi
161
194
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
162
195
  end
163
196
 
197
+ pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
198
+ if name !~ pattern
199
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
200
+ end
201
+
164
202
  @name = name
165
203
  end
166
204
 
167
205
  # Custom attribute writer method with validation
168
206
  # @param [Object] description Value to be assigned
169
207
  def description=(description)
170
- if !description.nil? && description.to_s.length > 250
208
+ if description.nil?
209
+ fail ArgumentError, 'description cannot be nil'
210
+ end
211
+
212
+ if description.to_s.length > 250
171
213
  fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
172
214
  end
173
215
 
@@ -192,6 +234,24 @@ module NetworkStorageApi
192
234
  @volumes = volumes
193
235
  end
194
236
 
237
+ # Custom attribute writer method with validation
238
+ # @param [Object] client_vlan Value to be assigned
239
+ def client_vlan=(client_vlan)
240
+ if client_vlan.nil?
241
+ fail ArgumentError, 'client_vlan cannot be nil'
242
+ end
243
+
244
+ if client_vlan > 4094
245
+ fail ArgumentError, 'invalid value for "client_vlan", must be smaller than or equal to 4094.'
246
+ end
247
+
248
+ if client_vlan < 2
249
+ fail ArgumentError, 'invalid value for "client_vlan", must be greater than or equal to 2.'
250
+ end
251
+
252
+ @client_vlan = client_vlan
253
+ end
254
+
195
255
  # Checks equality by comparing each attribute.
196
256
  # @param [Object] Object to be compared
197
257
  def ==(o)
@@ -200,7 +260,8 @@ module NetworkStorageApi
200
260
  name == o.name &&
201
261
  description == o.description &&
202
262
  location == o.location &&
203
- volumes == o.volumes
263
+ volumes == o.volumes &&
264
+ client_vlan == o.client_vlan
204
265
  end
205
266
 
206
267
  # @see the `==` method
@@ -212,44 +273,37 @@ module NetworkStorageApi
212
273
  # Calculates hash code according to all attributes.
213
274
  # @return [Integer] Hash code
214
275
  def hash
215
- [name, description, location, volumes].hash
276
+ [name, description, location, volumes, client_vlan].hash
216
277
  end
217
278
 
218
279
  # Builds the object from hash
219
280
  # @param [Hash] attributes Model attributes in the form of hash
220
281
  # @return [Object] Returns the model itself
221
282
  def self.build_from_hash(attributes)
222
- new.build_from_hash(attributes)
223
- end
224
-
225
- # Builds the object from hash
226
- # @param [Hash] attributes Model attributes in the form of hash
227
- # @return [Object] Returns the model itself
228
- def build_from_hash(attributes)
229
283
  return nil unless attributes.is_a?(Hash)
230
284
  attributes = attributes.transform_keys(&:to_sym)
231
- self.class.openapi_types.each_pair do |key, type|
232
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
233
- self.send("#{key}=", nil)
285
+ transformed_hash = {}
286
+ openapi_types.each_pair do |key, type|
287
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
288
+ transformed_hash["#{key}"] = nil
234
289
  elsif type =~ /\AArray<(.*)>/i
235
290
  # check to ensure the input is an array given that the attribute
236
291
  # is documented as an array but the input is not
237
- if attributes[self.class.attribute_map[key]].is_a?(Array)
238
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
292
+ if attributes[attribute_map[key]].is_a?(Array)
293
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
239
294
  end
240
- elsif !attributes[self.class.attribute_map[key]].nil?
241
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
295
+ elsif !attributes[attribute_map[key]].nil?
296
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
242
297
  end
243
298
  end
244
-
245
- self
299
+ new(transformed_hash)
246
300
  end
247
301
 
248
302
  # Deserializes the data based on type
249
303
  # @param string type Data type
250
304
  # @param string value Value to be deserialized
251
305
  # @return [Object] Deserialized data
252
- def _deserialize(type, value)
306
+ def self._deserialize(type, value)
253
307
  case type.to_sym
254
308
  when :Time
255
309
  Time.parse(value)
@@ -284,7 +338,7 @@ module NetworkStorageApi
284
338
  else # model
285
339
  # models (e.g. Pet) or oneOf
286
340
  klass = NetworkStorageApi.const_get(type)
287
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
341
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
288
342
  end
289
343
  end
290
344
 
@@ -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
 
@@ -76,6 +76,7 @@ module NetworkStorageApi
76
76
  # Show invalid properties with the reasons. Usually used together with valid?
77
77
  # @return Array for valid properties with the reasons
78
78
  def list_invalid_properties
79
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
80
  invalid_properties = Array.new
80
81
  if !@name.nil? && @name.to_s.length > 100
81
82
  invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
@@ -85,6 +86,11 @@ module NetworkStorageApi
85
86
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
86
87
  end
87
88
 
89
+ pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
90
+ if !@name.nil? && @name !~ pattern
91
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
92
+ end
93
+
88
94
  if !@description.nil? && @description.to_s.length > 250
89
95
  invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
90
96
  end
@@ -95,8 +101,10 @@ module NetworkStorageApi
95
101
  # Check to see if the all the properties in the model are valid
96
102
  # @return true if the model is valid
97
103
  def valid?
104
+ warn '[DEPRECATED] the `valid?` method is obsolete'
98
105
  return false if !@name.nil? && @name.to_s.length > 100
99
106
  return false if !@name.nil? && @name.to_s.length < 1
107
+ return false if !@name.nil? && @name !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
100
108
  return false if !@description.nil? && @description.to_s.length > 250
101
109
  true
102
110
  end
@@ -104,21 +112,34 @@ module NetworkStorageApi
104
112
  # Custom attribute writer method with validation
105
113
  # @param [Object] name Value to be assigned
106
114
  def name=(name)
107
- if !name.nil? && name.to_s.length > 100
115
+ if name.nil?
116
+ fail ArgumentError, 'name cannot be nil'
117
+ end
118
+
119
+ if name.to_s.length > 100
108
120
  fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.'
109
121
  end
110
122
 
111
- if !name.nil? && name.to_s.length < 1
123
+ if name.to_s.length < 1
112
124
  fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
113
125
  end
114
126
 
127
+ pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
128
+ if name !~ pattern
129
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
130
+ end
131
+
115
132
  @name = name
116
133
  end
117
134
 
118
135
  # Custom attribute writer method with validation
119
136
  # @param [Object] description Value to be assigned
120
137
  def description=(description)
121
- if !description.nil? && description.to_s.length > 250
138
+ if description.nil?
139
+ fail ArgumentError, 'description cannot be nil'
140
+ end
141
+
142
+ if description.to_s.length > 250
122
143
  fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
123
144
  end
124
145
 
@@ -150,37 +171,30 @@ module NetworkStorageApi
150
171
  # @param [Hash] attributes Model attributes in the form of hash
151
172
  # @return [Object] Returns the model itself
152
173
  def self.build_from_hash(attributes)
153
- new.build_from_hash(attributes)
154
- end
155
-
156
- # Builds the object from hash
157
- # @param [Hash] attributes Model attributes in the form of hash
158
- # @return [Object] Returns the model itself
159
- def build_from_hash(attributes)
160
174
  return nil unless attributes.is_a?(Hash)
161
175
  attributes = attributes.transform_keys(&:to_sym)
162
- self.class.openapi_types.each_pair do |key, type|
163
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
164
- self.send("#{key}=", nil)
176
+ transformed_hash = {}
177
+ openapi_types.each_pair do |key, type|
178
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
179
+ transformed_hash["#{key}"] = nil
165
180
  elsif type =~ /\AArray<(.*)>/i
166
181
  # check to ensure the input is an array given that the attribute
167
182
  # is documented as an array but the input is not
168
- if attributes[self.class.attribute_map[key]].is_a?(Array)
169
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
183
+ if attributes[attribute_map[key]].is_a?(Array)
184
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
170
185
  end
171
- elsif !attributes[self.class.attribute_map[key]].nil?
172
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
186
+ elsif !attributes[attribute_map[key]].nil?
187
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
173
188
  end
174
189
  end
175
-
176
- self
190
+ new(transformed_hash)
177
191
  end
178
192
 
179
193
  # Deserializes the data based on type
180
194
  # @param string type Data type
181
195
  # @param string value Value to be deserialized
182
196
  # @return [Object] Deserialized data
183
- def _deserialize(type, value)
197
+ def self._deserialize(type, value)
184
198
  case type.to_sym
185
199
  when :Time
186
200
  Time.parse(value)
@@ -215,7 +229,7 @@ module NetworkStorageApi
215
229
  else # model
216
230
  # models (e.g. Pet) or oneOf
217
231
  klass = NetworkStorageApi.const_get(type)
218
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
232
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
219
233
  end
220
234
  end
221
235