github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2transitgateway/getRouteTable.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 ec2transitgateway
     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 information on an EC2 Transit Gateway Route Table.
    15  //
    16  // ## Example Usage
    17  //
    18  // ### By Filter
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := ec2transitgateway.LookupRouteTable(ctx, &ec2transitgateway.LookupRouteTableArgs{
    34  //				Filters: []ec2transitgateway.GetRouteTableFilter{
    35  //					{
    36  //						Name: "default-association-route-table",
    37  //						Values: []string{
    38  //							"true",
    39  //						},
    40  //					},
    41  //					{
    42  //						Name: "transit-gateway-id",
    43  //						Values: []string{
    44  //							"tgw-12345678",
    45  //						},
    46  //					},
    47  //				},
    48  //			}, nil)
    49  //			if err != nil {
    50  //				return err
    51  //			}
    52  //			return nil
    53  //		})
    54  //	}
    55  //
    56  // ```
    57  // <!--End PulumiCodeChooser -->
    58  //
    59  // ### By Identifier
    60  //
    61  // <!--Start PulumiCodeChooser -->
    62  // ```go
    63  // package main
    64  //
    65  // import (
    66  //
    67  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
    68  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    69  //
    70  // )
    71  //
    72  //	func main() {
    73  //		pulumi.Run(func(ctx *pulumi.Context) error {
    74  //			_, err := ec2transitgateway.LookupRouteTable(ctx, &ec2transitgateway.LookupRouteTableArgs{
    75  //				Id: pulumi.StringRef("tgw-rtb-12345678"),
    76  //			}, nil)
    77  //			if err != nil {
    78  //				return err
    79  //			}
    80  //			return nil
    81  //		})
    82  //	}
    83  //
    84  // ```
    85  // <!--End PulumiCodeChooser -->
    86  func LookupRouteTable(ctx *pulumi.Context, args *LookupRouteTableArgs, opts ...pulumi.InvokeOption) (*LookupRouteTableResult, error) {
    87  	opts = internal.PkgInvokeDefaultOpts(opts)
    88  	var rv LookupRouteTableResult
    89  	err := ctx.Invoke("aws:ec2transitgateway/getRouteTable:getRouteTable", args, &rv, opts...)
    90  	if err != nil {
    91  		return nil, err
    92  	}
    93  	return &rv, nil
    94  }
    95  
    96  // A collection of arguments for invoking getRouteTable.
    97  type LookupRouteTableArgs struct {
    98  	// One or more configuration blocks containing name-values filters. Detailed below.
    99  	Filters []GetRouteTableFilter `pulumi:"filters"`
   100  	// Identifier of the EC2 Transit Gateway Route Table.
   101  	Id *string `pulumi:"id"`
   102  	// Key-value tags for the EC2 Transit Gateway Route Table
   103  	Tags map[string]string `pulumi:"tags"`
   104  }
   105  
   106  // A collection of values returned by getRouteTable.
   107  type LookupRouteTableResult struct {
   108  	// EC2 Transit Gateway Route Table ARN.
   109  	Arn string `pulumi:"arn"`
   110  	// Boolean whether this is the default association route table for the EC2 Transit Gateway
   111  	DefaultAssociationRouteTable bool `pulumi:"defaultAssociationRouteTable"`
   112  	// Boolean whether this is the default propagation route table for the EC2 Transit Gateway
   113  	DefaultPropagationRouteTable bool                  `pulumi:"defaultPropagationRouteTable"`
   114  	Filters                      []GetRouteTableFilter `pulumi:"filters"`
   115  	// EC2 Transit Gateway Route Table identifier
   116  	Id string `pulumi:"id"`
   117  	// Key-value tags for the EC2 Transit Gateway Route Table
   118  	Tags map[string]string `pulumi:"tags"`
   119  	// EC2 Transit Gateway identifier
   120  	TransitGatewayId string `pulumi:"transitGatewayId"`
   121  }
   122  
   123  func LookupRouteTableOutput(ctx *pulumi.Context, args LookupRouteTableOutputArgs, opts ...pulumi.InvokeOption) LookupRouteTableResultOutput {
   124  	return pulumi.ToOutputWithContext(context.Background(), args).
   125  		ApplyT(func(v interface{}) (LookupRouteTableResult, error) {
   126  			args := v.(LookupRouteTableArgs)
   127  			r, err := LookupRouteTable(ctx, &args, opts...)
   128  			var s LookupRouteTableResult
   129  			if r != nil {
   130  				s = *r
   131  			}
   132  			return s, err
   133  		}).(LookupRouteTableResultOutput)
   134  }
   135  
   136  // A collection of arguments for invoking getRouteTable.
   137  type LookupRouteTableOutputArgs struct {
   138  	// One or more configuration blocks containing name-values filters. Detailed below.
   139  	Filters GetRouteTableFilterArrayInput `pulumi:"filters"`
   140  	// Identifier of the EC2 Transit Gateway Route Table.
   141  	Id pulumi.StringPtrInput `pulumi:"id"`
   142  	// Key-value tags for the EC2 Transit Gateway Route Table
   143  	Tags pulumi.StringMapInput `pulumi:"tags"`
   144  }
   145  
   146  func (LookupRouteTableOutputArgs) ElementType() reflect.Type {
   147  	return reflect.TypeOf((*LookupRouteTableArgs)(nil)).Elem()
   148  }
   149  
   150  // A collection of values returned by getRouteTable.
   151  type LookupRouteTableResultOutput struct{ *pulumi.OutputState }
   152  
   153  func (LookupRouteTableResultOutput) ElementType() reflect.Type {
   154  	return reflect.TypeOf((*LookupRouteTableResult)(nil)).Elem()
   155  }
   156  
   157  func (o LookupRouteTableResultOutput) ToLookupRouteTableResultOutput() LookupRouteTableResultOutput {
   158  	return o
   159  }
   160  
   161  func (o LookupRouteTableResultOutput) ToLookupRouteTableResultOutputWithContext(ctx context.Context) LookupRouteTableResultOutput {
   162  	return o
   163  }
   164  
   165  // EC2 Transit Gateway Route Table ARN.
   166  func (o LookupRouteTableResultOutput) Arn() pulumi.StringOutput {
   167  	return o.ApplyT(func(v LookupRouteTableResult) string { return v.Arn }).(pulumi.StringOutput)
   168  }
   169  
   170  // Boolean whether this is the default association route table for the EC2 Transit Gateway
   171  func (o LookupRouteTableResultOutput) DefaultAssociationRouteTable() pulumi.BoolOutput {
   172  	return o.ApplyT(func(v LookupRouteTableResult) bool { return v.DefaultAssociationRouteTable }).(pulumi.BoolOutput)
   173  }
   174  
   175  // Boolean whether this is the default propagation route table for the EC2 Transit Gateway
   176  func (o LookupRouteTableResultOutput) DefaultPropagationRouteTable() pulumi.BoolOutput {
   177  	return o.ApplyT(func(v LookupRouteTableResult) bool { return v.DefaultPropagationRouteTable }).(pulumi.BoolOutput)
   178  }
   179  
   180  func (o LookupRouteTableResultOutput) Filters() GetRouteTableFilterArrayOutput {
   181  	return o.ApplyT(func(v LookupRouteTableResult) []GetRouteTableFilter { return v.Filters }).(GetRouteTableFilterArrayOutput)
   182  }
   183  
   184  // EC2 Transit Gateway Route Table identifier
   185  func (o LookupRouteTableResultOutput) Id() pulumi.StringOutput {
   186  	return o.ApplyT(func(v LookupRouteTableResult) string { return v.Id }).(pulumi.StringOutput)
   187  }
   188  
   189  // Key-value tags for the EC2 Transit Gateway Route Table
   190  func (o LookupRouteTableResultOutput) Tags() pulumi.StringMapOutput {
   191  	return o.ApplyT(func(v LookupRouteTableResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   192  }
   193  
   194  // EC2 Transit Gateway identifier
   195  func (o LookupRouteTableResultOutput) TransitGatewayId() pulumi.StringOutput {
   196  	return o.ApplyT(func(v LookupRouteTableResult) string { return v.TransitGatewayId }).(pulumi.StringOutput)
   197  }
   198  
   199  func init() {
   200  	pulumi.RegisterOutputType(LookupRouteTableResultOutput{})
   201  }