github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2transitgateway/getAttachment.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 resource.
    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/ec2transitgateway"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  // func main() {
    29  // pulumi.Run(func(ctx *pulumi.Context) error {
    30  // _, err := ec2transitgateway.GetAttachment(ctx, &ec2transitgateway.GetAttachmentArgs{
    31  // Filters: []ec2transitgateway.GetAttachmentFilter{
    32  // {
    33  // Name: "transit-gateway-id",
    34  // Values: interface{}{
    35  // exampleAwsEc2TransitGateway.Id,
    36  // },
    37  // },
    38  // {
    39  // Name: "resource-type",
    40  // Values: []string{
    41  // "peering",
    42  // },
    43  // },
    44  // },
    45  // }, nil);
    46  // if err != nil {
    47  // return err
    48  // }
    49  // return nil
    50  // })
    51  // }
    52  // ```
    53  // <!--End PulumiCodeChooser -->
    54  func GetAttachment(ctx *pulumi.Context, args *GetAttachmentArgs, opts ...pulumi.InvokeOption) (*GetAttachmentResult, error) {
    55  	opts = internal.PkgInvokeDefaultOpts(opts)
    56  	var rv GetAttachmentResult
    57  	err := ctx.Invoke("aws:ec2transitgateway/getAttachment:getAttachment", args, &rv, opts...)
    58  	if err != nil {
    59  		return nil, err
    60  	}
    61  	return &rv, nil
    62  }
    63  
    64  // A collection of arguments for invoking getAttachment.
    65  type GetAttachmentArgs struct {
    66  	// One or more configuration blocks containing name-values filters. Detailed below.
    67  	Filters []GetAttachmentFilter `pulumi:"filters"`
    68  	// Key-value tags for the attachment.
    69  	Tags map[string]string `pulumi:"tags"`
    70  	// ID of the attachment.
    71  	TransitGatewayAttachmentId *string `pulumi:"transitGatewayAttachmentId"`
    72  }
    73  
    74  // A collection of values returned by getAttachment.
    75  type GetAttachmentResult struct {
    76  	// ARN of the attachment.
    77  	Arn string `pulumi:"arn"`
    78  	// The state of the association (see [the underlying AWS API](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayAttachmentAssociation.html) for valid values).
    79  	AssociationState string `pulumi:"associationState"`
    80  	// The ID of the route table for the transit gateway.
    81  	AssociationTransitGatewayRouteTableId string                `pulumi:"associationTransitGatewayRouteTableId"`
    82  	Filters                               []GetAttachmentFilter `pulumi:"filters"`
    83  	// The provider-assigned unique ID for this managed resource.
    84  	Id string `pulumi:"id"`
    85  	// ID of the resource.
    86  	ResourceId string `pulumi:"resourceId"`
    87  	// ID of the AWS account that owns the resource.
    88  	ResourceOwnerId string `pulumi:"resourceOwnerId"`
    89  	// Resource type.
    90  	ResourceType string `pulumi:"resourceType"`
    91  	// Attachment state.
    92  	State string `pulumi:"state"`
    93  	// Key-value tags for the attachment.
    94  	Tags                       map[string]string `pulumi:"tags"`
    95  	TransitGatewayAttachmentId string            `pulumi:"transitGatewayAttachmentId"`
    96  	// ID of the transit gateway.
    97  	TransitGatewayId string `pulumi:"transitGatewayId"`
    98  	// The ID of the AWS account that owns the transit gateway.
    99  	TransitGatewayOwnerId string `pulumi:"transitGatewayOwnerId"`
   100  }
   101  
   102  func GetAttachmentOutput(ctx *pulumi.Context, args GetAttachmentOutputArgs, opts ...pulumi.InvokeOption) GetAttachmentResultOutput {
   103  	return pulumi.ToOutputWithContext(context.Background(), args).
   104  		ApplyT(func(v interface{}) (GetAttachmentResult, error) {
   105  			args := v.(GetAttachmentArgs)
   106  			r, err := GetAttachment(ctx, &args, opts...)
   107  			var s GetAttachmentResult
   108  			if r != nil {
   109  				s = *r
   110  			}
   111  			return s, err
   112  		}).(GetAttachmentResultOutput)
   113  }
   114  
   115  // A collection of arguments for invoking getAttachment.
   116  type GetAttachmentOutputArgs struct {
   117  	// One or more configuration blocks containing name-values filters. Detailed below.
   118  	Filters GetAttachmentFilterArrayInput `pulumi:"filters"`
   119  	// Key-value tags for the attachment.
   120  	Tags pulumi.StringMapInput `pulumi:"tags"`
   121  	// ID of the attachment.
   122  	TransitGatewayAttachmentId pulumi.StringPtrInput `pulumi:"transitGatewayAttachmentId"`
   123  }
   124  
   125  func (GetAttachmentOutputArgs) ElementType() reflect.Type {
   126  	return reflect.TypeOf((*GetAttachmentArgs)(nil)).Elem()
   127  }
   128  
   129  // A collection of values returned by getAttachment.
   130  type GetAttachmentResultOutput struct{ *pulumi.OutputState }
   131  
   132  func (GetAttachmentResultOutput) ElementType() reflect.Type {
   133  	return reflect.TypeOf((*GetAttachmentResult)(nil)).Elem()
   134  }
   135  
   136  func (o GetAttachmentResultOutput) ToGetAttachmentResultOutput() GetAttachmentResultOutput {
   137  	return o
   138  }
   139  
   140  func (o GetAttachmentResultOutput) ToGetAttachmentResultOutputWithContext(ctx context.Context) GetAttachmentResultOutput {
   141  	return o
   142  }
   143  
   144  // ARN of the attachment.
   145  func (o GetAttachmentResultOutput) Arn() pulumi.StringOutput {
   146  	return o.ApplyT(func(v GetAttachmentResult) string { return v.Arn }).(pulumi.StringOutput)
   147  }
   148  
   149  // The state of the association (see [the underlying AWS API](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayAttachmentAssociation.html) for valid values).
   150  func (o GetAttachmentResultOutput) AssociationState() pulumi.StringOutput {
   151  	return o.ApplyT(func(v GetAttachmentResult) string { return v.AssociationState }).(pulumi.StringOutput)
   152  }
   153  
   154  // The ID of the route table for the transit gateway.
   155  func (o GetAttachmentResultOutput) AssociationTransitGatewayRouteTableId() pulumi.StringOutput {
   156  	return o.ApplyT(func(v GetAttachmentResult) string { return v.AssociationTransitGatewayRouteTableId }).(pulumi.StringOutput)
   157  }
   158  
   159  func (o GetAttachmentResultOutput) Filters() GetAttachmentFilterArrayOutput {
   160  	return o.ApplyT(func(v GetAttachmentResult) []GetAttachmentFilter { return v.Filters }).(GetAttachmentFilterArrayOutput)
   161  }
   162  
   163  // The provider-assigned unique ID for this managed resource.
   164  func (o GetAttachmentResultOutput) Id() pulumi.StringOutput {
   165  	return o.ApplyT(func(v GetAttachmentResult) string { return v.Id }).(pulumi.StringOutput)
   166  }
   167  
   168  // ID of the resource.
   169  func (o GetAttachmentResultOutput) ResourceId() pulumi.StringOutput {
   170  	return o.ApplyT(func(v GetAttachmentResult) string { return v.ResourceId }).(pulumi.StringOutput)
   171  }
   172  
   173  // ID of the AWS account that owns the resource.
   174  func (o GetAttachmentResultOutput) ResourceOwnerId() pulumi.StringOutput {
   175  	return o.ApplyT(func(v GetAttachmentResult) string { return v.ResourceOwnerId }).(pulumi.StringOutput)
   176  }
   177  
   178  // Resource type.
   179  func (o GetAttachmentResultOutput) ResourceType() pulumi.StringOutput {
   180  	return o.ApplyT(func(v GetAttachmentResult) string { return v.ResourceType }).(pulumi.StringOutput)
   181  }
   182  
   183  // Attachment state.
   184  func (o GetAttachmentResultOutput) State() pulumi.StringOutput {
   185  	return o.ApplyT(func(v GetAttachmentResult) string { return v.State }).(pulumi.StringOutput)
   186  }
   187  
   188  // Key-value tags for the attachment.
   189  func (o GetAttachmentResultOutput) Tags() pulumi.StringMapOutput {
   190  	return o.ApplyT(func(v GetAttachmentResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   191  }
   192  
   193  func (o GetAttachmentResultOutput) TransitGatewayAttachmentId() pulumi.StringOutput {
   194  	return o.ApplyT(func(v GetAttachmentResult) string { return v.TransitGatewayAttachmentId }).(pulumi.StringOutput)
   195  }
   196  
   197  // ID of the transit gateway.
   198  func (o GetAttachmentResultOutput) TransitGatewayId() pulumi.StringOutput {
   199  	return o.ApplyT(func(v GetAttachmentResult) string { return v.TransitGatewayId }).(pulumi.StringOutput)
   200  }
   201  
   202  // The ID of the AWS account that owns the transit gateway.
   203  func (o GetAttachmentResultOutput) TransitGatewayOwnerId() pulumi.StringOutput {
   204  	return o.ApplyT(func(v GetAttachmentResult) string { return v.TransitGatewayOwnerId }).(pulumi.StringOutput)
   205  }
   206  
   207  func init() {
   208  	pulumi.RegisterOutputType(GetAttachmentResultOutput{})
   209  }