-
Notifications
You must be signed in to change notification settings - Fork 151
/
getRouteTable.go
199 lines (174 loc) · 7.92 KB
/
getRouteTable.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
// *** 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/pulumi/pulumi/sdk/v3/go/pulumi"
)
// `ec2.RouteTable` provides details about a specific Route Table.
//
// This resource can prove useful when a module accepts a Subnet ID as an input variable and needs to, for example, add a route in the Route Table.
//
// ## Example Usage
//
// The following example shows how one might accept a Route Table ID as a variable and use this data source to obtain the data necessary to create a route.
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// cfg := config.New(ctx, "")
// subnetId := cfg.RequireObject("subnetId")
// opt0 := subnetId
// selected, err := ec2.LookupRouteTable(ctx, &ec2.LookupRouteTableArgs{
// SubnetId: &opt0,
// }, nil)
// if err != nil {
// return err
// }
// _, err = ec2.NewRoute(ctx, "route", &ec2.RouteArgs{
// RouteTableId: pulumi.String(selected.Id),
// DestinationCidrBlock: pulumi.String("10.0.1.0/22"),
// VpcPeeringConnectionId: pulumi.String("pcx-45ff3dc1"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
func LookupRouteTable(ctx *pulumi.Context, args *LookupRouteTableArgs, opts ...pulumi.InvokeOption) (*LookupRouteTableResult, error) {
var rv LookupRouteTableResult
err := ctx.Invoke("aws:ec2/getRouteTable:getRouteTable", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getRouteTable.
type LookupRouteTableArgs struct {
// Configuration block. Detailed below.
Filters []GetRouteTableFilter `pulumi:"filters"`
// ID of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
GatewayId *string `pulumi:"gatewayId"`
// ID of the specific Route Table to retrieve.
RouteTableId *string `pulumi:"routeTableId"`
// ID of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
SubnetId *string `pulumi:"subnetId"`
// Map of tags, each pair of which must exactly match a pair on the desired Route Table.
Tags map[string]string `pulumi:"tags"`
// ID of the VPC that the desired Route Table belongs to.
VpcId *string `pulumi:"vpcId"`
}
// A collection of values returned by getRouteTable.
type LookupRouteTableResult struct {
// ARN of the route table.
Arn string `pulumi:"arn"`
// List of associations with attributes detailed below.
Associations []GetRouteTableAssociationType `pulumi:"associations"`
Filters []GetRouteTableFilter `pulumi:"filters"`
// Gateway ID. Only set when associated with an Internet Gateway or Virtual Private Gateway.
GatewayId string `pulumi:"gatewayId"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// ID of the AWS account that owns the route table.
OwnerId string `pulumi:"ownerId"`
// Route Table ID.
RouteTableId string `pulumi:"routeTableId"`
// List of routes with attributes detailed below.
Routes []GetRouteTableRoute `pulumi:"routes"`
// Subnet ID. Only set when associated with a subnet.
SubnetId string `pulumi:"subnetId"`
Tags map[string]string `pulumi:"tags"`
VpcId string `pulumi:"vpcId"`
}
func LookupRouteTableOutput(ctx *pulumi.Context, args LookupRouteTableOutputArgs, opts ...pulumi.InvokeOption) LookupRouteTableResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupRouteTableResult, error) {
args := v.(LookupRouteTableArgs)
r, err := LookupRouteTable(ctx, &args, opts...)
return *r, err
}).(LookupRouteTableResultOutput)
}
// A collection of arguments for invoking getRouteTable.
type LookupRouteTableOutputArgs struct {
// Configuration block. Detailed below.
Filters GetRouteTableFilterArrayInput `pulumi:"filters"`
// ID of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
GatewayId pulumi.StringPtrInput `pulumi:"gatewayId"`
// ID of the specific Route Table to retrieve.
RouteTableId pulumi.StringPtrInput `pulumi:"routeTableId"`
// ID of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
SubnetId pulumi.StringPtrInput `pulumi:"subnetId"`
// Map of tags, each pair of which must exactly match a pair on the desired Route Table.
Tags pulumi.StringMapInput `pulumi:"tags"`
// ID of the VPC that the desired Route Table belongs to.
VpcId pulumi.StringPtrInput `pulumi:"vpcId"`
}
func (LookupRouteTableOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupRouteTableArgs)(nil)).Elem()
}
// A collection of values returned by getRouteTable.
type LookupRouteTableResultOutput struct{ *pulumi.OutputState }
func (LookupRouteTableResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupRouteTableResult)(nil)).Elem()
}
func (o LookupRouteTableResultOutput) ToLookupRouteTableResultOutput() LookupRouteTableResultOutput {
return o
}
func (o LookupRouteTableResultOutput) ToLookupRouteTableResultOutputWithContext(ctx context.Context) LookupRouteTableResultOutput {
return o
}
// ARN of the route table.
func (o LookupRouteTableResultOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v LookupRouteTableResult) string { return v.Arn }).(pulumi.StringOutput)
}
// List of associations with attributes detailed below.
func (o LookupRouteTableResultOutput) Associations() GetRouteTableAssociationTypeArrayOutput {
return o.ApplyT(func(v LookupRouteTableResult) []GetRouteTableAssociationType { return v.Associations }).(GetRouteTableAssociationTypeArrayOutput)
}
func (o LookupRouteTableResultOutput) Filters() GetRouteTableFilterArrayOutput {
return o.ApplyT(func(v LookupRouteTableResult) []GetRouteTableFilter { return v.Filters }).(GetRouteTableFilterArrayOutput)
}
// Gateway ID. Only set when associated with an Internet Gateway or Virtual Private Gateway.
func (o LookupRouteTableResultOutput) GatewayId() pulumi.StringOutput {
return o.ApplyT(func(v LookupRouteTableResult) string { return v.GatewayId }).(pulumi.StringOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupRouteTableResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupRouteTableResult) string { return v.Id }).(pulumi.StringOutput)
}
// ID of the AWS account that owns the route table.
func (o LookupRouteTableResultOutput) OwnerId() pulumi.StringOutput {
return o.ApplyT(func(v LookupRouteTableResult) string { return v.OwnerId }).(pulumi.StringOutput)
}
// Route Table ID.
func (o LookupRouteTableResultOutput) RouteTableId() pulumi.StringOutput {
return o.ApplyT(func(v LookupRouteTableResult) string { return v.RouteTableId }).(pulumi.StringOutput)
}
// List of routes with attributes detailed below.
func (o LookupRouteTableResultOutput) Routes() GetRouteTableRouteArrayOutput {
return o.ApplyT(func(v LookupRouteTableResult) []GetRouteTableRoute { return v.Routes }).(GetRouteTableRouteArrayOutput)
}
// Subnet ID. Only set when associated with a subnet.
func (o LookupRouteTableResultOutput) SubnetId() pulumi.StringOutput {
return o.ApplyT(func(v LookupRouteTableResult) string { return v.SubnetId }).(pulumi.StringOutput)
}
func (o LookupRouteTableResultOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v LookupRouteTableResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
}
func (o LookupRouteTableResultOutput) VpcId() pulumi.StringOutput {
return o.ApplyT(func(v LookupRouteTableResult) string { return v.VpcId }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupRouteTableResultOutput{})
}