github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getInternetGateway.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  // `ec2.InternetGateway` provides details about a specific Internet 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  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    27  //
    28  // )
    29  // func main() {
    30  // pulumi.Run(func(ctx *pulumi.Context) error {
    31  // cfg := config.New(ctx, "")
    32  // vpcId := cfg.RequireObject("vpcId")
    33  // _, err := ec2.LookupInternetGateway(ctx, &ec2.LookupInternetGatewayArgs{
    34  // Filters: []ec2.GetInternetGatewayFilter{
    35  // {
    36  // Name: "attachment.vpc-id",
    37  // Values: interface{}{
    38  // vpcId,
    39  // },
    40  // },
    41  // },
    42  // }, nil);
    43  // if err != nil {
    44  // return err
    45  // }
    46  // return nil
    47  // })
    48  // }
    49  // ```
    50  // <!--End PulumiCodeChooser -->
    51  func LookupInternetGateway(ctx *pulumi.Context, args *LookupInternetGatewayArgs, opts ...pulumi.InvokeOption) (*LookupInternetGatewayResult, error) {
    52  	opts = internal.PkgInvokeDefaultOpts(opts)
    53  	var rv LookupInternetGatewayResult
    54  	err := ctx.Invoke("aws:ec2/getInternetGateway:getInternetGateway", args, &rv, opts...)
    55  	if err != nil {
    56  		return nil, err
    57  	}
    58  	return &rv, nil
    59  }
    60  
    61  // A collection of arguments for invoking getInternetGateway.
    62  type LookupInternetGatewayArgs struct {
    63  	// Custom filter block as described below.
    64  	//
    65  	// More complex filters can be expressed using one or more `filter` sub-blocks,
    66  	// which take the following arguments:
    67  	Filters []GetInternetGatewayFilter `pulumi:"filters"`
    68  	// ID of the specific Internet Gateway to retrieve.
    69  	InternetGatewayId *string `pulumi:"internetGatewayId"`
    70  	// Map of tags, each pair of which must exactly match
    71  	// a pair on the desired Internet Gateway.
    72  	Tags map[string]string `pulumi:"tags"`
    73  }
    74  
    75  // A collection of values returned by getInternetGateway.
    76  type LookupInternetGatewayResult struct {
    77  	// ARN of the Internet Gateway.
    78  	Arn         string                             `pulumi:"arn"`
    79  	Attachments []GetInternetGatewayAttachmentType `pulumi:"attachments"`
    80  	Filters     []GetInternetGatewayFilter         `pulumi:"filters"`
    81  	// The provider-assigned unique ID for this managed resource.
    82  	Id                string `pulumi:"id"`
    83  	InternetGatewayId string `pulumi:"internetGatewayId"`
    84  	// ID of the AWS account that owns the internet gateway.
    85  	OwnerId string            `pulumi:"ownerId"`
    86  	Tags    map[string]string `pulumi:"tags"`
    87  }
    88  
    89  func LookupInternetGatewayOutput(ctx *pulumi.Context, args LookupInternetGatewayOutputArgs, opts ...pulumi.InvokeOption) LookupInternetGatewayResultOutput {
    90  	return pulumi.ToOutputWithContext(context.Background(), args).
    91  		ApplyT(func(v interface{}) (LookupInternetGatewayResult, error) {
    92  			args := v.(LookupInternetGatewayArgs)
    93  			r, err := LookupInternetGateway(ctx, &args, opts...)
    94  			var s LookupInternetGatewayResult
    95  			if r != nil {
    96  				s = *r
    97  			}
    98  			return s, err
    99  		}).(LookupInternetGatewayResultOutput)
   100  }
   101  
   102  // A collection of arguments for invoking getInternetGateway.
   103  type LookupInternetGatewayOutputArgs struct {
   104  	// Custom filter block as described below.
   105  	//
   106  	// More complex filters can be expressed using one or more `filter` sub-blocks,
   107  	// which take the following arguments:
   108  	Filters GetInternetGatewayFilterArrayInput `pulumi:"filters"`
   109  	// ID of the specific Internet Gateway to retrieve.
   110  	InternetGatewayId pulumi.StringPtrInput `pulumi:"internetGatewayId"`
   111  	// Map of tags, each pair of which must exactly match
   112  	// a pair on the desired Internet Gateway.
   113  	Tags pulumi.StringMapInput `pulumi:"tags"`
   114  }
   115  
   116  func (LookupInternetGatewayOutputArgs) ElementType() reflect.Type {
   117  	return reflect.TypeOf((*LookupInternetGatewayArgs)(nil)).Elem()
   118  }
   119  
   120  // A collection of values returned by getInternetGateway.
   121  type LookupInternetGatewayResultOutput struct{ *pulumi.OutputState }
   122  
   123  func (LookupInternetGatewayResultOutput) ElementType() reflect.Type {
   124  	return reflect.TypeOf((*LookupInternetGatewayResult)(nil)).Elem()
   125  }
   126  
   127  func (o LookupInternetGatewayResultOutput) ToLookupInternetGatewayResultOutput() LookupInternetGatewayResultOutput {
   128  	return o
   129  }
   130  
   131  func (o LookupInternetGatewayResultOutput) ToLookupInternetGatewayResultOutputWithContext(ctx context.Context) LookupInternetGatewayResultOutput {
   132  	return o
   133  }
   134  
   135  // ARN of the Internet Gateway.
   136  func (o LookupInternetGatewayResultOutput) Arn() pulumi.StringOutput {
   137  	return o.ApplyT(func(v LookupInternetGatewayResult) string { return v.Arn }).(pulumi.StringOutput)
   138  }
   139  
   140  func (o LookupInternetGatewayResultOutput) Attachments() GetInternetGatewayAttachmentTypeArrayOutput {
   141  	return o.ApplyT(func(v LookupInternetGatewayResult) []GetInternetGatewayAttachmentType { return v.Attachments }).(GetInternetGatewayAttachmentTypeArrayOutput)
   142  }
   143  
   144  func (o LookupInternetGatewayResultOutput) Filters() GetInternetGatewayFilterArrayOutput {
   145  	return o.ApplyT(func(v LookupInternetGatewayResult) []GetInternetGatewayFilter { return v.Filters }).(GetInternetGatewayFilterArrayOutput)
   146  }
   147  
   148  // The provider-assigned unique ID for this managed resource.
   149  func (o LookupInternetGatewayResultOutput) Id() pulumi.StringOutput {
   150  	return o.ApplyT(func(v LookupInternetGatewayResult) string { return v.Id }).(pulumi.StringOutput)
   151  }
   152  
   153  func (o LookupInternetGatewayResultOutput) InternetGatewayId() pulumi.StringOutput {
   154  	return o.ApplyT(func(v LookupInternetGatewayResult) string { return v.InternetGatewayId }).(pulumi.StringOutput)
   155  }
   156  
   157  // ID of the AWS account that owns the internet gateway.
   158  func (o LookupInternetGatewayResultOutput) OwnerId() pulumi.StringOutput {
   159  	return o.ApplyT(func(v LookupInternetGatewayResult) string { return v.OwnerId }).(pulumi.StringOutput)
   160  }
   161  
   162  func (o LookupInternetGatewayResultOutput) Tags() pulumi.StringMapOutput {
   163  	return o.ApplyT(func(v LookupInternetGatewayResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   164  }
   165  
   166  func init() {
   167  	pulumi.RegisterOutputType(LookupInternetGatewayResultOutput{})
   168  }