Skip to content

create_rule_group async

create_rule_group(
    name: ResourceName,
    metric_name: MetricName,
    change_token: ChangeToken,
    *,
    config_overrides: Optional[AsyncWAFClientConfig] = None,
    tags: Optional[TagList] = None,
) -> CreateRuleGroupResponse

This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the developer guide.

For the latest version of AWS WAF, use the AWS WAFV2 API and see the AWS WAF Developer Guide. With the latest version, AWS WAF has a single set of endpoints for regional and global use.

Creates a RuleGroup. A rule group is a collection of predefined rules that you add to a web ACL. You use UpdateRuleGroup to add rules to the rule group.

Rule groups are subject to the following limits:

  • Three rule groups per account. You can request an increase to this limit by contacting customer support.

  • One rule group per web ACL.

  • Ten rules per rule group.

For more information about how to use the AWS WAF API to allow or block HTTP requests, see the AWS WAF Developer Guide.

Parameters:

  • name (ResourceName) –

    A friendly name or description of the RuleGroup. You can't change Name after you create a RuleGroup.

  • metric_name (MetricName) –

    A friendly name or description for the metrics for this RuleGroup. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name of the metric after you create the RuleGroup.

  • change_token (ChangeToken) –

    The value returned by the most recent call to GetChangeToken.

  • tags (Optional[TagList], default: None ) –

Raises:

Source code in docs_src/capo_waf/_services/async_waf.py
async def create_rule_group(
    self,
    name: "capo_waf.types.resource_name.ResourceName",
    metric_name: "capo_waf.types.metric_name.MetricName",
    change_token: "capo_waf.types.change_token.ChangeToken",
    *,
    config_overrides: Optional[AsyncWAFClientConfig] = None,
    tags: Optional["capo_waf.types.tag_list.TagList"] = None,
) -> "capo_waf.types.create_rule_group_response.CreateRuleGroupResponse":
    """<note> <p>This is <b>AWS WAF Classic</b> documentation. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html">AWS WAF Classic</a> in the developer guide.</p> <p> <b>For the latest version of AWS WAF</b>, use the AWS WAFV2 API and see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS WAF Developer Guide</a>. With the latest version, AWS WAF has a single set of endpoints for regional and global use. </p> </note> <p>Creates a <code>RuleGroup</code>. A rule group is a collection of predefined rules that you add to a web ACL. You use <a>UpdateRuleGroup</a> to add rules to the rule group.</p> <p>Rule groups are subject to the following limits:</p> <ul> <li> <p>Three rule groups per account. You can request an increase to this limit by contacting customer support.</p> </li> <li> <p>One rule group per web ACL.</p> </li> <li> <p>Ten rules per rule group.</p> </li> </ul> <p>For more information about how to use the AWS WAF API to allow or block HTTP requests, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer Guide</a>.</p>

    Args:
        name: <p>A friendly name or description of the <a>RuleGroup</a>. You can't change <code>Name</code> after you create a <code>RuleGroup</code>.</p>
        metric_name: <p>A friendly name or description for the metrics for this <code>RuleGroup</code>. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name of the metric after you create the <code>RuleGroup</code>.</p>
        change_token: <p>The value returned by the most recent call to <a>GetChangeToken</a>.</p>
        tags: <p></p>

    Raises:
        capo_waf.errors.waf_bad_request_exception.WAFBadRequestException: <p></p>
        capo_waf.errors.waf_disallowed_name_exception.WAFDisallowedNameException: <p>The name specified is invalid.</p>
        capo_waf.errors.waf_internal_error_exception.WAFInternalErrorException: <p>The operation failed because of a system problem, even though the request was valid. Retry your request.</p>
        capo_waf.errors.waf_limits_exceeded_exception.WAFLimitsExceededException: <p>The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code> objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a> in the <i>AWS WAF Developer Guide</i>.</p>
        capo_waf.errors.waf_stale_data_exception.WAFStaleDataException: <p>The operation failed because you tried to create, update, or delete an object by using a change token that has already been used.</p>
        capo_waf.errors.waf_tag_operation_exception.WAFTagOperationException: <p></p>
        capo_waf.errors.waf_tag_operation_internal_error_exception.WAFTagOperationInternalErrorException: <p></p>
        capo_waf.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_waf.types.create_rule_group_request.CreateRuleGroupRequest]",
    ) -> AsyncOperationResponse[
        "capo_waf.types.create_rule_group_response.CreateRuleGroupResponse"
    ]:
        import capo_waf._operations.awswaf_20150824.create_rule_group

        (
            output,
            http_response,
        ) = await capo_waf._operations.awswaf_20150824.create_rule_group.async_create_rule_group(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateRuleGroup")
    )
    input_: capo_waf.types.create_rule_group_request.CreateRuleGroupRequest = {
        "name": name,
        "metric_name": metric_name,
        "change_token": change_token,
    }
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output