Skip to content

associate_health_check

associate_health_check(
    protection_id: ProtectionId,
    health_check_arn: HealthCheckArn,
    *,
    config_overrides: Optional[ShieldClientConfig] = None,
) -> AssociateHealthCheckResponse

Adds health-based detection to the Shield Advanced protection for a resource. Shield Advanced health-based detection uses the health of your Amazon Web Services resource to improve responsiveness and accuracy in attack detection and response.

You define the health check in Route 53 and then associate it with your Shield Advanced protection. For more information, see Shield Advanced Health-Based Detection in the WAF Developer Guide.

Parameters:

  • protection_id (ProtectionId) –

    The unique identifier (ID) for the Protection object to add the health check association to.

  • health_check_arn (HealthCheckArn) –

    The Amazon Resource Name (ARN) of the health check to associate with the protection.

Raises:

  • InternalErrorException –

    Exception that indicates that a problem occurred with the service infrastructure. You can retry the request.

  • InvalidParameterException –

    Exception that indicates that the parameters passed to the API are invalid. If available, this exception includes details in additional properties.

  • InvalidResourceException –

    Exception that indicates that the resource is invalid. You might not have access to the resource, or the resource might not exist.

  • LimitsExceededException –

    Exception that indicates that the operation would exceed a limit.

  • OptimisticLockException –

    Exception that indicates that the resource state has been modified by another client. Retrieve the resource and then retry your request.

  • ResourceNotFoundException –

    Exception indicating the specified resource does not exist. If available, this exception includes details in additional properties.

  • UnknownServiceError –

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

Source code in docs_src/capo_shield/_services/shield.py
def associate_health_check(
    self,
    protection_id: "capo_shield.types.protection_id.ProtectionId",
    health_check_arn: "capo_shield.types.health_check_arn.HealthCheckArn",
    *,
    config_overrides: Optional[ShieldClientConfig] = None,
) -> (
    "capo_shield.types.associate_health_check_response.AssociateHealthCheckResponse"
):
    """<p>Adds health-based detection to the Shield Advanced protection for a resource. Shield Advanced health-based detection uses the health of your Amazon Web Services resource to improve responsiveness and accuracy in attack detection and response. </p> <p>You define the health check in Route 53 and then associate it with your Shield Advanced protection. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/ddos-overview.html#ddos-advanced-health-check-option">Shield Advanced Health-Based Detection</a> in the <i>WAF Developer Guide</i>. </p>

    Args:
        protection_id: <p>The unique identifier (ID) for the <a>Protection</a> object to add the health check association to. </p>
        health_check_arn: <p>The Amazon Resource Name (ARN) of the health check to associate with the protection.</p>

    Raises:
        capo_shield.errors.internal_error_exception.InternalErrorException: <p>Exception that indicates that a problem occurred with the service infrastructure. You can retry the request.</p>
        capo_shield.errors.invalid_parameter_exception.InvalidParameterException: <p>Exception that indicates that the parameters passed to the API are invalid. If available, this exception includes details in additional properties. </p>
        capo_shield.errors.invalid_resource_exception.InvalidResourceException: <p>Exception that indicates that the resource is invalid. You might not have access to the resource, or the resource might not exist.</p>
        capo_shield.errors.limits_exceeded_exception.LimitsExceededException: <p>Exception that indicates that the operation would exceed a limit.</p>
        capo_shield.errors.optimistic_lock_exception.OptimisticLockException: <p>Exception that indicates that the resource state has been modified by another client. Retrieve the resource and then retry your request.</p>
        capo_shield.errors.resource_not_found_exception.ResourceNotFoundException: <p>Exception indicating the specified resource does not exist. If available, this exception includes details in additional properties. </p>
        capo_shield.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_shield.types.associate_health_check_request.AssociateHealthCheckRequest]",
    ) -> OperationResponse[
        "capo_shield.types.associate_health_check_response.AssociateHealthCheckResponse"
    ]:
        import capo_shield._operations.aws_shield_20160616.associate_health_check

        output, http_response = (
            capo_shield._operations.aws_shield_20160616.associate_health_check.associate_health_check(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateHealthCheck")
    )
    input_: capo_shield.types.associate_health_check_request.AssociateHealthCheckRequest = {
        "protection_id": protection_id,
        "health_check_arn": health_check_arn,
    }

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