createCodeReview method

Future<CreateCodeReviewResponse> createCodeReview({
  1. required String name,
  2. required String repositoryAssociationArn,
  3. required CodeReviewType type,
  4. 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.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter name : The name of the code review. The name of each code review in your Amazon Web Services 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 {
  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);
}