-
Notifications
You must be signed in to change notification settings - Fork 4
/
model_bgp_routing_protocol_request.go
411 lines (344 loc) · 13.2 KB
/
model_bgp_routing_protocol_request.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
/*
Equinix Internet Access API
Equinix Internet Access provides direct access to the Internet with scalable bandwidth options in IBX data centers.
Contact: api-support@equinix.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package eiav2
import (
"encoding/json"
"fmt"
"reflect"
"strings"
)
// checks if the BgpRoutingProtocolRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &BgpRoutingProtocolRequest{}
// BgpRoutingProtocolRequest struct for BgpRoutingProtocolRequest
type BgpRoutingProtocolRequest struct {
RoutingProtocolRequest
CustomerAsnRange *BgpRoutingProtocolRequestAllOfCustomerAsnRange `json:"customerAsnRange,omitempty"`
// Customer Autonomous System Number
CustomerAsn *int64 `json:"customerAsn,omitempty"`
// BGP authentication key
BgpAuthKey *string `json:"bgpAuthKey,omitempty"`
ExportPolicy BgpRoutingProtocolRequestAllOfExportPolicy `json:"exportPolicy"`
Ipv4 *RoutingProtocolIpv4Request `json:"ipv4,omitempty"`
Ipv6 *RoutingProtocolIpv6Request `json:"ipv6,omitempty"`
AdditionalProperties map[string]interface{}
}
type _BgpRoutingProtocolRequest BgpRoutingProtocolRequest
// NewBgpRoutingProtocolRequest instantiates a new BgpRoutingProtocolRequest object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewBgpRoutingProtocolRequest(exportPolicy BgpRoutingProtocolRequestAllOfExportPolicy, type_ RoutingProtocolType) *BgpRoutingProtocolRequest {
this := BgpRoutingProtocolRequest{}
this.Type = type_
this.ExportPolicy = exportPolicy
return &this
}
// NewBgpRoutingProtocolRequestWithDefaults instantiates a new BgpRoutingProtocolRequest object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewBgpRoutingProtocolRequestWithDefaults() *BgpRoutingProtocolRequest {
this := BgpRoutingProtocolRequest{}
return &this
}
// GetCustomerAsnRange returns the CustomerAsnRange field value if set, zero value otherwise.
func (o *BgpRoutingProtocolRequest) GetCustomerAsnRange() BgpRoutingProtocolRequestAllOfCustomerAsnRange {
if o == nil || IsNil(o.CustomerAsnRange) {
var ret BgpRoutingProtocolRequestAllOfCustomerAsnRange
return ret
}
return *o.CustomerAsnRange
}
// GetCustomerAsnRangeOk returns a tuple with the CustomerAsnRange field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BgpRoutingProtocolRequest) GetCustomerAsnRangeOk() (*BgpRoutingProtocolRequestAllOfCustomerAsnRange, bool) {
if o == nil || IsNil(o.CustomerAsnRange) {
return nil, false
}
return o.CustomerAsnRange, true
}
// HasCustomerAsnRange returns a boolean if a field has been set.
func (o *BgpRoutingProtocolRequest) HasCustomerAsnRange() bool {
if o != nil && !IsNil(o.CustomerAsnRange) {
return true
}
return false
}
// SetCustomerAsnRange gets a reference to the given BgpRoutingProtocolRequestAllOfCustomerAsnRange and assigns it to the CustomerAsnRange field.
func (o *BgpRoutingProtocolRequest) SetCustomerAsnRange(v BgpRoutingProtocolRequestAllOfCustomerAsnRange) {
o.CustomerAsnRange = &v
}
// GetCustomerAsn returns the CustomerAsn field value if set, zero value otherwise.
func (o *BgpRoutingProtocolRequest) GetCustomerAsn() int64 {
if o == nil || IsNil(o.CustomerAsn) {
var ret int64
return ret
}
return *o.CustomerAsn
}
// GetCustomerAsnOk returns a tuple with the CustomerAsn field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BgpRoutingProtocolRequest) GetCustomerAsnOk() (*int64, bool) {
if o == nil || IsNil(o.CustomerAsn) {
return nil, false
}
return o.CustomerAsn, true
}
// HasCustomerAsn returns a boolean if a field has been set.
func (o *BgpRoutingProtocolRequest) HasCustomerAsn() bool {
if o != nil && !IsNil(o.CustomerAsn) {
return true
}
return false
}
// SetCustomerAsn gets a reference to the given int64 and assigns it to the CustomerAsn field.
func (o *BgpRoutingProtocolRequest) SetCustomerAsn(v int64) {
o.CustomerAsn = &v
}
// GetBgpAuthKey returns the BgpAuthKey field value if set, zero value otherwise.
func (o *BgpRoutingProtocolRequest) GetBgpAuthKey() string {
if o == nil || IsNil(o.BgpAuthKey) {
var ret string
return ret
}
return *o.BgpAuthKey
}
// GetBgpAuthKeyOk returns a tuple with the BgpAuthKey field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BgpRoutingProtocolRequest) GetBgpAuthKeyOk() (*string, bool) {
if o == nil || IsNil(o.BgpAuthKey) {
return nil, false
}
return o.BgpAuthKey, true
}
// HasBgpAuthKey returns a boolean if a field has been set.
func (o *BgpRoutingProtocolRequest) HasBgpAuthKey() bool {
if o != nil && !IsNil(o.BgpAuthKey) {
return true
}
return false
}
// SetBgpAuthKey gets a reference to the given string and assigns it to the BgpAuthKey field.
func (o *BgpRoutingProtocolRequest) SetBgpAuthKey(v string) {
o.BgpAuthKey = &v
}
// GetExportPolicy returns the ExportPolicy field value
func (o *BgpRoutingProtocolRequest) GetExportPolicy() BgpRoutingProtocolRequestAllOfExportPolicy {
if o == nil {
var ret BgpRoutingProtocolRequestAllOfExportPolicy
return ret
}
return o.ExportPolicy
}
// GetExportPolicyOk returns a tuple with the ExportPolicy field value
// and a boolean to check if the value has been set.
func (o *BgpRoutingProtocolRequest) GetExportPolicyOk() (*BgpRoutingProtocolRequestAllOfExportPolicy, bool) {
if o == nil {
return nil, false
}
return &o.ExportPolicy, true
}
// SetExportPolicy sets field value
func (o *BgpRoutingProtocolRequest) SetExportPolicy(v BgpRoutingProtocolRequestAllOfExportPolicy) {
o.ExportPolicy = v
}
// GetIpv4 returns the Ipv4 field value if set, zero value otherwise.
func (o *BgpRoutingProtocolRequest) GetIpv4() RoutingProtocolIpv4Request {
if o == nil || IsNil(o.Ipv4) {
var ret RoutingProtocolIpv4Request
return ret
}
return *o.Ipv4
}
// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BgpRoutingProtocolRequest) GetIpv4Ok() (*RoutingProtocolIpv4Request, bool) {
if o == nil || IsNil(o.Ipv4) {
return nil, false
}
return o.Ipv4, true
}
// HasIpv4 returns a boolean if a field has been set.
func (o *BgpRoutingProtocolRequest) HasIpv4() bool {
if o != nil && !IsNil(o.Ipv4) {
return true
}
return false
}
// SetIpv4 gets a reference to the given RoutingProtocolIpv4Request and assigns it to the Ipv4 field.
func (o *BgpRoutingProtocolRequest) SetIpv4(v RoutingProtocolIpv4Request) {
o.Ipv4 = &v
}
// GetIpv6 returns the Ipv6 field value if set, zero value otherwise.
func (o *BgpRoutingProtocolRequest) GetIpv6() RoutingProtocolIpv6Request {
if o == nil || IsNil(o.Ipv6) {
var ret RoutingProtocolIpv6Request
return ret
}
return *o.Ipv6
}
// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BgpRoutingProtocolRequest) GetIpv6Ok() (*RoutingProtocolIpv6Request, bool) {
if o == nil || IsNil(o.Ipv6) {
return nil, false
}
return o.Ipv6, true
}
// HasIpv6 returns a boolean if a field has been set.
func (o *BgpRoutingProtocolRequest) HasIpv6() bool {
if o != nil && !IsNil(o.Ipv6) {
return true
}
return false
}
// SetIpv6 gets a reference to the given RoutingProtocolIpv6Request and assigns it to the Ipv6 field.
func (o *BgpRoutingProtocolRequest) SetIpv6(v RoutingProtocolIpv6Request) {
o.Ipv6 = &v
}
func (o BgpRoutingProtocolRequest) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o BgpRoutingProtocolRequest) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
serializedRoutingProtocolRequest, errRoutingProtocolRequest := json.Marshal(o.RoutingProtocolRequest)
if errRoutingProtocolRequest != nil {
return map[string]interface{}{}, errRoutingProtocolRequest
}
errRoutingProtocolRequest = json.Unmarshal([]byte(serializedRoutingProtocolRequest), &toSerialize)
if errRoutingProtocolRequest != nil {
return map[string]interface{}{}, errRoutingProtocolRequest
}
if !IsNil(o.CustomerAsnRange) {
toSerialize["customerAsnRange"] = o.CustomerAsnRange
}
if !IsNil(o.CustomerAsn) {
toSerialize["customerAsn"] = o.CustomerAsn
}
if !IsNil(o.BgpAuthKey) {
toSerialize["bgpAuthKey"] = o.BgpAuthKey
}
toSerialize["exportPolicy"] = o.ExportPolicy
if !IsNil(o.Ipv4) {
toSerialize["ipv4"] = o.Ipv4
}
if !IsNil(o.Ipv6) {
toSerialize["ipv6"] = o.Ipv6
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *BgpRoutingProtocolRequest) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"exportPolicy",
"type",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err
}
for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
type BgpRoutingProtocolRequestWithoutEmbeddedStruct struct {
CustomerAsnRange *BgpRoutingProtocolRequestAllOfCustomerAsnRange `json:"customerAsnRange,omitempty"`
// Customer Autonomous System Number
CustomerAsn *int64 `json:"customerAsn,omitempty"`
// BGP authentication key
BgpAuthKey *string `json:"bgpAuthKey,omitempty"`
ExportPolicy BgpRoutingProtocolRequestAllOfExportPolicy `json:"exportPolicy"`
Ipv4 *RoutingProtocolIpv4Request `json:"ipv4,omitempty"`
Ipv6 *RoutingProtocolIpv6Request `json:"ipv6,omitempty"`
}
varBgpRoutingProtocolRequestWithoutEmbeddedStruct := BgpRoutingProtocolRequestWithoutEmbeddedStruct{}
err = json.Unmarshal(data, &varBgpRoutingProtocolRequestWithoutEmbeddedStruct)
if err == nil {
varBgpRoutingProtocolRequest := _BgpRoutingProtocolRequest{}
varBgpRoutingProtocolRequest.CustomerAsnRange = varBgpRoutingProtocolRequestWithoutEmbeddedStruct.CustomerAsnRange
varBgpRoutingProtocolRequest.CustomerAsn = varBgpRoutingProtocolRequestWithoutEmbeddedStruct.CustomerAsn
varBgpRoutingProtocolRequest.BgpAuthKey = varBgpRoutingProtocolRequestWithoutEmbeddedStruct.BgpAuthKey
varBgpRoutingProtocolRequest.ExportPolicy = varBgpRoutingProtocolRequestWithoutEmbeddedStruct.ExportPolicy
varBgpRoutingProtocolRequest.Ipv4 = varBgpRoutingProtocolRequestWithoutEmbeddedStruct.Ipv4
varBgpRoutingProtocolRequest.Ipv6 = varBgpRoutingProtocolRequestWithoutEmbeddedStruct.Ipv6
*o = BgpRoutingProtocolRequest(varBgpRoutingProtocolRequest)
} else {
return err
}
varBgpRoutingProtocolRequest := _BgpRoutingProtocolRequest{}
err = json.Unmarshal(data, &varBgpRoutingProtocolRequest)
if err == nil {
o.RoutingProtocolRequest = varBgpRoutingProtocolRequest.RoutingProtocolRequest
} else {
return err
}
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "customerAsnRange")
delete(additionalProperties, "customerAsn")
delete(additionalProperties, "bgpAuthKey")
delete(additionalProperties, "exportPolicy")
delete(additionalProperties, "ipv4")
delete(additionalProperties, "ipv6")
// remove fields from embedded structs
reflectRoutingProtocolRequest := reflect.ValueOf(o.RoutingProtocolRequest)
for i := 0; i < reflectRoutingProtocolRequest.Type().NumField(); i++ {
t := reflectRoutingProtocolRequest.Type().Field(i)
if jsonTag := t.Tag.Get("json"); jsonTag != "" {
fieldName := ""
if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 {
fieldName = jsonTag[:commaIdx]
} else {
fieldName = jsonTag
}
if fieldName != "AdditionalProperties" {
delete(additionalProperties, fieldName)
}
}
}
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableBgpRoutingProtocolRequest struct {
value *BgpRoutingProtocolRequest
isSet bool
}
func (v NullableBgpRoutingProtocolRequest) Get() *BgpRoutingProtocolRequest {
return v.value
}
func (v *NullableBgpRoutingProtocolRequest) Set(val *BgpRoutingProtocolRequest) {
v.value = val
v.isSet = true
}
func (v NullableBgpRoutingProtocolRequest) IsSet() bool {
return v.isSet
}
func (v *NullableBgpRoutingProtocolRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableBgpRoutingProtocolRequest(val *BgpRoutingProtocolRequest) *NullableBgpRoutingProtocolRequest {
return &NullableBgpRoutingProtocolRequest{value: val, isSet: true}
}
func (v NullableBgpRoutingProtocolRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableBgpRoutingProtocolRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}