Skip to content

start_automated_reasoning_policy_test_workflow

start_automated_reasoning_policy_test_workflow(
    policy_arn: AutomatedReasoningPolicyArn,
    build_workflow_id: AutomatedReasoningPolicyBuildWorkflowId,
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    test_case_ids: Optional[AutomatedReasoningPolicyTestCaseIdList] = None,
    client_request_token: Optional[IdempotencyToken] = None,
) -> StartAutomatedReasoningPolicyTestWorkflowResponse

Initiates a test workflow to validate Automated Reasoning policy tests. The workflow executes the specified tests against the policy and generates validation results.

Parameters:

  • policy_arn (AutomatedReasoningPolicyArn) –

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

  • build_workflow_id (AutomatedReasoningPolicyBuildWorkflowId) –

    The build workflow identifier. The build workflow must show a COMPLETED status before running tests.

  • test_case_ids (Optional[AutomatedReasoningPolicyTestCaseIdList], default: None ) –

    The list of test identifiers to run. If not provided, all tests for the policy are run.

  • client_request_token (Optional[IdempotencyToken], default: None ) –

    A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request but doesn't return an error.

Raises:

  • AccessDeniedException –

    The request is denied because of missing access permissions.

  • 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 start_automated_reasoning_policy_test_workflow(
    self,
    policy_arn: "capo_bedrock.types.automated_reasoning_policy_arn.AutomatedReasoningPolicyArn",
    build_workflow_id: "capo_bedrock.types.automated_reasoning_policy_build_workflow_id.AutomatedReasoningPolicyBuildWorkflowId",
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    test_case_ids: Optional[
        "capo_bedrock.types.automated_reasoning_policy_test_case_id_list.AutomatedReasoningPolicyTestCaseIdList"
    ] = None,
    client_request_token: Optional[
        "capo_bedrock.types.idempotency_token.IdempotencyToken"
    ] = None,
) -> "capo_bedrock.types.start_automated_reasoning_policy_test_workflow_response.StartAutomatedReasoningPolicyTestWorkflowResponse":
    """<p>Initiates a test workflow to validate Automated Reasoning policy tests. The workflow executes the specified tests against the policy and generates validation results.</p>

    Args:
        policy_arn: <p>The Amazon Resource Name (ARN) of the Automated Reasoning policy to test.</p>
        build_workflow_id: <p>The build workflow identifier. The build workflow must show a <code>COMPLETED</code> status before running tests.</p>
        test_case_ids: <p>The list of test identifiers to run. If not provided, all tests for the policy are run.</p>
        client_request_token: <p>A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request but doesn't return an error.</p>

    Raises:
        capo_bedrock.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</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.start_automated_reasoning_policy_test_workflow_request.StartAutomatedReasoningPolicyTestWorkflowRequest]",
    ) -> OperationResponse[
        "capo_bedrock.types.start_automated_reasoning_policy_test_workflow_response.StartAutomatedReasoningPolicyTestWorkflowResponse"
    ]:
        import capo_bedrock._operations.amazon_bedrock_control_plane_service.start_automated_reasoning_policy_test_workflow

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

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartAutomatedReasoningPolicyTestWorkflow"),
    )
    input_: capo_bedrock.types.start_automated_reasoning_policy_test_workflow_request.StartAutomatedReasoningPolicyTestWorkflowRequest = {
        "policy_arn": policy_arn,
        "build_workflow_id": build_workflow_id,
    }
    if test_case_ids is not None:
        input_["test_case_ids"] = test_case_ids
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token

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