pnap_network_api 1.3.2 → 2.0.1
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/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 +26 -23
- 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 +35 -20
- 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 +9 -17
- 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
|
|
@@ -32,6 +32,7 @@ module NetworkApi
|
|
32
32
|
end
|
33
33
|
else
|
34
34
|
super arg
|
35
|
+
@message = arg
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -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
|
|
@@ -62,6 +62,16 @@ module NetworkApi
|
|
62
62
|
# Defines the access token (Bearer) used with OAuth2.
|
63
63
|
attr_accessor :access_token
|
64
64
|
|
65
|
+
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
|
66
|
+
# Overrides the access_token if set
|
67
|
+
# @return [Proc]
|
68
|
+
attr_accessor :access_token_getter
|
69
|
+
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
72
|
+
# Default to false.
|
73
|
+
attr_accessor :return_binary_data
|
74
|
+
|
65
75
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
66
76
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
67
77
|
# Default to false.
|
@@ -142,7 +152,7 @@ module NetworkApi
|
|
142
152
|
@scheme = 'https'
|
143
153
|
@host = 'api.phoenixnap.com'
|
144
154
|
@base_path = '/networks/v1'
|
145
|
-
@server_index =
|
155
|
+
@server_index = nil
|
146
156
|
@server_operation_index = {}
|
147
157
|
@server_variables = {}
|
148
158
|
@server_operation_variables = {}
|
@@ -190,10 +200,12 @@ module NetworkApi
|
|
190
200
|
|
191
201
|
# Returns base URL for specified operation based on server settings
|
192
202
|
def base_url(operation = nil)
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
203
|
+
if operation_server_settings.key?(operation) then
|
204
|
+
index = server_operation_index.fetch(operation, server_index)
|
205
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
206
|
+
else
|
207
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
208
|
+
end
|
197
209
|
end
|
198
210
|
|
199
211
|
# Gets API key (with prefix if set).
|
@@ -208,6 +220,12 @@ module NetworkApi
|
|
208
220
|
end
|
209
221
|
end
|
210
222
|
|
223
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
224
|
+
def access_token_with_refresh
|
225
|
+
return access_token if access_token_getter.nil?
|
226
|
+
access_token_getter.call
|
227
|
+
end
|
228
|
+
|
211
229
|
# Gets Basic Auth token string
|
212
230
|
def basic_auth_token
|
213
231
|
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
@@ -221,7 +239,7 @@ module NetworkApi
|
|
221
239
|
type: 'oauth2',
|
222
240
|
in: 'header',
|
223
241
|
key: 'Authorization',
|
224
|
-
value: "Bearer #{
|
242
|
+
value: "Bearer #{access_token_with_refresh}"
|
225
243
|
},
|
226
244
|
}
|
227
245
|
end
|
@@ -249,8 +267,8 @@ module NetworkApi
|
|
249
267
|
servers = server_settings if servers == nil
|
250
268
|
|
251
269
|
# check array index out of bound
|
252
|
-
if (index < 0 || index >= servers.size)
|
253
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
270
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
271
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
254
272
|
end
|
255
273
|
|
256
274
|
server = servers[index]
|
@@ -275,5 +293,6 @@ module NetworkApi
|
|
275
293
|
url
|
276
294
|
end
|
277
295
|
|
296
|
+
|
278
297
|
end
|
279
298
|
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:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -65,6 +65,8 @@ module NetworkApi
|
|
65
65
|
|
66
66
|
if attributes.key?(:'message')
|
67
67
|
self.message = attributes[:'message']
|
68
|
+
else
|
69
|
+
self.message = nil
|
68
70
|
end
|
69
71
|
|
70
72
|
if attributes.key?(:'validation_errors')
|
@@ -77,6 +79,7 @@ module NetworkApi
|
|
77
79
|
# Show invalid properties with the reasons. Usually used together with valid?
|
78
80
|
# @return Array for valid properties with the reasons
|
79
81
|
def list_invalid_properties
|
82
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
80
83
|
invalid_properties = Array.new
|
81
84
|
if @message.nil?
|
82
85
|
invalid_properties.push('invalid value for "message", message cannot be nil.')
|
@@ -88,6 +91,7 @@ module NetworkApi
|
|
88
91
|
# Check to see if the all the properties in the model are valid
|
89
92
|
# @return true if the model is valid
|
90
93
|
def valid?
|
94
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
91
95
|
return false if @message.nil?
|
92
96
|
true
|
93
97
|
end
|
@@ -117,37 +121,30 @@ module NetworkApi
|
|
117
121
|
# @param [Hash] attributes Model attributes in the form of hash
|
118
122
|
# @return [Object] Returns the model itself
|
119
123
|
def self.build_from_hash(attributes)
|
120
|
-
new.build_from_hash(attributes)
|
121
|
-
end
|
122
|
-
|
123
|
-
# Builds the object from hash
|
124
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
-
# @return [Object] Returns the model itself
|
126
|
-
def build_from_hash(attributes)
|
127
124
|
return nil unless attributes.is_a?(Hash)
|
128
125
|
attributes = attributes.transform_keys(&:to_sym)
|
129
|
-
|
130
|
-
|
131
|
-
|
126
|
+
transformed_hash = {}
|
127
|
+
openapi_types.each_pair do |key, type|
|
128
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
129
|
+
transformed_hash["#{key}"] = nil
|
132
130
|
elsif type =~ /\AArray<(.*)>/i
|
133
131
|
# check to ensure the input is an array given that the attribute
|
134
132
|
# is documented as an array but the input is not
|
135
|
-
if attributes[
|
136
|
-
|
133
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
134
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
137
135
|
end
|
138
|
-
elsif !attributes[
|
139
|
-
|
136
|
+
elsif !attributes[attribute_map[key]].nil?
|
137
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
140
138
|
end
|
141
139
|
end
|
142
|
-
|
143
|
-
self
|
140
|
+
new(transformed_hash)
|
144
141
|
end
|
145
142
|
|
146
143
|
# Deserializes the data based on type
|
147
144
|
# @param string type Data type
|
148
145
|
# @param string value Value to be deserialized
|
149
146
|
# @return [Object] Deserialized data
|
150
|
-
def _deserialize(type, value)
|
147
|
+
def self._deserialize(type, value)
|
151
148
|
case type.to_sym
|
152
149
|
when :Time
|
153
150
|
Time.parse(value)
|
@@ -182,7 +179,7 @@ module NetworkApi
|
|
182
179
|
else # model
|
183
180
|
# models (e.g. Pet) or oneOf
|
184
181
|
klass = NetworkApi.const_get(type)
|
185
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
182
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
186
183
|
end
|
187
184
|
end
|
188
185
|
|
@@ -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,22 +71,29 @@ module NetworkApi
|
|
71
71
|
|
72
72
|
if attributes.key?(:'resource_id')
|
73
73
|
self.resource_id = attributes[:'resource_id']
|
74
|
+
else
|
75
|
+
self.resource_id = nil
|
74
76
|
end
|
75
77
|
|
76
78
|
if attributes.key?(:'resource_type')
|
77
79
|
self.resource_type = attributes[:'resource_type']
|
80
|
+
else
|
81
|
+
self.resource_type = nil
|
78
82
|
end
|
79
83
|
|
80
84
|
if attributes.key?(:'ips')
|
81
85
|
if (value = attributes[:'ips']).is_a?(Array)
|
82
86
|
self.ips = value
|
83
87
|
end
|
88
|
+
else
|
89
|
+
self.ips = nil
|
84
90
|
end
|
85
91
|
end
|
86
92
|
|
87
93
|
# Show invalid properties with the reasons. Usually used together with valid?
|
88
94
|
# @return Array for valid properties with the reasons
|
89
95
|
def list_invalid_properties
|
96
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
90
97
|
invalid_properties = Array.new
|
91
98
|
if @resource_id.nil?
|
92
99
|
invalid_properties.push('invalid value for "resource_id", resource_id cannot be nil.')
|
@@ -106,6 +113,7 @@ module NetworkApi
|
|
106
113
|
# Check to see if the all the properties in the model are valid
|
107
114
|
# @return true if the model is valid
|
108
115
|
def valid?
|
116
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
109
117
|
return false if @resource_id.nil?
|
110
118
|
return false if @resource_type.nil?
|
111
119
|
return false if @ips.nil?
|
@@ -138,37 +146,30 @@ module NetworkApi
|
|
138
146
|
# @param [Hash] attributes Model attributes in the form of hash
|
139
147
|
# @return [Object] Returns the model itself
|
140
148
|
def self.build_from_hash(attributes)
|
141
|
-
new.build_from_hash(attributes)
|
142
|
-
end
|
143
|
-
|
144
|
-
# Builds the object from hash
|
145
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
146
|
-
# @return [Object] Returns the model itself
|
147
|
-
def build_from_hash(attributes)
|
148
149
|
return nil unless attributes.is_a?(Hash)
|
149
150
|
attributes = attributes.transform_keys(&:to_sym)
|
150
|
-
|
151
|
-
|
152
|
-
|
151
|
+
transformed_hash = {}
|
152
|
+
openapi_types.each_pair do |key, type|
|
153
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
154
|
+
transformed_hash["#{key}"] = nil
|
153
155
|
elsif type =~ /\AArray<(.*)>/i
|
154
156
|
# check to ensure the input is an array given that the attribute
|
155
157
|
# is documented as an array but the input is not
|
156
|
-
if attributes[
|
157
|
-
|
158
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
159
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
158
160
|
end
|
159
|
-
elsif !attributes[
|
160
|
-
|
161
|
+
elsif !attributes[attribute_map[key]].nil?
|
162
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
161
163
|
end
|
162
164
|
end
|
163
|
-
|
164
|
-
self
|
165
|
+
new(transformed_hash)
|
165
166
|
end
|
166
167
|
|
167
168
|
# Deserializes the data based on type
|
168
169
|
# @param string type Data type
|
169
170
|
# @param string value Value to be deserialized
|
170
171
|
# @return [Object] Deserialized data
|
171
|
-
def _deserialize(type, value)
|
172
|
+
def self._deserialize(type, value)
|
172
173
|
case type.to_sym
|
173
174
|
when :Time
|
174
175
|
Time.parse(value)
|
@@ -203,7 +204,7 @@ module NetworkApi
|
|
203
204
|
else # model
|
204
205
|
# models (e.g. Pet) or oneOf
|
205
206
|
klass = NetworkApi.const_get(type)
|
206
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
207
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
207
208
|
end
|
208
209
|
end
|
209
210
|
|
@@ -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
|
|
@@ -45,7 +45,7 @@ module NetworkApi
|
|
45
45
|
# A list of resources that are members of this private network.
|
46
46
|
attr_accessor :memberships
|
47
47
|
|
48
|
-
# The status of the private network. Can have one of the following values: `BUSY` or `
|
48
|
+
# The status of the private network. Can have one of the following values: `BUSY`, `READY`, `DELETING` or `ERROR`.
|
49
49
|
attr_accessor :status
|
50
50
|
|
51
51
|
# Date and time when this private network was created.
|
@@ -115,10 +115,14 @@ module NetworkApi
|
|
115
115
|
|
116
116
|
if attributes.key?(:'id')
|
117
117
|
self.id = attributes[:'id']
|
118
|
+
else
|
119
|
+
self.id = nil
|
118
120
|
end
|
119
121
|
|
120
122
|
if attributes.key?(:'name')
|
121
123
|
self.name = attributes[:'name']
|
124
|
+
else
|
125
|
+
self.name = nil
|
122
126
|
end
|
123
127
|
|
124
128
|
if attributes.key?(:'description')
|
@@ -127,18 +131,26 @@ module NetworkApi
|
|
127
131
|
|
128
132
|
if attributes.key?(:'vlan_id')
|
129
133
|
self.vlan_id = attributes[:'vlan_id']
|
134
|
+
else
|
135
|
+
self.vlan_id = nil
|
130
136
|
end
|
131
137
|
|
132
138
|
if attributes.key?(:'type')
|
133
139
|
self.type = attributes[:'type']
|
140
|
+
else
|
141
|
+
self.type = nil
|
134
142
|
end
|
135
143
|
|
136
144
|
if attributes.key?(:'location')
|
137
145
|
self.location = attributes[:'location']
|
146
|
+
else
|
147
|
+
self.location = nil
|
138
148
|
end
|
139
149
|
|
140
150
|
if attributes.key?(:'location_default')
|
141
151
|
self.location_default = attributes[:'location_default']
|
152
|
+
else
|
153
|
+
self.location_default = nil
|
142
154
|
end
|
143
155
|
|
144
156
|
if attributes.key?(:'cidr')
|
@@ -149,26 +161,35 @@ module NetworkApi
|
|
149
161
|
if (value = attributes[:'servers']).is_a?(Array)
|
150
162
|
self.servers = value
|
151
163
|
end
|
164
|
+
else
|
165
|
+
self.servers = nil
|
152
166
|
end
|
153
167
|
|
154
168
|
if attributes.key?(:'memberships')
|
155
169
|
if (value = attributes[:'memberships']).is_a?(Array)
|
156
170
|
self.memberships = value
|
157
171
|
end
|
172
|
+
else
|
173
|
+
self.memberships = nil
|
158
174
|
end
|
159
175
|
|
160
176
|
if attributes.key?(:'status')
|
161
177
|
self.status = attributes[:'status']
|
178
|
+
else
|
179
|
+
self.status = nil
|
162
180
|
end
|
163
181
|
|
164
182
|
if attributes.key?(:'created_on')
|
165
183
|
self.created_on = attributes[:'created_on']
|
184
|
+
else
|
185
|
+
self.created_on = nil
|
166
186
|
end
|
167
187
|
end
|
168
188
|
|
169
189
|
# Show invalid properties with the reasons. Usually used together with valid?
|
170
190
|
# @return Array for valid properties with the reasons
|
171
191
|
def list_invalid_properties
|
192
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
172
193
|
invalid_properties = Array.new
|
173
194
|
if @id.nil?
|
174
195
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
@@ -228,6 +249,7 @@ module NetworkApi
|
|
228
249
|
# Check to see if the all the properties in the model are valid
|
229
250
|
# @return true if the model is valid
|
230
251
|
def valid?
|
252
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
231
253
|
return false if @id.nil?
|
232
254
|
return false if @name.nil?
|
233
255
|
return false if @name.to_s.length > 100
|
@@ -265,7 +287,11 @@ module NetworkApi
|
|
265
287
|
# Custom attribute writer method with validation
|
266
288
|
# @param [Object] description Value to be assigned
|
267
289
|
def description=(description)
|
268
|
-
if
|
290
|
+
if description.nil?
|
291
|
+
fail ArgumentError, 'description cannot be nil'
|
292
|
+
end
|
293
|
+
|
294
|
+
if description.to_s.length > 250
|
269
295
|
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
|
270
296
|
end
|
271
297
|
|
@@ -307,37 +333,30 @@ module NetworkApi
|
|
307
333
|
# @param [Hash] attributes Model attributes in the form of hash
|
308
334
|
# @return [Object] Returns the model itself
|
309
335
|
def self.build_from_hash(attributes)
|
310
|
-
new.build_from_hash(attributes)
|
311
|
-
end
|
312
|
-
|
313
|
-
# Builds the object from hash
|
314
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
315
|
-
# @return [Object] Returns the model itself
|
316
|
-
def build_from_hash(attributes)
|
317
336
|
return nil unless attributes.is_a?(Hash)
|
318
337
|
attributes = attributes.transform_keys(&:to_sym)
|
319
|
-
|
320
|
-
|
321
|
-
|
338
|
+
transformed_hash = {}
|
339
|
+
openapi_types.each_pair do |key, type|
|
340
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
341
|
+
transformed_hash["#{key}"] = nil
|
322
342
|
elsif type =~ /\AArray<(.*)>/i
|
323
343
|
# check to ensure the input is an array given that the attribute
|
324
344
|
# is documented as an array but the input is not
|
325
|
-
if attributes[
|
326
|
-
|
345
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
346
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
327
347
|
end
|
328
|
-
elsif !attributes[
|
329
|
-
|
348
|
+
elsif !attributes[attribute_map[key]].nil?
|
349
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
330
350
|
end
|
331
351
|
end
|
332
|
-
|
333
|
-
self
|
352
|
+
new(transformed_hash)
|
334
353
|
end
|
335
354
|
|
336
355
|
# Deserializes the data based on type
|
337
356
|
# @param string type Data type
|
338
357
|
# @param string value Value to be deserialized
|
339
358
|
# @return [Object] Deserialized data
|
340
|
-
def _deserialize(type, value)
|
359
|
+
def self._deserialize(type, value)
|
341
360
|
case type.to_sym
|
342
361
|
when :Time
|
343
362
|
Time.parse(value)
|
@@ -372,7 +391,7 @@ module NetworkApi
|
|
372
391
|
else # model
|
373
392
|
# models (e.g. Pet) or oneOf
|
374
393
|
klass = NetworkApi.const_get(type)
|
375
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
394
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
376
395
|
end
|
377
396
|
end
|
378
397
|
|
@@ -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
|
|
@@ -86,6 +86,8 @@ module NetworkApi
|
|
86
86
|
|
87
87
|
if attributes.key?(:'name')
|
88
88
|
self.name = attributes[:'name']
|
89
|
+
else
|
90
|
+
self.name = nil
|
89
91
|
end
|
90
92
|
|
91
93
|
if attributes.key?(:'description')
|
@@ -94,6 +96,8 @@ module NetworkApi
|
|
94
96
|
|
95
97
|
if attributes.key?(:'location')
|
96
98
|
self.location = attributes[:'location']
|
99
|
+
else
|
100
|
+
self.location = nil
|
97
101
|
end
|
98
102
|
|
99
103
|
if attributes.key?(:'location_default')
|
@@ -114,6 +118,7 @@ module NetworkApi
|
|
114
118
|
# Show invalid properties with the reasons. Usually used together with valid?
|
115
119
|
# @return Array for valid properties with the reasons
|
116
120
|
def list_invalid_properties
|
121
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
117
122
|
invalid_properties = Array.new
|
118
123
|
if @name.nil?
|
119
124
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
@@ -127,6 +132,11 @@ module NetworkApi
|
|
127
132
|
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
128
133
|
end
|
129
134
|
|
135
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
|
136
|
+
if @name !~ pattern
|
137
|
+
invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
|
138
|
+
end
|
139
|
+
|
130
140
|
if !@description.nil? && @description.to_s.length > 250
|
131
141
|
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
|
132
142
|
end
|
@@ -149,9 +159,11 @@ module NetworkApi
|
|
149
159
|
# Check to see if the all the properties in the model are valid
|
150
160
|
# @return true if the model is valid
|
151
161
|
def valid?
|
162
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
152
163
|
return false if @name.nil?
|
153
164
|
return false if @name.to_s.length > 100
|
154
165
|
return false if @name.to_s.length < 1
|
166
|
+
return false if @name !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
|
155
167
|
return false if !@description.nil? && @description.to_s.length > 250
|
156
168
|
return false if @location.nil?
|
157
169
|
return false if !@vlan_id.nil? && @vlan_id > 4094
|
@@ -174,13 +186,22 @@ module NetworkApi
|
|
174
186
|
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
175
187
|
end
|
176
188
|
|
189
|
+
pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/)
|
190
|
+
if name !~ pattern
|
191
|
+
fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
|
192
|
+
end
|
193
|
+
|
177
194
|
@name = name
|
178
195
|
end
|
179
196
|
|
180
197
|
# Custom attribute writer method with validation
|
181
198
|
# @param [Object] description Value to be assigned
|
182
199
|
def description=(description)
|
183
|
-
if
|
200
|
+
if description.nil?
|
201
|
+
fail ArgumentError, 'description cannot be nil'
|
202
|
+
end
|
203
|
+
|
204
|
+
if description.to_s.length > 250
|
184
205
|
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
|
185
206
|
end
|
186
207
|
|
@@ -190,11 +211,15 @@ module NetworkApi
|
|
190
211
|
# Custom attribute writer method with validation
|
191
212
|
# @param [Object] vlan_id Value to be assigned
|
192
213
|
def vlan_id=(vlan_id)
|
193
|
-
if
|
214
|
+
if vlan_id.nil?
|
215
|
+
fail ArgumentError, 'vlan_id cannot be nil'
|
216
|
+
end
|
217
|
+
|
218
|
+
if vlan_id > 4094
|
194
219
|
fail ArgumentError, 'invalid value for "vlan_id", must be smaller than or equal to 4094.'
|
195
220
|
end
|
196
221
|
|
197
|
-
if
|
222
|
+
if vlan_id < 2
|
198
223
|
fail ArgumentError, 'invalid value for "vlan_id", must be greater than or equal to 2.'
|
199
224
|
end
|
200
225
|
|
@@ -230,37 +255,30 @@ module NetworkApi
|
|
230
255
|
# @param [Hash] attributes Model attributes in the form of hash
|
231
256
|
# @return [Object] Returns the model itself
|
232
257
|
def self.build_from_hash(attributes)
|
233
|
-
new.build_from_hash(attributes)
|
234
|
-
end
|
235
|
-
|
236
|
-
# Builds the object from hash
|
237
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
238
|
-
# @return [Object] Returns the model itself
|
239
|
-
def build_from_hash(attributes)
|
240
258
|
return nil unless attributes.is_a?(Hash)
|
241
259
|
attributes = attributes.transform_keys(&:to_sym)
|
242
|
-
|
243
|
-
|
244
|
-
|
260
|
+
transformed_hash = {}
|
261
|
+
openapi_types.each_pair do |key, type|
|
262
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
263
|
+
transformed_hash["#{key}"] = nil
|
245
264
|
elsif type =~ /\AArray<(.*)>/i
|
246
265
|
# check to ensure the input is an array given that the attribute
|
247
266
|
# is documented as an array but the input is not
|
248
|
-
if attributes[
|
249
|
-
|
267
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
268
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
250
269
|
end
|
251
|
-
elsif !attributes[
|
252
|
-
|
270
|
+
elsif !attributes[attribute_map[key]].nil?
|
271
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
253
272
|
end
|
254
273
|
end
|
255
|
-
|
256
|
-
self
|
274
|
+
new(transformed_hash)
|
257
275
|
end
|
258
276
|
|
259
277
|
# Deserializes the data based on type
|
260
278
|
# @param string type Data type
|
261
279
|
# @param string value Value to be deserialized
|
262
280
|
# @return [Object] Deserialized data
|
263
|
-
def _deserialize(type, value)
|
281
|
+
def self._deserialize(type, value)
|
264
282
|
case type.to_sym
|
265
283
|
when :Time
|
266
284
|
Time.parse(value)
|
@@ -295,7 +313,7 @@ module NetworkApi
|
|
295
313
|
else # model
|
296
314
|
# models (e.g. Pet) or oneOf
|
297
315
|
klass = NetworkApi.const_get(type)
|
298
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
316
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
299
317
|
end
|
300
318
|
end
|
301
319
|
|