github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/vpc/getSecurityGroupRules.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 vpc
     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 security group rule IDs.
    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/vpc"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  // func main() {
    29  // pulumi.Run(func(ctx *pulumi.Context) error {
    30  // _, err := vpc.GetSecurityGroupRules(ctx, &vpc.GetSecurityGroupRulesArgs{
    31  // Filters: []vpc.GetSecurityGroupRulesFilter{
    32  // {
    33  // Name: "group-id",
    34  // Values: interface{}{
    35  // securityGroupId,
    36  // },
    37  // },
    38  // },
    39  // }, nil);
    40  // if err != nil {
    41  // return err
    42  // }
    43  // return nil
    44  // })
    45  // }
    46  // ```
    47  // <!--End PulumiCodeChooser -->
    48  func GetSecurityGroupRules(ctx *pulumi.Context, args *GetSecurityGroupRulesArgs, opts ...pulumi.InvokeOption) (*GetSecurityGroupRulesResult, error) {
    49  	opts = internal.PkgInvokeDefaultOpts(opts)
    50  	var rv GetSecurityGroupRulesResult
    51  	err := ctx.Invoke("aws:vpc/getSecurityGroupRules:getSecurityGroupRules", 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 getSecurityGroupRules.
    59  type GetSecurityGroupRulesArgs struct {
    60  	// Custom filter block as described below.
    61  	Filters []GetSecurityGroupRulesFilter `pulumi:"filters"`
    62  	// Map of tags, each pair of which must exactly match
    63  	// a pair on the desired security group rule.
    64  	//
    65  	// More complex filters can be expressed using one or more `filter` sub-blocks,
    66  	// which take the following arguments:
    67  	Tags map[string]string `pulumi:"tags"`
    68  }
    69  
    70  // A collection of values returned by getSecurityGroupRules.
    71  type GetSecurityGroupRulesResult struct {
    72  	Filters []GetSecurityGroupRulesFilter `pulumi:"filters"`
    73  	Id      string                        `pulumi:"id"`
    74  	// List of all the security group rule IDs found.
    75  	Ids  []string          `pulumi:"ids"`
    76  	Tags map[string]string `pulumi:"tags"`
    77  }
    78  
    79  func GetSecurityGroupRulesOutput(ctx *pulumi.Context, args GetSecurityGroupRulesOutputArgs, opts ...pulumi.InvokeOption) GetSecurityGroupRulesResultOutput {
    80  	return pulumi.ToOutputWithContext(context.Background(), args).
    81  		ApplyT(func(v interface{}) (GetSecurityGroupRulesResult, error) {
    82  			args := v.(GetSecurityGroupRulesArgs)
    83  			r, err := GetSecurityGroupRules(ctx, &args, opts...)
    84  			var s GetSecurityGroupRulesResult
    85  			if r != nil {
    86  				s = *r
    87  			}
    88  			return s, err
    89  		}).(GetSecurityGroupRulesResultOutput)
    90  }
    91  
    92  // A collection of arguments for invoking getSecurityGroupRules.
    93  type GetSecurityGroupRulesOutputArgs struct {
    94  	// Custom filter block as described below.
    95  	Filters GetSecurityGroupRulesFilterArrayInput `pulumi:"filters"`
    96  	// Map of tags, each pair of which must exactly match
    97  	// a pair on the desired security group rule.
    98  	//
    99  	// More complex filters can be expressed using one or more `filter` sub-blocks,
   100  	// which take the following arguments:
   101  	Tags pulumi.StringMapInput `pulumi:"tags"`
   102  }
   103  
   104  func (GetSecurityGroupRulesOutputArgs) ElementType() reflect.Type {
   105  	return reflect.TypeOf((*GetSecurityGroupRulesArgs)(nil)).Elem()
   106  }
   107  
   108  // A collection of values returned by getSecurityGroupRules.
   109  type GetSecurityGroupRulesResultOutput struct{ *pulumi.OutputState }
   110  
   111  func (GetSecurityGroupRulesResultOutput) ElementType() reflect.Type {
   112  	return reflect.TypeOf((*GetSecurityGroupRulesResult)(nil)).Elem()
   113  }
   114  
   115  func (o GetSecurityGroupRulesResultOutput) ToGetSecurityGroupRulesResultOutput() GetSecurityGroupRulesResultOutput {
   116  	return o
   117  }
   118  
   119  func (o GetSecurityGroupRulesResultOutput) ToGetSecurityGroupRulesResultOutputWithContext(ctx context.Context) GetSecurityGroupRulesResultOutput {
   120  	return o
   121  }
   122  
   123  func (o GetSecurityGroupRulesResultOutput) Filters() GetSecurityGroupRulesFilterArrayOutput {
   124  	return o.ApplyT(func(v GetSecurityGroupRulesResult) []GetSecurityGroupRulesFilter { return v.Filters }).(GetSecurityGroupRulesFilterArrayOutput)
   125  }
   126  
   127  func (o GetSecurityGroupRulesResultOutput) Id() pulumi.StringOutput {
   128  	return o.ApplyT(func(v GetSecurityGroupRulesResult) string { return v.Id }).(pulumi.StringOutput)
   129  }
   130  
   131  // List of all the security group rule IDs found.
   132  func (o GetSecurityGroupRulesResultOutput) Ids() pulumi.StringArrayOutput {
   133  	return o.ApplyT(func(v GetSecurityGroupRulesResult) []string { return v.Ids }).(pulumi.StringArrayOutput)
   134  }
   135  
   136  func (o GetSecurityGroupRulesResultOutput) Tags() pulumi.StringMapOutput {
   137  	return o.ApplyT(func(v GetSecurityGroupRulesResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   138  }
   139  
   140  func init() {
   141  	pulumi.RegisterOutputType(GetSecurityGroupRulesResultOutput{})
   142  }