github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getCustomerGateway.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package ec2 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Get an existing AWS Customer Gateway. 15 // 16 // ## Example Usage 17 // 18 // <!--Start PulumiCodeChooser --> 19 // ```go 20 // package main 21 // 22 // import ( 23 // 24 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 25 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 26 // 27 // ) 28 // 29 // func main() { 30 // pulumi.Run(func(ctx *pulumi.Context) error { 31 // foo, err := ec2.LookupCustomerGateway(ctx, &ec2.LookupCustomerGatewayArgs{ 32 // Filters: []ec2.GetCustomerGatewayFilter{ 33 // { 34 // Name: "tag:Name", 35 // Values: []string{ 36 // "foo-prod", 37 // }, 38 // }, 39 // }, 40 // }, nil) 41 // if err != nil { 42 // return err 43 // } 44 // main, err := ec2.NewVpnGateway(ctx, "main", &ec2.VpnGatewayArgs{ 45 // VpcId: pulumi.Any(mainAwsVpc.Id), 46 // AmazonSideAsn: pulumi.String("7224"), 47 // }) 48 // if err != nil { 49 // return err 50 // } 51 // _, err = ec2.NewVpnConnection(ctx, "transit", &ec2.VpnConnectionArgs{ 52 // VpnGatewayId: main.ID(), 53 // CustomerGatewayId: pulumi.String(foo.Id), 54 // Type: pulumi.String(foo.Type), 55 // StaticRoutesOnly: pulumi.Bool(false), 56 // }) 57 // if err != nil { 58 // return err 59 // } 60 // return nil 61 // }) 62 // } 63 // 64 // ``` 65 // <!--End PulumiCodeChooser --> 66 func LookupCustomerGateway(ctx *pulumi.Context, args *LookupCustomerGatewayArgs, opts ...pulumi.InvokeOption) (*LookupCustomerGatewayResult, error) { 67 opts = internal.PkgInvokeDefaultOpts(opts) 68 var rv LookupCustomerGatewayResult 69 err := ctx.Invoke("aws:ec2/getCustomerGateway:getCustomerGateway", args, &rv, opts...) 70 if err != nil { 71 return nil, err 72 } 73 return &rv, nil 74 } 75 76 // A collection of arguments for invoking getCustomerGateway. 77 type LookupCustomerGatewayArgs struct { 78 // One or more [name-value pairs][dcg-filters] to filter by. 79 // 80 // [dcg-filters]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeCustomerGateways.html 81 Filters []GetCustomerGatewayFilter `pulumi:"filters"` 82 // ID of the gateway. 83 Id *string `pulumi:"id"` 84 // Map of key-value pairs assigned to the gateway. 85 Tags map[string]string `pulumi:"tags"` 86 } 87 88 // A collection of values returned by getCustomerGateway. 89 type LookupCustomerGatewayResult struct { 90 // ARN of the customer gateway. 91 Arn string `pulumi:"arn"` 92 // Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN). 93 BgpAsn int `pulumi:"bgpAsn"` 94 // ARN for the customer gateway certificate. 95 CertificateArn string `pulumi:"certificateArn"` 96 // Name for the customer gateway device. 97 DeviceName string `pulumi:"deviceName"` 98 Filters []GetCustomerGatewayFilter `pulumi:"filters"` 99 Id string `pulumi:"id"` 100 // IP address of the gateway's Internet-routable external interface. 101 IpAddress string `pulumi:"ipAddress"` 102 // Map of key-value pairs assigned to the gateway. 103 Tags map[string]string `pulumi:"tags"` 104 // Type of customer gateway. The only type AWS supports at this time is "ipsec.1". 105 Type string `pulumi:"type"` 106 } 107 108 func LookupCustomerGatewayOutput(ctx *pulumi.Context, args LookupCustomerGatewayOutputArgs, opts ...pulumi.InvokeOption) LookupCustomerGatewayResultOutput { 109 return pulumi.ToOutputWithContext(context.Background(), args). 110 ApplyT(func(v interface{}) (LookupCustomerGatewayResult, error) { 111 args := v.(LookupCustomerGatewayArgs) 112 r, err := LookupCustomerGateway(ctx, &args, opts...) 113 var s LookupCustomerGatewayResult 114 if r != nil { 115 s = *r 116 } 117 return s, err 118 }).(LookupCustomerGatewayResultOutput) 119 } 120 121 // A collection of arguments for invoking getCustomerGateway. 122 type LookupCustomerGatewayOutputArgs struct { 123 // One or more [name-value pairs][dcg-filters] to filter by. 124 // 125 // [dcg-filters]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeCustomerGateways.html 126 Filters GetCustomerGatewayFilterArrayInput `pulumi:"filters"` 127 // ID of the gateway. 128 Id pulumi.StringPtrInput `pulumi:"id"` 129 // Map of key-value pairs assigned to the gateway. 130 Tags pulumi.StringMapInput `pulumi:"tags"` 131 } 132 133 func (LookupCustomerGatewayOutputArgs) ElementType() reflect.Type { 134 return reflect.TypeOf((*LookupCustomerGatewayArgs)(nil)).Elem() 135 } 136 137 // A collection of values returned by getCustomerGateway. 138 type LookupCustomerGatewayResultOutput struct{ *pulumi.OutputState } 139 140 func (LookupCustomerGatewayResultOutput) ElementType() reflect.Type { 141 return reflect.TypeOf((*LookupCustomerGatewayResult)(nil)).Elem() 142 } 143 144 func (o LookupCustomerGatewayResultOutput) ToLookupCustomerGatewayResultOutput() LookupCustomerGatewayResultOutput { 145 return o 146 } 147 148 func (o LookupCustomerGatewayResultOutput) ToLookupCustomerGatewayResultOutputWithContext(ctx context.Context) LookupCustomerGatewayResultOutput { 149 return o 150 } 151 152 // ARN of the customer gateway. 153 func (o LookupCustomerGatewayResultOutput) Arn() pulumi.StringOutput { 154 return o.ApplyT(func(v LookupCustomerGatewayResult) string { return v.Arn }).(pulumi.StringOutput) 155 } 156 157 // Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN). 158 func (o LookupCustomerGatewayResultOutput) BgpAsn() pulumi.IntOutput { 159 return o.ApplyT(func(v LookupCustomerGatewayResult) int { return v.BgpAsn }).(pulumi.IntOutput) 160 } 161 162 // ARN for the customer gateway certificate. 163 func (o LookupCustomerGatewayResultOutput) CertificateArn() pulumi.StringOutput { 164 return o.ApplyT(func(v LookupCustomerGatewayResult) string { return v.CertificateArn }).(pulumi.StringOutput) 165 } 166 167 // Name for the customer gateway device. 168 func (o LookupCustomerGatewayResultOutput) DeviceName() pulumi.StringOutput { 169 return o.ApplyT(func(v LookupCustomerGatewayResult) string { return v.DeviceName }).(pulumi.StringOutput) 170 } 171 172 func (o LookupCustomerGatewayResultOutput) Filters() GetCustomerGatewayFilterArrayOutput { 173 return o.ApplyT(func(v LookupCustomerGatewayResult) []GetCustomerGatewayFilter { return v.Filters }).(GetCustomerGatewayFilterArrayOutput) 174 } 175 176 func (o LookupCustomerGatewayResultOutput) Id() pulumi.StringOutput { 177 return o.ApplyT(func(v LookupCustomerGatewayResult) string { return v.Id }).(pulumi.StringOutput) 178 } 179 180 // IP address of the gateway's Internet-routable external interface. 181 func (o LookupCustomerGatewayResultOutput) IpAddress() pulumi.StringOutput { 182 return o.ApplyT(func(v LookupCustomerGatewayResult) string { return v.IpAddress }).(pulumi.StringOutput) 183 } 184 185 // Map of key-value pairs assigned to the gateway. 186 func (o LookupCustomerGatewayResultOutput) Tags() pulumi.StringMapOutput { 187 return o.ApplyT(func(v LookupCustomerGatewayResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput) 188 } 189 190 // Type of customer gateway. The only type AWS supports at this time is "ipsec.1". 191 func (o LookupCustomerGatewayResultOutput) Type() pulumi.StringOutput { 192 return o.ApplyT(func(v LookupCustomerGatewayResult) string { return v.Type }).(pulumi.StringOutput) 193 } 194 195 func init() { 196 pulumi.RegisterOutputType(LookupCustomerGatewayResultOutput{}) 197 }