updatePullRequestApprovalRuleContent method
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.
May throw PullRequestDoesNotExistException. May throw InvalidPullRequestIdException. May throw PullRequestIdRequiredException. May throw PullRequestAlreadyClosedException. May throw ApprovalRuleNameRequiredException. May throw InvalidApprovalRuleNameException. May throw ApprovalRuleDoesNotExistException. May throw InvalidRuleContentSha256Exception. May throw ApprovalRuleContentRequiredException. May throw InvalidApprovalRuleContentException. May throw CannotModifyApprovalRuleFromTemplateException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.
Parameter approvalRuleName
:
The name of the approval rule you want to update.
Parameter newRuleContent
:
The updated content for the approval rule.
-
CodeCommitApprovers: This option only requires an AWS 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 AWS 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)
- Fully qualified ARN: This option allows you to specify the fully qualified Amazon Resource Name (ARN) of the IAM user or role.
Parameter pullRequestId
:
The system-generated ID of the pull request.
Parameter existingRuleContentSha256
:
The SHA-256 hash signature for the content of the approval rule. You can
retrieve this information by using GetPullRequest.
Implementation
Future<UpdatePullRequestApprovalRuleContentOutput>
updatePullRequestApprovalRuleContent({
required String approvalRuleName,
required String newRuleContent,
required String pullRequestId,
String? existingRuleContentSha256,
}) async {
ArgumentError.checkNotNull(approvalRuleName, 'approvalRuleName');
_s.validateStringLength(
'approvalRuleName',
approvalRuleName,
1,
100,
isRequired: true,
);
ArgumentError.checkNotNull(newRuleContent, 'newRuleContent');
_s.validateStringLength(
'newRuleContent',
newRuleContent,
1,
3000,
isRequired: true,
);
ArgumentError.checkNotNull(pullRequestId, 'pullRequestId');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CodeCommit_20150413.UpdatePullRequestApprovalRuleContent'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'approvalRuleName': approvalRuleName,
'newRuleContent': newRuleContent,
'pullRequestId': pullRequestId,
if (existingRuleContentSha256 != null)
'existingRuleContentSha256': existingRuleContentSha256,
},
);
return UpdatePullRequestApprovalRuleContentOutput.fromJson(
jsonResponse.body);
}