create_pull_request_approval_rule
¶
create_pull_request_approval_rule(
pull_request_id: PullRequestId,
approval_rule_name: ApprovalRuleName,
approval_rule_content: ApprovalRuleContent,
*,
config_overrides: Optional[CodeCommitClientConfig] = None,
) -> CreatePullRequestApprovalRuleOutput
Creates an approval rule for a pull request.
Parameters:
-
pull_request_id(PullRequestId) –The system-generated ID of the pull request for which you want to create the approval rule.
-
approval_rule_name(ApprovalRuleName) –The name for the approval rule.
-
approval_rule_content(ApprovalRuleContent) –The content of the approval rule, including the number of approvals needed and the structure of an approval pool defined for approvals, if any. For more information about approval pools, see the CodeCommit User Guide.
When you create 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 would be 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:
-
ApprovalRuleContentRequiredException–The content for the approval rule is empty. You must provide some content for an approval rule. The content cannot be null.
-
ApprovalRuleNameAlreadyExistsException–An approval rule with that name already exists. Approval rule names must be unique within the scope of a pull request.
-
ApprovalRuleNameRequiredException–An approval rule name is required, but was not specified.
-
EncryptionIntegrityChecksFailedException–An encryption integrity check failed.
-
EncryptionKeyAccessDeniedException–An encryption key could not be accessed.
-
EncryptionKeyDisabledException–The encryption key is disabled.
-
EncryptionKeyNotFoundException–No encryption key was found.
-
EncryptionKeyUnavailableException–The encryption key is not available.
-
InvalidApprovalRuleContentException–The content for the approval rule is not valid.
-
InvalidApprovalRuleNameException–The name for the approval rule is not valid.
-
InvalidPullRequestIdException–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.
-
NumberOfRulesExceededException–The approval rule cannot be added. The pull request has the maximum number of approval rules associated with it.
-
PullRequestAlreadyClosedException–The pull request status cannot be updated because it is already closed.
-
PullRequestDoesNotExistException–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.
-
PullRequestIdRequiredException–A pull request ID is required, but none was provided.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_codecommit/_services/code_commit.py
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 | |