github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getNetworkAcls.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  // ## Example Usage
    15  //
    16  // The following shows outputting all network ACL ids in a vpc.
    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  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			example, err := ec2.GetNetworkAcls(ctx, &ec2.GetNetworkAclsArgs{
    32  //				VpcId: pulumi.StringRef(vpcId),
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			ctx.Export("example", example.Ids)
    38  //			return nil
    39  //		})
    40  //	}
    41  //
    42  // ```
    43  // <!--End PulumiCodeChooser -->
    44  //
    45  // The following example retrieves a list of all network ACL ids in a VPC with a custom
    46  // tag of `Tier` set to a value of "Private".
    47  //
    48  // <!--Start PulumiCodeChooser -->
    49  // ```go
    50  // package main
    51  //
    52  // import (
    53  //
    54  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    55  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    56  //
    57  // )
    58  //
    59  //	func main() {
    60  //		pulumi.Run(func(ctx *pulumi.Context) error {
    61  //			_, err := ec2.GetNetworkAcls(ctx, &ec2.GetNetworkAclsArgs{
    62  //				VpcId: pulumi.StringRef(vpcId),
    63  //				Tags: map[string]interface{}{
    64  //					"Tier": "Private",
    65  //				},
    66  //			}, nil)
    67  //			if err != nil {
    68  //				return err
    69  //			}
    70  //			return nil
    71  //		})
    72  //	}
    73  //
    74  // ```
    75  // <!--End PulumiCodeChooser -->
    76  //
    77  // The following example retrieves a network ACL id in a VPC which associated
    78  // with specific subnet.
    79  //
    80  // <!--Start PulumiCodeChooser -->
    81  // ```go
    82  // package main
    83  //
    84  // import (
    85  //
    86  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    87  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    88  //
    89  // )
    90  // func main() {
    91  // pulumi.Run(func(ctx *pulumi.Context) error {
    92  // _, err := ec2.GetNetworkAcls(ctx, &ec2.GetNetworkAclsArgs{
    93  // VpcId: pulumi.StringRef(vpcId),
    94  // Filters: []ec2.GetNetworkAclsFilter{
    95  // {
    96  // Name: "association.subnet-id",
    97  // Values: interface{}{
    98  // test.Id,
    99  // },
   100  // },
   101  // },
   102  // }, nil);
   103  // if err != nil {
   104  // return err
   105  // }
   106  // return nil
   107  // })
   108  // }
   109  // ```
   110  // <!--End PulumiCodeChooser -->
   111  func GetNetworkAcls(ctx *pulumi.Context, args *GetNetworkAclsArgs, opts ...pulumi.InvokeOption) (*GetNetworkAclsResult, error) {
   112  	opts = internal.PkgInvokeDefaultOpts(opts)
   113  	var rv GetNetworkAclsResult
   114  	err := ctx.Invoke("aws:ec2/getNetworkAcls:getNetworkAcls", args, &rv, opts...)
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	return &rv, nil
   119  }
   120  
   121  // A collection of arguments for invoking getNetworkAcls.
   122  type GetNetworkAclsArgs struct {
   123  	// Custom filter block as described below.
   124  	//
   125  	// More complex filters can be expressed using one or more `filter` sub-blocks,
   126  	// which take the following arguments:
   127  	Filters []GetNetworkAclsFilter `pulumi:"filters"`
   128  	// Map of tags, each pair of which must exactly match
   129  	// a pair on the desired network ACLs.
   130  	Tags map[string]string `pulumi:"tags"`
   131  	// VPC ID that you want to filter from.
   132  	VpcId *string `pulumi:"vpcId"`
   133  }
   134  
   135  // A collection of values returned by getNetworkAcls.
   136  type GetNetworkAclsResult struct {
   137  	Filters []GetNetworkAclsFilter `pulumi:"filters"`
   138  	// The provider-assigned unique ID for this managed resource.
   139  	Id string `pulumi:"id"`
   140  	// List of all the network ACL ids found.
   141  	Ids   []string          `pulumi:"ids"`
   142  	Tags  map[string]string `pulumi:"tags"`
   143  	VpcId *string           `pulumi:"vpcId"`
   144  }
   145  
   146  func GetNetworkAclsOutput(ctx *pulumi.Context, args GetNetworkAclsOutputArgs, opts ...pulumi.InvokeOption) GetNetworkAclsResultOutput {
   147  	return pulumi.ToOutputWithContext(context.Background(), args).
   148  		ApplyT(func(v interface{}) (GetNetworkAclsResult, error) {
   149  			args := v.(GetNetworkAclsArgs)
   150  			r, err := GetNetworkAcls(ctx, &args, opts...)
   151  			var s GetNetworkAclsResult
   152  			if r != nil {
   153  				s = *r
   154  			}
   155  			return s, err
   156  		}).(GetNetworkAclsResultOutput)
   157  }
   158  
   159  // A collection of arguments for invoking getNetworkAcls.
   160  type GetNetworkAclsOutputArgs struct {
   161  	// Custom filter block as described below.
   162  	//
   163  	// More complex filters can be expressed using one or more `filter` sub-blocks,
   164  	// which take the following arguments:
   165  	Filters GetNetworkAclsFilterArrayInput `pulumi:"filters"`
   166  	// Map of tags, each pair of which must exactly match
   167  	// a pair on the desired network ACLs.
   168  	Tags pulumi.StringMapInput `pulumi:"tags"`
   169  	// VPC ID that you want to filter from.
   170  	VpcId pulumi.StringPtrInput `pulumi:"vpcId"`
   171  }
   172  
   173  func (GetNetworkAclsOutputArgs) ElementType() reflect.Type {
   174  	return reflect.TypeOf((*GetNetworkAclsArgs)(nil)).Elem()
   175  }
   176  
   177  // A collection of values returned by getNetworkAcls.
   178  type GetNetworkAclsResultOutput struct{ *pulumi.OutputState }
   179  
   180  func (GetNetworkAclsResultOutput) ElementType() reflect.Type {
   181  	return reflect.TypeOf((*GetNetworkAclsResult)(nil)).Elem()
   182  }
   183  
   184  func (o GetNetworkAclsResultOutput) ToGetNetworkAclsResultOutput() GetNetworkAclsResultOutput {
   185  	return o
   186  }
   187  
   188  func (o GetNetworkAclsResultOutput) ToGetNetworkAclsResultOutputWithContext(ctx context.Context) GetNetworkAclsResultOutput {
   189  	return o
   190  }
   191  
   192  func (o GetNetworkAclsResultOutput) Filters() GetNetworkAclsFilterArrayOutput {
   193  	return o.ApplyT(func(v GetNetworkAclsResult) []GetNetworkAclsFilter { return v.Filters }).(GetNetworkAclsFilterArrayOutput)
   194  }
   195  
   196  // The provider-assigned unique ID for this managed resource.
   197  func (o GetNetworkAclsResultOutput) Id() pulumi.StringOutput {
   198  	return o.ApplyT(func(v GetNetworkAclsResult) string { return v.Id }).(pulumi.StringOutput)
   199  }
   200  
   201  // List of all the network ACL ids found.
   202  func (o GetNetworkAclsResultOutput) Ids() pulumi.StringArrayOutput {
   203  	return o.ApplyT(func(v GetNetworkAclsResult) []string { return v.Ids }).(pulumi.StringArrayOutput)
   204  }
   205  
   206  func (o GetNetworkAclsResultOutput) Tags() pulumi.StringMapOutput {
   207  	return o.ApplyT(func(v GetNetworkAclsResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   208  }
   209  
   210  func (o GetNetworkAclsResultOutput) VpcId() pulumi.StringPtrOutput {
   211  	return o.ApplyT(func(v GetNetworkAclsResult) *string { return v.VpcId }).(pulumi.StringPtrOutput)
   212  }
   213  
   214  func init() {
   215  	pulumi.RegisterOutputType(GetNetworkAclsResultOutput{})
   216  }