createCodeReview method
- required String name,
- required String repositoryAssociationArn,
- required CodeReviewType type,
- String? clientRequestToken,
Use to create a code review with a
CodeReviewType
of RepositoryAnalysis
. This
type of code review analyzes all code under a specified branch in an
associated repository. PullRequest
code reviews are
automatically triggered by a pull request so cannot be created using this
method.
May throw ResourceNotFoundException. May throw InternalServerException. May throw ValidationException. May throw ConflictException. May throw AccessDeniedException. May throw ThrottlingException.
Parameter name
:
The name of the code review. The name of each code review in your AWS
account must be unique.
Parameter repositoryAssociationArn
:
The Amazon Resource Name (ARN) of the
RepositoryAssociation
object. You can retrieve this ARN
by calling
ListRepositoryAssociations
.
A code review can only be created on an associated repository. This is the ARN of the associated repository.
Parameter type
:
The type of code review to create. This is specified using a
CodeReviewType
object. You can create a code review only
of type RepositoryAnalysis
.
Parameter clientRequestToken
:
Amazon CodeGuru Reviewer uses this value to prevent the accidental
creation of duplicate code reviews if there are failures and retries.
Implementation
Future<CreateCodeReviewResponse> createCodeReview({
required String name,
required String repositoryAssociationArn,
required CodeReviewType type,
String? clientRequestToken,
}) async {
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
100,
isRequired: true,
);
ArgumentError.checkNotNull(
repositoryAssociationArn, 'repositoryAssociationArn');
_s.validateStringLength(
'repositoryAssociationArn',
repositoryAssociationArn,
1,
1600,
isRequired: true,
);
ArgumentError.checkNotNull(type, 'type');
_s.validateStringLength(
'clientRequestToken',
clientRequestToken,
1,
64,
);
final $payload = <String, dynamic>{
'Name': name,
'RepositoryAssociationArn': repositoryAssociationArn,
'Type': type,
'ClientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/codereviews',
exceptionFnMap: _exceptionFns,
);
return CreateCodeReviewResponse.fromJson(response);
}