Skip to content

delete_automated_reasoning_policy

delete_automated_reasoning_policy(
    policy_arn: AutomatedReasoningPolicyArn,
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    force: Optional[bool] = None,
) -> DeleteAutomatedReasoningPolicyResponse

Deletes an Automated Reasoning policy or policy version. This operation is idempotent. If you delete a policy more than once, each call succeeds. Deleting a policy removes it permanently and cannot be undone.

Parameters:

  • policy_arn (AutomatedReasoningPolicyArn) –

    The Amazon Resource Name (ARN) of the Automated Reasoning policy to delete.

  • force (Optional[bool], default: None ) –

    Specifies whether to force delete the automated reasoning policy even if it has active resources. When false, Amazon Bedrock validates if all artifacts have been deleted (e.g. policy version, test case, test result) for a policy before deletion. When true, Amazon Bedrock will delete the policy and all its artifacts without validation. Default is false.

Raises:

  • AccessDeniedException –

    The request is denied because of missing access permissions.

  • ConflictException –

    Error occurred because of a conflict while performing an operation.

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • ResourceInUseException –

    Thrown when attempting to delete or modify a resource that is currently being used by other resources or operations. For example, trying to delete an Automated Reasoning policy that is referenced by an active guardrail.

  • ResourceNotFoundException –

    The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

  • ThrottlingException –

    The number of requests exceeds the limit. Resubmit your request later.

  • ValidationException –

    Input validation failed. Check your request parameters and retry the request.

  • UnknownServiceError –

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

Source code in docs_src/capo_bedrock/_services/bedrock.py
def delete_automated_reasoning_policy(
    self,
    policy_arn: "capo_bedrock.types.automated_reasoning_policy_arn.AutomatedReasoningPolicyArn",
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    force: Optional[bool] = None,
) -> "capo_bedrock.types.delete_automated_reasoning_policy_response.DeleteAutomatedReasoningPolicyResponse":
    """<p>Deletes an Automated Reasoning policy or policy version. This operation is idempotent. If you delete a policy more than once, each call succeeds. Deleting a policy removes it permanently and cannot be undone.</p>

    Args:
        policy_arn: <p>The Amazon Resource Name (ARN) of the Automated Reasoning policy to delete.</p>
        force: <p>Specifies whether to force delete the automated reasoning policy even if it has active resources. When <code>false</code>, Amazon Bedrock validates if all artifacts have been deleted (e.g. policy version, test case, test result) for a policy before deletion. When <code>true</code>, Amazon Bedrock will delete the policy and all its artifacts without validation. Default is <code>false</code>. </p>

    Raises:
        capo_bedrock.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock.errors.conflict_exception.ConflictException: <p>Error occurred because of a conflict while performing an operation.</p>
        capo_bedrock.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock.errors.resource_in_use_exception.ResourceInUseException: <p>Thrown when attempting to delete or modify a resource that is currently being used by other resources or operations. For example, trying to delete an Automated Reasoning policy that is referenced by an active guardrail.</p>
        capo_bedrock.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
        capo_bedrock.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_bedrock.types.delete_automated_reasoning_policy_request.DeleteAutomatedReasoningPolicyRequest]",
    ) -> OperationResponse[
        "capo_bedrock.types.delete_automated_reasoning_policy_response.DeleteAutomatedReasoningPolicyResponse"
    ]:
        import capo_bedrock._operations.amazon_bedrock_control_plane_service.delete_automated_reasoning_policy

        output, http_response = (
            capo_bedrock._operations.amazon_bedrock_control_plane_service.delete_automated_reasoning_policy.delete_automated_reasoning_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteAutomatedReasoningPolicy")
    )
    input_: capo_bedrock.types.delete_automated_reasoning_policy_request.DeleteAutomatedReasoningPolicyRequest = {
        "policy_arn": policy_arn
    }
    if force is not None:
        input_["force"] = force

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