github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/wafv2/ruleGroup.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 wafv2
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  type RuleGroup struct {
    16  	pulumi.CustomResourceState
    17  
    18  	// The Amazon Resource Name (ARN) of the IP Set that this statement references.
    19  	Arn pulumi.StringOutput `pulumi:"arn"`
    20  	// The web ACL capacity units (WCUs) required for this rule group. See [here](https://docs.aws.amazon.com/waf/latest/APIReference/API_CreateRuleGroup.html#API_CreateRuleGroup_RequestSyntax) for general information and [here](https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statements-list.html) for capacity specific information.
    21  	Capacity pulumi.IntOutput `pulumi:"capacity"`
    22  	// Defines custom response bodies that can be referenced by `customResponse` actions. See Custom Response Body below for details.
    23  	CustomResponseBodies RuleGroupCustomResponseBodyArrayOutput `pulumi:"customResponseBodies"`
    24  	// A friendly description of the rule group.
    25  	Description pulumi.StringPtrOutput `pulumi:"description"`
    26  	LockToken   pulumi.StringOutput    `pulumi:"lockToken"`
    27  	// A friendly name of the rule group.
    28  	Name       pulumi.StringOutput `pulumi:"name"`
    29  	NamePrefix pulumi.StringOutput `pulumi:"namePrefix"`
    30  	// The rule blocks used to identify the web requests that you want to `allow`, `block`, or `count`. See Rules below for details.
    31  	Rules RuleGroupRuleArrayOutput `pulumi:"rules"`
    32  	// Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
    33  	Scope pulumi.StringOutput `pulumi:"scope"`
    34  	// An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    35  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    36  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    37  	//
    38  	// Deprecated: Please use `tags` instead.
    39  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    40  	// Defines and enables Amazon CloudWatch metrics and web request sample collection. See Visibility Configuration below for details.
    41  	VisibilityConfig RuleGroupVisibilityConfigOutput `pulumi:"visibilityConfig"`
    42  }
    43  
    44  // NewRuleGroup registers a new resource with the given unique name, arguments, and options.
    45  func NewRuleGroup(ctx *pulumi.Context,
    46  	name string, args *RuleGroupArgs, opts ...pulumi.ResourceOption) (*RuleGroup, error) {
    47  	if args == nil {
    48  		return nil, errors.New("missing one or more required arguments")
    49  	}
    50  
    51  	if args.Capacity == nil {
    52  		return nil, errors.New("invalid value for required argument 'Capacity'")
    53  	}
    54  	if args.Scope == nil {
    55  		return nil, errors.New("invalid value for required argument 'Scope'")
    56  	}
    57  	if args.VisibilityConfig == nil {
    58  		return nil, errors.New("invalid value for required argument 'VisibilityConfig'")
    59  	}
    60  	opts = internal.PkgResourceDefaultOpts(opts)
    61  	var resource RuleGroup
    62  	err := ctx.RegisterResource("aws:wafv2/ruleGroup:RuleGroup", name, args, &resource, opts...)
    63  	if err != nil {
    64  		return nil, err
    65  	}
    66  	return &resource, nil
    67  }
    68  
    69  // GetRuleGroup gets an existing RuleGroup resource's state with the given name, ID, and optional
    70  // state properties that are used to uniquely qualify the lookup (nil if not required).
    71  func GetRuleGroup(ctx *pulumi.Context,
    72  	name string, id pulumi.IDInput, state *RuleGroupState, opts ...pulumi.ResourceOption) (*RuleGroup, error) {
    73  	var resource RuleGroup
    74  	err := ctx.ReadResource("aws:wafv2/ruleGroup:RuleGroup", name, id, state, &resource, opts...)
    75  	if err != nil {
    76  		return nil, err
    77  	}
    78  	return &resource, nil
    79  }
    80  
    81  // Input properties used for looking up and filtering RuleGroup resources.
    82  type ruleGroupState struct {
    83  	// The Amazon Resource Name (ARN) of the IP Set that this statement references.
    84  	Arn *string `pulumi:"arn"`
    85  	// The web ACL capacity units (WCUs) required for this rule group. See [here](https://docs.aws.amazon.com/waf/latest/APIReference/API_CreateRuleGroup.html#API_CreateRuleGroup_RequestSyntax) for general information and [here](https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statements-list.html) for capacity specific information.
    86  	Capacity *int `pulumi:"capacity"`
    87  	// Defines custom response bodies that can be referenced by `customResponse` actions. See Custom Response Body below for details.
    88  	CustomResponseBodies []RuleGroupCustomResponseBody `pulumi:"customResponseBodies"`
    89  	// A friendly description of the rule group.
    90  	Description *string `pulumi:"description"`
    91  	LockToken   *string `pulumi:"lockToken"`
    92  	// A friendly name of the rule group.
    93  	Name       *string `pulumi:"name"`
    94  	NamePrefix *string `pulumi:"namePrefix"`
    95  	// The rule blocks used to identify the web requests that you want to `allow`, `block`, or `count`. See Rules below for details.
    96  	Rules []RuleGroupRule `pulumi:"rules"`
    97  	// Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
    98  	Scope *string `pulumi:"scope"`
    99  	// An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   100  	Tags map[string]string `pulumi:"tags"`
   101  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   102  	//
   103  	// Deprecated: Please use `tags` instead.
   104  	TagsAll map[string]string `pulumi:"tagsAll"`
   105  	// Defines and enables Amazon CloudWatch metrics and web request sample collection. See Visibility Configuration below for details.
   106  	VisibilityConfig *RuleGroupVisibilityConfig `pulumi:"visibilityConfig"`
   107  }
   108  
   109  type RuleGroupState struct {
   110  	// The Amazon Resource Name (ARN) of the IP Set that this statement references.
   111  	Arn pulumi.StringPtrInput
   112  	// The web ACL capacity units (WCUs) required for this rule group. See [here](https://docs.aws.amazon.com/waf/latest/APIReference/API_CreateRuleGroup.html#API_CreateRuleGroup_RequestSyntax) for general information and [here](https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statements-list.html) for capacity specific information.
   113  	Capacity pulumi.IntPtrInput
   114  	// Defines custom response bodies that can be referenced by `customResponse` actions. See Custom Response Body below for details.
   115  	CustomResponseBodies RuleGroupCustomResponseBodyArrayInput
   116  	// A friendly description of the rule group.
   117  	Description pulumi.StringPtrInput
   118  	LockToken   pulumi.StringPtrInput
   119  	// A friendly name of the rule group.
   120  	Name       pulumi.StringPtrInput
   121  	NamePrefix pulumi.StringPtrInput
   122  	// The rule blocks used to identify the web requests that you want to `allow`, `block`, or `count`. See Rules below for details.
   123  	Rules RuleGroupRuleArrayInput
   124  	// Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
   125  	Scope pulumi.StringPtrInput
   126  	// An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   127  	Tags pulumi.StringMapInput
   128  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   129  	//
   130  	// Deprecated: Please use `tags` instead.
   131  	TagsAll pulumi.StringMapInput
   132  	// Defines and enables Amazon CloudWatch metrics and web request sample collection. See Visibility Configuration below for details.
   133  	VisibilityConfig RuleGroupVisibilityConfigPtrInput
   134  }
   135  
   136  func (RuleGroupState) ElementType() reflect.Type {
   137  	return reflect.TypeOf((*ruleGroupState)(nil)).Elem()
   138  }
   139  
   140  type ruleGroupArgs struct {
   141  	// The web ACL capacity units (WCUs) required for this rule group. See [here](https://docs.aws.amazon.com/waf/latest/APIReference/API_CreateRuleGroup.html#API_CreateRuleGroup_RequestSyntax) for general information and [here](https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statements-list.html) for capacity specific information.
   142  	Capacity int `pulumi:"capacity"`
   143  	// Defines custom response bodies that can be referenced by `customResponse` actions. See Custom Response Body below for details.
   144  	CustomResponseBodies []RuleGroupCustomResponseBody `pulumi:"customResponseBodies"`
   145  	// A friendly description of the rule group.
   146  	Description *string `pulumi:"description"`
   147  	// A friendly name of the rule group.
   148  	Name       *string `pulumi:"name"`
   149  	NamePrefix *string `pulumi:"namePrefix"`
   150  	// The rule blocks used to identify the web requests that you want to `allow`, `block`, or `count`. See Rules below for details.
   151  	Rules []RuleGroupRule `pulumi:"rules"`
   152  	// Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
   153  	Scope string `pulumi:"scope"`
   154  	// An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   155  	Tags map[string]string `pulumi:"tags"`
   156  	// Defines and enables Amazon CloudWatch metrics and web request sample collection. See Visibility Configuration below for details.
   157  	VisibilityConfig RuleGroupVisibilityConfig `pulumi:"visibilityConfig"`
   158  }
   159  
   160  // The set of arguments for constructing a RuleGroup resource.
   161  type RuleGroupArgs struct {
   162  	// The web ACL capacity units (WCUs) required for this rule group. See [here](https://docs.aws.amazon.com/waf/latest/APIReference/API_CreateRuleGroup.html#API_CreateRuleGroup_RequestSyntax) for general information and [here](https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statements-list.html) for capacity specific information.
   163  	Capacity pulumi.IntInput
   164  	// Defines custom response bodies that can be referenced by `customResponse` actions. See Custom Response Body below for details.
   165  	CustomResponseBodies RuleGroupCustomResponseBodyArrayInput
   166  	// A friendly description of the rule group.
   167  	Description pulumi.StringPtrInput
   168  	// A friendly name of the rule group.
   169  	Name       pulumi.StringPtrInput
   170  	NamePrefix pulumi.StringPtrInput
   171  	// The rule blocks used to identify the web requests that you want to `allow`, `block`, or `count`. See Rules below for details.
   172  	Rules RuleGroupRuleArrayInput
   173  	// Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
   174  	Scope pulumi.StringInput
   175  	// An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   176  	Tags pulumi.StringMapInput
   177  	// Defines and enables Amazon CloudWatch metrics and web request sample collection. See Visibility Configuration below for details.
   178  	VisibilityConfig RuleGroupVisibilityConfigInput
   179  }
   180  
   181  func (RuleGroupArgs) ElementType() reflect.Type {
   182  	return reflect.TypeOf((*ruleGroupArgs)(nil)).Elem()
   183  }
   184  
   185  type RuleGroupInput interface {
   186  	pulumi.Input
   187  
   188  	ToRuleGroupOutput() RuleGroupOutput
   189  	ToRuleGroupOutputWithContext(ctx context.Context) RuleGroupOutput
   190  }
   191  
   192  func (*RuleGroup) ElementType() reflect.Type {
   193  	return reflect.TypeOf((**RuleGroup)(nil)).Elem()
   194  }
   195  
   196  func (i *RuleGroup) ToRuleGroupOutput() RuleGroupOutput {
   197  	return i.ToRuleGroupOutputWithContext(context.Background())
   198  }
   199  
   200  func (i *RuleGroup) ToRuleGroupOutputWithContext(ctx context.Context) RuleGroupOutput {
   201  	return pulumi.ToOutputWithContext(ctx, i).(RuleGroupOutput)
   202  }
   203  
   204  // RuleGroupArrayInput is an input type that accepts RuleGroupArray and RuleGroupArrayOutput values.
   205  // You can construct a concrete instance of `RuleGroupArrayInput` via:
   206  //
   207  //	RuleGroupArray{ RuleGroupArgs{...} }
   208  type RuleGroupArrayInput interface {
   209  	pulumi.Input
   210  
   211  	ToRuleGroupArrayOutput() RuleGroupArrayOutput
   212  	ToRuleGroupArrayOutputWithContext(context.Context) RuleGroupArrayOutput
   213  }
   214  
   215  type RuleGroupArray []RuleGroupInput
   216  
   217  func (RuleGroupArray) ElementType() reflect.Type {
   218  	return reflect.TypeOf((*[]*RuleGroup)(nil)).Elem()
   219  }
   220  
   221  func (i RuleGroupArray) ToRuleGroupArrayOutput() RuleGroupArrayOutput {
   222  	return i.ToRuleGroupArrayOutputWithContext(context.Background())
   223  }
   224  
   225  func (i RuleGroupArray) ToRuleGroupArrayOutputWithContext(ctx context.Context) RuleGroupArrayOutput {
   226  	return pulumi.ToOutputWithContext(ctx, i).(RuleGroupArrayOutput)
   227  }
   228  
   229  // RuleGroupMapInput is an input type that accepts RuleGroupMap and RuleGroupMapOutput values.
   230  // You can construct a concrete instance of `RuleGroupMapInput` via:
   231  //
   232  //	RuleGroupMap{ "key": RuleGroupArgs{...} }
   233  type RuleGroupMapInput interface {
   234  	pulumi.Input
   235  
   236  	ToRuleGroupMapOutput() RuleGroupMapOutput
   237  	ToRuleGroupMapOutputWithContext(context.Context) RuleGroupMapOutput
   238  }
   239  
   240  type RuleGroupMap map[string]RuleGroupInput
   241  
   242  func (RuleGroupMap) ElementType() reflect.Type {
   243  	return reflect.TypeOf((*map[string]*RuleGroup)(nil)).Elem()
   244  }
   245  
   246  func (i RuleGroupMap) ToRuleGroupMapOutput() RuleGroupMapOutput {
   247  	return i.ToRuleGroupMapOutputWithContext(context.Background())
   248  }
   249  
   250  func (i RuleGroupMap) ToRuleGroupMapOutputWithContext(ctx context.Context) RuleGroupMapOutput {
   251  	return pulumi.ToOutputWithContext(ctx, i).(RuleGroupMapOutput)
   252  }
   253  
   254  type RuleGroupOutput struct{ *pulumi.OutputState }
   255  
   256  func (RuleGroupOutput) ElementType() reflect.Type {
   257  	return reflect.TypeOf((**RuleGroup)(nil)).Elem()
   258  }
   259  
   260  func (o RuleGroupOutput) ToRuleGroupOutput() RuleGroupOutput {
   261  	return o
   262  }
   263  
   264  func (o RuleGroupOutput) ToRuleGroupOutputWithContext(ctx context.Context) RuleGroupOutput {
   265  	return o
   266  }
   267  
   268  // The Amazon Resource Name (ARN) of the IP Set that this statement references.
   269  func (o RuleGroupOutput) Arn() pulumi.StringOutput {
   270  	return o.ApplyT(func(v *RuleGroup) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   271  }
   272  
   273  // The web ACL capacity units (WCUs) required for this rule group. See [here](https://docs.aws.amazon.com/waf/latest/APIReference/API_CreateRuleGroup.html#API_CreateRuleGroup_RequestSyntax) for general information and [here](https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statements-list.html) for capacity specific information.
   274  func (o RuleGroupOutput) Capacity() pulumi.IntOutput {
   275  	return o.ApplyT(func(v *RuleGroup) pulumi.IntOutput { return v.Capacity }).(pulumi.IntOutput)
   276  }
   277  
   278  // Defines custom response bodies that can be referenced by `customResponse` actions. See Custom Response Body below for details.
   279  func (o RuleGroupOutput) CustomResponseBodies() RuleGroupCustomResponseBodyArrayOutput {
   280  	return o.ApplyT(func(v *RuleGroup) RuleGroupCustomResponseBodyArrayOutput { return v.CustomResponseBodies }).(RuleGroupCustomResponseBodyArrayOutput)
   281  }
   282  
   283  // A friendly description of the rule group.
   284  func (o RuleGroupOutput) Description() pulumi.StringPtrOutput {
   285  	return o.ApplyT(func(v *RuleGroup) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   286  }
   287  
   288  func (o RuleGroupOutput) LockToken() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *RuleGroup) pulumi.StringOutput { return v.LockToken }).(pulumi.StringOutput)
   290  }
   291  
   292  // A friendly name of the rule group.
   293  func (o RuleGroupOutput) Name() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *RuleGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   295  }
   296  
   297  func (o RuleGroupOutput) NamePrefix() pulumi.StringOutput {
   298  	return o.ApplyT(func(v *RuleGroup) pulumi.StringOutput { return v.NamePrefix }).(pulumi.StringOutput)
   299  }
   300  
   301  // The rule blocks used to identify the web requests that you want to `allow`, `block`, or `count`. See Rules below for details.
   302  func (o RuleGroupOutput) Rules() RuleGroupRuleArrayOutput {
   303  	return o.ApplyT(func(v *RuleGroup) RuleGroupRuleArrayOutput { return v.Rules }).(RuleGroupRuleArrayOutput)
   304  }
   305  
   306  // Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
   307  func (o RuleGroupOutput) Scope() pulumi.StringOutput {
   308  	return o.ApplyT(func(v *RuleGroup) pulumi.StringOutput { return v.Scope }).(pulumi.StringOutput)
   309  }
   310  
   311  // An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   312  func (o RuleGroupOutput) Tags() pulumi.StringMapOutput {
   313  	return o.ApplyT(func(v *RuleGroup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   314  }
   315  
   316  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   317  //
   318  // Deprecated: Please use `tags` instead.
   319  func (o RuleGroupOutput) TagsAll() pulumi.StringMapOutput {
   320  	return o.ApplyT(func(v *RuleGroup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   321  }
   322  
   323  // Defines and enables Amazon CloudWatch metrics and web request sample collection. See Visibility Configuration below for details.
   324  func (o RuleGroupOutput) VisibilityConfig() RuleGroupVisibilityConfigOutput {
   325  	return o.ApplyT(func(v *RuleGroup) RuleGroupVisibilityConfigOutput { return v.VisibilityConfig }).(RuleGroupVisibilityConfigOutput)
   326  }
   327  
   328  type RuleGroupArrayOutput struct{ *pulumi.OutputState }
   329  
   330  func (RuleGroupArrayOutput) ElementType() reflect.Type {
   331  	return reflect.TypeOf((*[]*RuleGroup)(nil)).Elem()
   332  }
   333  
   334  func (o RuleGroupArrayOutput) ToRuleGroupArrayOutput() RuleGroupArrayOutput {
   335  	return o
   336  }
   337  
   338  func (o RuleGroupArrayOutput) ToRuleGroupArrayOutputWithContext(ctx context.Context) RuleGroupArrayOutput {
   339  	return o
   340  }
   341  
   342  func (o RuleGroupArrayOutput) Index(i pulumi.IntInput) RuleGroupOutput {
   343  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RuleGroup {
   344  		return vs[0].([]*RuleGroup)[vs[1].(int)]
   345  	}).(RuleGroupOutput)
   346  }
   347  
   348  type RuleGroupMapOutput struct{ *pulumi.OutputState }
   349  
   350  func (RuleGroupMapOutput) ElementType() reflect.Type {
   351  	return reflect.TypeOf((*map[string]*RuleGroup)(nil)).Elem()
   352  }
   353  
   354  func (o RuleGroupMapOutput) ToRuleGroupMapOutput() RuleGroupMapOutput {
   355  	return o
   356  }
   357  
   358  func (o RuleGroupMapOutput) ToRuleGroupMapOutputWithContext(ctx context.Context) RuleGroupMapOutput {
   359  	return o
   360  }
   361  
   362  func (o RuleGroupMapOutput) MapIndex(k pulumi.StringInput) RuleGroupOutput {
   363  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RuleGroup {
   364  		return vs[0].(map[string]*RuleGroup)[vs[1].(string)]
   365  	}).(RuleGroupOutput)
   366  }
   367  
   368  func init() {
   369  	pulumi.RegisterInputType(reflect.TypeOf((*RuleGroupInput)(nil)).Elem(), &RuleGroup{})
   370  	pulumi.RegisterInputType(reflect.TypeOf((*RuleGroupArrayInput)(nil)).Elem(), RuleGroupArray{})
   371  	pulumi.RegisterInputType(reflect.TypeOf((*RuleGroupMapInput)(nil)).Elem(), RuleGroupMap{})
   372  	pulumi.RegisterOutputType(RuleGroupOutput{})
   373  	pulumi.RegisterOutputType(RuleGroupArrayOutput{})
   374  	pulumi.RegisterOutputType(RuleGroupMapOutput{})
   375  }