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.
Parameters:
-
name
(CodeReviewName)
–
The name of the code review. The name of each code review in your Amazon Web Services account must be unique.
-
repository_association_arn
(AssociationArn)
–
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.
-
type
(CodeReviewType)
–
The type of code review to create. This is specified using a CodeReviewType object. You can create a code review only of type RepositoryAnalysis.
-
client_request_token
(Optional[ClientRequestToken], default:
None
)
–
Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate code reviews if there are failures and retries.
Raises:
Source code in docs_src/capo_codeguru_reviewer/_services/async_code_guru_reviewer.py
| async def create_code_review(
self,
name: "capo_codeguru_reviewer.types.code_review_name.CodeReviewName",
repository_association_arn: "capo_codeguru_reviewer.types.association_arn.AssociationArn",
type: "capo_codeguru_reviewer.types.code_review_type.CodeReviewType",
*,
config_overrides: Optional[AsyncCodeGuruReviewerClientConfig] = None,
client_request_token: Optional[
"capo_codeguru_reviewer.types.client_request_token.ClientRequestToken"
] = None,
) -> "capo_codeguru_reviewer.types.create_code_review_response.CreateCodeReviewResponse":
"""<p>Use to create a code review with a <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReviewType.html">CodeReviewType</a> of <code>RepositoryAnalysis</code>. This type of code review analyzes all code under a specified branch in an associated repository. <code>PullRequest</code> code reviews are automatically triggered by a pull request.</p>
Args:
name: <p>The name of the code review. The name of each code review in your Amazon Web Services account must be unique.</p>
repository_association_arn: <p>The Amazon Resource Name (ARN) of the <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html">RepositoryAssociation</a> object. You can retrieve this ARN by calling <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html">ListRepositoryAssociations</a>.</p> <p>A code review can only be created on an associated repository. This is the ARN of the associated repository.</p>
type: <p>The type of code review to create. This is specified using a <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReviewType.html">CodeReviewType</a> object. You can create a code review only of type <code>RepositoryAnalysis</code>.</p>
client_request_token: <p>Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate code reviews if there are failures and retries.</p>
Raises:
capo_codeguru_reviewer.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
capo_codeguru_reviewer.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. </p>
capo_codeguru_reviewer.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
capo_codeguru_reviewer.errors.resource_not_found_exception.ResourceNotFoundException: <p> The resource specified in the request was not found. </p>
capo_codeguru_reviewer.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
capo_codeguru_reviewer.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
capo_codeguru_reviewer.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_codeguru_reviewer.types.create_code_review_request.CreateCodeReviewRequest]",
) -> AsyncOperationResponse[
"capo_codeguru_reviewer.types.create_code_review_response.CreateCodeReviewResponse"
]:
import capo_codeguru_reviewer._operations.aws_guru_frontend_service.create_code_review
(
output,
http_response,
) = await capo_codeguru_reviewer._operations.aws_guru_frontend_service.create_code_review.async_create_code_review(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateCodeReview")
)
input_: capo_codeguru_reviewer.types.create_code_review_request.CreateCodeReviewRequest = {
"name": name,
"repository_association_arn": repository_association_arn,
"type": type,
}
if client_request_token is None:
client_request_token = str(uuid.uuid4())
input_["client_request_token"] = client_request_token
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|