/
bgpPeer.go
321 lines (275 loc) · 11.3 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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package directconnect
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Direct Connect BGP peer resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/directconnect"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := directconnect.NewBgpPeer(ctx, "peer", &directconnect.BgpPeerArgs{
// VirtualInterfaceId: pulumi.Any(aws_dx_private_virtual_interface.Foo.Id),
// AddressFamily: pulumi.String("ipv6"),
// BgpAsn: pulumi.Int(65351),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type BgpPeer struct {
pulumi.CustomResourceState
// The address family for the BGP peer. ` ipv4 ` or `ipv6`.
AddressFamily pulumi.StringOutput `pulumi:"addressFamily"`
// The IPv4 CIDR address to use to send traffic to Amazon.
// Required for IPv4 BGP peers on public virtual interfaces.
AmazonAddress pulumi.StringOutput `pulumi:"amazonAddress"`
// The Direct Connect endpoint on which the BGP peer terminates.
AwsDevice pulumi.StringOutput `pulumi:"awsDevice"`
// The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
BgpAsn pulumi.IntOutput `pulumi:"bgpAsn"`
// The authentication key for BGP configuration.
BgpAuthKey pulumi.StringOutput `pulumi:"bgpAuthKey"`
// The ID of the BGP peer.
BgpPeerId pulumi.StringOutput `pulumi:"bgpPeerId"`
// The Up/Down state of the BGP peer.
BgpStatus pulumi.StringOutput `pulumi:"bgpStatus"`
// The IPv4 CIDR destination address to which Amazon should send traffic.
// Required for IPv4 BGP peers on public virtual interfaces.
CustomerAddress pulumi.StringOutput `pulumi:"customerAddress"`
// The ID of the Direct Connect virtual interface on which to create the BGP peer.
VirtualInterfaceId pulumi.StringOutput `pulumi:"virtualInterfaceId"`
}
// 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.AddressFamily == nil {
return nil, errors.New("invalid value for required argument 'AddressFamily'")
}
if args.BgpAsn == nil {
return nil, errors.New("invalid value for required argument 'BgpAsn'")
}
if args.VirtualInterfaceId == nil {
return nil, errors.New("invalid value for required argument 'VirtualInterfaceId'")
}
var resource BgpPeer
err := ctx.RegisterResource("aws:directconnect/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("aws:directconnect/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 {
// The address family for the BGP peer. ` ipv4 ` or `ipv6`.
AddressFamily *string `pulumi:"addressFamily"`
// The IPv4 CIDR address to use to send traffic to Amazon.
// Required for IPv4 BGP peers on public virtual interfaces.
AmazonAddress *string `pulumi:"amazonAddress"`
// The Direct Connect endpoint on which the BGP peer terminates.
AwsDevice *string `pulumi:"awsDevice"`
// The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
BgpAsn *int `pulumi:"bgpAsn"`
// The authentication key for BGP configuration.
BgpAuthKey *string `pulumi:"bgpAuthKey"`
// The ID of the BGP peer.
BgpPeerId *string `pulumi:"bgpPeerId"`
// The Up/Down state of the BGP peer.
BgpStatus *string `pulumi:"bgpStatus"`
// The IPv4 CIDR destination address to which Amazon should send traffic.
// Required for IPv4 BGP peers on public virtual interfaces.
CustomerAddress *string `pulumi:"customerAddress"`
// The ID of the Direct Connect virtual interface on which to create the BGP peer.
VirtualInterfaceId *string `pulumi:"virtualInterfaceId"`
}
type BgpPeerState struct {
// The address family for the BGP peer. ` ipv4 ` or `ipv6`.
AddressFamily pulumi.StringPtrInput
// The IPv4 CIDR address to use to send traffic to Amazon.
// Required for IPv4 BGP peers on public virtual interfaces.
AmazonAddress pulumi.StringPtrInput
// The Direct Connect endpoint on which the BGP peer terminates.
AwsDevice pulumi.StringPtrInput
// The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
BgpAsn pulumi.IntPtrInput
// The authentication key for BGP configuration.
BgpAuthKey pulumi.StringPtrInput
// The ID of the BGP peer.
BgpPeerId pulumi.StringPtrInput
// The Up/Down state of the BGP peer.
BgpStatus pulumi.StringPtrInput
// The IPv4 CIDR destination address to which Amazon should send traffic.
// Required for IPv4 BGP peers on public virtual interfaces.
CustomerAddress pulumi.StringPtrInput
// The ID of the Direct Connect virtual interface on which to create the BGP peer.
VirtualInterfaceId pulumi.StringPtrInput
}
func (BgpPeerState) ElementType() reflect.Type {
return reflect.TypeOf((*bgpPeerState)(nil)).Elem()
}
type bgpPeerArgs struct {
// The address family for the BGP peer. ` ipv4 ` or `ipv6`.
AddressFamily string `pulumi:"addressFamily"`
// The IPv4 CIDR address to use to send traffic to Amazon.
// Required for IPv4 BGP peers on public virtual interfaces.
AmazonAddress *string `pulumi:"amazonAddress"`
// The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
BgpAsn int `pulumi:"bgpAsn"`
// The authentication key for BGP configuration.
BgpAuthKey *string `pulumi:"bgpAuthKey"`
// The IPv4 CIDR destination address to which Amazon should send traffic.
// Required for IPv4 BGP peers on public virtual interfaces.
CustomerAddress *string `pulumi:"customerAddress"`
// The ID of the Direct Connect virtual interface on which to create the BGP peer.
VirtualInterfaceId string `pulumi:"virtualInterfaceId"`
}
// The set of arguments for constructing a BgpPeer resource.
type BgpPeerArgs struct {
// The address family for the BGP peer. ` ipv4 ` or `ipv6`.
AddressFamily pulumi.StringInput
// The IPv4 CIDR address to use to send traffic to Amazon.
// Required for IPv4 BGP peers on public virtual interfaces.
AmazonAddress pulumi.StringPtrInput
// The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
BgpAsn pulumi.IntInput
// The authentication key for BGP configuration.
BgpAuthKey pulumi.StringPtrInput
// The IPv4 CIDR destination address to which Amazon should send traffic.
// Required for IPv4 BGP peers on public virtual interfaces.
CustomerAddress pulumi.StringPtrInput
// The ID of the Direct Connect virtual interface on which to create the BGP peer.
VirtualInterfaceId 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)
}
// 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)
}
// 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)
}
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
}
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) 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) 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{})
}