pnap_network_api 2.0.1 → 2.1.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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -7
  3. data/VERSION +1 -1
  4. data/docs/AsnDetails.md +24 -0
  5. data/docs/BGPPeerGroupsApi.md +361 -0
  6. data/docs/BgpIPv4Prefix.md +26 -0
  7. data/docs/BgpPeerGroup.md +46 -0
  8. data/docs/BgpPeerGroupCreate.md +24 -0
  9. data/docs/BgpPeerGroupPatch.md +22 -0
  10. data/docs/PublicNetwork.md +3 -1
  11. data/docs/PublicNetworkCreate.md +4 -2
  12. data/docs/PublicNetworkIpBlock.md +5 -1
  13. data/docs/PublicNetworkIpBlockCreate.md +18 -0
  14. data/docs/PublicNetworkModify.md +3 -1
  15. data/docs/PublicNetworksApi.md +6 -6
  16. data/lib/pnap_network_api/api/bgp_peer_groups_api.rb +350 -0
  17. data/lib/pnap_network_api/api/private_networks_api.rb +1 -1
  18. data/lib/pnap_network_api/api/public_networks_api.rb +10 -10
  19. data/lib/pnap_network_api/api_client.rb +1 -1
  20. data/lib/pnap_network_api/api_error.rb +1 -1
  21. data/lib/pnap_network_api/configuration.rb +1 -1
  22. data/lib/pnap_network_api/models/asn_details.rb +267 -0
  23. data/lib/pnap_network_api/models/bgp_ipv4_prefix.rb +312 -0
  24. data/lib/pnap_network_api/models/bgp_peer_group.rb +481 -0
  25. data/lib/pnap_network_api/models/bgp_peer_group_create.rb +306 -0
  26. data/lib/pnap_network_api/models/bgp_peer_group_patch.rb +275 -0
  27. data/lib/pnap_network_api/models/error.rb +1 -1
  28. data/lib/pnap_network_api/models/network_membership.rb +1 -1
  29. data/lib/pnap_network_api/models/private_network.rb +1 -1
  30. data/lib/pnap_network_api/models/private_network_create.rb +1 -1
  31. data/lib/pnap_network_api/models/private_network_modify.rb +1 -1
  32. data/lib/pnap_network_api/models/private_network_server.rb +1 -1
  33. data/lib/pnap_network_api/models/public_network.rb +15 -5
  34. data/lib/pnap_network_api/models/public_network_create.rb +21 -11
  35. data/lib/pnap_network_api/models/public_network_ip_block.rb +39 -5
  36. data/lib/pnap_network_api/models/public_network_ip_block_create.rb +223 -0
  37. data/lib/pnap_network_api/models/public_network_modify.rb +15 -5
  38. data/lib/pnap_network_api/version.rb +1 -1
  39. data/lib/pnap_network_api.rb +8 -1
  40. data/pnap_network_api.gemspec +1 -1
  41. data/spec/api/bgp_peer_groups_api_spec.rb +96 -0
  42. data/spec/api/private_networks_api_spec.rb +1 -1
  43. data/spec/api/public_networks_api_spec.rb +2 -2
  44. data/spec/models/asn_details_spec.rb +54 -0
  45. data/spec/models/bgp_ipv4_prefix_spec.rb +60 -0
  46. data/spec/models/bgp_peer_group_create_spec.rb +54 -0
  47. data/spec/models/bgp_peer_group_patch_spec.rb +48 -0
  48. data/spec/models/bgp_peer_group_spec.rb +120 -0
  49. data/spec/models/error_spec.rb +1 -1
  50. data/spec/models/network_membership_spec.rb +1 -1
  51. data/spec/models/private_network_create_spec.rb +1 -1
  52. data/spec/models/private_network_modify_spec.rb +1 -1
  53. data/spec/models/private_network_server_spec.rb +1 -1
  54. data/spec/models/private_network_spec.rb +1 -1
  55. data/spec/models/public_network_create_spec.rb +7 -1
  56. data/spec/models/public_network_ip_block_create_spec.rb +36 -0
  57. data/spec/models/public_network_ip_block_spec.rb +13 -1
  58. data/spec/models/public_network_modify_spec.rb +7 -1
  59. data/spec/models/public_network_spec.rb +7 -1
  60. data/spec/spec_helper.rb +1 -1
  61. metadata +40 -12
@@ -0,0 +1,306 @@
1
+ =begin
2
+ #Networks API
3
+
4
+ #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a>, <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a> and <a href='https://phoenixnap.com/kb/border-gateway-protocol-bmc' target='_blank'>border gateway protocol peer groups</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module NetworkApi
17
+ # Create a BGP Peer Group.
18
+ class BgpPeerGroupCreate
19
+ # The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`.
20
+ attr_accessor :location
21
+
22
+ # The BGP Peer Group ASN.
23
+ attr_accessor :asn
24
+
25
+ # The BGP Peer Group password.
26
+ attr_accessor :password
27
+
28
+ # The Advertised routes for the BGP Peer Group. Can have one of the following values: `DEFAULT` and `NONE`.
29
+ attr_accessor :advertised_routes
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'location' => :'location',
35
+ :'asn' => :'asn',
36
+ :'password' => :'password',
37
+ :'advertised_routes' => :'advertisedRoutes'
38
+ }
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'location' => :'String',
50
+ :'asn' => :'Integer',
51
+ :'password' => :'String',
52
+ :'advertised_routes' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `NetworkApi::BgpPeerGroupCreate` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpPeerGroupCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'location')
78
+ self.location = attributes[:'location']
79
+ else
80
+ self.location = nil
81
+ end
82
+
83
+ if attributes.key?(:'asn')
84
+ self.asn = attributes[:'asn']
85
+ else
86
+ self.asn = 65401
87
+ end
88
+
89
+ if attributes.key?(:'password')
90
+ self.password = attributes[:'password']
91
+ end
92
+
93
+ if attributes.key?(:'advertised_routes')
94
+ self.advertised_routes = attributes[:'advertised_routes']
95
+ else
96
+ self.advertised_routes = 'NONE'
97
+ end
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properties with the reasons
102
+ def list_invalid_properties
103
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
104
+ invalid_properties = Array.new
105
+ if @location.nil?
106
+ invalid_properties.push('invalid value for "location", location cannot be nil.')
107
+ end
108
+
109
+ if @asn.nil?
110
+ invalid_properties.push('invalid value for "asn", asn cannot be nil.')
111
+ end
112
+
113
+ if !@password.nil? && @password.to_s.length > 32
114
+ invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 32.')
115
+ end
116
+
117
+ if !@password.nil? && @password.to_s.length < 8
118
+ invalid_properties.push('invalid value for "password", the character length must be great than or equal to 8.')
119
+ end
120
+
121
+ pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
122
+ if !@password.nil? && @password !~ pattern
123
+ invalid_properties.push("invalid value for \"password\", must conform to the pattern #{pattern}.")
124
+ end
125
+
126
+ if @advertised_routes.nil?
127
+ invalid_properties.push('invalid value for "advertised_routes", advertised_routes cannot be nil.')
128
+ end
129
+
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ warn '[DEPRECATED] the `valid?` method is obsolete'
137
+ return false if @location.nil?
138
+ return false if @asn.nil?
139
+ return false if !@password.nil? && @password.to_s.length > 32
140
+ return false if !@password.nil? && @password.to_s.length < 8
141
+ return false if !@password.nil? && @password !~ Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
142
+ return false if @advertised_routes.nil?
143
+ true
144
+ end
145
+
146
+ # Custom attribute writer method with validation
147
+ # @param [Object] password Value to be assigned
148
+ def password=(password)
149
+ if password.nil?
150
+ fail ArgumentError, 'password cannot be nil'
151
+ end
152
+
153
+ if password.to_s.length > 32
154
+ fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 32.'
155
+ end
156
+
157
+ if password.to_s.length < 8
158
+ fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 8.'
159
+ end
160
+
161
+ pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
162
+ if password !~ pattern
163
+ fail ArgumentError, "invalid value for \"password\", must conform to the pattern #{pattern}."
164
+ end
165
+
166
+ @password = password
167
+ end
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] Object to be compared
171
+ def ==(o)
172
+ return true if self.equal?(o)
173
+ self.class == o.class &&
174
+ location == o.location &&
175
+ asn == o.asn &&
176
+ password == o.password &&
177
+ advertised_routes == o.advertised_routes
178
+ end
179
+
180
+ # @see the `==` method
181
+ # @param [Object] Object to be compared
182
+ def eql?(o)
183
+ self == o
184
+ end
185
+
186
+ # Calculates hash code according to all attributes.
187
+ # @return [Integer] Hash code
188
+ def hash
189
+ [location, asn, password, advertised_routes].hash
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def self.build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ attributes = attributes.transform_keys(&:to_sym)
198
+ transformed_hash = {}
199
+ openapi_types.each_pair do |key, type|
200
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
201
+ transformed_hash["#{key}"] = nil
202
+ elsif type =~ /\AArray<(.*)>/i
203
+ # check to ensure the input is an array given that the attribute
204
+ # is documented as an array but the input is not
205
+ if attributes[attribute_map[key]].is_a?(Array)
206
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
207
+ end
208
+ elsif !attributes[attribute_map[key]].nil?
209
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
210
+ end
211
+ end
212
+ new(transformed_hash)
213
+ end
214
+
215
+ # Deserializes the data based on type
216
+ # @param string type Data type
217
+ # @param string value Value to be deserialized
218
+ # @return [Object] Deserialized data
219
+ def self._deserialize(type, value)
220
+ case type.to_sym
221
+ when :Time
222
+ Time.parse(value)
223
+ when :Date
224
+ Date.parse(value)
225
+ when :String
226
+ value.to_s
227
+ when :Integer
228
+ value.to_i
229
+ when :Float
230
+ value.to_f
231
+ when :Boolean
232
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
233
+ true
234
+ else
235
+ false
236
+ end
237
+ when :Object
238
+ # generic object (usually a Hash), return directly
239
+ value
240
+ when /\AArray<(?<inner_type>.+)>\z/
241
+ inner_type = Regexp.last_match[:inner_type]
242
+ value.map { |v| _deserialize(inner_type, v) }
243
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
244
+ k_type = Regexp.last_match[:k_type]
245
+ v_type = Regexp.last_match[:v_type]
246
+ {}.tap do |hash|
247
+ value.each do |k, v|
248
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
249
+ end
250
+ end
251
+ else # model
252
+ # models (e.g. Pet) or oneOf
253
+ klass = NetworkApi.const_get(type)
254
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
255
+ end
256
+ end
257
+
258
+ # Returns the string representation of the object
259
+ # @return [String] String presentation of the object
260
+ def to_s
261
+ to_hash.to_s
262
+ end
263
+
264
+ # to_body is an alias to to_hash (backward compatibility)
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_body
267
+ to_hash
268
+ end
269
+
270
+ # Returns the object in the form of hash
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_hash
273
+ hash = {}
274
+ self.class.attribute_map.each_pair do |attr, param|
275
+ value = self.send(attr)
276
+ if value.nil?
277
+ is_nullable = self.class.openapi_nullable.include?(attr)
278
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
279
+ end
280
+
281
+ hash[param] = _to_hash(value)
282
+ end
283
+ hash
284
+ end
285
+
286
+ # Outputs non-array value in the form of hash
287
+ # For object, use to_hash. Otherwise, just return the value
288
+ # @param [Object] value Any valid value
289
+ # @return [Hash] Returns the value in the form of hash
290
+ def _to_hash(value)
291
+ if value.is_a?(Array)
292
+ value.compact.map { |v| _to_hash(v) }
293
+ elsif value.is_a?(Hash)
294
+ {}.tap do |hash|
295
+ value.each { |k, v| hash[k] = _to_hash(v) }
296
+ end
297
+ elsif value.respond_to? :to_hash
298
+ value.to_hash
299
+ else
300
+ value
301
+ end
302
+ end
303
+
304
+ end
305
+
306
+ end
@@ -0,0 +1,275 @@
1
+ =begin
2
+ #Networks API
3
+
4
+ #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a>, <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a> and <a href='https://phoenixnap.com/kb/border-gateway-protocol-bmc' target='_blank'>border gateway protocol peer groups</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module NetworkApi
17
+ # Update a BGP Peer Group.
18
+ class BgpPeerGroupPatch
19
+ # The BGP Peer Group ASN.
20
+ attr_accessor :asn
21
+
22
+ # The BGP Peer Group password.
23
+ attr_accessor :password
24
+
25
+ # The Advertised routes for the BGP Peer Group. Can have one of the following values: `DEFAULT` and `NONE`.
26
+ attr_accessor :advertised_routes
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'asn' => :'asn',
32
+ :'password' => :'password',
33
+ :'advertised_routes' => :'advertisedRoutes'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'asn' => :'Integer',
46
+ :'password' => :'String',
47
+ :'advertised_routes' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `NetworkApi::BgpPeerGroupPatch` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpPeerGroupPatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'asn')
73
+ self.asn = attributes[:'asn']
74
+ end
75
+
76
+ if attributes.key?(:'password')
77
+ self.password = attributes[:'password']
78
+ end
79
+
80
+ if attributes.key?(:'advertised_routes')
81
+ self.advertised_routes = attributes[:'advertised_routes']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ if !@password.nil? && @password.to_s.length > 32
91
+ invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 32.')
92
+ end
93
+
94
+ if !@password.nil? && @password.to_s.length < 8
95
+ invalid_properties.push('invalid value for "password", the character length must be great than or equal to 8.')
96
+ end
97
+
98
+ pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
99
+ if !@password.nil? && @password !~ pattern
100
+ invalid_properties.push("invalid value for \"password\", must conform to the pattern #{pattern}.")
101
+ end
102
+
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ warn '[DEPRECATED] the `valid?` method is obsolete'
110
+ return false if !@password.nil? && @password.to_s.length > 32
111
+ return false if !@password.nil? && @password.to_s.length < 8
112
+ return false if !@password.nil? && @password !~ Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
113
+ true
114
+ end
115
+
116
+ # Custom attribute writer method with validation
117
+ # @param [Object] password Value to be assigned
118
+ def password=(password)
119
+ if password.nil?
120
+ fail ArgumentError, 'password cannot be nil'
121
+ end
122
+
123
+ if password.to_s.length > 32
124
+ fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 32.'
125
+ end
126
+
127
+ if password.to_s.length < 8
128
+ fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 8.'
129
+ end
130
+
131
+ pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
132
+ if password !~ pattern
133
+ fail ArgumentError, "invalid value for \"password\", must conform to the pattern #{pattern}."
134
+ end
135
+
136
+ @password = password
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ asn == o.asn &&
145
+ password == o.password &&
146
+ advertised_routes == o.advertised_routes
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [asn, password, advertised_routes].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ attributes = attributes.transform_keys(&:to_sym)
167
+ transformed_hash = {}
168
+ openapi_types.each_pair do |key, type|
169
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
170
+ transformed_hash["#{key}"] = nil
171
+ elsif type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[attribute_map[key]].is_a?(Array)
175
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
176
+ end
177
+ elsif !attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
179
+ end
180
+ end
181
+ new(transformed_hash)
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def self._deserialize(type, value)
189
+ case type.to_sym
190
+ when :Time
191
+ Time.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ # models (e.g. Pet) or oneOf
222
+ klass = NetworkApi.const_get(type)
223
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+
273
+ end
274
+
275
+ end
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Networks API
3
3
 
4
- #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a> and <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
4
+ #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a>, <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a> and <a href='https://phoenixnap.com/kb/border-gateway-protocol-bmc' target='_blank'>border gateway protocol peer groups</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
5
5
 
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Networks API
3
3
 
4
- #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a> and <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
4
+ #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a>, <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a> and <a href='https://phoenixnap.com/kb/border-gateway-protocol-bmc' target='_blank'>border gateway protocol peer groups</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
5
5
 
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Networks API
3
3
 
4
- #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a> and <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
4
+ #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a>, <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a> and <a href='https://phoenixnap.com/kb/border-gateway-protocol-bmc' target='_blank'>border gateway protocol peer groups</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
5
5
 
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Networks API
3
3
 
4
- #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a> and <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
4
+ #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a>, <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a> and <a href='https://phoenixnap.com/kb/border-gateway-protocol-bmc' target='_blank'>border gateway protocol peer groups</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
5
5
 
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Networks API
3
3
 
4
- #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a> and <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
4
+ #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a>, <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a> and <a href='https://phoenixnap.com/kb/border-gateway-protocol-bmc' target='_blank'>border gateway protocol peer groups</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
5
5
 
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Networks API
3
3
 
4
- #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a> and <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
4
+ #Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.<br> <br> <span class='pnap-api-knowledge-base-link'> Helpful knowledge base articles are available for <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#multi-private-backend-network-api' target='_blank'>multi-private backend networks</a>, <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#ftoc-heading-15' target='_blank'>public networks</a> and <a href='https://phoenixnap.com/kb/border-gateway-protocol-bmc' target='_blank'>border gateway protocol peer groups</a>. </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/networks/v1/)</b>
5
5
 
6
6
  The version of the OpenAPI document: 1.0
7
7
  Contact: support@phoenixnap.com