github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getLocalGateways.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  // Provides information for multiple EC2 Local Gateways, such as their identifiers.
    15  //
    16  // ## Example Usage
    17  //
    18  // The following example retrieves Local Gateways with a resource tag of `service` set to `production`.
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			foo, err := ec2.GetLocalGateways(ctx, &ec2.GetLocalGatewaysArgs{
    34  //				Tags: map[string]interface{}{
    35  //					"service": "production",
    36  //				},
    37  //			}, nil)
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			ctx.Export("foo", foo.Ids)
    42  //			return nil
    43  //		})
    44  //	}
    45  //
    46  // ```
    47  // <!--End PulumiCodeChooser -->
    48  func GetLocalGateways(ctx *pulumi.Context, args *GetLocalGatewaysArgs, opts ...pulumi.InvokeOption) (*GetLocalGatewaysResult, error) {
    49  	opts = internal.PkgInvokeDefaultOpts(opts)
    50  	var rv GetLocalGatewaysResult
    51  	err := ctx.Invoke("aws:ec2/getLocalGateways:getLocalGateways", args, &rv, opts...)
    52  	if err != nil {
    53  		return nil, err
    54  	}
    55  	return &rv, nil
    56  }
    57  
    58  // A collection of arguments for invoking getLocalGateways.
    59  type GetLocalGatewaysArgs struct {
    60  	// Custom filter block as described below.
    61  	//
    62  	// More complex filters can be expressed using one or more `filter` sub-blocks,
    63  	// which take the following arguments:
    64  	Filters []GetLocalGatewaysFilter `pulumi:"filters"`
    65  	// Mapping of tags, each pair of which must exactly match
    66  	// a pair on the desired local_gateways.
    67  	Tags map[string]string `pulumi:"tags"`
    68  }
    69  
    70  // A collection of values returned by getLocalGateways.
    71  type GetLocalGatewaysResult struct {
    72  	Filters []GetLocalGatewaysFilter `pulumi:"filters"`
    73  	// The provider-assigned unique ID for this managed resource.
    74  	Id string `pulumi:"id"`
    75  	// Set of all the Local Gateway identifiers
    76  	Ids  []string          `pulumi:"ids"`
    77  	Tags map[string]string `pulumi:"tags"`
    78  }
    79  
    80  func GetLocalGatewaysOutput(ctx *pulumi.Context, args GetLocalGatewaysOutputArgs, opts ...pulumi.InvokeOption) GetLocalGatewaysResultOutput {
    81  	return pulumi.ToOutputWithContext(context.Background(), args).
    82  		ApplyT(func(v interface{}) (GetLocalGatewaysResult, error) {
    83  			args := v.(GetLocalGatewaysArgs)
    84  			r, err := GetLocalGateways(ctx, &args, opts...)
    85  			var s GetLocalGatewaysResult
    86  			if r != nil {
    87  				s = *r
    88  			}
    89  			return s, err
    90  		}).(GetLocalGatewaysResultOutput)
    91  }
    92  
    93  // A collection of arguments for invoking getLocalGateways.
    94  type GetLocalGatewaysOutputArgs struct {
    95  	// Custom filter block as described below.
    96  	//
    97  	// More complex filters can be expressed using one or more `filter` sub-blocks,
    98  	// which take the following arguments:
    99  	Filters GetLocalGatewaysFilterArrayInput `pulumi:"filters"`
   100  	// Mapping of tags, each pair of which must exactly match
   101  	// a pair on the desired local_gateways.
   102  	Tags pulumi.StringMapInput `pulumi:"tags"`
   103  }
   104  
   105  func (GetLocalGatewaysOutputArgs) ElementType() reflect.Type {
   106  	return reflect.TypeOf((*GetLocalGatewaysArgs)(nil)).Elem()
   107  }
   108  
   109  // A collection of values returned by getLocalGateways.
   110  type GetLocalGatewaysResultOutput struct{ *pulumi.OutputState }
   111  
   112  func (GetLocalGatewaysResultOutput) ElementType() reflect.Type {
   113  	return reflect.TypeOf((*GetLocalGatewaysResult)(nil)).Elem()
   114  }
   115  
   116  func (o GetLocalGatewaysResultOutput) ToGetLocalGatewaysResultOutput() GetLocalGatewaysResultOutput {
   117  	return o
   118  }
   119  
   120  func (o GetLocalGatewaysResultOutput) ToGetLocalGatewaysResultOutputWithContext(ctx context.Context) GetLocalGatewaysResultOutput {
   121  	return o
   122  }
   123  
   124  func (o GetLocalGatewaysResultOutput) Filters() GetLocalGatewaysFilterArrayOutput {
   125  	return o.ApplyT(func(v GetLocalGatewaysResult) []GetLocalGatewaysFilter { return v.Filters }).(GetLocalGatewaysFilterArrayOutput)
   126  }
   127  
   128  // The provider-assigned unique ID for this managed resource.
   129  func (o GetLocalGatewaysResultOutput) Id() pulumi.StringOutput {
   130  	return o.ApplyT(func(v GetLocalGatewaysResult) string { return v.Id }).(pulumi.StringOutput)
   131  }
   132  
   133  // Set of all the Local Gateway identifiers
   134  func (o GetLocalGatewaysResultOutput) Ids() pulumi.StringArrayOutput {
   135  	return o.ApplyT(func(v GetLocalGatewaysResult) []string { return v.Ids }).(pulumi.StringArrayOutput)
   136  }
   137  
   138  func (o GetLocalGatewaysResultOutput) Tags() pulumi.StringMapOutput {
   139  	return o.ApplyT(func(v GetLocalGatewaysResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   140  }
   141  
   142  func init() {
   143  	pulumi.RegisterOutputType(GetLocalGatewaysResultOutput{})
   144  }