github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2transitgateway/getDirectConnectGatewayAttachment.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's attachment to a Direct Connect Gateway.
    15  //
    16  // ## Example Usage
    17  //
    18  // ### By Transit Gateway and Direct Connect Gateway Identifiers
    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.GetDirectConnectGatewayAttachment(ctx, &ec2transitgateway.GetDirectConnectGatewayAttachmentArgs{
    34  //				TransitGatewayId: pulumi.StringRef(exampleAwsEc2TransitGateway.Id),
    35  //				DxGatewayId:      pulumi.StringRef(exampleAwsDxGateway.Id),
    36  //			}, nil)
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			return nil
    41  //		})
    42  //	}
    43  //
    44  // ```
    45  // <!--End PulumiCodeChooser -->
    46  func GetDirectConnectGatewayAttachment(ctx *pulumi.Context, args *GetDirectConnectGatewayAttachmentArgs, opts ...pulumi.InvokeOption) (*GetDirectConnectGatewayAttachmentResult, error) {
    47  	opts = internal.PkgInvokeDefaultOpts(opts)
    48  	var rv GetDirectConnectGatewayAttachmentResult
    49  	err := ctx.Invoke("aws:ec2transitgateway/getDirectConnectGatewayAttachment:getDirectConnectGatewayAttachment", args, &rv, opts...)
    50  	if err != nil {
    51  		return nil, err
    52  	}
    53  	return &rv, nil
    54  }
    55  
    56  // A collection of arguments for invoking getDirectConnectGatewayAttachment.
    57  type GetDirectConnectGatewayAttachmentArgs struct {
    58  	// Identifier of the Direct Connect Gateway.
    59  	DxGatewayId *string `pulumi:"dxGatewayId"`
    60  	// Configuration block(s) for filtering. Detailed below.
    61  	Filters []GetDirectConnectGatewayAttachmentFilter `pulumi:"filters"`
    62  	// Map of tags, each pair of which must exactly match a pair on the desired Transit Gateway Direct Connect Gateway Attachment.
    63  	Tags map[string]string `pulumi:"tags"`
    64  	// Identifier of the EC2 Transit Gateway.
    65  	TransitGatewayId *string `pulumi:"transitGatewayId"`
    66  }
    67  
    68  // A collection of values returned by getDirectConnectGatewayAttachment.
    69  type GetDirectConnectGatewayAttachmentResult struct {
    70  	DxGatewayId *string                                   `pulumi:"dxGatewayId"`
    71  	Filters     []GetDirectConnectGatewayAttachmentFilter `pulumi:"filters"`
    72  	// The provider-assigned unique ID for this managed resource.
    73  	Id string `pulumi:"id"`
    74  	// Key-value tags for the EC2 Transit Gateway Attachment
    75  	Tags             map[string]string `pulumi:"tags"`
    76  	TransitGatewayId *string           `pulumi:"transitGatewayId"`
    77  }
    78  
    79  func GetDirectConnectGatewayAttachmentOutput(ctx *pulumi.Context, args GetDirectConnectGatewayAttachmentOutputArgs, opts ...pulumi.InvokeOption) GetDirectConnectGatewayAttachmentResultOutput {
    80  	return pulumi.ToOutputWithContext(context.Background(), args).
    81  		ApplyT(func(v interface{}) (GetDirectConnectGatewayAttachmentResult, error) {
    82  			args := v.(GetDirectConnectGatewayAttachmentArgs)
    83  			r, err := GetDirectConnectGatewayAttachment(ctx, &args, opts...)
    84  			var s GetDirectConnectGatewayAttachmentResult
    85  			if r != nil {
    86  				s = *r
    87  			}
    88  			return s, err
    89  		}).(GetDirectConnectGatewayAttachmentResultOutput)
    90  }
    91  
    92  // A collection of arguments for invoking getDirectConnectGatewayAttachment.
    93  type GetDirectConnectGatewayAttachmentOutputArgs struct {
    94  	// Identifier of the Direct Connect Gateway.
    95  	DxGatewayId pulumi.StringPtrInput `pulumi:"dxGatewayId"`
    96  	// Configuration block(s) for filtering. Detailed below.
    97  	Filters GetDirectConnectGatewayAttachmentFilterArrayInput `pulumi:"filters"`
    98  	// Map of tags, each pair of which must exactly match a pair on the desired Transit Gateway Direct Connect Gateway Attachment.
    99  	Tags pulumi.StringMapInput `pulumi:"tags"`
   100  	// Identifier of the EC2 Transit Gateway.
   101  	TransitGatewayId pulumi.StringPtrInput `pulumi:"transitGatewayId"`
   102  }
   103  
   104  func (GetDirectConnectGatewayAttachmentOutputArgs) ElementType() reflect.Type {
   105  	return reflect.TypeOf((*GetDirectConnectGatewayAttachmentArgs)(nil)).Elem()
   106  }
   107  
   108  // A collection of values returned by getDirectConnectGatewayAttachment.
   109  type GetDirectConnectGatewayAttachmentResultOutput struct{ *pulumi.OutputState }
   110  
   111  func (GetDirectConnectGatewayAttachmentResultOutput) ElementType() reflect.Type {
   112  	return reflect.TypeOf((*GetDirectConnectGatewayAttachmentResult)(nil)).Elem()
   113  }
   114  
   115  func (o GetDirectConnectGatewayAttachmentResultOutput) ToGetDirectConnectGatewayAttachmentResultOutput() GetDirectConnectGatewayAttachmentResultOutput {
   116  	return o
   117  }
   118  
   119  func (o GetDirectConnectGatewayAttachmentResultOutput) ToGetDirectConnectGatewayAttachmentResultOutputWithContext(ctx context.Context) GetDirectConnectGatewayAttachmentResultOutput {
   120  	return o
   121  }
   122  
   123  func (o GetDirectConnectGatewayAttachmentResultOutput) DxGatewayId() pulumi.StringPtrOutput {
   124  	return o.ApplyT(func(v GetDirectConnectGatewayAttachmentResult) *string { return v.DxGatewayId }).(pulumi.StringPtrOutput)
   125  }
   126  
   127  func (o GetDirectConnectGatewayAttachmentResultOutput) Filters() GetDirectConnectGatewayAttachmentFilterArrayOutput {
   128  	return o.ApplyT(func(v GetDirectConnectGatewayAttachmentResult) []GetDirectConnectGatewayAttachmentFilter {
   129  		return v.Filters
   130  	}).(GetDirectConnectGatewayAttachmentFilterArrayOutput)
   131  }
   132  
   133  // The provider-assigned unique ID for this managed resource.
   134  func (o GetDirectConnectGatewayAttachmentResultOutput) Id() pulumi.StringOutput {
   135  	return o.ApplyT(func(v GetDirectConnectGatewayAttachmentResult) string { return v.Id }).(pulumi.StringOutput)
   136  }
   137  
   138  // Key-value tags for the EC2 Transit Gateway Attachment
   139  func (o GetDirectConnectGatewayAttachmentResultOutput) Tags() pulumi.StringMapOutput {
   140  	return o.ApplyT(func(v GetDirectConnectGatewayAttachmentResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   141  }
   142  
   143  func (o GetDirectConnectGatewayAttachmentResultOutput) TransitGatewayId() pulumi.StringPtrOutput {
   144  	return o.ApplyT(func(v GetDirectConnectGatewayAttachmentResult) *string { return v.TransitGatewayId }).(pulumi.StringPtrOutput)
   145  }
   146  
   147  func init() {
   148  	pulumi.RegisterOutputType(GetDirectConnectGatewayAttachmentResultOutput{})
   149  }