CodeGuru Reviewer examples using AWS CLI - AWS Command Line Interface

CodeGuru Reviewer examples using AWS CLI

다음 코드 예제에서는 CodeGuru Reviewer에서 AWS Command Line Interface를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여 줍니다.

작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 관련 시나리오의 컨텍스트에 따라 표시되며, 개별 서비스 함수를 직접적으로 호출하는 방법을 보여줍니다.

각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.

주제

작업

다음 코드 예시에서는 associate-repository을 사용하는 방법을 보여 줍니다.

AWS CLI

예제 1: Bitbucket 리포지토리 연결을 만드는 방법

다음 associate-repository 예제에서는 기존 Bitbucket 리포지토리를 사용하여 리포지토리 연결을 생성합니다.

aws codeguru-reviewer associate-repository \ --repository 'Bitbucket={Owner=sample-owner, Name=mySampleRepo, ConnectionArn=arn:aws:codestar-connections:us-west-2:123456789012:connection/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 }'

출력:

{ "RepositoryAssociation": { "ProviderType": "Bitbucket", "Name": "mySampleRepo", "LastUpdatedTimeStamp": 1596216896.979, "AssociationId": "association:a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "CreatedTimeStamp": 1596216896.979, "ConnectionArn": "arn:aws:codestar-connections:us-west-2:123456789012:connection/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "State": "Associating", "StateReason": "Pending Repository Association", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "Owner": "sample-owner" } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 Amazon CodeGuru Reviewer에서 Bitbucket 리포지토리 연결 생성을 참조하세요.

예제 2: GitHub Enterprise 리포지토리 연결을 만드는 방법

다음 associate-repository 예제에서는 기존 GitHub Enterprise 리포지토리를 사용하여 리포지토리 연결을 생성합니다.

aws codeguru-reviewer associate-repository \ --repository 'GitHubEnterpriseServer={Owner=sample-owner, Name=mySampleRepo, ConnectionArn=arn:aws:codestar-connections:us-west-2:123456789012:connection/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 }'

출력:

{ "RepositoryAssociation": { "ProviderType": "GitHubEnterpriseServer", "Name": "mySampleRepo", "LastUpdatedTimeStamp": 1596216896.979, "AssociationId": "association:a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "CreatedTimeStamp": 1596216896.979, "ConnectionArn": "arn:aws:codestar-connections:us-west-2:123456789012:connection/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "State": "Associating", "StateReason": "Pending Repository Association", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "Owner": "sample-owner" } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 Amazon CodeGuru Reviewer에서 GitHub Enterprise Server 리포지토리 연결 생성을 참조하세요.

예제 3: AWS CodeCommit 리포지토리 연결을 생성하는 방법

다음 associate-repository 예제에서는 기존 AWS CodeCommit 리포지토리를 사용하여 리포지토리 연결을 생성합니다.

aws codeguru-reviewer associate-repository \ --repository CodeCommit={Name=mySampleRepo}

출력:

{ "RepositoryAssociation": { "AssociationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Name": "My-ecs-beta-repo", "LastUpdatedTimeStamp": 1595634764.029, "ProviderType": "CodeCommit", "CreatedTimeStamp": 1595634764.029, "Owner": "544120495673", "State": "Associating", "StateReason": "Pending Repository Association", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:544120495673:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 Amazon CodeGuru Reviewer에서 AWS CodeCommit 리포지토리 연결 생성을 참조하세요.

다음 코드 예시에서는 create-code-review을 사용하는 방법을 보여 줍니다.

AWS CLI

코드 검토를 생성하는 방법

다음 create-code-review 코드는 이름이 my-repository-name인 AWS CodeCommit 리포지토리의 mainline 브랜치에 코드 검토를 생성합니다.

aws codeguru-reviewer create-code-review \ --name my-code-review \ --repository-association-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \ --type '{"RepositoryAnalysis": {"RepositoryHead": {"BranchName": "mainline"}}}'

출력:

{ "CodeReview": { "Name": "my-code-review", "CodeReviewArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE22222:code-review:RepositoryAnalysis-my-code-review", "RepositoryName": "my-repository-name", "Owner": "123456789012", "ProviderType": "CodeCommit", "State": "Pending", "StateReason": "CodeGuru Reviewer has received the request, and a code review is scheduled.", "CreatedTimeStamp": 1618873489.195, "LastUpdatedTimeStamp": 1618873489.195, "Type": "RepositoryAnalysis", "SourceCodeType": { "RepositoryHead": { "BranchName": "mainline" } }, "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 Amazon CodeGuru Reviewer에서 코드 검토 생성을 참조하세요.

  • API 세부 정보는 AWS CLI 명령 참조의 CreateCodeReview 섹션을 참조하세요.

다음 코드 예시에서는 describe-code-review을 사용하는 방법을 보여 줍니다.

AWS CLI

코드 검토에 대한 세부 정보를 나열합니다.

다음 describe-code-review 코드는 'my-repo-name'이라는 이름이 붙은 AWS CodeCommit 리포지토리의 'mainline' 브랜치의 코드 검토에 대한 정보를 나열합니다.

aws codeguru-reviewer put-recommendation-feedback \ --code-review-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:code-review:RepositoryAnalysis-my-repository-name-branch-abcdefgh12345678 \ --recommendation-id 3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390eb \ --reactions ThumbsUp

출력

{ "CodeReview": { "Name": "My-ecs-beta-repo-master-xs6di4kfd4j269dz", "CodeReviewArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE22222:code-review:RepositoryAnalysis-my-repo-name", "RepositoryName": "My-ecs-beta-repo", "Owner": "123456789012", "ProviderType": "CodeCommit", "State": "Pending", "StateReason": "CodeGuru Reviewer is reviewing the source code.", "CreatedTimeStamp": 1618874226.226, "LastUpdatedTimeStamp": 1618874233.689, "Type": "RepositoryAnalysis", "SourceCodeType": { "RepositoryHead": { "BranchName": "mainline" } }, "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 코드 검토 세부 정보 보기를 참조하세요.

  • API 세부 정보는 AWS CLI 명령 참조의 DescribeCodeReview 섹션을 참조하세요.

다음 코드 예시에서는 describe-recommendation-feedback을 사용하는 방법을 보여 줍니다.

AWS CLI

권장 사항에 대한 피드백 정보를 보는 방법

다음 describe-recommendation-feedback 코드는 권장 사항에 대한 피드백에 대한 정보를 표시합니다. 이 권장 사항에는 한 가지 ThumbsUp 반응이 있습니다.

aws codeguru-reviewer describe-recommendation-feedback \ --code-review-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:code-review:RepositoryAnalysis-my-repository-name-branch-abcdefgh12345678 \ --recommendation-id 3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390eb

출력:

{ "RecommendationFeedback": { "CodeReviewArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:code-review:RepositoryAnalysis-my-repository-name-branch-abcdefgh12345678", "RecommendationId": "3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390eb", "Reactions": [ "ThumbsUp" ], "UserId": "aws-user-id", "CreatedTimeStamp": 1618877070.313, "LastUpdatedTimeStamp": 1618877948.881 } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 권장 사항 보기 및 피드백 제공4단계: 피드백 제공을 참조하세요.

다음 코드 예시에서는 describe-repository-association을 사용하는 방법을 보여 줍니다.

AWS CLI

예제 1: GitHub 리포지토리 연결에 대한 정보를 반환하는 방법

다음 describe-repository-association 예제에서는 GitHub Enterprise 리포지토리를 사용하고 Associated 상태에 있는 리포지토리 연결에 대한 정보를 반환합니다.

aws codeguru-reviewer describe-repository-association \ --association-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111

출력:

{ "RepositoryAssociation": { "AssociationId": "b822717e-0711-4e8a-bada-0e738289c75e", "Name": "mySampleRepo", "LastUpdatedTimeStamp": 1588102637.649, "ProviderType": "GitHub", "CreatedTimeStamp": 1588102615.636, "Owner": "sample-owner", "State": "Associated", "StateReason": "Pull Request Notification configuration successful", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 Amazon CodeGuru Reviewer에서 GitHub Enterprise Server 리포지토리 연결 생성을 참조하세요.

예제 2: 실패한 리포지토리 연결에 대한 정보를 반환하는 방법

다음 describe-repository-association 예제에서는 GitHub Enterprise 리포지토리를 사용하고 Failed 상태에 있는 리포지토리 연결에 대한 정보를 반환합니다.

aws codeguru-reviewer describe-repository-association \ --association-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111

출력:

{ "RepositoryAssociation": { "ProviderType": "GitHubEnterpriseServer", "Name": "mySampleRepo", "LastUpdatedTimeStamp": 1596217036.892, "AssociationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "CreatedTimeStamp": 1596216896.979, "ConnectionArn": "arn:aws:codestar-connections:us-west-2:123456789012:connection/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "State": "Failed", "StateReason": "Failed, Please retry.", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "Owner": "sample-owner" } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 Amazon CodeGuru Reviewer에서 GitHub Enterprise Server 리포지토리 연결 생성을 참조하세요.

예제 3: 연결 해제 리포지토리 연결에 대한 정보를 반환하는 방법

다음 describe-repository-association 예제에서는 GitHub Enterprise 리포지토리를 사용하고 Disassociating 상태에 있는 리포지토리 연결에 대한 정보를 반환합니다.

aws codeguru-reviewer describe-repository-association \ --association-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111

출력:

{ "RepositoryAssociation": { "ProviderType": "GitHubEnterpriseServer", "Name": "mySampleRepo", "LastUpdatedTimeStamp": 1596217036.892, "AssociationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "CreatedTimeStamp": 1596216896.979, "ConnectionArn": "arn:aws:codestar-connections:us-west-2:123456789012:connection/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "State": "Disassociating", "StateReason": "Source code access removal in progress", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "Owner": "sample-owner" } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 Amazon CodeGuru Reviewer에서 GitHub Enterprise Server 리포지토리 연결 생성을 참조하세요.

다음 코드 예시에서는 disassociate-repository을 사용하는 방법을 보여 줍니다.

AWS CLI

리포지토리 연결을 해제하는 방법

다음 disassociate-repository는 AWS CodeCommit 리포지토리를 사용하는 리포지토리 연결을 해제합니다.

aws codeguru-reviewer disassociate-repository \ --association-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111

출력:

{ "RepositoryAssociation": { "AssociationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Name": "my-repository", "Owner": "123456789012", "ProviderType": "CodeCommit", "State": "Disassociating", "LastUpdatedTimeStamp": 1618939174.759, "CreatedTimeStamp": 1595636947.096 }, "Tags": { "Status": "Secret", "Team": "Saanvi" } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 CodeGuru Reviewer에서 리포지토리 연결 해제를 참조하세요.

다음 코드 예시에서는 list-code-reviews을 사용하는 방법을 보여 줍니다.

AWS CLI

지난 90일 동안 AWS 계정에 생성된 코드 검토를 나열하는 방법.

다음 list-code-reviews 예제에서는 풀 요청을 사용하여 지난 90일 동안 생성된 코드 검토를 나열합니다.

aws codeguru-reviewer list-code-reviews \ --type PullRequest

출력:

{ "CodeReviewSummaries": [ { "LastUpdatedTimeStamp": 1588897288.054, "Name": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ProviderType": "GitHub", "PullRequestId": "5", "MetricsSummary": { "MeteredLinesOfCodeCount": 24, "FindingsCount": 1 }, "CreatedTimeStamp": 1588897068.512, "State": "Completed", "CodeReviewArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:code-review:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Owner": "sample-owner", "RepositoryName": "sample-repository-name", "Type": "PullRequest" }, { "LastUpdatedTimeStamp": 1588869793.263, "Name": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "ProviderType": "GitHub", "PullRequestId": "4", "MetricsSummary": { "MeteredLinesOfCodeCount": 29, "FindingsCount": 0 }, "CreatedTimeStamp": 1588869575.949, "State": "Completed", "CodeReviewArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:code-review:a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "Owner": "sample-owner", "RepositoryName": "sample-repository-name", "Type": "PullRequest" }, { "LastUpdatedTimeStamp": 1588870511.211, "Name": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "ProviderType": "GitHub", "PullRequestId": "4", "MetricsSummary": { "MeteredLinesOfCodeCount": 2, "FindingsCount": 0 }, "CreatedTimeStamp": 1588870292.425, "State": "Completed", "CodeReviewArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:code-review:a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "Owner": "sample-owner", "RepositoryName": "sample-repository-name", "Type": "PullRequest" }, { "LastUpdatedTimeStamp": 1588118522.452, "Name": "a1b2c3d4-5678-90ab-cdef-EXAMPLE44444", "ProviderType": "GitHub", "PullRequestId": "3", "MetricsSummary": { "MeteredLinesOfCodeCount": 29, "FindingsCount": 0 }, "CreatedTimeStamp": 1588118301.131, "State": "Completed", "CodeReviewArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:code-review:a1b2c3d4-5678-90ab-cdef-EXAMPLE44444", "Owner": "sample-owner", "RepositoryName": "sample-repository-name", "Type": "PullRequest" }, { "LastUpdatedTimeStamp": 1588112205.207, "Name": "a1b2c3d4-5678-90ab-cdef-EXAMPLE55555", "ProviderType": "GitHub", "PullRequestId": "2", "MetricsSummary": { "MeteredLinesOfCodeCount": 25, "FindingsCount": 0 }, "CreatedTimeStamp": 1588111987.443, "State": "Completed", "CodeReviewArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:code-review:a1b2c3d4-5678-90ab-cdef-EXAMPLE55555", "Owner": "sample-owner", "RepositoryName": "sample-repository-name", "Type": "PullRequest" }, { "LastUpdatedTimeStamp": 1588104489.981, "Name": "a1b2c3d4-5678-90ab-cdef-EXAMPLE66666", "ProviderType": "GitHub", "PullRequestId": "1", "MetricsSummary": { "MeteredLinesOfCodeCount": 25, "FindingsCount": 0 }, "CreatedTimeStamp": 1588104270.223, "State": "Completed", "CodeReviewArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:code-review:a1b2c3d4-5678-90ab-cdef-EXAMPLE66666", "Owner": "sample-owner", "RepositoryName": "sample-repository-name", "Type": "PullRequest" } ] }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 모든 코드 검토 보기를 참조하세요.

  • API 세부 정보는 AWS CLI 명령 참조의 ListCodeReviews 섹션 섹션을 참조하세요.

다음 코드 예시에서는 list-recommendation-feedback을 사용하는 방법을 보여 줍니다.

AWS CLI

연결된 리포지토리의 권장 사항에 대한 고객 권장 사항 피드백을 나열하는 방법

다음 list-recommendation-feedback 코드는 코드 검토에 대한 모든 권장 사항에 대한 고객 피드백을 나열합니다. 이 코드 검토에는 고객의 피드백인 “ThumbsUp”이 있습니다.

aws codeguru-reviewer list-recommendation-feedback \ --code-review-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:code-review:RepositoryAnalysis-my-repository-name-branch-abcdefgh12345678

출력:

{ "RecommendationFeedbackSummaries": [ { "RecommendationId": "3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390eb", "Reactions": [ "ThumbsUp" ], "UserId": "aws-user-id" } ] }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 4단계: 피드백 제공을 참조하세요.

다음 코드 예시에서는 list-recommendations을 사용하는 방법을 보여 줍니다.

AWS CLI

완료된 코드 검토에 대한 권장 사항을 나열하는 방법

다음 list-recommendations 예제에서는 완료된 코드 검토에 대한 권장 사항을 나열합니다. 이 코드 검토에는 한 가지 권장 사항이 있습니다.

aws codeguru-reviewer list-recommendations \ --code-review-arn arn:aws:codeguru-reviewer:us-west-2:544120495673:code-review:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111

출력:

{ "RecommendationSummaries": [ { "Description": "\n\n**Problem** \n You are using a `ConcurrentHashMap`, but your usage of `containsKey()` and `get()` may not be thread-safe at lines: **63 and 64**. In between the check and the `get()` another thread can remove the key and the `get()` will return `null`. The remove that can remove the key is at line: **59**.\n\n**Fix** \n Consider calling `get()`, checking instead of your current check if the returned object is `null`, and then using that object only, without calling `get()` again.\n\n**More info** \n [View an example on GitHub](https://github.com/apache/hadoop/blob/f16cf877e565084c66bc63605659b157c4394dc8/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3Guard.java#L302-L304) (external link).", "RecommendationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "StartLine": 63, "EndLine": 64, "FilePath": "src/main/java/com/company/sample/application/CreateOrderThread.java" } ] }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 4단계: 피드백 제공을 참조하세요.

다음 코드 예시에서는 list-repository-associations을 사용하는 방법을 보여 줍니다.

AWS CLI

AWS 계정의 리포지토리 연결을 나열하는 방법

다음 list-repository-associations 예제에서는 계정의 리포지토리 연결 요약 객체 목록을 반환합니다. ProviderType, Name, StateOwner를 기준으로 반환된 목록을 필터링할 수 있습니다.

aws codeguru-reviewer list-repository-associations

출력:

{ "RepositoryAssociationSummaries": [ { "LastUpdatedTimeStamp": 1595886609.616, "Name": "test", "AssociationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Owner": "sample-owner", "State": "Associated", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ProviderType": "Bitbucket" }, { "LastUpdatedTimeStamp": 1595636969.035, "Name": "CodeDeploy-CodePipeline-ECS-Tutorial", "AssociationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "Owner": "123456789012", "State": "Associated", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "ProviderType": "CodeCommit" }, { "LastUpdatedTimeStamp": 1595634785.983, "Name": "My-ecs-beta-repo", "AssociationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "Owner": "123456789012", "State": "Associated", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "ProviderType": "CodeCommit" }, { "LastUpdatedTimeStamp": 1590712811.77, "Name": "MyTestCodeCommit", "AssociationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE44444", "Owner": "123456789012", "State": "Associated", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE44444", "ProviderType": "CodeCommit" }, { "LastUpdatedTimeStamp": 1588102637.649, "Name": "aws-codeguru-profiler-sample-application", "AssociationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE55555", "Owner": "sample-owner", "State": "Associated", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE55555", "ProviderType": "GitHub" }, { "LastUpdatedTimeStamp": 1588028233.995, "Name": "codeguru-profiler-demo-app", "AssociationId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE66666", "Owner": "sample-owner", "State": "Associated", "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE66666", "ProviderType": "GitHub" } ] }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 CodeGuru Reviewer에서 모든 리포지토리 연결 보기를 참조하세요.

다음 코드 예시에서는 list-tags-for-resource을 사용하는 방법을 보여 줍니다.

AWS CLI

연결된 리포지토리의 태그를 나열하는 방법

다음 list-tags-for-resource 코드는 리포지토리와 연결된 태그를 나열합니다. 이 연결된 리포지토리에는 두 개의 태그가 있습니다.

aws codeguru-reviewer list-tags-for-resource \ --resource-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111

출력:

{ "Tags": { "Status": "Secret", "Team": "Saanvi" } }

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 CodeGuru Reviewer와 연결된 리포지토리에 대한 태그 보기(AWS CLI)를 참조하세요.

다음 코드 예시에서는 put-recommendation-feedback을 사용하는 방법을 보여 줍니다.

AWS CLI

코드 검토에 권장 사항을 추가하는 방법

다음 put-recommendation-feedback 코드는 코드 검토에 ThumbsUp 권장 사항을 표시합니다.

aws codeguru-reviewer put-recommendation-feedback \ --code-review-arn \arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:code-review:RepositoryAnalysis-my-repository-name-branch-abcdefgh12345678 \ --recommendation-id 3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390eb \ --reactions ThumbsUp

이 명령은 출력을 생성하지 않습니다.

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 4단계: 피드백 제공을 참조하세요.

다음 코드 예시에서는 tag-resource을 사용하는 방법을 보여 줍니다.

AWS CLI

연결된 리포지토리에 태그를 추가하는 방법

다음 tag-resource 코드는 연결된 리포지토리에 두 개의 태그를 추가합니다.

aws codeguru-reviewer tag-resource \ --resource-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \ --tags Status=Secret,Team=Saanvi

이 명령은 출력을 생성하지 않습니다.

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 CodeGuru Reviewer 연결 리포지토리에 태그 추가(AWS CLI)CodeGuru Reviewer 연결 리포지토리에 대한 태그 추가 또는 업데이트(AWS CLI)를 참조하세요.

  • API 세부 정보는 AWS CLI 명령 참조TagResource를 참조하세요.

다음 코드 예시에서는 untag-resource을 사용하는 방법을 보여 줍니다.

AWS CLI

연결된 리포지토리의 태그를 해제하는 방법

다음 untag-resource 코드는 연결된 리포지토리에서 'Secret' 및 'Team' 키가 있는 태그 2개를 제거합니다.

aws codeguru-reviewer untag-resource \ --resource-arn arn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \ --tag-keys Status Team

이 명령은 출력을 생성하지 않습니다.

자세한 내용은 Amazon CodeGuru Reviewer 사용 설명서의 CodeGuru Reviewer와 연결된 리포지토리에서 태그 제거(AWS CLI)를 참조하세요.

  • API 세부 정보는 AWS CLI 명령 참조UntagResource를 참조하세요.