AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
CodeGuru 使用审阅者示例 AWS CLI
以下代码示例向您展示了如何使用 with 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 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:创建 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 Reviewer 用户指南中的在 Amazon CodeGuru Reviewer 中创建 AWS CodeCommit 存储库关联。 CodeGuru
-
有关API详细信息,请参阅 “AssociateRepository AWS CLI
命令参考”。
-
以下代码示例演示如何使用 create-code-review
。
- AWS CLI
-
创建代码审查。
以下内容
create-code-review
创建了对名为的 AWS CodeCommit 存储库mainline
分支中的代码的审查my-repository-name
。aws codeguru-reviewer create-code-review \ --name
my-code-review
\ --repository-association-arnarn: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详细信息,请参阅 “CreateCodeReview AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-code-review
。
- AWS CLI
-
列出有关代码审查的详细信息。
下面
describe-code-review
列出了有关审查名为 “” 的 AWS CodeCommit 存储库 “主线” 分支中的代码的信息。my-repo-nameaws 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-id3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390eb
\ --reactionsThumbsUp
输出
{ "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详细信息,请参阅 “DescribeCodeReview AWS CLI
命令参考”。
-
以下代码示例演示如何使用 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-id3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390eb
输出:
{ "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:提供反馈”。
-
有关API详细信息,请参阅 “DescribeRecommendationFeedback AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-repository-association
。
- AWS 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
-
有关API详细信息,请参阅 “DescribeRepositoryAssociation AWS CLI
命令参考”。
-
以下代码示例演示如何使用 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" } }
有关更多信息,请参阅 A ma CodeGuru zon Reviewer 用户指南中的在 CodeGuru Reviewer 中取消关联仓库。
-
有关API详细信息,请参阅 “DisassociateRepository AWS CLI
命令参考”。
-
以下代码示例演示如何使用 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详细信息,请参阅 “ListCodeReviews AWS CLI
命令参考”。
-
以下代码示例演示如何使用 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:提供反馈。
-
有关API详细信息,请参阅 “ListRecommendationFeedback AWS CLI
命令参考”。
-
以下代码示例演示如何使用 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:提供反馈。
-
有关API详细信息,请参阅 “ListRecommendations AWS CLI
命令参考”。
-
以下代码示例演示如何使用 list-repository-associations
。
- AWS CLI
-
列出您 AWS 账户中的仓库关联
以下
list-repository-associations
示例返回您账户中存储库关联摘要对象的列表。您可以按ProviderType
、Name
State
、和筛选返回的列表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 中查看所有存储库关联。
-
有关API详细信息,请参阅 “ListRepositoryAssociations AWS CLI
命令参考”。
-
以下代码示例演示如何使用 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 CodeGuru Reviewer 用户指南中的查看审阅者关联存储库的标签 (AWS CLI)。
-
有关API详细信息,请参阅 “ListTagsForResource 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-id3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390eb
\ --reactionsThumbsUp
此命令不生成任何输出。
有关更多信息,请参阅 Amazon CodeGuru Reviewer 用户指南中的步骤 4:提供反馈。
-
有关API详细信息,请参阅 “PutRecommendationFeedback AWS CLI
命令参考”。
-
以下代码示例演示如何使用 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
\ --tagsStatus=Secret,Team=Saanvi
此命令不生成任何输出。
有关更多信息,请参阅 A ma CodeGuru zon CodeGuru Reviewer 用户指南中的向审阅者关联存储库添加标签 (AWS CLI) 和为 CodeGuru 审阅者关联存储库添加或更新标签 (AWS CLI)。
-
有关API详细信息,请参阅 “TagResource AWS CLI
命令参考”。
-
以下代码示例演示如何使用 untag-resource
。
- AWS 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-keysStatus
Team
此命令不生成任何输出。
有关更多信息,请参阅 Amazon CodeGuru CodeGuru Reviewer 用户指南中的从审阅者关联存储库中移除标签 (AWS CLI)。
-
有关API详细信息,请参阅 “UntagResource AWS CLI
命令参考”。
-