createPullRequestApprovalRule method
Creates an approval rule for a pull request.
May throw ApprovalRuleContentRequiredException.
May throw ApprovalRuleNameAlreadyExistsException.
May throw ApprovalRuleNameRequiredException.
May throw EncryptionIntegrityChecksFailedException.
May throw EncryptionKeyAccessDeniedException.
May throw EncryptionKeyDisabledException.
May throw EncryptionKeyNotFoundException.
May throw EncryptionKeyUnavailableException.
May throw InvalidApprovalRuleContentException.
May throw InvalidApprovalRuleNameException.
May throw InvalidPullRequestIdException.
May throw NumberOfRulesExceededException.
May throw PullRequestAlreadyClosedException.
May throw PullRequestDoesNotExistException.
May throw PullRequestIdRequiredException.
Parameter 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.
-
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)
- Fully qualified ARN: This option allows you to specify the fully qualified Amazon Resource Name (ARN) of the IAM user or role.
Parameter approvalRuleName :
The name for the approval rule.
Parameter pullRequestId :
The system-generated ID of the pull request for which you want to create
the approval rule.
Implementation
Future<CreatePullRequestApprovalRuleOutput> createPullRequestApprovalRule({
required String approvalRuleContent,
required String approvalRuleName,
required String pullRequestId,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CodeCommit_20150413.CreatePullRequestApprovalRule'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'approvalRuleContent': approvalRuleContent,
'approvalRuleName': approvalRuleName,
'pullRequestId': pullRequestId,
},
);
return CreatePullRequestApprovalRuleOutput.fromJson(jsonResponse.body);
}