Skip to content

update_approval_rule_template_content

update_approval_rule_template_content(
    approval_rule_template_name: ApprovalRuleTemplateName,
    new_rule_content: ApprovalRuleTemplateContent,
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
    existing_rule_content_sha256: Optional[RuleContentSha256] = None,
) -> UpdateApprovalRuleTemplateContentOutput

Updates the content of an approval rule template. You can change the number of required approvals, the membership of the approval rule, and whether an approval pool is defined.

Parameters:

  • approval_rule_template_name (ApprovalRuleTemplateName) –

    The name of the approval rule template where you want to update the content of the rule.

  • new_rule_content (ApprovalRuleTemplateContent) –

    The content that replaces the existing content of the rule. Content statements must be complete. You cannot provide only the changes.

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

Raises:

Source code in docs_src/capo_codecommit/_services/code_commit.py
def update_approval_rule_template_content(
    self,
    approval_rule_template_name: "capo_codecommit.types.approval_rule_template_name.ApprovalRuleTemplateName",
    new_rule_content: "capo_codecommit.types.approval_rule_template_content.ApprovalRuleTemplateContent",
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
    existing_rule_content_sha256: Optional[
        "capo_codecommit.types.rule_content_sha256.RuleContentSha256"
    ] = None,
) -> "capo_codecommit.types.update_approval_rule_template_content_output.UpdateApprovalRuleTemplateContentOutput":
    """<p>Updates the content of an approval rule template. You can change the number of required approvals, the membership of the approval rule, and whether an approval pool is defined.</p>

    Args:
        approval_rule_template_name: <p>The name of the approval rule template where you want to update the content of the rule. </p>
        new_rule_content: <p>The content that replaces the existing content of the rule. Content statements must be complete. You cannot provide only the changes.</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>

    Raises:
        capo_codecommit.errors.approval_rule_template_content_required_exception.ApprovalRuleTemplateContentRequiredException: <p>The content for the approval rule template is empty. You must provide some content for an approval rule template. The content cannot be null.</p>
        capo_codecommit.errors.approval_rule_template_does_not_exist_exception.ApprovalRuleTemplateDoesNotExistException: <p>The specified approval rule template does not exist. Verify that the name is correct and that you are signed in to the Amazon Web Services Region where the template was created, and then try again.</p>
        capo_codecommit.errors.approval_rule_template_name_required_exception.ApprovalRuleTemplateNameRequiredException: <p>An approval rule template name is required, but was not specified.</p>
        capo_codecommit.errors.invalid_approval_rule_template_content_exception.InvalidApprovalRuleTemplateContentException: <p>The content of the approval rule template is not valid.</p>
        capo_codecommit.errors.invalid_approval_rule_template_name_exception.InvalidApprovalRuleTemplateNameException: <p>The name of the approval rule template is not valid. Template names must be between 1 and 100 valid characters in length. For more information about limits in CodeCommit, see <a href="https://docs.aws.amazon.com/codecommit/latest/userguide/limits.html">Quotas</a> in the <i>CodeCommit User Guide</i>.</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.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codecommit.types.update_approval_rule_template_content_input.UpdateApprovalRuleTemplateContentInput]",
    ) -> OperationResponse[
        "capo_codecommit.types.update_approval_rule_template_content_output.UpdateApprovalRuleTemplateContentOutput"
    ]:
        import capo_codecommit._operations.code_commit_20150413.update_approval_rule_template_content

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateApprovalRuleTemplateContent")
    )
    input_: capo_codecommit.types.update_approval_rule_template_content_input.UpdateApprovalRuleTemplateContentInput = {
        "approval_rule_template_name": approval_rule_template_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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output