Skip to content

update_pull_request_approval_rule_content async

update_pull_request_approval_rule_content(
    pull_request_id: PullRequestId,
    approval_rule_name: ApprovalRuleName,
    new_rule_content: ApprovalRuleContent,
    *,
    config_overrides: Optional[AsyncCodeCommitClientConfig] = None,
    existing_rule_content_sha256: Optional[RuleContentSha256] = None,
) -> UpdatePullRequestApprovalRuleContentOutput

Updates the structure of an approval rule created specifically for a pull request. For example, you can change the number of required approvers and the approval pool for approvers.

Parameters:

  • pull_request_id (PullRequestId) –

    The system-generated ID of the pull request.

  • approval_rule_name (ApprovalRuleName) –

    The name of the approval rule you want to update.

  • existing_rule_content_sha256 (Optional[RuleContentSha256], default: None ) –

    The SHA-256 hash signature for the content of the approval rule. You can retrieve this information by using GetPullRequest.

  • new_rule_content (ApprovalRuleContent) –

    The updated content for the approval rule.

    When you update the content of the approval rule, you can specify approvers in an approval pool in one of two ways:

    • CodeCommitApprovers: This option only requires an Amazon Web Services account and a resource. It can be used for both IAM users and federated access users whose name matches the provided resource name. This is a very powerful option that offers a great deal of flexibility. For example, if you specify the Amazon Web Services account 123456789012 and Mary_Major, all of the following are counted as approvals coming from that user:

      • An IAM user in the account (arn:aws:iam::123456789012:user/Mary_Major)

      • A federated user identified in IAM as Mary_Major (arn:aws:sts::123456789012:federated-user/Mary_Major)

      This option does not recognize an active session of someone assuming the role of CodeCommitReview with a role session name of Mary_Major (arn:aws:sts::123456789012:assumed-role/CodeCommitReview/Mary_Major) unless you include a wildcard (*Mary_Major).

    • Fully qualified ARN: This option allows you to specify the fully qualified Amazon Resource Name (ARN) of the IAM user or role.

    For more information about IAM ARNs, wildcards, and formats, see IAM Identifiers in the IAM User Guide.

Raises:

Source code in docs_src/capo_codecommit/_services/async_code_commit.py
async def update_pull_request_approval_rule_content(
    self,
    pull_request_id: "capo_codecommit.types.pull_request_id.PullRequestId",
    approval_rule_name: "capo_codecommit.types.approval_rule_name.ApprovalRuleName",
    new_rule_content: "capo_codecommit.types.approval_rule_content.ApprovalRuleContent",
    *,
    config_overrides: Optional[AsyncCodeCommitClientConfig] = None,
    existing_rule_content_sha256: Optional[
        "capo_codecommit.types.rule_content_sha256.RuleContentSha256"
    ] = None,
) -> "capo_codecommit.types.update_pull_request_approval_rule_content_output.UpdatePullRequestApprovalRuleContentOutput":
    """<p>Updates the structure of an approval rule created specifically for a pull request. For example, you can change the number of required approvers and the approval pool for approvers. </p>

    Args:
        pull_request_id: <p>The system-generated ID of the pull request.</p>
        approval_rule_name: <p>The name of the approval rule you want to update.</p>
        existing_rule_content_sha256: <p>The SHA-256 hash signature for the content of the approval rule. You can retrieve this information by using <a>GetPullRequest</a>.</p>
        new_rule_content: <p>The updated content for the approval rule.</p> <note> <p>When you update the content of the approval rule, you can specify approvers in an approval pool in one of two ways:</p> <ul> <li> <p> <b>CodeCommitApprovers</b>: This option only requires an Amazon Web Services account and a resource. It can be used for both IAM users and federated access users whose name matches the provided resource name. This is a very powerful option that offers a great deal of flexibility. For example, if you specify the Amazon Web Services account <i>123456789012</i> and <i>Mary_Major</i>, all of the following are counted as approvals coming from that user:</p> <ul> <li> <p>An IAM user in the account (arn:aws:iam::<i>123456789012</i>:user/<i>Mary_Major</i>)</p> </li> <li> <p>A federated user identified in IAM as Mary_Major (arn:aws:sts::<i>123456789012</i>:federated-user/<i>Mary_Major</i>)</p> </li> </ul> <p>This option does not recognize an active session of someone assuming the role of CodeCommitReview with a role session name of <i>Mary_Major</i> (arn:aws:sts::<i>123456789012</i>:assumed-role/CodeCommitReview/<i>Mary_Major</i>) unless you include a wildcard (*Mary_Major).</p> </li> <li> <p> <b>Fully qualified ARN</b>: This option allows you to specify the fully qualified Amazon Resource Name (ARN) of the IAM user or role. </p> </li> </ul> <p>For more information about IAM ARNs, wildcards, and formats, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html">IAM Identifiers</a> in the <i>IAM User Guide</i>.</p> </note>

    Raises:
        capo_codecommit.errors.approval_rule_content_required_exception.ApprovalRuleContentRequiredException: <p>The content for the approval rule is empty. You must provide some content for an approval rule. The content cannot be null.</p>
        capo_codecommit.errors.approval_rule_does_not_exist_exception.ApprovalRuleDoesNotExistException: <p>The specified approval rule does not exist.</p>
        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_modify_approval_rule_from_template_exception.CannotModifyApprovalRuleFromTemplateException: <p>The approval rule cannot be modified for 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_content_exception.InvalidApprovalRuleContentException: <p>The content for the approval rule is not valid.</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.invalid_rule_content_sha256_exception.InvalidRuleContentSha256Exception: <p>The SHA-256 hash signature for the rule content is not valid.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codecommit.types.update_pull_request_approval_rule_content_input.UpdatePullRequestApprovalRuleContentInput]",
    ) -> AsyncOperationResponse[
        "capo_codecommit.types.update_pull_request_approval_rule_content_output.UpdatePullRequestApprovalRuleContentOutput"
    ]:
        import capo_codecommit._operations.code_commit_20150413.update_pull_request_approval_rule_content

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePullRequestApprovalRuleContent")
    )
    input_: capo_codecommit.types.update_pull_request_approval_rule_content_input.UpdatePullRequestApprovalRuleContentInput = {
        "pull_request_id": pull_request_id,
        "approval_rule_name": approval_rule_name,
        "new_rule_content": new_rule_content,
    }
    if existing_rule_content_sha256 is not None:
        input_["existing_rule_content_sha256"] = existing_rule_content_sha256

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