github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getEips.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 a list of Elastic IPs in a region.
    15  //
    16  // ## Example Usage
    17  //
    18  // The following shows outputting all Elastic IPs with the a specific tag value.
    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  //			example, err := ec2.GetEips(ctx, &ec2.GetEipsArgs{
    34  //				Tags: map[string]interface{}{
    35  //					"Env": "dev",
    36  //				},
    37  //			}, nil)
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			ctx.Export("allocationIds", example.AllocationIds)
    42  //			ctx.Export("publicIps", example.PublicIps)
    43  //			return nil
    44  //		})
    45  //	}
    46  //
    47  // ```
    48  // <!--End PulumiCodeChooser -->
    49  func GetEips(ctx *pulumi.Context, args *GetEipsArgs, opts ...pulumi.InvokeOption) (*GetEipsResult, error) {
    50  	opts = internal.PkgInvokeDefaultOpts(opts)
    51  	var rv GetEipsResult
    52  	err := ctx.Invoke("aws:ec2/getEips:getEips", args, &rv, opts...)
    53  	if err != nil {
    54  		return nil, err
    55  	}
    56  	return &rv, nil
    57  }
    58  
    59  // A collection of arguments for invoking getEips.
    60  type GetEipsArgs struct {
    61  	// Custom filter block as described below.
    62  	Filters []GetEipsFilter `pulumi:"filters"`
    63  	// Map of tags, each pair of which must exactly match a pair on the desired Elastic IPs.
    64  	Tags map[string]string `pulumi:"tags"`
    65  }
    66  
    67  // A collection of values returned by getEips.
    68  type GetEipsResult struct {
    69  	// List of all the allocation IDs for address for use with EC2-VPC.
    70  	AllocationIds []string        `pulumi:"allocationIds"`
    71  	Filters       []GetEipsFilter `pulumi:"filters"`
    72  	// The provider-assigned unique ID for this managed resource.
    73  	Id string `pulumi:"id"`
    74  	// List of all the Elastic IP addresses.
    75  	PublicIps []string          `pulumi:"publicIps"`
    76  	Tags      map[string]string `pulumi:"tags"`
    77  }
    78  
    79  func GetEipsOutput(ctx *pulumi.Context, args GetEipsOutputArgs, opts ...pulumi.InvokeOption) GetEipsResultOutput {
    80  	return pulumi.ToOutputWithContext(context.Background(), args).
    81  		ApplyT(func(v interface{}) (GetEipsResult, error) {
    82  			args := v.(GetEipsArgs)
    83  			r, err := GetEips(ctx, &args, opts...)
    84  			var s GetEipsResult
    85  			if r != nil {
    86  				s = *r
    87  			}
    88  			return s, err
    89  		}).(GetEipsResultOutput)
    90  }
    91  
    92  // A collection of arguments for invoking getEips.
    93  type GetEipsOutputArgs struct {
    94  	// Custom filter block as described below.
    95  	Filters GetEipsFilterArrayInput `pulumi:"filters"`
    96  	// Map of tags, each pair of which must exactly match a pair on the desired Elastic IPs.
    97  	Tags pulumi.StringMapInput `pulumi:"tags"`
    98  }
    99  
   100  func (GetEipsOutputArgs) ElementType() reflect.Type {
   101  	return reflect.TypeOf((*GetEipsArgs)(nil)).Elem()
   102  }
   103  
   104  // A collection of values returned by getEips.
   105  type GetEipsResultOutput struct{ *pulumi.OutputState }
   106  
   107  func (GetEipsResultOutput) ElementType() reflect.Type {
   108  	return reflect.TypeOf((*GetEipsResult)(nil)).Elem()
   109  }
   110  
   111  func (o GetEipsResultOutput) ToGetEipsResultOutput() GetEipsResultOutput {
   112  	return o
   113  }
   114  
   115  func (o GetEipsResultOutput) ToGetEipsResultOutputWithContext(ctx context.Context) GetEipsResultOutput {
   116  	return o
   117  }
   118  
   119  // List of all the allocation IDs for address for use with EC2-VPC.
   120  func (o GetEipsResultOutput) AllocationIds() pulumi.StringArrayOutput {
   121  	return o.ApplyT(func(v GetEipsResult) []string { return v.AllocationIds }).(pulumi.StringArrayOutput)
   122  }
   123  
   124  func (o GetEipsResultOutput) Filters() GetEipsFilterArrayOutput {
   125  	return o.ApplyT(func(v GetEipsResult) []GetEipsFilter { return v.Filters }).(GetEipsFilterArrayOutput)
   126  }
   127  
   128  // The provider-assigned unique ID for this managed resource.
   129  func (o GetEipsResultOutput) Id() pulumi.StringOutput {
   130  	return o.ApplyT(func(v GetEipsResult) string { return v.Id }).(pulumi.StringOutput)
   131  }
   132  
   133  // List of all the Elastic IP addresses.
   134  func (o GetEipsResultOutput) PublicIps() pulumi.StringArrayOutput {
   135  	return o.ApplyT(func(v GetEipsResult) []string { return v.PublicIps }).(pulumi.StringArrayOutput)
   136  }
   137  
   138  func (o GetEipsResultOutput) Tags() pulumi.StringMapOutput {
   139  	return o.ApplyT(func(v GetEipsResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   140  }
   141  
   142  func init() {
   143  	pulumi.RegisterOutputType(GetEipsResultOutput{})
   144  }