Skip to content

update_automated_reasoning_policy async

update_automated_reasoning_policy(
    policy_arn: AutomatedReasoningPolicyArn,
    policy_definition: AutomatedReasoningPolicyDefinition,
    *,
    config_overrides: Optional[AsyncBedrockClientConfig] = None,
    name: Optional[AutomatedReasoningPolicyName] = None,
    description: Optional[AutomatedReasoningPolicyDescription] = None,
) -> UpdateAutomatedReasoningPolicyResponse

Updates an existing Automated Reasoning policy with new rules, variables, or configuration. This creates a new version of the policy while preserving the previous version.

Parameters:

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.

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

  • TooManyTagsException –

    The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request.

  • 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/async_bedrock.py
async def update_automated_reasoning_policy(
    self,
    policy_arn: "capo_bedrock.types.automated_reasoning_policy_arn.AutomatedReasoningPolicyArn",
    policy_definition: "capo_bedrock.types.automated_reasoning_policy_definition.AutomatedReasoningPolicyDefinition",
    *,
    config_overrides: Optional[AsyncBedrockClientConfig] = None,
    name: Optional[
        "capo_bedrock.types.automated_reasoning_policy_name.AutomatedReasoningPolicyName"
    ] = None,
    description: Optional[
        "capo_bedrock.types.automated_reasoning_policy_description.AutomatedReasoningPolicyDescription"
    ] = None,
) -> "capo_bedrock.types.update_automated_reasoning_policy_response.UpdateAutomatedReasoningPolicyResponse":
    """<p>Updates an existing Automated Reasoning policy with new rules, variables, or configuration. This creates a new version of the policy while preserving the previous version.</p>

    Args:
        policy_arn: <p>The Amazon Resource Name (ARN) of the Automated Reasoning policy to update. This must be the ARN of a draft policy.</p>
        policy_definition: <p>The updated policy definition containing the formal logic rules, variables, and types.</p>
        name: <p>The updated name for the Automated Reasoning policy.</p>
        description: <p>The updated description for the Automated Reasoning policy.</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_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.too_many_tags_exception.TooManyTagsException: <p>The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request. </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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock.types.update_automated_reasoning_policy_request.UpdateAutomatedReasoningPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock.types.update_automated_reasoning_policy_response.UpdateAutomatedReasoningPolicyResponse"
    ]:
        import capo_bedrock._operations.amazon_bedrock_control_plane_service.update_automated_reasoning_policy

        (
            output,
            http_response,
        ) = await capo_bedrock._operations.amazon_bedrock_control_plane_service.update_automated_reasoning_policy.async_update_automated_reasoning_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock.types.update_automated_reasoning_policy_request.UpdateAutomatedReasoningPolicyRequest",
    ) -> dict[str, Any]:
        import capo_bedrock.types.update_automated_reasoning_policy_request

        return capo_bedrock.types.update_automated_reasoning_policy_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_bedrock.types.update_automated_reasoning_policy_response.UpdateAutomatedReasoningPolicyResponse",
    ) -> dict[str, Any]:
        import capo_bedrock.types.update_automated_reasoning_policy_response

        return capo_bedrock.types.update_automated_reasoning_policy_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateAutomatedReasoningPolicy",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_bedrock.types.update_automated_reasoning_policy_request.UpdateAutomatedReasoningPolicyRequest = {
        "policy_arn": policy_arn,
        "policy_definition": policy_definition,
    }
    if name is not None:
        input_["name"] = name
    if description is not None:
        input_["description"] = description

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output