-
Notifications
You must be signed in to change notification settings - Fork 151
/
vpnConnectionRoute.go
333 lines (273 loc) · 11.4 KB
/
vpnConnectionRoute.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
// *** 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 ec2
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a static route between a VPN connection and a customer gateway.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// vpc, err := ec2.NewVpc(ctx, "vpc", &ec2.VpcArgs{
// CidrBlock: pulumi.String("10.0.0.0/16"),
// })
// if err != nil {
// return err
// }
// vpnGateway, err := ec2.NewVpnGateway(ctx, "vpnGateway", &ec2.VpnGatewayArgs{
// VpcId: vpc.ID(),
// })
// if err != nil {
// return err
// }
// customerGateway, err := ec2.NewCustomerGateway(ctx, "customerGateway", &ec2.CustomerGatewayArgs{
// BgpAsn: pulumi.String("65000"),
// IpAddress: pulumi.String("172.0.0.1"),
// Type: pulumi.String("ipsec.1"),
// })
// if err != nil {
// return err
// }
// main, err := ec2.NewVpnConnection(ctx, "main", &ec2.VpnConnectionArgs{
// VpnGatewayId: vpnGateway.ID(),
// CustomerGatewayId: customerGateway.ID(),
// Type: pulumi.String("ipsec.1"),
// StaticRoutesOnly: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// _, err = ec2.NewVpnConnectionRoute(ctx, "office", &ec2.VpnConnectionRouteArgs{
// DestinationCidrBlock: pulumi.String("192.168.10.0/24"),
// VpnConnectionId: main.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type VpnConnectionRoute struct {
pulumi.CustomResourceState
// The CIDR block associated with the local subnet of the customer network.
DestinationCidrBlock pulumi.StringOutput `pulumi:"destinationCidrBlock"`
// The ID of the VPN connection.
VpnConnectionId pulumi.StringOutput `pulumi:"vpnConnectionId"`
}
// NewVpnConnectionRoute registers a new resource with the given unique name, arguments, and options.
func NewVpnConnectionRoute(ctx *pulumi.Context,
name string, args *VpnConnectionRouteArgs, opts ...pulumi.ResourceOption) (*VpnConnectionRoute, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DestinationCidrBlock == nil {
return nil, errors.New("invalid value for required argument 'DestinationCidrBlock'")
}
if args.VpnConnectionId == nil {
return nil, errors.New("invalid value for required argument 'VpnConnectionId'")
}
var resource VpnConnectionRoute
err := ctx.RegisterResource("aws:ec2/vpnConnectionRoute:VpnConnectionRoute", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetVpnConnectionRoute gets an existing VpnConnectionRoute 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 GetVpnConnectionRoute(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *VpnConnectionRouteState, opts ...pulumi.ResourceOption) (*VpnConnectionRoute, error) {
var resource VpnConnectionRoute
err := ctx.ReadResource("aws:ec2/vpnConnectionRoute:VpnConnectionRoute", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering VpnConnectionRoute resources.
type vpnConnectionRouteState struct {
// The CIDR block associated with the local subnet of the customer network.
DestinationCidrBlock *string `pulumi:"destinationCidrBlock"`
// The ID of the VPN connection.
VpnConnectionId *string `pulumi:"vpnConnectionId"`
}
type VpnConnectionRouteState struct {
// The CIDR block associated with the local subnet of the customer network.
DestinationCidrBlock pulumi.StringPtrInput
// The ID of the VPN connection.
VpnConnectionId pulumi.StringPtrInput
}
func (VpnConnectionRouteState) ElementType() reflect.Type {
return reflect.TypeOf((*vpnConnectionRouteState)(nil)).Elem()
}
type vpnConnectionRouteArgs struct {
// The CIDR block associated with the local subnet of the customer network.
DestinationCidrBlock string `pulumi:"destinationCidrBlock"`
// The ID of the VPN connection.
VpnConnectionId string `pulumi:"vpnConnectionId"`
}
// The set of arguments for constructing a VpnConnectionRoute resource.
type VpnConnectionRouteArgs struct {
// The CIDR block associated with the local subnet of the customer network.
DestinationCidrBlock pulumi.StringInput
// The ID of the VPN connection.
VpnConnectionId pulumi.StringInput
}
func (VpnConnectionRouteArgs) ElementType() reflect.Type {
return reflect.TypeOf((*vpnConnectionRouteArgs)(nil)).Elem()
}
type VpnConnectionRouteInput interface {
pulumi.Input
ToVpnConnectionRouteOutput() VpnConnectionRouteOutput
ToVpnConnectionRouteOutputWithContext(ctx context.Context) VpnConnectionRouteOutput
}
func (*VpnConnectionRoute) ElementType() reflect.Type {
return reflect.TypeOf((*VpnConnectionRoute)(nil))
}
func (i *VpnConnectionRoute) ToVpnConnectionRouteOutput() VpnConnectionRouteOutput {
return i.ToVpnConnectionRouteOutputWithContext(context.Background())
}
func (i *VpnConnectionRoute) ToVpnConnectionRouteOutputWithContext(ctx context.Context) VpnConnectionRouteOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpnConnectionRouteOutput)
}
func (i *VpnConnectionRoute) ToVpnConnectionRoutePtrOutput() VpnConnectionRoutePtrOutput {
return i.ToVpnConnectionRoutePtrOutputWithContext(context.Background())
}
func (i *VpnConnectionRoute) ToVpnConnectionRoutePtrOutputWithContext(ctx context.Context) VpnConnectionRoutePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpnConnectionRoutePtrOutput)
}
type VpnConnectionRoutePtrInput interface {
pulumi.Input
ToVpnConnectionRoutePtrOutput() VpnConnectionRoutePtrOutput
ToVpnConnectionRoutePtrOutputWithContext(ctx context.Context) VpnConnectionRoutePtrOutput
}
type vpnConnectionRoutePtrType VpnConnectionRouteArgs
func (*vpnConnectionRoutePtrType) ElementType() reflect.Type {
return reflect.TypeOf((**VpnConnectionRoute)(nil))
}
func (i *vpnConnectionRoutePtrType) ToVpnConnectionRoutePtrOutput() VpnConnectionRoutePtrOutput {
return i.ToVpnConnectionRoutePtrOutputWithContext(context.Background())
}
func (i *vpnConnectionRoutePtrType) ToVpnConnectionRoutePtrOutputWithContext(ctx context.Context) VpnConnectionRoutePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpnConnectionRoutePtrOutput)
}
// VpnConnectionRouteArrayInput is an input type that accepts VpnConnectionRouteArray and VpnConnectionRouteArrayOutput values.
// You can construct a concrete instance of `VpnConnectionRouteArrayInput` via:
//
// VpnConnectionRouteArray{ VpnConnectionRouteArgs{...} }
type VpnConnectionRouteArrayInput interface {
pulumi.Input
ToVpnConnectionRouteArrayOutput() VpnConnectionRouteArrayOutput
ToVpnConnectionRouteArrayOutputWithContext(context.Context) VpnConnectionRouteArrayOutput
}
type VpnConnectionRouteArray []VpnConnectionRouteInput
func (VpnConnectionRouteArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*VpnConnectionRoute)(nil))
}
func (i VpnConnectionRouteArray) ToVpnConnectionRouteArrayOutput() VpnConnectionRouteArrayOutput {
return i.ToVpnConnectionRouteArrayOutputWithContext(context.Background())
}
func (i VpnConnectionRouteArray) ToVpnConnectionRouteArrayOutputWithContext(ctx context.Context) VpnConnectionRouteArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpnConnectionRouteArrayOutput)
}
// VpnConnectionRouteMapInput is an input type that accepts VpnConnectionRouteMap and VpnConnectionRouteMapOutput values.
// You can construct a concrete instance of `VpnConnectionRouteMapInput` via:
//
// VpnConnectionRouteMap{ "key": VpnConnectionRouteArgs{...} }
type VpnConnectionRouteMapInput interface {
pulumi.Input
ToVpnConnectionRouteMapOutput() VpnConnectionRouteMapOutput
ToVpnConnectionRouteMapOutputWithContext(context.Context) VpnConnectionRouteMapOutput
}
type VpnConnectionRouteMap map[string]VpnConnectionRouteInput
func (VpnConnectionRouteMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*VpnConnectionRoute)(nil))
}
func (i VpnConnectionRouteMap) ToVpnConnectionRouteMapOutput() VpnConnectionRouteMapOutput {
return i.ToVpnConnectionRouteMapOutputWithContext(context.Background())
}
func (i VpnConnectionRouteMap) ToVpnConnectionRouteMapOutputWithContext(ctx context.Context) VpnConnectionRouteMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpnConnectionRouteMapOutput)
}
type VpnConnectionRouteOutput struct {
*pulumi.OutputState
}
func (VpnConnectionRouteOutput) ElementType() reflect.Type {
return reflect.TypeOf((*VpnConnectionRoute)(nil))
}
func (o VpnConnectionRouteOutput) ToVpnConnectionRouteOutput() VpnConnectionRouteOutput {
return o
}
func (o VpnConnectionRouteOutput) ToVpnConnectionRouteOutputWithContext(ctx context.Context) VpnConnectionRouteOutput {
return o
}
func (o VpnConnectionRouteOutput) ToVpnConnectionRoutePtrOutput() VpnConnectionRoutePtrOutput {
return o.ToVpnConnectionRoutePtrOutputWithContext(context.Background())
}
func (o VpnConnectionRouteOutput) ToVpnConnectionRoutePtrOutputWithContext(ctx context.Context) VpnConnectionRoutePtrOutput {
return o.ApplyT(func(v VpnConnectionRoute) *VpnConnectionRoute {
return &v
}).(VpnConnectionRoutePtrOutput)
}
type VpnConnectionRoutePtrOutput struct {
*pulumi.OutputState
}
func (VpnConnectionRoutePtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**VpnConnectionRoute)(nil))
}
func (o VpnConnectionRoutePtrOutput) ToVpnConnectionRoutePtrOutput() VpnConnectionRoutePtrOutput {
return o
}
func (o VpnConnectionRoutePtrOutput) ToVpnConnectionRoutePtrOutputWithContext(ctx context.Context) VpnConnectionRoutePtrOutput {
return o
}
type VpnConnectionRouteArrayOutput struct{ *pulumi.OutputState }
func (VpnConnectionRouteArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]VpnConnectionRoute)(nil))
}
func (o VpnConnectionRouteArrayOutput) ToVpnConnectionRouteArrayOutput() VpnConnectionRouteArrayOutput {
return o
}
func (o VpnConnectionRouteArrayOutput) ToVpnConnectionRouteArrayOutputWithContext(ctx context.Context) VpnConnectionRouteArrayOutput {
return o
}
func (o VpnConnectionRouteArrayOutput) Index(i pulumi.IntInput) VpnConnectionRouteOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) VpnConnectionRoute {
return vs[0].([]VpnConnectionRoute)[vs[1].(int)]
}).(VpnConnectionRouteOutput)
}
type VpnConnectionRouteMapOutput struct{ *pulumi.OutputState }
func (VpnConnectionRouteMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]VpnConnectionRoute)(nil))
}
func (o VpnConnectionRouteMapOutput) ToVpnConnectionRouteMapOutput() VpnConnectionRouteMapOutput {
return o
}
func (o VpnConnectionRouteMapOutput) ToVpnConnectionRouteMapOutputWithContext(ctx context.Context) VpnConnectionRouteMapOutput {
return o
}
func (o VpnConnectionRouteMapOutput) MapIndex(k pulumi.StringInput) VpnConnectionRouteOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) VpnConnectionRoute {
return vs[0].(map[string]VpnConnectionRoute)[vs[1].(string)]
}).(VpnConnectionRouteOutput)
}
func init() {
pulumi.RegisterOutputType(VpnConnectionRouteOutput{})
pulumi.RegisterOutputType(VpnConnectionRoutePtrOutput{})
pulumi.RegisterOutputType(VpnConnectionRouteArrayOutput{})
pulumi.RegisterOutputType(VpnConnectionRouteMapOutput{})
}