Skip to content

aws.codeguru_reviewer.list_code_reviews

Example SQL Queries

SELECT * FROM
aws.codeguru_reviewer.list_code_reviews
WHERE
"type" = 'VALUE';

Description

Lists all the code reviews that the customer has created in the past 90 days.

Table Definition

Column NameColumn Data Type
type Required Input Column

The type of code reviews to list in the response.

VARCHAR
max_results Input Column

The maximum number of results that are returned per call. The default is 100.

BIGINT
next_token Input Column

Pagination token.

VARCHAR
provider_types Input Column

List of provider types for filtering that needs to be applied before displaying the result. For example, providerTypes=[GitHub] lists code reviews from GitHub.

VARCHAR[]
Show child fields
provider_types[]
repository_names Input Column

List of repository names for filtering that needs to be applied before displaying the result.

VARCHAR[]
Show child fields
repository_names[]
states Input Column

List of states for filtering that needs to be applied before displaying the result. For example, states=[Pending] lists code reviews in the Pending state.

The valid code review states are:

  • Completed: The code review is complete.

  • Pending: The code review started and has not completed or failed.

  • Failed: The code review failed.

  • Deleting: The code review is being deleted.

VARCHAR[]
Show child fields
states[]
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
code_review_summaries

A list of code reviews that meet the criteria of the request.

STRUCT(
"name" VARCHAR,
"code_review_arn" VARCHAR,
"repository_name" VARCHAR,
"owner" VARCHAR,
"provider_type" VARCHAR,
"state" VARCHAR,
"created_time_stamp" TIMESTAMP_S,
"last_updated_time_stamp" TIMESTAMP_S,
"type" VARCHAR,
"pull_request_id" VARCHAR,
"metrics_summary" STRUCT(
"metered_lines_of_code_count" BIGINT,
"suppressed_lines_of_code_count" BIGINT,
"findings_count" BIGINT
),
"source_code_type" STRUCT(
"commit_diff" STRUCT(
"source_commit" VARCHAR,
"destination_commit" VARCHAR,
"merge_base_commit" VARCHAR
),
"repository_head" STRUCT(
"branch_name" VARCHAR
),
"branch_diff" STRUCT(
"source_branch_name" VARCHAR,
"destination_branch_name" VARCHAR
),
"s3_bucket_repository" STRUCT(
"name" VARCHAR,
"details" STRUCT(
"bucket_name" VARCHAR,
"code_artifacts" STRUCT(
"source_code_artifacts_object_key" VARCHAR,
"build_artifacts_object_key" VARCHAR
)
)
),
"request_metadata" STRUCT(
"request_id" VARCHAR,
"requester" VARCHAR,
"event_info" STRUCT(
"name" VARCHAR,
"state" VARCHAR
),
"vendor_name" VARCHAR
)
)
)[]
Show child fields
code_review_summaries[]
Show child fields
code_review_summaries[].code_review_arn

The Amazon Resource Name (ARN) of the CodeReview object.

code_review_summaries[].created_time_stamp

The time, in milliseconds since the epoch, when the code review was created.

code_review_summaries[].last_updated_time_stamp

The time, in milliseconds since the epoch, when the code review was last updated.

code_review_summaries[].metrics_summary

The statistics from the code review.

Show child fields
code_review_summaries[].metrics_summary.findings_count

Total number of recommendations found in the code review.

code_review_summaries[].metrics_summary.metered_lines_of_code_count

Lines of code metered in the code review. For the initial code review pull request and all subsequent revisions, this includes all lines of code in the files added to the pull request. In subsequent revisions, for files that already existed in the pull request, this includes only the changed lines of code. In both cases, this does not include non-code lines such as comments and import statements. For example, if you submit a pull request containing 5 files, each with 500 lines of code, and in a subsequent revision you added a new file with 200 lines of code, and also modified a total of 25 lines across the initial 5 files, MeteredLinesOfCodeCount includes the first 5 files (5 * 500 = 2,500 lines), the new file (200 lines) and the 25 changed lines of code for a total of 2,725 lines of code.

code_review_summaries[].metrics_summary.suppressed_lines_of_code_count

Lines of code suppressed in the code review based on the excludeFiles element in the aws-codeguru-reviewer.yml file. For full repository analyses, this number includes all lines of code in the files that are suppressed. For pull requests, this number only includes the changed lines of code that are suppressed. In both cases, this number does not include non-code lines such as comments and import statements. For example, if you initiate a full repository analysis on a repository containing 5 files, each file with 100 lines of code, and 2 files are listed as excluded in the aws-codeguru-reviewer.yml file, then SuppressedLinesOfCodeCount returns 200 (2 * 100) as the total number of lines of code suppressed. However, if you submit a pull request for the same repository, then SuppressedLinesOfCodeCount only includes the lines in the 2 files that changed. If only 1 of the 2 files changed in the pull request, then SuppressedLinesOfCodeCount returns 100 (1 * 100) as the total number of lines of code suppressed.

code_review_summaries[].name

The name of the code review.

code_review_summaries[].owner

The owner of the repository. For an Amazon Web Services CodeCommit repository, this is the Amazon Web Services account ID of the account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository. For an S3 repository, it can be the username or Amazon Web Services account ID.

code_review_summaries[].provider_type

The provider type of the repository association.

code_review_summaries[].pull_request_id

The pull request ID for the code review.

code_review_summaries[].repository_name

The name of the repository.

code_review_summaries[].source_code_type

Specifies the source code that is analyzed in a code review.

Show child fields
code_review_summaries[].source_code_type.branch_diff

A type of SourceCodeType that specifies a source branch name and a destination branch name in an associated repository.

Show child fields
code_review_summaries[].source_code_type.branch_diff.destination_branch_name

The destination branch for a diff in an associated repository.

code_review_summaries[].source_code_type.branch_diff.source_branch_name

The source branch for a diff in an associated repository.

code_review_summaries[].source_code_type.commit_diff

A SourceCodeType that specifies a commit diff created by a pull request on an associated repository.

Show child fields
code_review_summaries[].source_code_type.commit_diff.destination_commit

The SHA of the destination commit used to generate a commit diff. This field is required for a pull request code review.

code_review_summaries[].source_code_type.commit_diff.merge_base_commit

The SHA of the merge base of a commit.

code_review_summaries[].source_code_type.commit_diff.source_commit

The SHA of the source commit used to generate a commit diff. This field is required for a pull request code review.

code_review_summaries[].source_code_type.repository_head

A SourceCodeType that specifies the tip of a branch in an associated repository.

Show child fields
code_review_summaries[].source_code_type.repository_head.branch_name

The name of the branch in an associated repository. The RepositoryHeadSourceCodeType specifies the tip of this branch.

code_review_summaries[].source_code_type.request_metadata

Metadata that is associated with a code review. This applies to any type of code review supported by CodeGuru Reviewer. The RequestMetadaa field captures any event metadata. For example, it might capture metadata associated with an event trigger, such as a push or a pull request.

Show child fields
code_review_summaries[].source_code_type.request_metadata.event_info

Information about the event associated with a code review.

Show child fields
code_review_summaries[].source_code_type.request_metadata.event_info.name

The name of the event. The possible names are pull_request, workflow_dispatch, schedule, and push

code_review_summaries[].source_code_type.request_metadata.event_info.state

The state of an event. The state might be open, closed, or another state.

code_review_summaries[].source_code_type.request_metadata.request_id

The ID of the request. This is required for a pull request code review.

code_review_summaries[].source_code_type.request_metadata.requester

An identifier, such as a name or account ID, that is associated with the requester. The Requester is used to capture the author/actor name of the event request.

code_review_summaries[].source_code_type.request_metadata.vendor_name

The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For example, if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts from a GitHub repository, then the repository association's ProviderType is S3Bucket and the CI/CD repository vendor name is GitHub. For more information, see the definition for ProviderType in RepositoryAssociation.

code_review_summaries[].source_code_type.s3_bucket_repository

Information about an associated repository in an S3 bucket that includes its name and an S3RepositoryDetails object. The S3RepositoryDetails object includes the name of an S3 bucket, an S3 key for a source code .zip file, and an S3 key for a build artifacts .zip file. S3BucketRepository is required in SourceCodeType for S3BucketRepository based code reviews.

Show child fields
code_review_summaries[].source_code_type.s3_bucket_repository.details

An S3RepositoryDetails object that specifies the name of an S3 bucket and a CodeArtifacts object. The CodeArtifacts object includes the S3 object keys for a source code .zip file and for a build artifacts .zip file.

Show child fields
code_review_summaries[].source_code_type.s3_bucket_repository.details.bucket_name

The name of the S3 bucket used for associating a new S3 repository. It must begin with codeguru-reviewer-.

code_review_summaries[].source_code_type.s3_bucket_repository.details.code_artifacts

A CodeArtifacts object. The CodeArtifacts object includes the S3 object key for a source code .zip file and for a build artifacts .zip file that contains .jar or .class files.

Show child fields
code_review_summaries[].source_code_type.s3_bucket_repository.details.code_artifacts.build_artifacts_object_key

The S3 object key for a build artifacts .zip file that contains .jar or .class files. This is required for a code review with security analysis. For more information, see Create code reviews with GitHub Actions in the Amazon CodeGuru Reviewer User Guide.

code_review_summaries[].source_code_type.s3_bucket_repository.details.code_artifacts.source_code_artifacts_object_key

The S3 object key for a source code .zip file. This is required for all code reviews.

code_review_summaries[].source_code_type.s3_bucket_repository.name

The name of the repository when the ProviderType is S3Bucket.

code_review_summaries[].state

The state of the code review.

The valid code review states are:

  • Completed: The code review is complete.

  • Pending: The code review started and has not completed or failed.

  • Failed: The code review failed.

  • Deleting: The code review is being deleted.

code_review_summaries[].type

The type of the code review.