pnap_network_storage_api 1.4.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.
- checksums.yaml +4 -4
- data/README.md +12 -9
- data/VERSION +1 -1
- data/docs/StorageNetwork.md +2 -0
- data/docs/StorageNetworksApi.md +77 -87
- data/docs/Volume.md +2 -0
- data/lib/pnap_network_storage_api/api/storage_networks_api.rb +120 -100
- data/lib/pnap_network_storage_api/api_client.rb +24 -21
- data/lib/pnap_network_storage_api/api_error.rb +2 -1
- data/lib/pnap_network_storage_api/configuration.rb +28 -9
- data/lib/pnap_network_storage_api/models/error.rb +16 -19
- data/lib/pnap_network_storage_api/models/nfs_permissions.rb +14 -19
- data/lib/pnap_network_storage_api/models/nfs_permissions_create.rb +14 -19
- data/lib/pnap_network_storage_api/models/nfs_permissions_update.rb +14 -19
- data/lib/pnap_network_storage_api/models/permissions.rb +14 -19
- data/lib/pnap_network_storage_api/models/permissions_create.rb +14 -19
- data/lib/pnap_network_storage_api/models/permissions_update.rb +14 -19
- data/lib/pnap_network_storage_api/models/status.rb +8 -4
- data/lib/pnap_network_storage_api/models/storage_network.rb +47 -20
- data/lib/pnap_network_storage_api/models/storage_network_create.rb +42 -22
- data/lib/pnap_network_storage_api/models/storage_network_update.rb +36 -22
- data/lib/pnap_network_storage_api/models/storage_network_volume_create.rb +41 -23
- data/lib/pnap_network_storage_api/models/tag_assignment.rb +20 -19
- data/lib/pnap_network_storage_api/models/tag_assignment_request.rb +16 -19
- data/lib/pnap_network_storage_api/models/volume.rb +47 -20
- data/lib/pnap_network_storage_api/models/volume_create.rb +41 -23
- data/lib/pnap_network_storage_api/models/volume_update.rb +48 -26
- data/lib/pnap_network_storage_api/version.rb +1 -1
- data/lib/pnap_network_storage_api.rb +1 -1
- data/pnap_network_storage_api.gemspec +2 -2
- data/spec/api/storage_networks_api_spec.rb +70 -15
- data/spec/models/error_spec.rb +6 -4
- data/spec/models/nfs_permissions_create_spec.rb +9 -7
- data/spec/models/nfs_permissions_spec.rb +9 -7
- data/spec/models/nfs_permissions_update_spec.rb +9 -7
- data/spec/models/permissions_create_spec.rb +5 -3
- data/spec/models/permissions_spec.rb +5 -3
- data/spec/models/permissions_update_spec.rb +5 -3
- data/spec/models/status_spec.rb +4 -2
- data/spec/models/storage_network_create_spec.rb +14 -6
- data/spec/models/storage_network_spec.rb +19 -11
- data/spec/models/storage_network_update_spec.rb +6 -4
- data/spec/models/storage_network_volume_create_spec.rb +14 -6
- data/spec/models/tag_assignment_request_spec.rb +6 -4
- data/spec/models/tag_assignment_spec.rb +9 -7
- data/spec/models/volume_create_spec.rb +20 -6
- data/spec/models/volume_spec.rb +32 -12
- data/spec/models/volume_update_spec.rb +29 -3
- data/spec/spec_helper.rb +1 -1
- metadata +13 -17
- data/spec/api_client_spec.rb +0 -226
- 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:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -103,10 +103,14 @@ module NetworkStorageApi
|
|
103
103
|
|
104
104
|
if attributes.key?(:'id')
|
105
105
|
self.id = attributes[:'id']
|
106
|
+
else
|
107
|
+
self.id = nil
|
106
108
|
end
|
107
109
|
|
108
110
|
if attributes.key?(:'name')
|
109
111
|
self.name = attributes[:'name']
|
112
|
+
else
|
113
|
+
self.name = nil
|
110
114
|
end
|
111
115
|
|
112
116
|
if attributes.key?(:'value')
|
@@ -115,6 +119,8 @@ module NetworkStorageApi
|
|
115
119
|
|
116
120
|
if attributes.key?(:'is_billing_tag')
|
117
121
|
self.is_billing_tag = attributes[:'is_billing_tag']
|
122
|
+
else
|
123
|
+
self.is_billing_tag = nil
|
118
124
|
end
|
119
125
|
|
120
126
|
if attributes.key?(:'created_by')
|
@@ -125,6 +131,7 @@ module NetworkStorageApi
|
|
125
131
|
# Show invalid properties with the reasons. Usually used together with valid?
|
126
132
|
# @return Array for valid properties with the reasons
|
127
133
|
def list_invalid_properties
|
134
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
128
135
|
invalid_properties = Array.new
|
129
136
|
if @id.nil?
|
130
137
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
@@ -144,6 +151,7 @@ module NetworkStorageApi
|
|
144
151
|
# Check to see if the all the properties in the model are valid
|
145
152
|
# @return true if the model is valid
|
146
153
|
def valid?
|
154
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
147
155
|
return false if @id.nil?
|
148
156
|
return false if @name.nil?
|
149
157
|
return false if @is_billing_tag.nil?
|
@@ -190,37 +198,30 @@ module NetworkStorageApi
|
|
190
198
|
# @param [Hash] attributes Model attributes in the form of hash
|
191
199
|
# @return [Object] Returns the model itself
|
192
200
|
def self.build_from_hash(attributes)
|
193
|
-
new.build_from_hash(attributes)
|
194
|
-
end
|
195
|
-
|
196
|
-
# Builds the object from hash
|
197
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
198
|
-
# @return [Object] Returns the model itself
|
199
|
-
def build_from_hash(attributes)
|
200
201
|
return nil unless attributes.is_a?(Hash)
|
201
202
|
attributes = attributes.transform_keys(&:to_sym)
|
202
|
-
|
203
|
-
|
204
|
-
|
203
|
+
transformed_hash = {}
|
204
|
+
openapi_types.each_pair do |key, type|
|
205
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
206
|
+
transformed_hash["#{key}"] = nil
|
205
207
|
elsif type =~ /\AArray<(.*)>/i
|
206
208
|
# check to ensure the input is an array given that the attribute
|
207
209
|
# is documented as an array but the input is not
|
208
|
-
if attributes[
|
209
|
-
|
210
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
211
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
210
212
|
end
|
211
|
-
elsif !attributes[
|
212
|
-
|
213
|
+
elsif !attributes[attribute_map[key]].nil?
|
214
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
213
215
|
end
|
214
216
|
end
|
215
|
-
|
216
|
-
self
|
217
|
+
new(transformed_hash)
|
217
218
|
end
|
218
219
|
|
219
220
|
# Deserializes the data based on type
|
220
221
|
# @param string type Data type
|
221
222
|
# @param string value Value to be deserialized
|
222
223
|
# @return [Object] Deserialized data
|
223
|
-
def _deserialize(type, value)
|
224
|
+
def self._deserialize(type, value)
|
224
225
|
case type.to_sym
|
225
226
|
when :Time
|
226
227
|
Time.parse(value)
|
@@ -255,7 +256,7 @@ module NetworkStorageApi
|
|
255
256
|
else # model
|
256
257
|
# models (e.g. Pet) or oneOf
|
257
258
|
klass = NetworkStorageApi.const_get(type)
|
258
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
259
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
259
260
|
end
|
260
261
|
end
|
261
262
|
|
@@ -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:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -66,6 +66,8 @@ module NetworkStorageApi
|
|
66
66
|
|
67
67
|
if attributes.key?(:'name')
|
68
68
|
self.name = attributes[:'name']
|
69
|
+
else
|
70
|
+
self.name = nil
|
69
71
|
end
|
70
72
|
|
71
73
|
if attributes.key?(:'value')
|
@@ -76,6 +78,7 @@ module NetworkStorageApi
|
|
76
78
|
# Show invalid properties with the reasons. Usually used together with valid?
|
77
79
|
# @return Array for valid properties with the reasons
|
78
80
|
def list_invalid_properties
|
81
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
79
82
|
invalid_properties = Array.new
|
80
83
|
if @name.nil?
|
81
84
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
@@ -87,6 +90,7 @@ module NetworkStorageApi
|
|
87
90
|
# Check to see if the all the properties in the model are valid
|
88
91
|
# @return true if the model is valid
|
89
92
|
def valid?
|
93
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
90
94
|
return false if @name.nil?
|
91
95
|
true
|
92
96
|
end
|
@@ -116,37 +120,30 @@ module NetworkStorageApi
|
|
116
120
|
# @param [Hash] attributes Model attributes in the form of hash
|
117
121
|
# @return [Object] Returns the model itself
|
118
122
|
def self.build_from_hash(attributes)
|
119
|
-
new.build_from_hash(attributes)
|
120
|
-
end
|
121
|
-
|
122
|
-
# Builds the object from hash
|
123
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
124
|
-
# @return [Object] Returns the model itself
|
125
|
-
def build_from_hash(attributes)
|
126
123
|
return nil unless attributes.is_a?(Hash)
|
127
124
|
attributes = attributes.transform_keys(&:to_sym)
|
128
|
-
|
129
|
-
|
130
|
-
|
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
|
131
129
|
elsif type =~ /\AArray<(.*)>/i
|
132
130
|
# check to ensure the input is an array given that the attribute
|
133
131
|
# is documented as an array but the input is not
|
134
|
-
if attributes[
|
135
|
-
|
132
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
133
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
136
134
|
end
|
137
|
-
elsif !attributes[
|
138
|
-
|
135
|
+
elsif !attributes[attribute_map[key]].nil?
|
136
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
139
137
|
end
|
140
138
|
end
|
141
|
-
|
142
|
-
self
|
139
|
+
new(transformed_hash)
|
143
140
|
end
|
144
141
|
|
145
142
|
# Deserializes the data based on type
|
146
143
|
# @param string type Data type
|
147
144
|
# @param string value Value to be deserialized
|
148
145
|
# @return [Object] Deserialized data
|
149
|
-
def _deserialize(type, value)
|
146
|
+
def self._deserialize(type, value)
|
150
147
|
case type.to_sym
|
151
148
|
when :Time
|
152
149
|
Time.parse(value)
|
@@ -181,7 +178,7 @@ module NetworkStorageApi
|
|
181
178
|
else # model
|
182
179
|
# models (e.g. Pet) or oneOf
|
183
180
|
klass = NetworkStorageApi.const_get(type)
|
184
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
181
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
185
182
|
end
|
186
183
|
end
|
187
184
|
|
@@ -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:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -44,11 +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
|
|
49
52
|
# The tags assigned if any.
|
50
53
|
attr_accessor :tags
|
51
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
|
+
|
52
77
|
# Attribute mapping from ruby-style variable name to JSON key.
|
53
78
|
def self.attribute_map
|
54
79
|
{
|
@@ -62,6 +87,7 @@ module NetworkStorageApi
|
|
62
87
|
:'protocol' => :'protocol',
|
63
88
|
:'status' => :'status',
|
64
89
|
:'created_on' => :'createdOn',
|
90
|
+
:'delete_requested_on' => :'deleteRequestedOn',
|
65
91
|
:'permissions' => :'permissions',
|
66
92
|
:'tags' => :'tags'
|
67
93
|
}
|
@@ -85,6 +111,7 @@ module NetworkStorageApi
|
|
85
111
|
:'protocol' => :'String',
|
86
112
|
:'status' => :'Status',
|
87
113
|
:'created_on' => :'Time',
|
114
|
+
:'delete_requested_on' => :'Time',
|
88
115
|
:'permissions' => :'Permissions',
|
89
116
|
:'tags' => :'Array<TagAssignment>'
|
90
117
|
}
|
@@ -151,6 +178,10 @@ module NetworkStorageApi
|
|
151
178
|
self.created_on = attributes[:'created_on']
|
152
179
|
end
|
153
180
|
|
181
|
+
if attributes.key?(:'delete_requested_on')
|
182
|
+
self.delete_requested_on = attributes[:'delete_requested_on']
|
183
|
+
end
|
184
|
+
|
154
185
|
if attributes.key?(:'permissions')
|
155
186
|
self.permissions = attributes[:'permissions']
|
156
187
|
end
|
@@ -165,6 +196,7 @@ module NetworkStorageApi
|
|
165
196
|
# Show invalid properties with the reasons. Usually used together with valid?
|
166
197
|
# @return Array for valid properties with the reasons
|
167
198
|
def list_invalid_properties
|
199
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
168
200
|
invalid_properties = Array.new
|
169
201
|
invalid_properties
|
170
202
|
end
|
@@ -172,6 +204,7 @@ module NetworkStorageApi
|
|
172
204
|
# Check to see if the all the properties in the model are valid
|
173
205
|
# @return true if the model is valid
|
174
206
|
def valid?
|
207
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
175
208
|
true
|
176
209
|
end
|
177
210
|
|
@@ -190,6 +223,7 @@ module NetworkStorageApi
|
|
190
223
|
protocol == o.protocol &&
|
191
224
|
status == o.status &&
|
192
225
|
created_on == o.created_on &&
|
226
|
+
delete_requested_on == o.delete_requested_on &&
|
193
227
|
permissions == o.permissions &&
|
194
228
|
tags == o.tags
|
195
229
|
end
|
@@ -203,44 +237,37 @@ module NetworkStorageApi
|
|
203
237
|
# Calculates hash code according to all attributes.
|
204
238
|
# @return [Integer] Hash code
|
205
239
|
def hash
|
206
|
-
[id, name, description, path, path_suffix, capacity_in_gb, used_capacity_in_gb, protocol, status, created_on, permissions, tags].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
|
207
241
|
end
|
208
242
|
|
209
243
|
# Builds the object from hash
|
210
244
|
# @param [Hash] attributes Model attributes in the form of hash
|
211
245
|
# @return [Object] Returns the model itself
|
212
246
|
def self.build_from_hash(attributes)
|
213
|
-
new.build_from_hash(attributes)
|
214
|
-
end
|
215
|
-
|
216
|
-
# Builds the object from hash
|
217
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
218
|
-
# @return [Object] Returns the model itself
|
219
|
-
def build_from_hash(attributes)
|
220
247
|
return nil unless attributes.is_a?(Hash)
|
221
248
|
attributes = attributes.transform_keys(&:to_sym)
|
222
|
-
|
223
|
-
|
224
|
-
|
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
|
225
253
|
elsif type =~ /\AArray<(.*)>/i
|
226
254
|
# check to ensure the input is an array given that the attribute
|
227
255
|
# is documented as an array but the input is not
|
228
|
-
if attributes[
|
229
|
-
|
256
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
257
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
230
258
|
end
|
231
|
-
elsif !attributes[
|
232
|
-
|
259
|
+
elsif !attributes[attribute_map[key]].nil?
|
260
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
233
261
|
end
|
234
262
|
end
|
235
|
-
|
236
|
-
self
|
263
|
+
new(transformed_hash)
|
237
264
|
end
|
238
265
|
|
239
266
|
# Deserializes the data based on type
|
240
267
|
# @param string type Data type
|
241
268
|
# @param string value Value to be deserialized
|
242
269
|
# @return [Object] Deserialized data
|
243
|
-
def _deserialize(type, value)
|
270
|
+
def self._deserialize(type, value)
|
244
271
|
case type.to_sym
|
245
272
|
when :Time
|
246
273
|
Time.parse(value)
|
@@ -275,7 +302,7 @@ module NetworkStorageApi
|
|
275
302
|
else # model
|
276
303
|
# models (e.g. Pet) or oneOf
|
277
304
|
klass = NetworkStorageApi.const_get(type)
|
278
|
-
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)
|
279
306
|
end
|
280
307
|
end
|
281
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:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -85,6 +85,8 @@ module NetworkStorageApi
|
|
85
85
|
|
86
86
|
if attributes.key?(:'name')
|
87
87
|
self.name = attributes[:'name']
|
88
|
+
else
|
89
|
+
self.name = nil
|
88
90
|
end
|
89
91
|
|
90
92
|
if attributes.key?(:'description')
|
@@ -97,6 +99,8 @@ module NetworkStorageApi
|
|
97
99
|
|
98
100
|
if attributes.key?(:'capacity_in_gb')
|
99
101
|
self.capacity_in_gb = attributes[:'capacity_in_gb']
|
102
|
+
else
|
103
|
+
self.capacity_in_gb = nil
|
100
104
|
end
|
101
105
|
|
102
106
|
if attributes.key?(:'permissions')
|
@@ -113,6 +117,7 @@ module NetworkStorageApi
|
|
113
117
|
# Show invalid properties with the reasons. Usually used together with valid?
|
114
118
|
# @return Array for valid properties with the reasons
|
115
119
|
def list_invalid_properties
|
120
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
116
121
|
invalid_properties = Array.new
|
117
122
|
if @name.nil?
|
118
123
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
@@ -126,6 +131,11 @@ module NetworkStorageApi
|
|
126
131
|
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
127
132
|
end
|
128
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
|
+
|
129
139
|
if !@description.nil? && @description.to_s.length > 250
|
130
140
|
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
|
131
141
|
end
|
@@ -157,9 +167,11 @@ module NetworkStorageApi
|
|
157
167
|
# Check to see if the all the properties in the model are valid
|
158
168
|
# @return true if the model is valid
|
159
169
|
def valid?
|
170
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
160
171
|
return false if @name.nil?
|
161
172
|
return false if @name.to_s.length > 100
|
162
173
|
return false if @name.to_s.length < 1
|
174
|
+
return false if @name !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
|
163
175
|
return false if !@description.nil? && @description.to_s.length > 250
|
164
176
|
return false if !@path_suffix.nil? && @path_suffix.to_s.length > 27
|
165
177
|
return false if !@path_suffix.nil? && @path_suffix.to_s.length < 0
|
@@ -184,13 +196,22 @@ module NetworkStorageApi
|
|
184
196
|
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
185
197
|
end
|
186
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
|
+
|
187
204
|
@name = name
|
188
205
|
end
|
189
206
|
|
190
207
|
# Custom attribute writer method with validation
|
191
208
|
# @param [Object] description Value to be assigned
|
192
209
|
def description=(description)
|
193
|
-
if
|
210
|
+
if description.nil?
|
211
|
+
fail ArgumentError, 'description cannot be nil'
|
212
|
+
end
|
213
|
+
|
214
|
+
if description.to_s.length > 250
|
194
215
|
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
|
195
216
|
end
|
196
217
|
|
@@ -200,16 +221,20 @@ module NetworkStorageApi
|
|
200
221
|
# Custom attribute writer method with validation
|
201
222
|
# @param [Object] path_suffix Value to be assigned
|
202
223
|
def path_suffix=(path_suffix)
|
203
|
-
if
|
224
|
+
if path_suffix.nil?
|
225
|
+
fail ArgumentError, 'path_suffix cannot be nil'
|
226
|
+
end
|
227
|
+
|
228
|
+
if path_suffix.to_s.length > 27
|
204
229
|
fail ArgumentError, 'invalid value for "path_suffix", the character length must be smaller than or equal to 27.'
|
205
230
|
end
|
206
231
|
|
207
|
-
if
|
232
|
+
if path_suffix.to_s.length < 0
|
208
233
|
fail ArgumentError, 'invalid value for "path_suffix", the character length must be great than or equal to 0.'
|
209
234
|
end
|
210
235
|
|
211
236
|
pattern = Regexp.new(/^(\/[\w-]+)+$|^$/)
|
212
|
-
if
|
237
|
+
if path_suffix !~ pattern
|
213
238
|
fail ArgumentError, "invalid value for \"path_suffix\", must conform to the pattern #{pattern}."
|
214
239
|
end
|
215
240
|
|
@@ -259,37 +284,30 @@ module NetworkStorageApi
|
|
259
284
|
# @param [Hash] attributes Model attributes in the form of hash
|
260
285
|
# @return [Object] Returns the model itself
|
261
286
|
def self.build_from_hash(attributes)
|
262
|
-
new.build_from_hash(attributes)
|
263
|
-
end
|
264
|
-
|
265
|
-
# Builds the object from hash
|
266
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
267
|
-
# @return [Object] Returns the model itself
|
268
|
-
def build_from_hash(attributes)
|
269
287
|
return nil unless attributes.is_a?(Hash)
|
270
288
|
attributes = attributes.transform_keys(&:to_sym)
|
271
|
-
|
272
|
-
|
273
|
-
|
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
|
274
293
|
elsif type =~ /\AArray<(.*)>/i
|
275
294
|
# check to ensure the input is an array given that the attribute
|
276
295
|
# is documented as an array but the input is not
|
277
|
-
if attributes[
|
278
|
-
|
296
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
297
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
279
298
|
end
|
280
|
-
elsif !attributes[
|
281
|
-
|
299
|
+
elsif !attributes[attribute_map[key]].nil?
|
300
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
282
301
|
end
|
283
302
|
end
|
284
|
-
|
285
|
-
self
|
303
|
+
new(transformed_hash)
|
286
304
|
end
|
287
305
|
|
288
306
|
# Deserializes the data based on type
|
289
307
|
# @param string type Data type
|
290
308
|
# @param string value Value to be deserialized
|
291
309
|
# @return [Object] Deserialized data
|
292
|
-
def _deserialize(type, value)
|
310
|
+
def self._deserialize(type, value)
|
293
311
|
case type.to_sym
|
294
312
|
when :Time
|
295
313
|
Time.parse(value)
|
@@ -324,7 +342,7 @@ module NetworkStorageApi
|
|
324
342
|
else # model
|
325
343
|
# models (e.g. Pet) or oneOf
|
326
344
|
klass = NetworkStorageApi.const_get(type)
|
327
|
-
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)
|
328
346
|
end
|
329
347
|
end
|
330
348
|
|