github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getSubnets.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  // This resource can be useful for getting back a set of subnet IDs.
    15  func GetSubnets(ctx *pulumi.Context, args *GetSubnetsArgs, opts ...pulumi.InvokeOption) (*GetSubnetsResult, error) {
    16  	opts = internal.PkgInvokeDefaultOpts(opts)
    17  	var rv GetSubnetsResult
    18  	err := ctx.Invoke("aws:ec2/getSubnets:getSubnets", args, &rv, opts...)
    19  	if err != nil {
    20  		return nil, err
    21  	}
    22  	return &rv, nil
    23  }
    24  
    25  // A collection of arguments for invoking getSubnets.
    26  type GetSubnetsArgs struct {
    27  	// Custom filter block as described below.
    28  	Filters []GetSubnetsFilter `pulumi:"filters"`
    29  	// Map of tags, each pair of which must exactly match
    30  	// a pair on the desired subnets.
    31  	//
    32  	// More complex filters can be expressed using one or more `filter` sub-blocks,
    33  	// which take the following arguments:
    34  	Tags map[string]string `pulumi:"tags"`
    35  }
    36  
    37  // A collection of values returned by getSubnets.
    38  type GetSubnetsResult struct {
    39  	Filters []GetSubnetsFilter `pulumi:"filters"`
    40  	// The provider-assigned unique ID for this managed resource.
    41  	Id string `pulumi:"id"`
    42  	// List of all the subnet ids found.
    43  	Ids  []string          `pulumi:"ids"`
    44  	Tags map[string]string `pulumi:"tags"`
    45  }
    46  
    47  func GetSubnetsOutput(ctx *pulumi.Context, args GetSubnetsOutputArgs, opts ...pulumi.InvokeOption) GetSubnetsResultOutput {
    48  	return pulumi.ToOutputWithContext(context.Background(), args).
    49  		ApplyT(func(v interface{}) (GetSubnetsResult, error) {
    50  			args := v.(GetSubnetsArgs)
    51  			r, err := GetSubnets(ctx, &args, opts...)
    52  			var s GetSubnetsResult
    53  			if r != nil {
    54  				s = *r
    55  			}
    56  			return s, err
    57  		}).(GetSubnetsResultOutput)
    58  }
    59  
    60  // A collection of arguments for invoking getSubnets.
    61  type GetSubnetsOutputArgs struct {
    62  	// Custom filter block as described below.
    63  	Filters GetSubnetsFilterArrayInput `pulumi:"filters"`
    64  	// Map of tags, each pair of which must exactly match
    65  	// a pair on the desired subnets.
    66  	//
    67  	// More complex filters can be expressed using one or more `filter` sub-blocks,
    68  	// which take the following arguments:
    69  	Tags pulumi.StringMapInput `pulumi:"tags"`
    70  }
    71  
    72  func (GetSubnetsOutputArgs) ElementType() reflect.Type {
    73  	return reflect.TypeOf((*GetSubnetsArgs)(nil)).Elem()
    74  }
    75  
    76  // A collection of values returned by getSubnets.
    77  type GetSubnetsResultOutput struct{ *pulumi.OutputState }
    78  
    79  func (GetSubnetsResultOutput) ElementType() reflect.Type {
    80  	return reflect.TypeOf((*GetSubnetsResult)(nil)).Elem()
    81  }
    82  
    83  func (o GetSubnetsResultOutput) ToGetSubnetsResultOutput() GetSubnetsResultOutput {
    84  	return o
    85  }
    86  
    87  func (o GetSubnetsResultOutput) ToGetSubnetsResultOutputWithContext(ctx context.Context) GetSubnetsResultOutput {
    88  	return o
    89  }
    90  
    91  func (o GetSubnetsResultOutput) Filters() GetSubnetsFilterArrayOutput {
    92  	return o.ApplyT(func(v GetSubnetsResult) []GetSubnetsFilter { return v.Filters }).(GetSubnetsFilterArrayOutput)
    93  }
    94  
    95  // The provider-assigned unique ID for this managed resource.
    96  func (o GetSubnetsResultOutput) Id() pulumi.StringOutput {
    97  	return o.ApplyT(func(v GetSubnetsResult) string { return v.Id }).(pulumi.StringOutput)
    98  }
    99  
   100  // List of all the subnet ids found.
   101  func (o GetSubnetsResultOutput) Ids() pulumi.StringArrayOutput {
   102  	return o.ApplyT(func(v GetSubnetsResult) []string { return v.Ids }).(pulumi.StringArrayOutput)
   103  }
   104  
   105  func (o GetSubnetsResultOutput) Tags() pulumi.StringMapOutput {
   106  	return o.ApplyT(func(v GetSubnetsResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   107  }
   108  
   109  func init() {
   110  	pulumi.RegisterOutputType(GetSubnetsResultOutput{})
   111  }