Skip to content

update_pull_request_approval_state async

update_pull_request_approval_state(
    pull_request_id: PullRequestId,
    revision_id: RevisionId,
    approval_state: ApprovalState,
    *,
    config_overrides: Optional[AsyncCodeCommitClientConfig] = None,
) -> None

Updates the state of a user's approval on a pull request. The user is derived from the signed-in account when the request is made.

Parameters:

  • pull_request_id (PullRequestId) –

    The system-generated ID of the pull request.

  • revision_id (RevisionId) –

    The system-generated ID of the revision.

  • approval_state (ApprovalState) –

    The approval state to associate with the user on the pull request.

Raises:

Source code in docs_src/capo_codecommit/_services/async_code_commit.py
async def update_pull_request_approval_state(
    self,
    pull_request_id: "capo_codecommit.types.pull_request_id.PullRequestId",
    revision_id: "capo_codecommit.types.revision_id.RevisionId",
    approval_state: "capo_codecommit.types.approval_state.ApprovalState",
    *,
    config_overrides: Optional[AsyncCodeCommitClientConfig] = None,
) -> None:
    """<p>Updates the state of a user's approval on a pull request. The user is derived from the signed-in account when the request is made.</p>

    Args:
        pull_request_id: <p>The system-generated ID of the pull request.</p>
        revision_id: <p>The system-generated ID of the revision.</p>
        approval_state: <p>The approval state to associate with the user on the pull request.</p>

    Raises:
        capo_codecommit.errors.approval_state_required_exception.ApprovalStateRequiredException: <p>An approval state is required, but was not specified.</p>
        capo_codecommit.errors.encryption_integrity_checks_failed_exception.EncryptionIntegrityChecksFailedException: <p>An encryption integrity check failed.</p>
        capo_codecommit.errors.encryption_key_access_denied_exception.EncryptionKeyAccessDeniedException: <p>An encryption key could not be accessed.</p>
        capo_codecommit.errors.encryption_key_disabled_exception.EncryptionKeyDisabledException: <p>The encryption key is disabled.</p>
        capo_codecommit.errors.encryption_key_not_found_exception.EncryptionKeyNotFoundException: <p>No encryption key was found.</p>
        capo_codecommit.errors.encryption_key_unavailable_exception.EncryptionKeyUnavailableException: <p>The encryption key is not available.</p>
        capo_codecommit.errors.invalid_approval_state_exception.InvalidApprovalStateException: <p>The state for the approval is not valid. Valid values include APPROVE and REVOKE. </p>
        capo_codecommit.errors.invalid_pull_request_id_exception.InvalidPullRequestIdException: <p>The pull request ID is not valid. Make sure that you have provided the full ID and that the pull request is in the specified repository, and then try again.</p>
        capo_codecommit.errors.invalid_revision_id_exception.InvalidRevisionIdException: <p>The revision ID is not valid. Use GetPullRequest to determine the value.</p>
        capo_codecommit.errors.maximum_number_of_approvals_exceeded_exception.MaximumNumberOfApprovalsExceededException: <p>The number of approvals required for the approval rule exceeds the maximum number allowed.</p>
        capo_codecommit.errors.pull_request_already_closed_exception.PullRequestAlreadyClosedException: <p>The pull request status cannot be updated because it is already closed.</p>
        capo_codecommit.errors.pull_request_cannot_be_approved_by_author_exception.PullRequestCannotBeApprovedByAuthorException: <p>The approval cannot be applied because the user approving the pull request matches the user who created the pull request. You cannot approve a pull request that you created.</p>
        capo_codecommit.errors.pull_request_does_not_exist_exception.PullRequestDoesNotExistException: <p>The pull request ID could not be found. Make sure that you have specified the correct repository name and pull request ID, and then try again.</p>
        capo_codecommit.errors.pull_request_id_required_exception.PullRequestIdRequiredException: <p>A pull request ID is required, but none was provided.</p>
        capo_codecommit.errors.revision_id_required_exception.RevisionIdRequiredException: <p>A revision ID is required, but was not provided.</p>
        capo_codecommit.errors.revision_not_current_exception.RevisionNotCurrentException: <p>The revision ID provided in the request does not match the current revision ID. Use GetPullRequest to retrieve the current revision ID.</p>
        capo_codecommit.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codecommit.types.update_pull_request_approval_state_input.UpdatePullRequestApprovalStateInput]",
    ) -> AsyncOperationResponse[None]:
        import capo_codecommit._operations.code_commit_20150413.update_pull_request_approval_state

        (
            output,
            http_response,
        ) = await capo_codecommit._operations.code_commit_20150413.update_pull_request_approval_state.async_update_pull_request_approval_state(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePullRequestApprovalState")
    )
    input_: capo_codecommit.types.update_pull_request_approval_state_input.UpdatePullRequestApprovalStateInput = {
        "pull_request_id": pull_request_id,
        "revision_id": revision_id,
        "approval_state": approval_state,
    }

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