Skip to content

get_rule_group

get_rule_group(
    *,
    config_overrides: Optional[WAFV2ClientConfig] = None,
    name: Optional[EntityName] = None,
    scope: Optional[Scope] = None,
    id: Optional[EntityId] = None,
    arn: Optional[ResourceArn] = None,
) -> GetRuleGroupResponse

Retrieves the specified RuleGroup.

Parameters:

  • name (Optional[EntityName], default: None ) –

    The name of the rule group. You cannot change the name of a rule group after you create it.

  • scope (Optional[Scope], default: None ) –

    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.

  • id (Optional[EntityId], default: None ) –

    A unique identifier for the rule group. This ID is returned in the responses to create and list commands. You provide it to operations like update and delete.

  • arn (Optional[ResourceArn], default: None ) –

    The Amazon Resource Name (ARN) of the entity.

Raises:

  • 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 WebACL with a DefaultAction that 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.

  • 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.

  • UnknownServiceError –

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

Source code in docs_src/capo_wafv2/_services/wafv2.py
def get_rule_group(
    self,
    *,
    config_overrides: Optional[WAFV2ClientConfig] = None,
    name: Optional["capo_wafv2.types.entity_name.EntityName"] = None,
    scope: Optional["capo_wafv2.types.scope.Scope"] = None,
    id: Optional["capo_wafv2.types.entity_id.EntityId"] = None,
    arn: Optional["capo_wafv2.types.resource_arn.ResourceArn"] = None,
) -> "capo_wafv2.types.get_rule_group_response.GetRuleGroupResponse":
    """<p>Retrieves the specified <a>RuleGroup</a>.</p>

    Args:
        name: <p>The name of the rule group. You cannot change the name of a rule group after you create it.</p>
        scope: <p>Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use <code>CLOUDFRONT</code>.</p> <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows: </p> <ul> <li> <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>. </p> </li> <li> <p>API and SDKs - For all calls, use the Region endpoint us-east-1. </p> </li> </ul>
        id: <p>A unique identifier for the rule group. This ID is returned in the responses to create and list commands. You provide it to operations like update and delete.</p>
        arn: <p>The Amazon Resource Name (ARN) of the entity.</p>

    Raises:
        capo_wafv2.errors.waf_internal_error_exception.WAFInternalErrorException: <p>Your request is valid, but WAF couldn’t perform the operation because of a system problem. Retry your request. </p>
        capo_wafv2.errors.waf_invalid_operation_exception.WAFInvalidOperationException: <p>The operation isn't valid. </p>
        capo_wafv2.errors.waf_invalid_parameter_exception.WAFInvalidParameterException: <p>The operation failed because WAF didn't recognize a parameter in the request. For example: </p> <ul> <li> <p>You specified a parameter name or value that isn't valid.</p> </li> <li> <p>Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested. </p> </li> <li> <p>You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't among the types available at <a>DefaultAction</a>.</p> </li> <li> <p>Your request references an ARN that is malformed, or corresponds to a resource with which a web ACL can't be associated.</p> </li> </ul>
        capo_wafv2.errors.waf_nonexistent_item_exception.WAFNonexistentItemException: <p>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. </p>
        capo_wafv2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_wafv2.types.get_rule_group_request.GetRuleGroupRequest]",
    ) -> OperationResponse[
        "capo_wafv2.types.get_rule_group_response.GetRuleGroupResponse"
    ]:
        import capo_wafv2._operations.awswaf_20190729.get_rule_group

        output, http_response = (
            capo_wafv2._operations.awswaf_20190729.get_rule_group.get_rule_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetRuleGroup")
    )
    input_: capo_wafv2.types.get_rule_group_request.GetRuleGroupRequest = {}
    if name is not None:
        input_["name"] = name
    if scope is not None:
        input_["scope"] = scope
    if id is not None:
        input_["id"] = id
    if arn is not None:
        input_["arn"] = arn

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output