github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2transitgateway/getPeeringAttachment.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 Peering Attachment.
    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.LookupPeeringAttachment(ctx, &ec2transitgateway.LookupPeeringAttachmentArgs{
    34  //				Filters: []ec2transitgateway.GetPeeringAttachmentFilter{
    35  //					{
    36  //						Name: "transit-gateway-attachment-id",
    37  //						Values: []string{
    38  //							"tgw-attach-12345678",
    39  //						},
    40  //					},
    41  //				},
    42  //			}, nil)
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			return nil
    47  //		})
    48  //	}
    49  //
    50  // ```
    51  // <!--End PulumiCodeChooser -->
    52  //
    53  // ### By Identifier
    54  //
    55  // <!--Start PulumiCodeChooser -->
    56  // ```go
    57  // package main
    58  //
    59  // import (
    60  //
    61  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
    62  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    63  //
    64  // )
    65  //
    66  //	func main() {
    67  //		pulumi.Run(func(ctx *pulumi.Context) error {
    68  //			_, err := ec2transitgateway.LookupPeeringAttachment(ctx, &ec2transitgateway.LookupPeeringAttachmentArgs{
    69  //				Id: pulumi.StringRef("tgw-attach-12345678"),
    70  //			}, nil)
    71  //			if err != nil {
    72  //				return err
    73  //			}
    74  //			return nil
    75  //		})
    76  //	}
    77  //
    78  // ```
    79  // <!--End PulumiCodeChooser -->
    80  func LookupPeeringAttachment(ctx *pulumi.Context, args *LookupPeeringAttachmentArgs, opts ...pulumi.InvokeOption) (*LookupPeeringAttachmentResult, error) {
    81  	opts = internal.PkgInvokeDefaultOpts(opts)
    82  	var rv LookupPeeringAttachmentResult
    83  	err := ctx.Invoke("aws:ec2transitgateway/getPeeringAttachment:getPeeringAttachment", args, &rv, opts...)
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  	return &rv, nil
    88  }
    89  
    90  // A collection of arguments for invoking getPeeringAttachment.
    91  type LookupPeeringAttachmentArgs struct {
    92  	// One or more configuration blocks containing name-values filters. Detailed below.
    93  	Filters []GetPeeringAttachmentFilter `pulumi:"filters"`
    94  	// Identifier of the EC2 Transit Gateway Peering Attachment.
    95  	Id *string `pulumi:"id"`
    96  	// Mapping of tags, each pair of which must exactly match
    97  	// a pair on the specific EC2 Transit Gateway Peering Attachment to retrieve.
    98  	//
    99  	// More complex filters can be expressed using one or more `filter` sub-blocks,
   100  	// which take the following arguments:
   101  	Tags map[string]string `pulumi:"tags"`
   102  }
   103  
   104  // A collection of values returned by getPeeringAttachment.
   105  type LookupPeeringAttachmentResult struct {
   106  	Filters []GetPeeringAttachmentFilter `pulumi:"filters"`
   107  	Id      string                       `pulumi:"id"`
   108  	// Identifier of the peer AWS account
   109  	PeerAccountId string `pulumi:"peerAccountId"`
   110  	// Identifier of the peer AWS region
   111  	PeerRegion string `pulumi:"peerRegion"`
   112  	// Identifier of the peer EC2 Transit Gateway
   113  	PeerTransitGatewayId string            `pulumi:"peerTransitGatewayId"`
   114  	State                string            `pulumi:"state"`
   115  	Tags                 map[string]string `pulumi:"tags"`
   116  	// Identifier of the local EC2 Transit Gateway
   117  	TransitGatewayId string `pulumi:"transitGatewayId"`
   118  }
   119  
   120  func LookupPeeringAttachmentOutput(ctx *pulumi.Context, args LookupPeeringAttachmentOutputArgs, opts ...pulumi.InvokeOption) LookupPeeringAttachmentResultOutput {
   121  	return pulumi.ToOutputWithContext(context.Background(), args).
   122  		ApplyT(func(v interface{}) (LookupPeeringAttachmentResult, error) {
   123  			args := v.(LookupPeeringAttachmentArgs)
   124  			r, err := LookupPeeringAttachment(ctx, &args, opts...)
   125  			var s LookupPeeringAttachmentResult
   126  			if r != nil {
   127  				s = *r
   128  			}
   129  			return s, err
   130  		}).(LookupPeeringAttachmentResultOutput)
   131  }
   132  
   133  // A collection of arguments for invoking getPeeringAttachment.
   134  type LookupPeeringAttachmentOutputArgs struct {
   135  	// One or more configuration blocks containing name-values filters. Detailed below.
   136  	Filters GetPeeringAttachmentFilterArrayInput `pulumi:"filters"`
   137  	// Identifier of the EC2 Transit Gateway Peering Attachment.
   138  	Id pulumi.StringPtrInput `pulumi:"id"`
   139  	// Mapping of tags, each pair of which must exactly match
   140  	// a pair on the specific EC2 Transit Gateway Peering Attachment to retrieve.
   141  	//
   142  	// More complex filters can be expressed using one or more `filter` sub-blocks,
   143  	// which take the following arguments:
   144  	Tags pulumi.StringMapInput `pulumi:"tags"`
   145  }
   146  
   147  func (LookupPeeringAttachmentOutputArgs) ElementType() reflect.Type {
   148  	return reflect.TypeOf((*LookupPeeringAttachmentArgs)(nil)).Elem()
   149  }
   150  
   151  // A collection of values returned by getPeeringAttachment.
   152  type LookupPeeringAttachmentResultOutput struct{ *pulumi.OutputState }
   153  
   154  func (LookupPeeringAttachmentResultOutput) ElementType() reflect.Type {
   155  	return reflect.TypeOf((*LookupPeeringAttachmentResult)(nil)).Elem()
   156  }
   157  
   158  func (o LookupPeeringAttachmentResultOutput) ToLookupPeeringAttachmentResultOutput() LookupPeeringAttachmentResultOutput {
   159  	return o
   160  }
   161  
   162  func (o LookupPeeringAttachmentResultOutput) ToLookupPeeringAttachmentResultOutputWithContext(ctx context.Context) LookupPeeringAttachmentResultOutput {
   163  	return o
   164  }
   165  
   166  func (o LookupPeeringAttachmentResultOutput) Filters() GetPeeringAttachmentFilterArrayOutput {
   167  	return o.ApplyT(func(v LookupPeeringAttachmentResult) []GetPeeringAttachmentFilter { return v.Filters }).(GetPeeringAttachmentFilterArrayOutput)
   168  }
   169  
   170  func (o LookupPeeringAttachmentResultOutput) Id() pulumi.StringOutput {
   171  	return o.ApplyT(func(v LookupPeeringAttachmentResult) string { return v.Id }).(pulumi.StringOutput)
   172  }
   173  
   174  // Identifier of the peer AWS account
   175  func (o LookupPeeringAttachmentResultOutput) PeerAccountId() pulumi.StringOutput {
   176  	return o.ApplyT(func(v LookupPeeringAttachmentResult) string { return v.PeerAccountId }).(pulumi.StringOutput)
   177  }
   178  
   179  // Identifier of the peer AWS region
   180  func (o LookupPeeringAttachmentResultOutput) PeerRegion() pulumi.StringOutput {
   181  	return o.ApplyT(func(v LookupPeeringAttachmentResult) string { return v.PeerRegion }).(pulumi.StringOutput)
   182  }
   183  
   184  // Identifier of the peer EC2 Transit Gateway
   185  func (o LookupPeeringAttachmentResultOutput) PeerTransitGatewayId() pulumi.StringOutput {
   186  	return o.ApplyT(func(v LookupPeeringAttachmentResult) string { return v.PeerTransitGatewayId }).(pulumi.StringOutput)
   187  }
   188  
   189  func (o LookupPeeringAttachmentResultOutput) State() pulumi.StringOutput {
   190  	return o.ApplyT(func(v LookupPeeringAttachmentResult) string { return v.State }).(pulumi.StringOutput)
   191  }
   192  
   193  func (o LookupPeeringAttachmentResultOutput) Tags() pulumi.StringMapOutput {
   194  	return o.ApplyT(func(v LookupPeeringAttachmentResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   195  }
   196  
   197  // Identifier of the local EC2 Transit Gateway
   198  func (o LookupPeeringAttachmentResultOutput) TransitGatewayId() pulumi.StringOutput {
   199  	return o.ApplyT(func(v LookupPeeringAttachmentResult) string { return v.TransitGatewayId }).(pulumi.StringOutput)
   200  }
   201  
   202  func init() {
   203  	pulumi.RegisterOutputType(LookupPeeringAttachmentResultOutput{})
   204  }