generated from pulumi/pulumi-tf-provider-boilerplate
/
bgpPeer.go
463 lines (400 loc) · 15.7 KB
/
bgpPeer.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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package nxos
import (
"context"
"reflect"
"errors"
"github.com/lbrlabs/pulumi-nxos/sdk/go/nxos/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// This resource can manage the BGP peer configuration.
//
// - API Documentation: [bgpPeer](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:Peer/)
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/lbrlabs/pulumi-nxos/sdk/go/nxos"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := nxos.NewBgpPeer(ctx, "example", &nxos.BgpPeerArgs{
// Address: pulumi.String("192.168.0.1"),
// Asn: pulumi.String("65001"),
// Description: pulumi.String("My description"),
// HoldTime: pulumi.Int(45),
// Keepalive: pulumi.Int(15),
// PeerTemplate: pulumi.String("SPINE-PEERS"),
// PeerType: pulumi.String("fabric-internal"),
// RemoteAsn: pulumi.String("65002"),
// SourceInterface: pulumi.String("lo0"),
// Vrf: pulumi.String("default"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// ```sh
//
// $ pulumi import nxos:index/bgpPeer:BgpPeer example "sys/bgp/inst/dom-[default]/peer-[192.168.0.1]"
//
// ```
type BgpPeer struct {
pulumi.CustomResourceState
// Peer address.
Address pulumi.StringOutput `pulumi:"address"`
// Autonomous system number.
Asn pulumi.StringOutput `pulumi:"asn"`
// Peer description.
Description pulumi.StringPtrOutput `pulumi:"description"`
// A device name from the provider configuration.
Device pulumi.StringPtrOutput `pulumi:"device"`
// BGP Hold Timer in seconds. The value must be greater than the keepalive timer - Range: `3`-`3600` - Default value: `180`
HoldTime pulumi.IntOutput `pulumi:"holdTime"`
// BGP Keepalive Timer in seconds - Range: `0`-`3600` - Default value: `60`
Keepalive pulumi.IntOutput `pulumi:"keepalive"`
// Peer template name.
PeerTemplate pulumi.StringPtrOutput `pulumi:"peerTemplate"`
// Neighbor Fabric Type. - Choices: `fabric-internal`, `fabric-external`, `fabric-border-leaf` - Default value:
// `fabric-internal`
PeerType pulumi.StringOutput `pulumi:"peerType"`
// Peer autonomous system number.
RemoteAsn pulumi.StringPtrOutput `pulumi:"remoteAsn"`
// Source Interface. Must match first field in the output of `show intf brief`. - Default value: `unspecified`
SourceInterface pulumi.StringOutput `pulumi:"sourceInterface"`
// VRF name.
Vrf pulumi.StringOutput `pulumi:"vrf"`
}
// NewBgpPeer registers a new resource with the given unique name, arguments, and options.
func NewBgpPeer(ctx *pulumi.Context,
name string, args *BgpPeerArgs, opts ...pulumi.ResourceOption) (*BgpPeer, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Address == nil {
return nil, errors.New("invalid value for required argument 'Address'")
}
if args.Asn == nil {
return nil, errors.New("invalid value for required argument 'Asn'")
}
if args.Vrf == nil {
return nil, errors.New("invalid value for required argument 'Vrf'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource BgpPeer
err := ctx.RegisterResource("nxos:index/bgpPeer:BgpPeer", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBgpPeer gets an existing BgpPeer resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetBgpPeer(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BgpPeerState, opts ...pulumi.ResourceOption) (*BgpPeer, error) {
var resource BgpPeer
err := ctx.ReadResource("nxos:index/bgpPeer:BgpPeer", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering BgpPeer resources.
type bgpPeerState struct {
// Peer address.
Address *string `pulumi:"address"`
// Autonomous system number.
Asn *string `pulumi:"asn"`
// Peer description.
Description *string `pulumi:"description"`
// A device name from the provider configuration.
Device *string `pulumi:"device"`
// BGP Hold Timer in seconds. The value must be greater than the keepalive timer - Range: `3`-`3600` - Default value: `180`
HoldTime *int `pulumi:"holdTime"`
// BGP Keepalive Timer in seconds - Range: `0`-`3600` - Default value: `60`
Keepalive *int `pulumi:"keepalive"`
// Peer template name.
PeerTemplate *string `pulumi:"peerTemplate"`
// Neighbor Fabric Type. - Choices: `fabric-internal`, `fabric-external`, `fabric-border-leaf` - Default value:
// `fabric-internal`
PeerType *string `pulumi:"peerType"`
// Peer autonomous system number.
RemoteAsn *string `pulumi:"remoteAsn"`
// Source Interface. Must match first field in the output of `show intf brief`. - Default value: `unspecified`
SourceInterface *string `pulumi:"sourceInterface"`
// VRF name.
Vrf *string `pulumi:"vrf"`
}
type BgpPeerState struct {
// Peer address.
Address pulumi.StringPtrInput
// Autonomous system number.
Asn pulumi.StringPtrInput
// Peer description.
Description pulumi.StringPtrInput
// A device name from the provider configuration.
Device pulumi.StringPtrInput
// BGP Hold Timer in seconds. The value must be greater than the keepalive timer - Range: `3`-`3600` - Default value: `180`
HoldTime pulumi.IntPtrInput
// BGP Keepalive Timer in seconds - Range: `0`-`3600` - Default value: `60`
Keepalive pulumi.IntPtrInput
// Peer template name.
PeerTemplate pulumi.StringPtrInput
// Neighbor Fabric Type. - Choices: `fabric-internal`, `fabric-external`, `fabric-border-leaf` - Default value:
// `fabric-internal`
PeerType pulumi.StringPtrInput
// Peer autonomous system number.
RemoteAsn pulumi.StringPtrInput
// Source Interface. Must match first field in the output of `show intf brief`. - Default value: `unspecified`
SourceInterface pulumi.StringPtrInput
// VRF name.
Vrf pulumi.StringPtrInput
}
func (BgpPeerState) ElementType() reflect.Type {
return reflect.TypeOf((*bgpPeerState)(nil)).Elem()
}
type bgpPeerArgs struct {
// Peer address.
Address string `pulumi:"address"`
// Autonomous system number.
Asn string `pulumi:"asn"`
// Peer description.
Description *string `pulumi:"description"`
// A device name from the provider configuration.
Device *string `pulumi:"device"`
// BGP Hold Timer in seconds. The value must be greater than the keepalive timer - Range: `3`-`3600` - Default value: `180`
HoldTime *int `pulumi:"holdTime"`
// BGP Keepalive Timer in seconds - Range: `0`-`3600` - Default value: `60`
Keepalive *int `pulumi:"keepalive"`
// Peer template name.
PeerTemplate *string `pulumi:"peerTemplate"`
// Neighbor Fabric Type. - Choices: `fabric-internal`, `fabric-external`, `fabric-border-leaf` - Default value:
// `fabric-internal`
PeerType *string `pulumi:"peerType"`
// Peer autonomous system number.
RemoteAsn *string `pulumi:"remoteAsn"`
// Source Interface. Must match first field in the output of `show intf brief`. - Default value: `unspecified`
SourceInterface *string `pulumi:"sourceInterface"`
// VRF name.
Vrf string `pulumi:"vrf"`
}
// The set of arguments for constructing a BgpPeer resource.
type BgpPeerArgs struct {
// Peer address.
Address pulumi.StringInput
// Autonomous system number.
Asn pulumi.StringInput
// Peer description.
Description pulumi.StringPtrInput
// A device name from the provider configuration.
Device pulumi.StringPtrInput
// BGP Hold Timer in seconds. The value must be greater than the keepalive timer - Range: `3`-`3600` - Default value: `180`
HoldTime pulumi.IntPtrInput
// BGP Keepalive Timer in seconds - Range: `0`-`3600` - Default value: `60`
Keepalive pulumi.IntPtrInput
// Peer template name.
PeerTemplate pulumi.StringPtrInput
// Neighbor Fabric Type. - Choices: `fabric-internal`, `fabric-external`, `fabric-border-leaf` - Default value:
// `fabric-internal`
PeerType pulumi.StringPtrInput
// Peer autonomous system number.
RemoteAsn pulumi.StringPtrInput
// Source Interface. Must match first field in the output of `show intf brief`. - Default value: `unspecified`
SourceInterface pulumi.StringPtrInput
// VRF name.
Vrf pulumi.StringInput
}
func (BgpPeerArgs) ElementType() reflect.Type {
return reflect.TypeOf((*bgpPeerArgs)(nil)).Elem()
}
type BgpPeerInput interface {
pulumi.Input
ToBgpPeerOutput() BgpPeerOutput
ToBgpPeerOutputWithContext(ctx context.Context) BgpPeerOutput
}
func (*BgpPeer) ElementType() reflect.Type {
return reflect.TypeOf((**BgpPeer)(nil)).Elem()
}
func (i *BgpPeer) ToBgpPeerOutput() BgpPeerOutput {
return i.ToBgpPeerOutputWithContext(context.Background())
}
func (i *BgpPeer) ToBgpPeerOutputWithContext(ctx context.Context) BgpPeerOutput {
return pulumi.ToOutputWithContext(ctx, i).(BgpPeerOutput)
}
func (i *BgpPeer) ToOutput(ctx context.Context) pulumix.Output[*BgpPeer] {
return pulumix.Output[*BgpPeer]{
OutputState: i.ToBgpPeerOutputWithContext(ctx).OutputState,
}
}
// BgpPeerArrayInput is an input type that accepts BgpPeerArray and BgpPeerArrayOutput values.
// You can construct a concrete instance of `BgpPeerArrayInput` via:
//
// BgpPeerArray{ BgpPeerArgs{...} }
type BgpPeerArrayInput interface {
pulumi.Input
ToBgpPeerArrayOutput() BgpPeerArrayOutput
ToBgpPeerArrayOutputWithContext(context.Context) BgpPeerArrayOutput
}
type BgpPeerArray []BgpPeerInput
func (BgpPeerArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BgpPeer)(nil)).Elem()
}
func (i BgpPeerArray) ToBgpPeerArrayOutput() BgpPeerArrayOutput {
return i.ToBgpPeerArrayOutputWithContext(context.Background())
}
func (i BgpPeerArray) ToBgpPeerArrayOutputWithContext(ctx context.Context) BgpPeerArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(BgpPeerArrayOutput)
}
func (i BgpPeerArray) ToOutput(ctx context.Context) pulumix.Output[[]*BgpPeer] {
return pulumix.Output[[]*BgpPeer]{
OutputState: i.ToBgpPeerArrayOutputWithContext(ctx).OutputState,
}
}
// BgpPeerMapInput is an input type that accepts BgpPeerMap and BgpPeerMapOutput values.
// You can construct a concrete instance of `BgpPeerMapInput` via:
//
// BgpPeerMap{ "key": BgpPeerArgs{...} }
type BgpPeerMapInput interface {
pulumi.Input
ToBgpPeerMapOutput() BgpPeerMapOutput
ToBgpPeerMapOutputWithContext(context.Context) BgpPeerMapOutput
}
type BgpPeerMap map[string]BgpPeerInput
func (BgpPeerMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BgpPeer)(nil)).Elem()
}
func (i BgpPeerMap) ToBgpPeerMapOutput() BgpPeerMapOutput {
return i.ToBgpPeerMapOutputWithContext(context.Background())
}
func (i BgpPeerMap) ToBgpPeerMapOutputWithContext(ctx context.Context) BgpPeerMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(BgpPeerMapOutput)
}
func (i BgpPeerMap) ToOutput(ctx context.Context) pulumix.Output[map[string]*BgpPeer] {
return pulumix.Output[map[string]*BgpPeer]{
OutputState: i.ToBgpPeerMapOutputWithContext(ctx).OutputState,
}
}
type BgpPeerOutput struct{ *pulumi.OutputState }
func (BgpPeerOutput) ElementType() reflect.Type {
return reflect.TypeOf((**BgpPeer)(nil)).Elem()
}
func (o BgpPeerOutput) ToBgpPeerOutput() BgpPeerOutput {
return o
}
func (o BgpPeerOutput) ToBgpPeerOutputWithContext(ctx context.Context) BgpPeerOutput {
return o
}
func (o BgpPeerOutput) ToOutput(ctx context.Context) pulumix.Output[*BgpPeer] {
return pulumix.Output[*BgpPeer]{
OutputState: o.OutputState,
}
}
// Peer address.
func (o BgpPeerOutput) Address() pulumi.StringOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.Address }).(pulumi.StringOutput)
}
// Autonomous system number.
func (o BgpPeerOutput) Asn() pulumi.StringOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.Asn }).(pulumi.StringOutput)
}
// Peer description.
func (o BgpPeerOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// A device name from the provider configuration.
func (o BgpPeerOutput) Device() pulumi.StringPtrOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.StringPtrOutput { return v.Device }).(pulumi.StringPtrOutput)
}
// BGP Hold Timer in seconds. The value must be greater than the keepalive timer - Range: `3`-`3600` - Default value: `180`
func (o BgpPeerOutput) HoldTime() pulumi.IntOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.IntOutput { return v.HoldTime }).(pulumi.IntOutput)
}
// BGP Keepalive Timer in seconds - Range: `0`-`3600` - Default value: `60`
func (o BgpPeerOutput) Keepalive() pulumi.IntOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.IntOutput { return v.Keepalive }).(pulumi.IntOutput)
}
// Peer template name.
func (o BgpPeerOutput) PeerTemplate() pulumi.StringPtrOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.StringPtrOutput { return v.PeerTemplate }).(pulumi.StringPtrOutput)
}
// Neighbor Fabric Type. - Choices: `fabric-internal`, `fabric-external`, `fabric-border-leaf` - Default value:
// `fabric-internal`
func (o BgpPeerOutput) PeerType() pulumi.StringOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.PeerType }).(pulumi.StringOutput)
}
// Peer autonomous system number.
func (o BgpPeerOutput) RemoteAsn() pulumi.StringPtrOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.StringPtrOutput { return v.RemoteAsn }).(pulumi.StringPtrOutput)
}
// Source Interface. Must match first field in the output of `show intf brief`. - Default value: `unspecified`
func (o BgpPeerOutput) SourceInterface() pulumi.StringOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.SourceInterface }).(pulumi.StringOutput)
}
// VRF name.
func (o BgpPeerOutput) Vrf() pulumi.StringOutput {
return o.ApplyT(func(v *BgpPeer) pulumi.StringOutput { return v.Vrf }).(pulumi.StringOutput)
}
type BgpPeerArrayOutput struct{ *pulumi.OutputState }
func (BgpPeerArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BgpPeer)(nil)).Elem()
}
func (o BgpPeerArrayOutput) ToBgpPeerArrayOutput() BgpPeerArrayOutput {
return o
}
func (o BgpPeerArrayOutput) ToBgpPeerArrayOutputWithContext(ctx context.Context) BgpPeerArrayOutput {
return o
}
func (o BgpPeerArrayOutput) ToOutput(ctx context.Context) pulumix.Output[[]*BgpPeer] {
return pulumix.Output[[]*BgpPeer]{
OutputState: o.OutputState,
}
}
func (o BgpPeerArrayOutput) Index(i pulumi.IntInput) BgpPeerOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BgpPeer {
return vs[0].([]*BgpPeer)[vs[1].(int)]
}).(BgpPeerOutput)
}
type BgpPeerMapOutput struct{ *pulumi.OutputState }
func (BgpPeerMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BgpPeer)(nil)).Elem()
}
func (o BgpPeerMapOutput) ToBgpPeerMapOutput() BgpPeerMapOutput {
return o
}
func (o BgpPeerMapOutput) ToBgpPeerMapOutputWithContext(ctx context.Context) BgpPeerMapOutput {
return o
}
func (o BgpPeerMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]*BgpPeer] {
return pulumix.Output[map[string]*BgpPeer]{
OutputState: o.OutputState,
}
}
func (o BgpPeerMapOutput) MapIndex(k pulumi.StringInput) BgpPeerOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BgpPeer {
return vs[0].(map[string]*BgpPeer)[vs[1].(string)]
}).(BgpPeerOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*BgpPeerInput)(nil)).Elem(), &BgpPeer{})
pulumi.RegisterInputType(reflect.TypeOf((*BgpPeerArrayInput)(nil)).Elem(), BgpPeerArray{})
pulumi.RegisterInputType(reflect.TypeOf((*BgpPeerMapInput)(nil)).Elem(), BgpPeerMap{})
pulumi.RegisterOutputType(BgpPeerOutput{})
pulumi.RegisterOutputType(BgpPeerArrayOutput{})
pulumi.RegisterOutputType(BgpPeerMapOutput{})
}