Skip to content

get_rule

get_rule(
    rule_id: ResourceId, *, config_overrides: Optional[WAFRegionalClientConfig] = None
) -> GetRuleResponse

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.

Returns the Rule that is specified by the RuleId that you included in the GetRule request.

Parameters:

Raises:

Examples:

To get a rule The following example returns the details of a rule with the ID example1ds3t-46da-4fdb-b8d5-abc321j569j5.

>>> client.get_rule(rule_id='example1ds3t-46da-4fdb-b8d5-abc321j569j5')
Source code in docs_src/capo_waf_regional/_services/waf_regional.py
def get_rule(
    self,
    rule_id: "capo_waf_regional.types.resource_id.ResourceId",
    *,
    config_overrides: Optional[WAFRegionalClientConfig] = None,
) -> "capo_waf_regional.types.get_rule_response.GetRuleResponse":
    """<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>Returns the <a>Rule</a> that is specified by the <code>RuleId</code> that you included in the <code>GetRule</code> request.</p>

    Args:
        rule_id: <p>The <code>RuleId</code> of the <a>Rule</a> that you want to get. <code>RuleId</code> is returned by <a>CreateRule</a> and by <a>ListRules</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_account_exception.WAFInvalidAccountException: <p>The operation failed because you tried to create, update, or delete an object by using an invalid account identifier.</p>
        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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To get a rule
        The following example returns the details of a rule with the ID example1ds3t-46da-4fdb-b8d5-abc321j569j5.

        >>> client.get_rule(rule_id='example1ds3t-46da-4fdb-b8d5-abc321j569j5')
    """

    def _handler(
        req: "OperationRequest[capo_waf_regional.types.get_rule_request.GetRuleRequest]",
    ) -> OperationResponse[
        "capo_waf_regional.types.get_rule_response.GetRuleResponse"
    ]:
        import capo_waf_regional._operations.awswaf_regional_20161128.get_rule

        output, http_response = (
            capo_waf_regional._operations.awswaf_regional_20161128.get_rule.get_rule(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetRule")
    )
    input_: capo_waf_regional.types.get_rule_request.GetRuleRequest = {
        "rule_id": rule_id
    }

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