Skip to content

delete_rule_group async

delete_rule_group(
    rule_group_id: ResourceId,
    change_token: ChangeToken,
    *,
    config_overrides: Optional[AsyncWAFRegionalClientConfig] = None,
) -> DeleteRuleGroupResponse

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.

Permanently deletes a RuleGroup. You can't delete a RuleGroup if it's still used in any WebACL objects or if it still includes any rules.

If you just want to remove a RuleGroup from a WebACL, use UpdateWebACL.

To permanently delete a RuleGroup from AWS WAF, perform the following steps:

  1. Update the RuleGroup to remove rules, if any. For more information, see UpdateRuleGroup.

  2. Use GetChangeToken to get the change token that you provide in the ChangeToken parameter of a DeleteRuleGroup request.

  3. Submit a DeleteRuleGroup request.

Parameters:

Raises:

  • WAFInternalErrorException –

    The operation failed because of a system problem, even though the request was valid. Retry your request.

  • WAFInvalidOperationException –

    The operation failed because there was nothing to do. For example:

    • You tried to remove a Rule from a WebACL, but the Rule isn't in the specified WebACL.

    • You tried to remove an IP address from an IPSet, but the IP address isn't in the specified IPSet.

    • You tried to remove a ByteMatchTuple from a ByteMatchSet, but the ByteMatchTuple isn't in the specified WebACL.

    • You tried to add a Rule to a WebACL, but the Rule already exists in the specified WebACL.

    • You tried to add a ByteMatchTuple to a ByteMatchSet, but the ByteMatchTuple already exists in the specified WebACL.

  • WAFNonEmptyEntityException –

    The operation failed because you tried to delete an object that isn't empty. For example:

    • You tried to delete a WebACL that still contains one or more Rule objects.

    • You tried to delete a Rule that still contains one or more ByteMatchSet objects or other predicates.

    • You tried to delete a ByteMatchSet that contains one or more ByteMatchTuple objects.

    • You tried to delete an IPSet that references one or more IP addresses.

  • WAFNonexistentItemException –

    The operation failed because the referenced object doesn't exist.

  • WAFReferencedItemException –

    The operation failed because you tried to delete an object that is still in use. For example:

    • You tried to delete a ByteMatchSet that is still referenced by a Rule.

    • You tried to delete a Rule that is still referenced by a WebACL.

  • WAFStaleDataException –

    The operation failed because you tried to create, update, or delete an object by using a change token that has already been used.

  • WAFTagOperationException –

  • WAFTagOperationInternalErrorException –

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_waf_regional/_services/async_waf_regional.py
async def delete_rule_group(
    self,
    rule_group_id: "capo_waf_regional.types.resource_id.ResourceId",
    change_token: "capo_waf_regional.types.change_token.ChangeToken",
    *,
    config_overrides: Optional[AsyncWAFRegionalClientConfig] = None,
) -> "capo_waf_regional.types.delete_rule_group_response.DeleteRuleGroupResponse":
    """<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>Permanently deletes a <a>RuleGroup</a>. You can't delete a <code>RuleGroup</code> if it's still used in any <code>WebACL</code> objects or if it still includes any rules.</p> <p>If you just want to remove a <code>RuleGroup</code> from a <code>WebACL</code>, use <a>UpdateWebACL</a>.</p> <p>To permanently delete a <code>RuleGroup</code> from AWS WAF, perform the following steps:</p> <ol> <li> <p>Update the <code>RuleGroup</code> to remove rules, if any. For more information, see <a>UpdateRuleGroup</a>.</p> </li> <li> <p>Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code> parameter of a <code>DeleteRuleGroup</code> request.</p> </li> <li> <p>Submit a <code>DeleteRuleGroup</code> request.</p> </li> </ol>

    Args:
        rule_group_id: <p>The <code>RuleGroupId</code> of the <a>RuleGroup</a> that you want to delete. <code>RuleGroupId</code> is returned by <a>CreateRuleGroup</a> and by <a>ListRuleGroups</a>.</p>
        change_token: <p>The value returned by the most recent call to <a>GetChangeToken</a>.</p>

    Raises:
        capo_waf_regional.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_regional.errors.waf_invalid_operation_exception.WAFInvalidOperationException: <p>The operation failed because there was nothing to do. For example:</p> <ul> <li> <p>You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code> isn't in the specified <code>WebACL</code>.</p> </li> <li> <p>You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't in the specified <code>IPSet</code>.</p> </li> <li> <p>You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>, but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.</p> </li> <li> <p>You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code> already exists in the specified <code>WebACL</code>.</p> </li> <li> <p>You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.</p> </li> </ul>
        capo_waf_regional.errors.waf_non_empty_entity_exception.WAFNonEmptyEntityException: <p>The operation failed because you tried to delete an object that isn't empty. For example:</p> <ul> <li> <p>You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code> objects.</p> </li> <li> <p>You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code> objects or other predicates.</p> </li> <li> <p>You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code> objects.</p> </li> <li> <p>You tried to delete an <code>IPSet</code> that references one or more IP addresses.</p> </li> </ul>
        capo_waf_regional.errors.waf_nonexistent_item_exception.WAFNonexistentItemException: <p>The operation failed because the referenced object doesn't exist.</p>
        capo_waf_regional.errors.waf_referenced_item_exception.WAFReferencedItemException: <p>The operation failed because you tried to delete an object that is still in use. For example:</p> <ul> <li> <p>You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.</p> </li> <li> <p>You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.</p> </li> </ul>
        capo_waf_regional.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_regional.errors.waf_tag_operation_exception.WAFTagOperationException: <p></p>
        capo_waf_regional.errors.waf_tag_operation_internal_error_exception.WAFTagOperationInternalErrorException: <p></p>
        capo_waf_regional.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_waf_regional.types.delete_rule_group_request.DeleteRuleGroupRequest]",
    ) -> AsyncOperationResponse[
        "capo_waf_regional.types.delete_rule_group_response.DeleteRuleGroupResponse"
    ]:
        import capo_waf_regional._operations.awswaf_regional_20161128.delete_rule_group

        (
            output,
            http_response,
        ) = await capo_waf_regional._operations.awswaf_regional_20161128.delete_rule_group.async_delete_rule_group(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteRuleGroup")
    )
    input_: capo_waf_regional.types.delete_rule_group_request.DeleteRuleGroupRequest = {
        "rule_group_id": rule_group_id,
        "change_token": change_token,
    }

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