Skip to content

delete_pull_request_approval_rule

delete_pull_request_approval_rule(
    pull_request_id: PullRequestId,
    approval_rule_name: ApprovalRuleName,
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
) -> DeletePullRequestApprovalRuleOutput

Deletes an approval rule from a specified pull request. Approval rules can be deleted from a pull request only if the pull request is open, and if the approval rule was created specifically for a pull request and not generated from an approval rule template associated with the repository where the pull request was created. You cannot delete an approval rule from a merged or closed pull request.

Parameters:

  • pull_request_id (PullRequestId) –

    The system-generated ID of the pull request that contains the approval rule you want to delete.

  • approval_rule_name (ApprovalRuleName) –

    The name of the approval rule you want to delete.

Raises:

Source code in docs_src/capo_codecommit/_services/code_commit.py
def delete_pull_request_approval_rule(
    self,
    pull_request_id: "capo_codecommit.types.pull_request_id.PullRequestId",
    approval_rule_name: "capo_codecommit.types.approval_rule_name.ApprovalRuleName",
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
) -> "capo_codecommit.types.delete_pull_request_approval_rule_output.DeletePullRequestApprovalRuleOutput":
    """<p>Deletes an approval rule from a specified pull request. Approval rules can be deleted from a pull request only if the pull request is open, and if the approval rule was created specifically for a pull request and not generated from an approval rule template associated with the repository where the pull request was created. You cannot delete an approval rule from a merged or closed pull request.</p>

    Args:
        pull_request_id: <p>The system-generated ID of the pull request that contains the approval rule you want to delete.</p>
        approval_rule_name: <p>The name of the approval rule you want to delete.</p>

    Raises:
        capo_codecommit.errors.approval_rule_name_required_exception.ApprovalRuleNameRequiredException: <p>An approval rule name is required, but was not specified.</p>
        capo_codecommit.errors.cannot_delete_approval_rule_from_template_exception.CannotDeleteApprovalRuleFromTemplateException: <p>The approval rule cannot be deleted from the pull request because it was created by an approval rule template and applied to the pull request automatically.</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_rule_name_exception.InvalidApprovalRuleNameException: <p>The name for the approval rule is not valid.</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.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_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.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codecommit.types.delete_pull_request_approval_rule_input.DeletePullRequestApprovalRuleInput]",
    ) -> OperationResponse[
        "capo_codecommit.types.delete_pull_request_approval_rule_output.DeletePullRequestApprovalRuleOutput"
    ]:
        import capo_codecommit._operations.code_commit_20150413.delete_pull_request_approval_rule

        output, http_response = (
            capo_codecommit._operations.code_commit_20150413.delete_pull_request_approval_rule.delete_pull_request_approval_rule(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeletePullRequestApprovalRule")
    )
    input_: capo_codecommit.types.delete_pull_request_approval_rule_input.DeletePullRequestApprovalRuleInput = {
        "pull_request_id": pull_request_id,
        "approval_rule_name": approval_rule_name,
    }

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