create_rule_group
¶
create_rule_group(
name: EntityName,
scope: Scope,
capacity: CapacityUnit,
visibility_config: VisibilityConfig,
*,
config_overrides: Optional[WAFV2ClientConfig] = None,
description: Optional[EntityDescription] = None,
rules: Optional[Rules] = None,
tags: Optional[TagList] = None,
custom_response_bodies: Optional[CustomResponseBodies] = None,
monetization_config: Optional[MonetizationConfig] = None,
) -> CreateRuleGroupResponse
Creates a RuleGroup per the specifications provided.
A rule group defines a collection of rules to inspect and control web requests that you can use in a WebACL. When you create a rule group, you define an immutable capacity limit. If you update a rule group, you must stay within the capacity. This allows others to reuse the rule group with confidence in its capacity requirements.
Parameters:
-
name(EntityName) –The name of the rule group. You cannot change the name of a rule group after you create it.
-
scope(Scope) –Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use
CLOUDFRONT.To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:
-
CLI - Specify the Region when you use the CloudFront scope:
--scope=CLOUDFRONT --region=us-east-1. -
API and SDKs - For all calls, use the Region endpoint us-east-1.
-
-
capacity(CapacityUnit) –The web ACL capacity units (WCUs) required for this rule group.
When you create your own rule group, you define this, and you cannot change it after creation. When you add or modify the rules in a rule group, WAF enforces this limit. You can check the capacity for a set of rules using CheckCapacity.
WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. WAF calculates capacity differently for each rule type, to reflect the relative cost of each rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule group. For more information, see WAF web ACL capacity units (WCU) in the WAF Developer Guide.
-
description(Optional[EntityDescription], default:None) –A description of the rule group that helps with identification.
-
rules(Optional[Rules], default:None) –The Rule statements used to identify the web requests that you want to manage. Each rule includes one top-level statement that WAF uses to identify matching web requests, and parameters that govern how WAF handles them.
-
visibility_config(VisibilityConfig) –Defines and enables Amazon CloudWatch metrics and web request sample collection.
-
tags(Optional[TagList], default:None) –An array of key:value pairs to associate with the resource.
-
custom_response_bodies(Optional[CustomResponseBodies], default:None) –A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the rule group, and then use them in the rules that you define in the rule group.
For information about customizing web requests and responses, see Customizing web requests and responses in WAF in the WAF Developer Guide.
For information about the limits on count and size for custom request and response settings, see WAF quotas in the WAF Developer Guide.
-
monetization_config(Optional[MonetizationConfig], default:None) –The monetization configuration for the rule group. Provide this when any rule in the rule group uses the
Monetizeaction.
Raises:
-
WAFDuplicateItemException–WAF couldn’t perform the operation because the resource that you tried to save is a duplicate of an existing one.
-
WAFInternalErrorException–Your request is valid, but WAF couldn’t perform the operation because of a system problem. Retry your request.
-
WAFInvalidOperationException–The operation isn't valid.
-
WAFInvalidParameterException–The operation failed because WAF didn't recognize a parameter in the request. For example:
-
You specified a parameter name or value that isn't valid.
-
Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
-
You tried to update a
WebACLwith aDefaultActionthat isn't among the types available at DefaultAction. -
Your request references an ARN that is malformed, or corresponds to a resource with which a web ACL can't be associated.
-
-
WAFLimitsExceededException–WAF couldn’t perform the operation because you exceeded your resource limit. For example, the maximum number of
WebACLobjects that you can create for an Amazon Web Services account. For more information, see WAF quotas in the WAF Developer Guide. -
WAFNonexistentItemException–WAF couldn’t perform the operation because your resource doesn't exist. If you've just created a resource that you're using in this operation, you might just need to wait a few minutes. It can take from a few seconds to a number of minutes for changes to propagate.
-
WAFOptimisticLockException–WAF couldn’t save your changes because you tried to update or delete a resource that has changed since you last retrieved it. Get the resource again, make any changes you need to make to the new copy, and retry your operation.
-
WAFSubscriptionNotFoundException–You tried to use a managed rule group that's available by subscription, but you aren't subscribed to it yet.
-
WAFTagOperationException–An error occurred during the tagging operation. Retry your request.
-
WAFTagOperationInternalErrorException–WAF couldn’t perform your tagging operation because of an internal error. Retry your request.
-
WAFUnavailableEntityException–WAF couldn’t retrieve a resource that you specified for this operation. If you've just created a resource that you're using in this operation, you might just need to wait a few minutes. It can take from a few seconds to a number of minutes for changes to propagate. Verify the resource specifications in your request parameters and then retry the operation.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_wafv2/_services/wafv2.py
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | |