pnap_network_api 2.1.2 → 2.2.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 +1 -0
- data/VERSION +1 -1
- data/docs/BgpIpPrefix.md +24 -0
- data/docs/BgpPeerGroup.md +6 -2
- data/docs/BgpPeerGroupCreate.md +1 -1
- data/docs/PrivateNetworkCreate.md +1 -1
- data/docs/PublicNetwork.md +1 -1
- data/docs/PublicNetworkCreate.md +1 -1
- data/lib/pnap_network_api/api/bgp_peer_groups_api.rb +6 -6
- data/lib/pnap_network_api/api/private_networks_api.rb +6 -6
- data/lib/pnap_network_api/api/public_networks_api.rb +8 -8
- data/lib/pnap_network_api/api_client.rb +17 -14
- data/lib/pnap_network_api/api_error.rb +1 -1
- data/lib/pnap_network_api/api_model_base.rb +88 -0
- data/lib/pnap_network_api/configuration.rb +11 -1
- data/lib/pnap_network_api/models/asn_details.rb +41 -78
- data/lib/pnap_network_api/models/bgp_ip_prefix.rb +247 -0
- data/lib/pnap_network_api/models/bgp_ipv4_prefix.rb +52 -79
- data/lib/pnap_network_api/models/bgp_peer_group.rb +184 -83
- data/lib/pnap_network_api/models/bgp_peer_group_create.rb +44 -81
- data/lib/pnap_network_api/models/bgp_peer_group_patch.rb +13 -80
- data/lib/pnap_network_api/models/error.rb +21 -78
- data/lib/pnap_network_api/models/network_membership.rb +41 -78
- data/lib/pnap_network_api/models/private_network.rb +103 -80
- data/lib/pnap_network_api/models/private_network_create.rb +24 -81
- data/lib/pnap_network_api/models/private_network_modify.rb +23 -80
- data/lib/pnap_network_api/models/private_network_server.rb +31 -78
- data/lib/pnap_network_api/models/public_network.rb +84 -81
- data/lib/pnap_network_api/models/public_network_create.rb +24 -81
- data/lib/pnap_network_api/models/public_network_ip_block.rb +41 -78
- data/lib/pnap_network_api/models/public_network_ip_block_create.rb +21 -78
- data/lib/pnap_network_api/models/public_network_modify.rb +13 -80
- data/lib/pnap_network_api/version.rb +1 -2
- data/lib/pnap_network_api.rb +3 -1
- data/pnap_network_api.gemspec +6 -6
- data/spec/api/bgp_peer_groups_api_spec.rb +1 -1
- data/spec/api/private_networks_api_spec.rb +1 -1
- data/spec/api/public_networks_api_spec.rb +1 -1
- data/spec/models/asn_details_spec.rb +2 -2
- data/spec/models/bgp_ip_prefix_spec.rb +54 -0
- data/spec/models/bgp_ipv4_prefix_spec.rb +2 -2
- data/spec/models/bgp_peer_group_create_spec.rb +2 -2
- data/spec/models/bgp_peer_group_patch_spec.rb +2 -2
- data/spec/models/bgp_peer_group_spec.rb +14 -2
- data/spec/models/error_spec.rb +2 -2
- data/spec/models/network_membership_spec.rb +2 -2
- data/spec/models/private_network_create_spec.rb +2 -2
- data/spec/models/private_network_modify_spec.rb +2 -2
- data/spec/models/private_network_server_spec.rb +2 -2
- data/spec/models/private_network_spec.rb +2 -2
- data/spec/models/public_network_create_spec.rb +2 -2
- data/spec/models/public_network_ip_block_create_spec.rb +2 -2
- data/spec/models/public_network_ip_block_spec.rb +2 -2
- data/spec/models/public_network_modify_spec.rb +2 -2
- data/spec/models/public_network_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +31 -18
|
@@ -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
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module NetworkApi
|
|
17
17
|
# BGP Peer Group ASN details.
|
|
18
|
-
class AsnDetails
|
|
18
|
+
class AsnDetails < ApiModelBase
|
|
19
19
|
# The BGP Peer Group ASN.
|
|
20
20
|
attr_accessor :asn
|
|
21
21
|
|
|
@@ -38,9 +38,14 @@ module NetworkApi
|
|
|
38
38
|
}
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
# Returns attribute mapping this model knows about
|
|
42
|
+
def self.acceptable_attribute_map
|
|
43
|
+
attribute_map
|
|
44
|
+
end
|
|
45
|
+
|
|
41
46
|
# Returns all the JSON keys this model knows about
|
|
42
47
|
def self.acceptable_attributes
|
|
43
|
-
|
|
48
|
+
acceptable_attribute_map.values
|
|
44
49
|
end
|
|
45
50
|
|
|
46
51
|
# Attribute type mapping.
|
|
@@ -67,9 +72,10 @@ module NetworkApi
|
|
|
67
72
|
end
|
|
68
73
|
|
|
69
74
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
75
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
70
76
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
71
|
-
if (!
|
|
72
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::AsnDetails`. Please check the name to make sure it's valid. List of attributes: " +
|
|
77
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
78
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::AsnDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
73
79
|
end
|
|
74
80
|
h[k.to_sym] = v
|
|
75
81
|
}
|
|
@@ -127,6 +133,36 @@ module NetworkApi
|
|
|
127
133
|
true
|
|
128
134
|
end
|
|
129
135
|
|
|
136
|
+
# Custom attribute writer method with validation
|
|
137
|
+
# @param [Object] asn Value to be assigned
|
|
138
|
+
def asn=(asn)
|
|
139
|
+
if asn.nil?
|
|
140
|
+
fail ArgumentError, 'asn cannot be nil'
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
@asn = asn
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Custom attribute writer method with validation
|
|
147
|
+
# @param [Object] is_bring_your_own Value to be assigned
|
|
148
|
+
def is_bring_your_own=(is_bring_your_own)
|
|
149
|
+
if is_bring_your_own.nil?
|
|
150
|
+
fail ArgumentError, 'is_bring_your_own cannot be nil'
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
@is_bring_your_own = is_bring_your_own
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Custom attribute writer method with validation
|
|
157
|
+
# @param [Object] verification_status Value to be assigned
|
|
158
|
+
def verification_status=(verification_status)
|
|
159
|
+
if verification_status.nil?
|
|
160
|
+
fail ArgumentError, 'verification_status cannot be nil'
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
@verification_status = verification_status
|
|
164
|
+
end
|
|
165
|
+
|
|
130
166
|
# Checks equality by comparing each attribute.
|
|
131
167
|
# @param [Object] Object to be compared
|
|
132
168
|
def ==(o)
|
|
@@ -173,61 +209,6 @@ module NetworkApi
|
|
|
173
209
|
new(transformed_hash)
|
|
174
210
|
end
|
|
175
211
|
|
|
176
|
-
# Deserializes the data based on type
|
|
177
|
-
# @param string type Data type
|
|
178
|
-
# @param string value Value to be deserialized
|
|
179
|
-
# @return [Object] Deserialized data
|
|
180
|
-
def self._deserialize(type, value)
|
|
181
|
-
case type.to_sym
|
|
182
|
-
when :Time
|
|
183
|
-
Time.parse(value)
|
|
184
|
-
when :Date
|
|
185
|
-
Date.parse(value)
|
|
186
|
-
when :String
|
|
187
|
-
value.to_s
|
|
188
|
-
when :Integer
|
|
189
|
-
value.to_i
|
|
190
|
-
when :Float
|
|
191
|
-
value.to_f
|
|
192
|
-
when :Boolean
|
|
193
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
194
|
-
true
|
|
195
|
-
else
|
|
196
|
-
false
|
|
197
|
-
end
|
|
198
|
-
when :Object
|
|
199
|
-
# generic object (usually a Hash), return directly
|
|
200
|
-
value
|
|
201
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
202
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
203
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
204
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
205
|
-
k_type = Regexp.last_match[:k_type]
|
|
206
|
-
v_type = Regexp.last_match[:v_type]
|
|
207
|
-
{}.tap do |hash|
|
|
208
|
-
value.each do |k, v|
|
|
209
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
else # model
|
|
213
|
-
# models (e.g. Pet) or oneOf
|
|
214
|
-
klass = NetworkApi.const_get(type)
|
|
215
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
# Returns the string representation of the object
|
|
220
|
-
# @return [String] String presentation of the object
|
|
221
|
-
def to_s
|
|
222
|
-
to_hash.to_s
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
226
|
-
# @return [Hash] Returns the object in the form of hash
|
|
227
|
-
def to_body
|
|
228
|
-
to_hash
|
|
229
|
-
end
|
|
230
|
-
|
|
231
212
|
# Returns the object in the form of hash
|
|
232
213
|
# @return [Hash] Returns the object in the form of hash
|
|
233
214
|
def to_hash
|
|
@@ -244,24 +225,6 @@ module NetworkApi
|
|
|
244
225
|
hash
|
|
245
226
|
end
|
|
246
227
|
|
|
247
|
-
# Outputs non-array value in the form of hash
|
|
248
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
249
|
-
# @param [Object] value Any valid value
|
|
250
|
-
# @return [Hash] Returns the value in the form of hash
|
|
251
|
-
def _to_hash(value)
|
|
252
|
-
if value.is_a?(Array)
|
|
253
|
-
value.compact.map { |v| _to_hash(v) }
|
|
254
|
-
elsif value.is_a?(Hash)
|
|
255
|
-
{}.tap do |hash|
|
|
256
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
257
|
-
end
|
|
258
|
-
elsif value.respond_to? :to_hash
|
|
259
|
-
value.to_hash
|
|
260
|
-
else
|
|
261
|
-
value
|
|
262
|
-
end
|
|
263
|
-
end
|
|
264
|
-
|
|
265
228
|
end
|
|
266
229
|
|
|
267
230
|
end
|
|
@@ -0,0 +1,247 @@
|
|
|
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
|
+
Generator version: 7.20.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module NetworkApi
|
|
17
|
+
# The BGP IP Prefix.
|
|
18
|
+
class BgpIpPrefix < ApiModelBase
|
|
19
|
+
# IP allocation ID.
|
|
20
|
+
attr_accessor :ip_allocation_id
|
|
21
|
+
|
|
22
|
+
# The IP block in CIDR format, dependent on IP version.
|
|
23
|
+
attr_accessor :cidr
|
|
24
|
+
|
|
25
|
+
# The IP block version.
|
|
26
|
+
attr_accessor :ip_version
|
|
27
|
+
|
|
28
|
+
# The BGP IP Prefix status. Can have one of the following values: `PENDING`, `BUSY`, `READY`, `ERROR` and `DELETING`.
|
|
29
|
+
attr_accessor :status
|
|
30
|
+
|
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
32
|
+
def self.attribute_map
|
|
33
|
+
{
|
|
34
|
+
:'ip_allocation_id' => :'ipAllocationId',
|
|
35
|
+
:'cidr' => :'cidr',
|
|
36
|
+
:'ip_version' => :'ipVersion',
|
|
37
|
+
:'status' => :'status'
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Returns attribute mapping this model knows about
|
|
42
|
+
def self.acceptable_attribute_map
|
|
43
|
+
attribute_map
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Returns all the JSON keys this model knows about
|
|
47
|
+
def self.acceptable_attributes
|
|
48
|
+
acceptable_attribute_map.values
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Attribute type mapping.
|
|
52
|
+
def self.openapi_types
|
|
53
|
+
{
|
|
54
|
+
:'ip_allocation_id' => :'String',
|
|
55
|
+
:'cidr' => :'String',
|
|
56
|
+
:'ip_version' => :'String',
|
|
57
|
+
:'status' => :'String'
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# List of attributes with nullable: true
|
|
62
|
+
def self.openapi_nullable
|
|
63
|
+
Set.new([
|
|
64
|
+
])
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Initializes the object
|
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
69
|
+
def initialize(attributes = {})
|
|
70
|
+
if (!attributes.is_a?(Hash))
|
|
71
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `NetworkApi::BgpIpPrefix` initialize method"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
75
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
76
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
77
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
78
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpIpPrefix`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
79
|
+
end
|
|
80
|
+
h[k.to_sym] = v
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if attributes.key?(:'ip_allocation_id')
|
|
84
|
+
self.ip_allocation_id = attributes[:'ip_allocation_id']
|
|
85
|
+
else
|
|
86
|
+
self.ip_allocation_id = nil
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'cidr')
|
|
90
|
+
self.cidr = attributes[:'cidr']
|
|
91
|
+
else
|
|
92
|
+
self.cidr = nil
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'ip_version')
|
|
96
|
+
self.ip_version = attributes[:'ip_version']
|
|
97
|
+
else
|
|
98
|
+
self.ip_version = nil
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'status')
|
|
102
|
+
self.status = attributes[:'status']
|
|
103
|
+
else
|
|
104
|
+
self.status = nil
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
109
|
+
# @return Array for valid properties with the reasons
|
|
110
|
+
def list_invalid_properties
|
|
111
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
112
|
+
invalid_properties = Array.new
|
|
113
|
+
if @ip_allocation_id.nil?
|
|
114
|
+
invalid_properties.push('invalid value for "ip_allocation_id", ip_allocation_id cannot be nil.')
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if @cidr.nil?
|
|
118
|
+
invalid_properties.push('invalid value for "cidr", cidr cannot be nil.')
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if @ip_version.nil?
|
|
122
|
+
invalid_properties.push('invalid value for "ip_version", ip_version cannot be nil.')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if @status.nil?
|
|
126
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
invalid_properties
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Check to see if the all the properties in the model are valid
|
|
133
|
+
# @return true if the model is valid
|
|
134
|
+
def valid?
|
|
135
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
136
|
+
return false if @ip_allocation_id.nil?
|
|
137
|
+
return false if @cidr.nil?
|
|
138
|
+
return false if @ip_version.nil?
|
|
139
|
+
return false if @status.nil?
|
|
140
|
+
true
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Custom attribute writer method with validation
|
|
144
|
+
# @param [Object] ip_allocation_id Value to be assigned
|
|
145
|
+
def ip_allocation_id=(ip_allocation_id)
|
|
146
|
+
if ip_allocation_id.nil?
|
|
147
|
+
fail ArgumentError, 'ip_allocation_id cannot be nil'
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
@ip_allocation_id = ip_allocation_id
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Custom attribute writer method with validation
|
|
154
|
+
# @param [Object] cidr Value to be assigned
|
|
155
|
+
def cidr=(cidr)
|
|
156
|
+
if cidr.nil?
|
|
157
|
+
fail ArgumentError, 'cidr cannot be nil'
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
@cidr = cidr
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Custom attribute writer method with validation
|
|
164
|
+
# @param [Object] ip_version Value to be assigned
|
|
165
|
+
def ip_version=(ip_version)
|
|
166
|
+
if ip_version.nil?
|
|
167
|
+
fail ArgumentError, 'ip_version cannot be nil'
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
@ip_version = ip_version
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Custom attribute writer method with validation
|
|
174
|
+
# @param [Object] status Value to be assigned
|
|
175
|
+
def status=(status)
|
|
176
|
+
if status.nil?
|
|
177
|
+
fail ArgumentError, 'status cannot be nil'
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
@status = status
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Checks equality by comparing each attribute.
|
|
184
|
+
# @param [Object] Object to be compared
|
|
185
|
+
def ==(o)
|
|
186
|
+
return true if self.equal?(o)
|
|
187
|
+
self.class == o.class &&
|
|
188
|
+
ip_allocation_id == o.ip_allocation_id &&
|
|
189
|
+
cidr == o.cidr &&
|
|
190
|
+
ip_version == o.ip_version &&
|
|
191
|
+
status == o.status
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# @see the `==` method
|
|
195
|
+
# @param [Object] Object to be compared
|
|
196
|
+
def eql?(o)
|
|
197
|
+
self == o
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Calculates hash code according to all attributes.
|
|
201
|
+
# @return [Integer] Hash code
|
|
202
|
+
def hash
|
|
203
|
+
[ip_allocation_id, cidr, ip_version, status].hash
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Builds the object from hash
|
|
207
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
208
|
+
# @return [Object] Returns the model itself
|
|
209
|
+
def self.build_from_hash(attributes)
|
|
210
|
+
return nil unless attributes.is_a?(Hash)
|
|
211
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
212
|
+
transformed_hash = {}
|
|
213
|
+
openapi_types.each_pair do |key, type|
|
|
214
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
215
|
+
transformed_hash["#{key}"] = nil
|
|
216
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
217
|
+
# check to ensure the input is an array given that the attribute
|
|
218
|
+
# is documented as an array but the input is not
|
|
219
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
220
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
221
|
+
end
|
|
222
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
223
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
new(transformed_hash)
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Returns the object in the form of hash
|
|
230
|
+
# @return [Hash] Returns the object in the form of hash
|
|
231
|
+
def to_hash
|
|
232
|
+
hash = {}
|
|
233
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
234
|
+
value = self.send(attr)
|
|
235
|
+
if value.nil?
|
|
236
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
237
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
hash[param] = _to_hash(value)
|
|
241
|
+
end
|
|
242
|
+
hash
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
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
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -14,8 +14,8 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module NetworkApi
|
|
17
|
-
# The BGP IPv4 Prefix.
|
|
18
|
-
class BgpIPv4Prefix
|
|
17
|
+
# The BGP IPv4 Prefix. Deprecated in favour of generic BgpIpPrefix.
|
|
18
|
+
class BgpIPv4Prefix < ApiModelBase
|
|
19
19
|
# IPv4 allocation ID.
|
|
20
20
|
attr_accessor :ipv4_allocation_id
|
|
21
21
|
|
|
@@ -42,9 +42,14 @@ module NetworkApi
|
|
|
42
42
|
}
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
+
# Returns attribute mapping this model knows about
|
|
46
|
+
def self.acceptable_attribute_map
|
|
47
|
+
attribute_map
|
|
48
|
+
end
|
|
49
|
+
|
|
45
50
|
# Returns all the JSON keys this model knows about
|
|
46
51
|
def self.acceptable_attributes
|
|
47
|
-
|
|
52
|
+
acceptable_attribute_map.values
|
|
48
53
|
end
|
|
49
54
|
|
|
50
55
|
# Attribute type mapping.
|
|
@@ -72,9 +77,10 @@ module NetworkApi
|
|
|
72
77
|
end
|
|
73
78
|
|
|
74
79
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
80
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
75
81
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
76
|
-
if (!
|
|
77
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpIPv4Prefix`. Please check the name to make sure it's valid. List of attributes: " +
|
|
82
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpIPv4Prefix`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
78
84
|
end
|
|
79
85
|
h[k.to_sym] = v
|
|
80
86
|
}
|
|
@@ -156,6 +162,16 @@ module NetworkApi
|
|
|
156
162
|
true
|
|
157
163
|
end
|
|
158
164
|
|
|
165
|
+
# Custom attribute writer method with validation
|
|
166
|
+
# @param [Object] ipv4_allocation_id Value to be assigned
|
|
167
|
+
def ipv4_allocation_id=(ipv4_allocation_id)
|
|
168
|
+
if ipv4_allocation_id.nil?
|
|
169
|
+
fail ArgumentError, 'ipv4_allocation_id cannot be nil'
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
@ipv4_allocation_id = ipv4_allocation_id
|
|
173
|
+
end
|
|
174
|
+
|
|
159
175
|
# Custom attribute writer method with validation
|
|
160
176
|
# @param [Object] cidr Value to be assigned
|
|
161
177
|
def cidr=(cidr)
|
|
@@ -171,6 +187,36 @@ module NetworkApi
|
|
|
171
187
|
@cidr = cidr
|
|
172
188
|
end
|
|
173
189
|
|
|
190
|
+
# Custom attribute writer method with validation
|
|
191
|
+
# @param [Object] status Value to be assigned
|
|
192
|
+
def status=(status)
|
|
193
|
+
if status.nil?
|
|
194
|
+
fail ArgumentError, 'status cannot be nil'
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
@status = status
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Custom attribute writer method with validation
|
|
201
|
+
# @param [Object] is_bring_your_own_ip Value to be assigned
|
|
202
|
+
def is_bring_your_own_ip=(is_bring_your_own_ip)
|
|
203
|
+
if is_bring_your_own_ip.nil?
|
|
204
|
+
fail ArgumentError, 'is_bring_your_own_ip cannot be nil'
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
@is_bring_your_own_ip = is_bring_your_own_ip
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Custom attribute writer method with validation
|
|
211
|
+
# @param [Object] in_use Value to be assigned
|
|
212
|
+
def in_use=(in_use)
|
|
213
|
+
if in_use.nil?
|
|
214
|
+
fail ArgumentError, 'in_use cannot be nil'
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
@in_use = in_use
|
|
218
|
+
end
|
|
219
|
+
|
|
174
220
|
# Checks equality by comparing each attribute.
|
|
175
221
|
# @param [Object] Object to be compared
|
|
176
222
|
def ==(o)
|
|
@@ -218,61 +264,6 @@ module NetworkApi
|
|
|
218
264
|
new(transformed_hash)
|
|
219
265
|
end
|
|
220
266
|
|
|
221
|
-
# Deserializes the data based on type
|
|
222
|
-
# @param string type Data type
|
|
223
|
-
# @param string value Value to be deserialized
|
|
224
|
-
# @return [Object] Deserialized data
|
|
225
|
-
def self._deserialize(type, value)
|
|
226
|
-
case type.to_sym
|
|
227
|
-
when :Time
|
|
228
|
-
Time.parse(value)
|
|
229
|
-
when :Date
|
|
230
|
-
Date.parse(value)
|
|
231
|
-
when :String
|
|
232
|
-
value.to_s
|
|
233
|
-
when :Integer
|
|
234
|
-
value.to_i
|
|
235
|
-
when :Float
|
|
236
|
-
value.to_f
|
|
237
|
-
when :Boolean
|
|
238
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
239
|
-
true
|
|
240
|
-
else
|
|
241
|
-
false
|
|
242
|
-
end
|
|
243
|
-
when :Object
|
|
244
|
-
# generic object (usually a Hash), return directly
|
|
245
|
-
value
|
|
246
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
247
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
248
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
249
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
250
|
-
k_type = Regexp.last_match[:k_type]
|
|
251
|
-
v_type = Regexp.last_match[:v_type]
|
|
252
|
-
{}.tap do |hash|
|
|
253
|
-
value.each do |k, v|
|
|
254
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
255
|
-
end
|
|
256
|
-
end
|
|
257
|
-
else # model
|
|
258
|
-
# models (e.g. Pet) or oneOf
|
|
259
|
-
klass = NetworkApi.const_get(type)
|
|
260
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
261
|
-
end
|
|
262
|
-
end
|
|
263
|
-
|
|
264
|
-
# Returns the string representation of the object
|
|
265
|
-
# @return [String] String presentation of the object
|
|
266
|
-
def to_s
|
|
267
|
-
to_hash.to_s
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
271
|
-
# @return [Hash] Returns the object in the form of hash
|
|
272
|
-
def to_body
|
|
273
|
-
to_hash
|
|
274
|
-
end
|
|
275
|
-
|
|
276
267
|
# Returns the object in the form of hash
|
|
277
268
|
# @return [Hash] Returns the object in the form of hash
|
|
278
269
|
def to_hash
|
|
@@ -289,24 +280,6 @@ module NetworkApi
|
|
|
289
280
|
hash
|
|
290
281
|
end
|
|
291
282
|
|
|
292
|
-
# Outputs non-array value in the form of hash
|
|
293
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
294
|
-
# @param [Object] value Any valid value
|
|
295
|
-
# @return [Hash] Returns the value in the form of hash
|
|
296
|
-
def _to_hash(value)
|
|
297
|
-
if value.is_a?(Array)
|
|
298
|
-
value.compact.map { |v| _to_hash(v) }
|
|
299
|
-
elsif value.is_a?(Hash)
|
|
300
|
-
{}.tap do |hash|
|
|
301
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
302
|
-
end
|
|
303
|
-
elsif value.respond_to? :to_hash
|
|
304
|
-
value.to_hash
|
|
305
|
-
else
|
|
306
|
-
value
|
|
307
|
-
end
|
|
308
|
-
end
|
|
309
|
-
|
|
310
283
|
end
|
|
311
284
|
|
|
312
285
|
end
|