CodeGuru 使用审阅者示例 Amazon CLI - Amazon Command Line Interface
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

CodeGuru 使用审阅者示例 Amazon CLI

以下代码示例向您展示了如何使用 with CodeGuru Reviewer 来执行操作和实现常见场景。 Amazon Command Line Interface

操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景和跨服务示例的上下文查看操作。

场景是展示如何通过在同一服务中调用多个函数来完成特定任务任务的代码示例。

每个示例都包含一个指向的链接 GitHub,您可以在其中找到有关如何在上下文中设置和运行代码的说明。

主题

操作

以下代码示例演示如何使用 associate-repository

Amazon 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 Reviewer 用户指南中的在 Amazon CodeGuru Reviewer 中创建 Bitbucket 存储库关联。 CodeGuru

示例 2:创建 GitHub 企业存储库关联

以下associate-repository示例使用现有的 GitHub 企业存储库创建存储库关联。

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 企业服务器存储库关联

示例 3:创建 Amazon CodeCommit 存储库关联

以下associate-repository示例使用现有存储库创建存储 Amazon 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 Reviewer 用户指南中的在 Amazon CodeGuru Reviewer 中创建 Amazon CodeCommit 存储库关联。 CodeGuru

以下代码示例演示如何使用 create-code-review

Amazon CLI

创建代码审查。

以下内容create-code-review创建了对名为的 Amazon CodeCommit 存储库mainline分支中的代码的审查my-repository-name

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 Reviewer 用户指南中的在 Amazon CodeGuru Rev CodeGuru iewer 中创建代码审查

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考CreateCodeReview中的。

以下代码示例演示如何使用 describe-code-review

Amazon CLI

列出有关代码审查的详细信息。

下面describe-code-review列出了有关审查名为 “” 的 Amazon CodeCommit 存储库 “主线” 分支中的代码的信息。my-repo-name

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 的详细信息,请参阅Amazon CLI 命令参考DescribeCodeReview中的。

以下代码示例演示如何使用 describe-recommendation-feedback

Amazon 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

Amazon CLI

示例 1:返回有关 GitHub 存储库关联的信息

以下describe-repository-association示例返回有关使用 GitHub 企业存储库且处于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 Reviewer 用户指南中的在 Amazon CodeGuru Reviewer 中创建 GitHub 企业服务器存储库关联。 CodeGuru

示例 2:返回有关存储库关联失败的信息

以下describe-repository-association示例返回有关使用 GitHub 企业存储库且处于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 Reviewer 用户指南中的在 Amazon CodeGuru Reviewer 中创建 GitHub 企业服务器存储库关联。 CodeGuru

示例 3:返回有关正在取消关联的存储库关联的信息

以下describe-repository-association示例返回有关使用 GitHub 企业存储库且处于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 Reviewer 用户指南中的在 Amazon CodeGuru Reviewer 中创建 GitHub 企业服务器存储库关联。 CodeGuru

以下代码示例演示如何使用 disassociate-repository

Amazon CLI

取消存储库关联

以下内容disassociate-repository取消关联正在使用存储库的存储 Amazon 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" } }

有关更多信息,请参阅 A ma CodeGuru zon Reviewer 用户指南中的在 CodeGuru Reviewer 中取消关联仓库

以下代码示例演示如何使用 list-code-reviews

Amazon CLI

列出过去 90 天内在您的 Amazon 账户中创建的代码评论。

以下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 的详细信息,请参阅Amazon CLI 命令参考ListCodeReviews中的。

以下代码示例演示如何使用 list-recommendation-feedback

Amazon 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

Amazon 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

Amazon CLI

列出您 Amazon 账户中的仓库关联

以下list-repository-associations示例返回您账户中存储库关联摘要对象的列表。您可以按ProviderTypeNameState、和筛选返回的列表Owner

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

Amazon 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 CodeGuru Reviewer 用户指南中的查看审阅者关联存储库 (Amazon CLI) 的标签

以下代码示例演示如何使用 put-recommendation-feedback

Amazon 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

Amazon 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

此命令不生成任何输出。

有关更多信息,请参阅 A ma CodeGuru zon Reviewer 用户指南中的向 CodeGuru 审阅者关联存储库 (Amazon CLI) 添加标签和为 CodeGuru 审阅者关联存储库 (CL Amazon I) 添加或更新标签 (CLI)。

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考TagResource中的。

以下代码示例演示如何使用 untag-resource

Amazon CLI

取消关联存储库的标签

以下内容untag-resource从关联的存储库中删除了两个密钥为 “Secret” 和 “Team” 的标签。

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 审阅者关联存储库 (Amazon CLI) 中移除标签

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考UntagResource中的。