pnap_network_api 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +3 -3
  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,481 @@
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
+ # The Border Gateway Protocol (BGP) Peer Group.
18
+ class BgpPeerGroup
19
+ # The unique identifier of the BGP Peer Group.
20
+ attr_accessor :id
21
+
22
+ # The BGP Peer Group status. Can have one of the following values: `PENDING`, `ON_HOLD`, `BUSY`, `READY`, `ERROR`, `PENDING_DELETION` and `DELETING`.
23
+ attr_accessor :status
24
+
25
+ # The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`.
26
+ attr_accessor :location
27
+
28
+ # The List of the BGP Peer Group IPv4 prefixes.
29
+ attr_accessor :ipv4_prefixes
30
+
31
+ attr_accessor :target_asn_details
32
+
33
+ attr_accessor :active_asn_details
34
+
35
+ # The BGP Peer Group password.
36
+ attr_accessor :password
37
+
38
+ # The Advertised routes for the BGP Peer Group. Can have one of the following values: `DEFAULT` and `NONE`.
39
+ attr_accessor :advertised_routes
40
+
41
+ # The RPKI ROA Origin ASN of the BGP Peer Group based on location.
42
+ attr_accessor :rpki_roa_origin_asn
43
+
44
+ # The eBGP Multi-hop of the BGP Peer Group.
45
+ attr_accessor :e_bgp_multi_hop
46
+
47
+ # The IPv4 Peering Loopback addresses of the BGP Peer Group. Valid IP formats are IPv4 addresses.
48
+ attr_accessor :peering_loopbacks_v4
49
+
50
+ # The Keep Alive Timer in seconds of the BGP Peer Group.
51
+ attr_accessor :keep_alive_timer_seconds
52
+
53
+ # The Hold Timer in seconds of the BGP Peer Group.
54
+ attr_accessor :hold_timer_seconds
55
+
56
+ # Date and time of creation.
57
+ attr_accessor :created_on
58
+
59
+ # Date and time of last update.
60
+ attr_accessor :last_updated_on
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'id' => :'id',
66
+ :'status' => :'status',
67
+ :'location' => :'location',
68
+ :'ipv4_prefixes' => :'ipv4Prefixes',
69
+ :'target_asn_details' => :'targetAsnDetails',
70
+ :'active_asn_details' => :'activeAsnDetails',
71
+ :'password' => :'password',
72
+ :'advertised_routes' => :'advertisedRoutes',
73
+ :'rpki_roa_origin_asn' => :'rpkiRoaOriginAsn',
74
+ :'e_bgp_multi_hop' => :'eBgpMultiHop',
75
+ :'peering_loopbacks_v4' => :'peeringLoopbacksV4',
76
+ :'keep_alive_timer_seconds' => :'keepAliveTimerSeconds',
77
+ :'hold_timer_seconds' => :'holdTimerSeconds',
78
+ :'created_on' => :'createdOn',
79
+ :'last_updated_on' => :'lastUpdatedOn'
80
+ }
81
+ end
82
+
83
+ # Returns all the JSON keys this model knows about
84
+ def self.acceptable_attributes
85
+ attribute_map.values
86
+ end
87
+
88
+ # Attribute type mapping.
89
+ def self.openapi_types
90
+ {
91
+ :'id' => :'String',
92
+ :'status' => :'String',
93
+ :'location' => :'String',
94
+ :'ipv4_prefixes' => :'Array<BgpIPv4Prefix>',
95
+ :'target_asn_details' => :'AsnDetails',
96
+ :'active_asn_details' => :'AsnDetails',
97
+ :'password' => :'String',
98
+ :'advertised_routes' => :'String',
99
+ :'rpki_roa_origin_asn' => :'Integer',
100
+ :'e_bgp_multi_hop' => :'Integer',
101
+ :'peering_loopbacks_v4' => :'Array<String>',
102
+ :'keep_alive_timer_seconds' => :'Integer',
103
+ :'hold_timer_seconds' => :'Integer',
104
+ :'created_on' => :'String',
105
+ :'last_updated_on' => :'String'
106
+ }
107
+ end
108
+
109
+ # List of attributes with nullable: true
110
+ def self.openapi_nullable
111
+ Set.new([
112
+ ])
113
+ end
114
+
115
+ # Initializes the object
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ def initialize(attributes = {})
118
+ if (!attributes.is_a?(Hash))
119
+ fail ArgumentError, "The input argument (attributes) must be a hash in `NetworkApi::BgpPeerGroup` initialize method"
120
+ end
121
+
122
+ # check to see if the attribute exists and convert string to symbol for hash key
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!self.class.attribute_map.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpPeerGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:'id')
131
+ self.id = attributes[:'id']
132
+ else
133
+ self.id = nil
134
+ end
135
+
136
+ if attributes.key?(:'status')
137
+ self.status = attributes[:'status']
138
+ else
139
+ self.status = nil
140
+ end
141
+
142
+ if attributes.key?(:'location')
143
+ self.location = attributes[:'location']
144
+ else
145
+ self.location = nil
146
+ end
147
+
148
+ if attributes.key?(:'ipv4_prefixes')
149
+ if (value = attributes[:'ipv4_prefixes']).is_a?(Array)
150
+ self.ipv4_prefixes = value
151
+ end
152
+ else
153
+ self.ipv4_prefixes = nil
154
+ end
155
+
156
+ if attributes.key?(:'target_asn_details')
157
+ self.target_asn_details = attributes[:'target_asn_details']
158
+ else
159
+ self.target_asn_details = nil
160
+ end
161
+
162
+ if attributes.key?(:'active_asn_details')
163
+ self.active_asn_details = attributes[:'active_asn_details']
164
+ end
165
+
166
+ if attributes.key?(:'password')
167
+ self.password = attributes[:'password']
168
+ else
169
+ self.password = nil
170
+ end
171
+
172
+ if attributes.key?(:'advertised_routes')
173
+ self.advertised_routes = attributes[:'advertised_routes']
174
+ else
175
+ self.advertised_routes = nil
176
+ end
177
+
178
+ if attributes.key?(:'rpki_roa_origin_asn')
179
+ self.rpki_roa_origin_asn = attributes[:'rpki_roa_origin_asn']
180
+ else
181
+ self.rpki_roa_origin_asn = nil
182
+ end
183
+
184
+ if attributes.key?(:'e_bgp_multi_hop')
185
+ self.e_bgp_multi_hop = attributes[:'e_bgp_multi_hop']
186
+ else
187
+ self.e_bgp_multi_hop = nil
188
+ end
189
+
190
+ if attributes.key?(:'peering_loopbacks_v4')
191
+ if (value = attributes[:'peering_loopbacks_v4']).is_a?(Array)
192
+ self.peering_loopbacks_v4 = value
193
+ end
194
+ else
195
+ self.peering_loopbacks_v4 = nil
196
+ end
197
+
198
+ if attributes.key?(:'keep_alive_timer_seconds')
199
+ self.keep_alive_timer_seconds = attributes[:'keep_alive_timer_seconds']
200
+ else
201
+ self.keep_alive_timer_seconds = nil
202
+ end
203
+
204
+ if attributes.key?(:'hold_timer_seconds')
205
+ self.hold_timer_seconds = attributes[:'hold_timer_seconds']
206
+ else
207
+ self.hold_timer_seconds = nil
208
+ end
209
+
210
+ if attributes.key?(:'created_on')
211
+ self.created_on = attributes[:'created_on']
212
+ end
213
+
214
+ if attributes.key?(:'last_updated_on')
215
+ self.last_updated_on = attributes[:'last_updated_on']
216
+ end
217
+ end
218
+
219
+ # Show invalid properties with the reasons. Usually used together with valid?
220
+ # @return Array for valid properties with the reasons
221
+ def list_invalid_properties
222
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
223
+ invalid_properties = Array.new
224
+ if @id.nil?
225
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
226
+ end
227
+
228
+ if @status.nil?
229
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
230
+ end
231
+
232
+ if @location.nil?
233
+ invalid_properties.push('invalid value for "location", location cannot be nil.')
234
+ end
235
+
236
+ if @ipv4_prefixes.nil?
237
+ invalid_properties.push('invalid value for "ipv4_prefixes", ipv4_prefixes cannot be nil.')
238
+ end
239
+
240
+ if @target_asn_details.nil?
241
+ invalid_properties.push('invalid value for "target_asn_details", target_asn_details cannot be nil.')
242
+ end
243
+
244
+ if @password.nil?
245
+ invalid_properties.push('invalid value for "password", password cannot be nil.')
246
+ end
247
+
248
+ if @password.to_s.length > 32
249
+ invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 32.')
250
+ end
251
+
252
+ if @password.to_s.length < 8
253
+ invalid_properties.push('invalid value for "password", the character length must be great than or equal to 8.')
254
+ end
255
+
256
+ pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
257
+ if @password !~ pattern
258
+ invalid_properties.push("invalid value for \"password\", must conform to the pattern #{pattern}.")
259
+ end
260
+
261
+ if @advertised_routes.nil?
262
+ invalid_properties.push('invalid value for "advertised_routes", advertised_routes cannot be nil.')
263
+ end
264
+
265
+ if @rpki_roa_origin_asn.nil?
266
+ invalid_properties.push('invalid value for "rpki_roa_origin_asn", rpki_roa_origin_asn cannot be nil.')
267
+ end
268
+
269
+ if @e_bgp_multi_hop.nil?
270
+ invalid_properties.push('invalid value for "e_bgp_multi_hop", e_bgp_multi_hop cannot be nil.')
271
+ end
272
+
273
+ if @peering_loopbacks_v4.nil?
274
+ invalid_properties.push('invalid value for "peering_loopbacks_v4", peering_loopbacks_v4 cannot be nil.')
275
+ end
276
+
277
+ if @keep_alive_timer_seconds.nil?
278
+ invalid_properties.push('invalid value for "keep_alive_timer_seconds", keep_alive_timer_seconds cannot be nil.')
279
+ end
280
+
281
+ if @hold_timer_seconds.nil?
282
+ invalid_properties.push('invalid value for "hold_timer_seconds", hold_timer_seconds cannot be nil.')
283
+ end
284
+
285
+ invalid_properties
286
+ end
287
+
288
+ # Check to see if the all the properties in the model are valid
289
+ # @return true if the model is valid
290
+ def valid?
291
+ warn '[DEPRECATED] the `valid?` method is obsolete'
292
+ return false if @id.nil?
293
+ return false if @status.nil?
294
+ return false if @location.nil?
295
+ return false if @ipv4_prefixes.nil?
296
+ return false if @target_asn_details.nil?
297
+ return false if @password.nil?
298
+ return false if @password.to_s.length > 32
299
+ return false if @password.to_s.length < 8
300
+ return false if @password !~ Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
301
+ return false if @advertised_routes.nil?
302
+ return false if @rpki_roa_origin_asn.nil?
303
+ return false if @e_bgp_multi_hop.nil?
304
+ return false if @peering_loopbacks_v4.nil?
305
+ return false if @keep_alive_timer_seconds.nil?
306
+ return false if @hold_timer_seconds.nil?
307
+ true
308
+ end
309
+
310
+ # Custom attribute writer method with validation
311
+ # @param [Object] password Value to be assigned
312
+ def password=(password)
313
+ if password.nil?
314
+ fail ArgumentError, 'password cannot be nil'
315
+ end
316
+
317
+ if password.to_s.length > 32
318
+ fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 32.'
319
+ end
320
+
321
+ if password.to_s.length < 8
322
+ fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 8.'
323
+ end
324
+
325
+ pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
326
+ if password !~ pattern
327
+ fail ArgumentError, "invalid value for \"password\", must conform to the pattern #{pattern}."
328
+ end
329
+
330
+ @password = password
331
+ end
332
+
333
+ # Checks equality by comparing each attribute.
334
+ # @param [Object] Object to be compared
335
+ def ==(o)
336
+ return true if self.equal?(o)
337
+ self.class == o.class &&
338
+ id == o.id &&
339
+ status == o.status &&
340
+ location == o.location &&
341
+ ipv4_prefixes == o.ipv4_prefixes &&
342
+ target_asn_details == o.target_asn_details &&
343
+ active_asn_details == o.active_asn_details &&
344
+ password == o.password &&
345
+ advertised_routes == o.advertised_routes &&
346
+ rpki_roa_origin_asn == o.rpki_roa_origin_asn &&
347
+ e_bgp_multi_hop == o.e_bgp_multi_hop &&
348
+ peering_loopbacks_v4 == o.peering_loopbacks_v4 &&
349
+ keep_alive_timer_seconds == o.keep_alive_timer_seconds &&
350
+ hold_timer_seconds == o.hold_timer_seconds &&
351
+ created_on == o.created_on &&
352
+ last_updated_on == o.last_updated_on
353
+ end
354
+
355
+ # @see the `==` method
356
+ # @param [Object] Object to be compared
357
+ def eql?(o)
358
+ self == o
359
+ end
360
+
361
+ # Calculates hash code according to all attributes.
362
+ # @return [Integer] Hash code
363
+ def hash
364
+ [id, status, location, ipv4_prefixes, target_asn_details, active_asn_details, password, advertised_routes, rpki_roa_origin_asn, e_bgp_multi_hop, peering_loopbacks_v4, keep_alive_timer_seconds, hold_timer_seconds, created_on, last_updated_on].hash
365
+ end
366
+
367
+ # Builds the object from hash
368
+ # @param [Hash] attributes Model attributes in the form of hash
369
+ # @return [Object] Returns the model itself
370
+ def self.build_from_hash(attributes)
371
+ return nil unless attributes.is_a?(Hash)
372
+ attributes = attributes.transform_keys(&:to_sym)
373
+ transformed_hash = {}
374
+ openapi_types.each_pair do |key, type|
375
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
376
+ transformed_hash["#{key}"] = nil
377
+ elsif type =~ /\AArray<(.*)>/i
378
+ # check to ensure the input is an array given that the attribute
379
+ # is documented as an array but the input is not
380
+ if attributes[attribute_map[key]].is_a?(Array)
381
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
382
+ end
383
+ elsif !attributes[attribute_map[key]].nil?
384
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
385
+ end
386
+ end
387
+ new(transformed_hash)
388
+ end
389
+
390
+ # Deserializes the data based on type
391
+ # @param string type Data type
392
+ # @param string value Value to be deserialized
393
+ # @return [Object] Deserialized data
394
+ def self._deserialize(type, value)
395
+ case type.to_sym
396
+ when :Time
397
+ Time.parse(value)
398
+ when :Date
399
+ Date.parse(value)
400
+ when :String
401
+ value.to_s
402
+ when :Integer
403
+ value.to_i
404
+ when :Float
405
+ value.to_f
406
+ when :Boolean
407
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
408
+ true
409
+ else
410
+ false
411
+ end
412
+ when :Object
413
+ # generic object (usually a Hash), return directly
414
+ value
415
+ when /\AArray<(?<inner_type>.+)>\z/
416
+ inner_type = Regexp.last_match[:inner_type]
417
+ value.map { |v| _deserialize(inner_type, v) }
418
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
419
+ k_type = Regexp.last_match[:k_type]
420
+ v_type = Regexp.last_match[:v_type]
421
+ {}.tap do |hash|
422
+ value.each do |k, v|
423
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
424
+ end
425
+ end
426
+ else # model
427
+ # models (e.g. Pet) or oneOf
428
+ klass = NetworkApi.const_get(type)
429
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
430
+ end
431
+ end
432
+
433
+ # Returns the string representation of the object
434
+ # @return [String] String presentation of the object
435
+ def to_s
436
+ to_hash.to_s
437
+ end
438
+
439
+ # to_body is an alias to to_hash (backward compatibility)
440
+ # @return [Hash] Returns the object in the form of hash
441
+ def to_body
442
+ to_hash
443
+ end
444
+
445
+ # Returns the object in the form of hash
446
+ # @return [Hash] Returns the object in the form of hash
447
+ def to_hash
448
+ hash = {}
449
+ self.class.attribute_map.each_pair do |attr, param|
450
+ value = self.send(attr)
451
+ if value.nil?
452
+ is_nullable = self.class.openapi_nullable.include?(attr)
453
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
454
+ end
455
+
456
+ hash[param] = _to_hash(value)
457
+ end
458
+ hash
459
+ end
460
+
461
+ # Outputs non-array value in the form of hash
462
+ # For object, use to_hash. Otherwise, just return the value
463
+ # @param [Object] value Any valid value
464
+ # @return [Hash] Returns the value in the form of hash
465
+ def _to_hash(value)
466
+ if value.is_a?(Array)
467
+ value.compact.map { |v| _to_hash(v) }
468
+ elsif value.is_a?(Hash)
469
+ {}.tap do |hash|
470
+ value.each { |k, v| hash[k] = _to_hash(v) }
471
+ end
472
+ elsif value.respond_to? :to_hash
473
+ value.to_hash
474
+ else
475
+ value
476
+ end
477
+ end
478
+
479
+ end
480
+
481
+ end