pnap_network_api 1.3.1 → 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 +3 -0
- data/VERSION +1 -1
- data/docs/PrivateNetwork.md +1 -1
- data/docs/PrivateNetworksApi.md +13 -15
- data/docs/PublicNetwork.md +1 -1
- data/docs/PublicNetworksApi.md +18 -24
- data/lib/pnap_network_api/api/private_networks_api.rb +21 -13
- data/lib/pnap_network_api/api/public_networks_api.rb +31 -19
- data/lib/pnap_network_api/api_client.rb +24 -21
- data/lib/pnap_network_api/api_error.rb +2 -1
- data/lib/pnap_network_api/configuration.rb +28 -9
- data/lib/pnap_network_api/models/error.rb +16 -19
- data/lib/pnap_network_api/models/network_membership.rb +20 -19
- data/lib/pnap_network_api/models/private_network.rb +40 -21
- data/lib/pnap_network_api/models/private_network_create.rb +40 -22
- data/lib/pnap_network_api/models/private_network_modify.rb +34 -20
- data/lib/pnap_network_api/models/private_network_server.rb +18 -19
- data/lib/pnap_network_api/models/public_network.rb +36 -21
- data/lib/pnap_network_api/models/public_network_create.rb +45 -23
- data/lib/pnap_network_api/models/public_network_ip_block.rb +16 -19
- data/lib/pnap_network_api/models/public_network_modify.rb +36 -22
- data/lib/pnap_network_api/version.rb +1 -1
- data/lib/pnap_network_api.rb +1 -1
- data/pnap_network_api.gemspec +2 -2
- data/spec/api/private_networks_api_spec.rb +10 -9
- data/spec/api/public_networks_api_spec.rb +14 -13
- data/spec/models/error_spec.rb +7 -5
- data/spec/models/network_membership_spec.rb +7 -5
- data/spec/models/private_network_create_spec.rb +16 -8
- data/spec/models/private_network_modify_spec.rb +8 -6
- data/spec/models/private_network_server_spec.rb +7 -5
- data/spec/models/private_network_spec.rb +32 -12
- data/spec/models/public_network_create_spec.rb +15 -7
- data/spec/models/public_network_ip_block_spec.rb +6 -4
- data/spec/models/public_network_modify_spec.rb +7 -5
- data/spec/models/public_network_spec.rb +19 -11
- data/spec/spec_helper.rb +1 -1
- metadata +8 -16
- data/docs/PublicNetworkMembership.md +0 -22
- data/lib/pnap_network_api/models/public_network_membership.rb +0 -257
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/public_network_membership_spec.rb +0 -46
@@ -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
|
|
@@ -71,6 +71,8 @@ module NetworkApi
|
|
71
71
|
|
72
72
|
if attributes.key?(:'name')
|
73
73
|
self.name = attributes[:'name']
|
74
|
+
else
|
75
|
+
self.name = nil
|
74
76
|
end
|
75
77
|
|
76
78
|
if attributes.key?(:'description')
|
@@ -79,12 +81,15 @@ module NetworkApi
|
|
79
81
|
|
80
82
|
if attributes.key?(:'location_default')
|
81
83
|
self.location_default = attributes[:'location_default']
|
84
|
+
else
|
85
|
+
self.location_default = nil
|
82
86
|
end
|
83
87
|
end
|
84
88
|
|
85
89
|
# Show invalid properties with the reasons. Usually used together with valid?
|
86
90
|
# @return Array for valid properties with the reasons
|
87
91
|
def list_invalid_properties
|
92
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
88
93
|
invalid_properties = Array.new
|
89
94
|
if @name.nil?
|
90
95
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
@@ -98,6 +103,11 @@ module NetworkApi
|
|
98
103
|
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
99
104
|
end
|
100
105
|
|
106
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
|
107
|
+
if @name !~ pattern
|
108
|
+
invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
|
109
|
+
end
|
110
|
+
|
101
111
|
if !@description.nil? && @description.to_s.length > 250
|
102
112
|
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
|
103
113
|
end
|
@@ -112,9 +122,11 @@ module NetworkApi
|
|
112
122
|
# Check to see if the all the properties in the model are valid
|
113
123
|
# @return true if the model is valid
|
114
124
|
def valid?
|
125
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
115
126
|
return false if @name.nil?
|
116
127
|
return false if @name.to_s.length > 100
|
117
128
|
return false if @name.to_s.length < 1
|
129
|
+
return false if @name !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
|
118
130
|
return false if !@description.nil? && @description.to_s.length > 250
|
119
131
|
return false if @location_default.nil?
|
120
132
|
true
|
@@ -135,13 +147,22 @@ module NetworkApi
|
|
135
147
|
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
136
148
|
end
|
137
149
|
|
150
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
|
151
|
+
if name !~ pattern
|
152
|
+
fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
|
153
|
+
end
|
154
|
+
|
138
155
|
@name = name
|
139
156
|
end
|
140
157
|
|
141
158
|
# Custom attribute writer method with validation
|
142
159
|
# @param [Object] description Value to be assigned
|
143
160
|
def description=(description)
|
144
|
-
if
|
161
|
+
if description.nil?
|
162
|
+
fail ArgumentError, 'description cannot be nil'
|
163
|
+
end
|
164
|
+
|
165
|
+
if description.to_s.length > 250
|
145
166
|
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
|
146
167
|
end
|
147
168
|
|
@@ -174,37 +195,30 @@ module NetworkApi
|
|
174
195
|
# @param [Hash] attributes Model attributes in the form of hash
|
175
196
|
# @return [Object] Returns the model itself
|
176
197
|
def self.build_from_hash(attributes)
|
177
|
-
new.build_from_hash(attributes)
|
178
|
-
end
|
179
|
-
|
180
|
-
# Builds the object from hash
|
181
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
182
|
-
# @return [Object] Returns the model itself
|
183
|
-
def build_from_hash(attributes)
|
184
198
|
return nil unless attributes.is_a?(Hash)
|
185
199
|
attributes = attributes.transform_keys(&:to_sym)
|
186
|
-
|
187
|
-
|
188
|
-
|
200
|
+
transformed_hash = {}
|
201
|
+
openapi_types.each_pair do |key, type|
|
202
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
203
|
+
transformed_hash["#{key}"] = nil
|
189
204
|
elsif type =~ /\AArray<(.*)>/i
|
190
205
|
# check to ensure the input is an array given that the attribute
|
191
206
|
# is documented as an array but the input is not
|
192
|
-
if attributes[
|
193
|
-
|
207
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
208
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
194
209
|
end
|
195
|
-
elsif !attributes[
|
196
|
-
|
210
|
+
elsif !attributes[attribute_map[key]].nil?
|
211
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
197
212
|
end
|
198
213
|
end
|
199
|
-
|
200
|
-
self
|
214
|
+
new(transformed_hash)
|
201
215
|
end
|
202
216
|
|
203
217
|
# Deserializes the data based on type
|
204
218
|
# @param string type Data type
|
205
219
|
# @param string value Value to be deserialized
|
206
220
|
# @return [Object] Deserialized data
|
207
|
-
def _deserialize(type, value)
|
221
|
+
def self._deserialize(type, value)
|
208
222
|
case type.to_sym
|
209
223
|
when :Time
|
210
224
|
Time.parse(value)
|
@@ -239,7 +253,7 @@ module NetworkApi
|
|
239
253
|
else # model
|
240
254
|
# models (e.g. Pet) or oneOf
|
241
255
|
klass = NetworkApi.const_get(type)
|
242
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
256
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
243
257
|
end
|
244
258
|
end
|
245
259
|
|
@@ -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,18 +66,23 @@ module NetworkApi
|
|
66
66
|
|
67
67
|
if attributes.key?(:'id')
|
68
68
|
self.id = attributes[:'id']
|
69
|
+
else
|
70
|
+
self.id = nil
|
69
71
|
end
|
70
72
|
|
71
73
|
if attributes.key?(:'ips')
|
72
74
|
if (value = attributes[:'ips']).is_a?(Array)
|
73
75
|
self.ips = value
|
74
76
|
end
|
77
|
+
else
|
78
|
+
self.ips = nil
|
75
79
|
end
|
76
80
|
end
|
77
81
|
|
78
82
|
# Show invalid properties with the reasons. Usually used together with valid?
|
79
83
|
# @return Array for valid properties with the reasons
|
80
84
|
def list_invalid_properties
|
85
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
81
86
|
invalid_properties = Array.new
|
82
87
|
if @id.nil?
|
83
88
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
@@ -93,6 +98,7 @@ module NetworkApi
|
|
93
98
|
# Check to see if the all the properties in the model are valid
|
94
99
|
# @return true if the model is valid
|
95
100
|
def valid?
|
101
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
96
102
|
return false if @id.nil?
|
97
103
|
return false if @ips.nil?
|
98
104
|
true
|
@@ -123,37 +129,30 @@ module NetworkApi
|
|
123
129
|
# @param [Hash] attributes Model attributes in the form of hash
|
124
130
|
# @return [Object] Returns the model itself
|
125
131
|
def self.build_from_hash(attributes)
|
126
|
-
new.build_from_hash(attributes)
|
127
|
-
end
|
128
|
-
|
129
|
-
# Builds the object from hash
|
130
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
131
|
-
# @return [Object] Returns the model itself
|
132
|
-
def build_from_hash(attributes)
|
133
132
|
return nil unless attributes.is_a?(Hash)
|
134
133
|
attributes = attributes.transform_keys(&:to_sym)
|
135
|
-
|
136
|
-
|
137
|
-
|
134
|
+
transformed_hash = {}
|
135
|
+
openapi_types.each_pair do |key, type|
|
136
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
137
|
+
transformed_hash["#{key}"] = nil
|
138
138
|
elsif type =~ /\AArray<(.*)>/i
|
139
139
|
# check to ensure the input is an array given that the attribute
|
140
140
|
# is documented as an array but the input is not
|
141
|
-
if attributes[
|
142
|
-
|
141
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
142
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
143
143
|
end
|
144
|
-
elsif !attributes[
|
145
|
-
|
144
|
+
elsif !attributes[attribute_map[key]].nil?
|
145
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
146
146
|
end
|
147
147
|
end
|
148
|
-
|
149
|
-
self
|
148
|
+
new(transformed_hash)
|
150
149
|
end
|
151
150
|
|
152
151
|
# Deserializes the data based on type
|
153
152
|
# @param string type Data type
|
154
153
|
# @param string value Value to be deserialized
|
155
154
|
# @return [Object] Deserialized data
|
156
|
-
def _deserialize(type, value)
|
155
|
+
def self._deserialize(type, value)
|
157
156
|
case type.to_sym
|
158
157
|
when :Time
|
159
158
|
Time.parse(value)
|
@@ -188,7 +187,7 @@ module NetworkApi
|
|
188
187
|
else # model
|
189
188
|
# models (e.g. Pet) or oneOf
|
190
189
|
klass = NetworkApi.const_get(type)
|
191
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
190
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
192
191
|
end
|
193
192
|
end
|
194
193
|
|
@@ -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
|
|
@@ -34,7 +34,7 @@ module NetworkApi
|
|
34
34
|
# The description of this public network.
|
35
35
|
attr_accessor :description
|
36
36
|
|
37
|
-
# The status of the public network. Can have one of the following values: `BUSY` or `
|
37
|
+
# The status of the public network. Can have one of the following values: `BUSY`, `READY`, `DELETING` or `ERROR`.
|
38
38
|
attr_accessor :status
|
39
39
|
|
40
40
|
# Date and time when this public network was created.
|
@@ -101,24 +101,34 @@ module NetworkApi
|
|
101
101
|
|
102
102
|
if attributes.key?(:'id')
|
103
103
|
self.id = attributes[:'id']
|
104
|
+
else
|
105
|
+
self.id = nil
|
104
106
|
end
|
105
107
|
|
106
108
|
if attributes.key?(:'vlan_id')
|
107
109
|
self.vlan_id = attributes[:'vlan_id']
|
110
|
+
else
|
111
|
+
self.vlan_id = nil
|
108
112
|
end
|
109
113
|
|
110
114
|
if attributes.key?(:'memberships')
|
111
115
|
if (value = attributes[:'memberships']).is_a?(Array)
|
112
116
|
self.memberships = value
|
113
117
|
end
|
118
|
+
else
|
119
|
+
self.memberships = nil
|
114
120
|
end
|
115
121
|
|
116
122
|
if attributes.key?(:'name')
|
117
123
|
self.name = attributes[:'name']
|
124
|
+
else
|
125
|
+
self.name = nil
|
118
126
|
end
|
119
127
|
|
120
128
|
if attributes.key?(:'location')
|
121
129
|
self.location = attributes[:'location']
|
130
|
+
else
|
131
|
+
self.location = nil
|
122
132
|
end
|
123
133
|
|
124
134
|
if attributes.key?(:'description')
|
@@ -127,22 +137,29 @@ module NetworkApi
|
|
127
137
|
|
128
138
|
if attributes.key?(:'status')
|
129
139
|
self.status = attributes[:'status']
|
140
|
+
else
|
141
|
+
self.status = nil
|
130
142
|
end
|
131
143
|
|
132
144
|
if attributes.key?(:'created_on')
|
133
145
|
self.created_on = attributes[:'created_on']
|
146
|
+
else
|
147
|
+
self.created_on = nil
|
134
148
|
end
|
135
149
|
|
136
150
|
if attributes.key?(:'ip_blocks')
|
137
151
|
if (value = attributes[:'ip_blocks']).is_a?(Array)
|
138
152
|
self.ip_blocks = value
|
139
153
|
end
|
154
|
+
else
|
155
|
+
self.ip_blocks = nil
|
140
156
|
end
|
141
157
|
end
|
142
158
|
|
143
159
|
# Show invalid properties with the reasons. Usually used together with valid?
|
144
160
|
# @return Array for valid properties with the reasons
|
145
161
|
def list_invalid_properties
|
162
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
146
163
|
invalid_properties = Array.new
|
147
164
|
if @id.nil?
|
148
165
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
@@ -194,6 +211,7 @@ module NetworkApi
|
|
194
211
|
# Check to see if the all the properties in the model are valid
|
195
212
|
# @return true if the model is valid
|
196
213
|
def valid?
|
214
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
197
215
|
return false if @id.nil?
|
198
216
|
return false if @vlan_id.nil?
|
199
217
|
return false if @memberships.nil?
|
@@ -229,7 +247,11 @@ module NetworkApi
|
|
229
247
|
# Custom attribute writer method with validation
|
230
248
|
# @param [Object] description Value to be assigned
|
231
249
|
def description=(description)
|
232
|
-
if
|
250
|
+
if description.nil?
|
251
|
+
fail ArgumentError, 'description cannot be nil'
|
252
|
+
end
|
253
|
+
|
254
|
+
if description.to_s.length > 250
|
233
255
|
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
|
234
256
|
end
|
235
257
|
|
@@ -268,37 +290,30 @@ module NetworkApi
|
|
268
290
|
# @param [Hash] attributes Model attributes in the form of hash
|
269
291
|
# @return [Object] Returns the model itself
|
270
292
|
def self.build_from_hash(attributes)
|
271
|
-
new.build_from_hash(attributes)
|
272
|
-
end
|
273
|
-
|
274
|
-
# Builds the object from hash
|
275
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
276
|
-
# @return [Object] Returns the model itself
|
277
|
-
def build_from_hash(attributes)
|
278
293
|
return nil unless attributes.is_a?(Hash)
|
279
294
|
attributes = attributes.transform_keys(&:to_sym)
|
280
|
-
|
281
|
-
|
282
|
-
|
295
|
+
transformed_hash = {}
|
296
|
+
openapi_types.each_pair do |key, type|
|
297
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
298
|
+
transformed_hash["#{key}"] = nil
|
283
299
|
elsif type =~ /\AArray<(.*)>/i
|
284
300
|
# check to ensure the input is an array given that the attribute
|
285
301
|
# is documented as an array but the input is not
|
286
|
-
if attributes[
|
287
|
-
|
302
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
303
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
288
304
|
end
|
289
|
-
elsif !attributes[
|
290
|
-
|
305
|
+
elsif !attributes[attribute_map[key]].nil?
|
306
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
291
307
|
end
|
292
308
|
end
|
293
|
-
|
294
|
-
self
|
309
|
+
new(transformed_hash)
|
295
310
|
end
|
296
311
|
|
297
312
|
# Deserializes the data based on type
|
298
313
|
# @param string type Data type
|
299
314
|
# @param string value Value to be deserialized
|
300
315
|
# @return [Object] Deserialized data
|
301
|
-
def _deserialize(type, value)
|
316
|
+
def self._deserialize(type, value)
|
302
317
|
case type.to_sym
|
303
318
|
when :Time
|
304
319
|
Time.parse(value)
|
@@ -333,7 +348,7 @@ module NetworkApi
|
|
333
348
|
else # model
|
334
349
|
# models (e.g. Pet) or oneOf
|
335
350
|
klass = NetworkApi.const_get(type)
|
336
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
351
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
337
352
|
end
|
338
353
|
end
|
339
354
|
|
@@ -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
|
|
@@ -81,6 +81,8 @@ module NetworkApi
|
|
81
81
|
|
82
82
|
if attributes.key?(:'name')
|
83
83
|
self.name = attributes[:'name']
|
84
|
+
else
|
85
|
+
self.name = nil
|
84
86
|
end
|
85
87
|
|
86
88
|
if attributes.key?(:'description')
|
@@ -89,6 +91,8 @@ module NetworkApi
|
|
89
91
|
|
90
92
|
if attributes.key?(:'location')
|
91
93
|
self.location = attributes[:'location']
|
94
|
+
else
|
95
|
+
self.location = nil
|
92
96
|
end
|
93
97
|
|
94
98
|
if attributes.key?(:'vlan_id')
|
@@ -105,6 +109,7 @@ module NetworkApi
|
|
105
109
|
# Show invalid properties with the reasons. Usually used together with valid?
|
106
110
|
# @return Array for valid properties with the reasons
|
107
111
|
def list_invalid_properties
|
112
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
108
113
|
invalid_properties = Array.new
|
109
114
|
if @name.nil?
|
110
115
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
@@ -118,6 +123,11 @@ module NetworkApi
|
|
118
123
|
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
119
124
|
end
|
120
125
|
|
126
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
|
127
|
+
if @name !~ pattern
|
128
|
+
invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
|
129
|
+
end
|
130
|
+
|
121
131
|
if !@description.nil? && @description.to_s.length > 250
|
122
132
|
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
|
123
133
|
end
|
@@ -144,9 +154,11 @@ module NetworkApi
|
|
144
154
|
# Check to see if the all the properties in the model are valid
|
145
155
|
# @return true if the model is valid
|
146
156
|
def valid?
|
157
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
147
158
|
return false if @name.nil?
|
148
159
|
return false if @name.to_s.length > 100
|
149
160
|
return false if @name.to_s.length < 1
|
161
|
+
return false if @name !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
|
150
162
|
return false if !@description.nil? && @description.to_s.length > 250
|
151
163
|
return false if @location.nil?
|
152
164
|
return false if !@vlan_id.nil? && @vlan_id > 4094
|
@@ -170,13 +182,22 @@ module NetworkApi
|
|
170
182
|
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
171
183
|
end
|
172
184
|
|
185
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
|
186
|
+
if name !~ pattern
|
187
|
+
fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
|
188
|
+
end
|
189
|
+
|
173
190
|
@name = name
|
174
191
|
end
|
175
192
|
|
176
193
|
# Custom attribute writer method with validation
|
177
194
|
# @param [Object] description Value to be assigned
|
178
195
|
def description=(description)
|
179
|
-
if
|
196
|
+
if description.nil?
|
197
|
+
fail ArgumentError, 'description cannot be nil'
|
198
|
+
end
|
199
|
+
|
200
|
+
if description.to_s.length > 250
|
180
201
|
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
|
181
202
|
end
|
182
203
|
|
@@ -186,11 +207,15 @@ module NetworkApi
|
|
186
207
|
# Custom attribute writer method with validation
|
187
208
|
# @param [Object] vlan_id Value to be assigned
|
188
209
|
def vlan_id=(vlan_id)
|
189
|
-
if
|
210
|
+
if vlan_id.nil?
|
211
|
+
fail ArgumentError, 'vlan_id cannot be nil'
|
212
|
+
end
|
213
|
+
|
214
|
+
if vlan_id > 4094
|
190
215
|
fail ArgumentError, 'invalid value for "vlan_id", must be smaller than or equal to 4094.'
|
191
216
|
end
|
192
217
|
|
193
|
-
if
|
218
|
+
if vlan_id < 2
|
194
219
|
fail ArgumentError, 'invalid value for "vlan_id", must be greater than or equal to 2.'
|
195
220
|
end
|
196
221
|
|
@@ -200,7 +225,11 @@ module NetworkApi
|
|
200
225
|
# Custom attribute writer method with validation
|
201
226
|
# @param [Object] ip_blocks Value to be assigned
|
202
227
|
def ip_blocks=(ip_blocks)
|
203
|
-
if
|
228
|
+
if ip_blocks.nil?
|
229
|
+
fail ArgumentError, 'ip_blocks cannot be nil'
|
230
|
+
end
|
231
|
+
|
232
|
+
if ip_blocks.length > 10
|
204
233
|
fail ArgumentError, 'invalid value for "ip_blocks", number of items must be less than or equal to 10.'
|
205
234
|
end
|
206
235
|
|
@@ -235,37 +264,30 @@ module NetworkApi
|
|
235
264
|
# @param [Hash] attributes Model attributes in the form of hash
|
236
265
|
# @return [Object] Returns the model itself
|
237
266
|
def self.build_from_hash(attributes)
|
238
|
-
new.build_from_hash(attributes)
|
239
|
-
end
|
240
|
-
|
241
|
-
# Builds the object from hash
|
242
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
243
|
-
# @return [Object] Returns the model itself
|
244
|
-
def build_from_hash(attributes)
|
245
267
|
return nil unless attributes.is_a?(Hash)
|
246
268
|
attributes = attributes.transform_keys(&:to_sym)
|
247
|
-
|
248
|
-
|
249
|
-
|
269
|
+
transformed_hash = {}
|
270
|
+
openapi_types.each_pair do |key, type|
|
271
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
272
|
+
transformed_hash["#{key}"] = nil
|
250
273
|
elsif type =~ /\AArray<(.*)>/i
|
251
274
|
# check to ensure the input is an array given that the attribute
|
252
275
|
# is documented as an array but the input is not
|
253
|
-
if attributes[
|
254
|
-
|
276
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
277
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
255
278
|
end
|
256
|
-
elsif !attributes[
|
257
|
-
|
279
|
+
elsif !attributes[attribute_map[key]].nil?
|
280
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
258
281
|
end
|
259
282
|
end
|
260
|
-
|
261
|
-
self
|
283
|
+
new(transformed_hash)
|
262
284
|
end
|
263
285
|
|
264
286
|
# Deserializes the data based on type
|
265
287
|
# @param string type Data type
|
266
288
|
# @param string value Value to be deserialized
|
267
289
|
# @return [Object] Deserialized data
|
268
|
-
def _deserialize(type, value)
|
290
|
+
def self._deserialize(type, value)
|
269
291
|
case type.to_sym
|
270
292
|
when :Time
|
271
293
|
Time.parse(value)
|
@@ -300,7 +322,7 @@ module NetworkApi
|
|
300
322
|
else # model
|
301
323
|
# models (e.g. Pet) or oneOf
|
302
324
|
klass = NetworkApi.const_get(type)
|
303
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
325
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
304
326
|
end
|
305
327
|
end
|
306
328
|
|
@@ -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
|
|
@@ -61,12 +61,15 @@ module NetworkApi
|
|
61
61
|
|
62
62
|
if attributes.key?(:'id')
|
63
63
|
self.id = attributes[:'id']
|
64
|
+
else
|
65
|
+
self.id = nil
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
67
69
|
# Show invalid properties with the reasons. Usually used together with valid?
|
68
70
|
# @return Array for valid properties with the reasons
|
69
71
|
def list_invalid_properties
|
72
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
70
73
|
invalid_properties = Array.new
|
71
74
|
if @id.nil?
|
72
75
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
@@ -78,6 +81,7 @@ module NetworkApi
|
|
78
81
|
# Check to see if the all the properties in the model are valid
|
79
82
|
# @return true if the model is valid
|
80
83
|
def valid?
|
84
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
81
85
|
return false if @id.nil?
|
82
86
|
true
|
83
87
|
end
|
@@ -106,37 +110,30 @@ module NetworkApi
|
|
106
110
|
# @param [Hash] attributes Model attributes in the form of hash
|
107
111
|
# @return [Object] Returns the model itself
|
108
112
|
def self.build_from_hash(attributes)
|
109
|
-
new.build_from_hash(attributes)
|
110
|
-
end
|
111
|
-
|
112
|
-
# Builds the object from hash
|
113
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
-
# @return [Object] Returns the model itself
|
115
|
-
def build_from_hash(attributes)
|
116
113
|
return nil unless attributes.is_a?(Hash)
|
117
114
|
attributes = attributes.transform_keys(&:to_sym)
|
118
|
-
|
119
|
-
|
120
|
-
|
115
|
+
transformed_hash = {}
|
116
|
+
openapi_types.each_pair do |key, type|
|
117
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
118
|
+
transformed_hash["#{key}"] = nil
|
121
119
|
elsif type =~ /\AArray<(.*)>/i
|
122
120
|
# check to ensure the input is an array given that the attribute
|
123
121
|
# is documented as an array but the input is not
|
124
|
-
if attributes[
|
125
|
-
|
122
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
123
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
126
124
|
end
|
127
|
-
elsif !attributes[
|
128
|
-
|
125
|
+
elsif !attributes[attribute_map[key]].nil?
|
126
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
129
127
|
end
|
130
128
|
end
|
131
|
-
|
132
|
-
self
|
129
|
+
new(transformed_hash)
|
133
130
|
end
|
134
131
|
|
135
132
|
# Deserializes the data based on type
|
136
133
|
# @param string type Data type
|
137
134
|
# @param string value Value to be deserialized
|
138
135
|
# @return [Object] Deserialized data
|
139
|
-
def _deserialize(type, value)
|
136
|
+
def self._deserialize(type, value)
|
140
137
|
case type.to_sym
|
141
138
|
when :Time
|
142
139
|
Time.parse(value)
|
@@ -171,7 +168,7 @@ module NetworkApi
|
|
171
168
|
else # model
|
172
169
|
# models (e.g. Pet) or oneOf
|
173
170
|
klass = NetworkApi.const_get(type)
|
174
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
171
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
175
172
|
end
|
176
173
|
end
|
177
174
|
|