Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
CodeGuru Esempi di revisori che utilizzano AWS CLI
I seguenti esempi di codice mostrano come eseguire azioni e implementare scenari comuni utilizzando AWS Command Line Interface with CodeGuru Reviewer.
Le azioni sono estratti di codice da programmi più grandi e devono essere eseguite nel contesto. Sebbene le azioni mostrino come richiamare le singole funzioni del servizio, è possibile visualizzarle contestualizzate negli scenari correlati.
Ogni esempio include un link al codice sorgente completo, in cui vengono fornite le istruzioni su come configurare ed eseguire il codice nel contesto.
Argomenti
Azioni
Il seguente esempio di codice mostra come utilizzareassociate-repository.
- AWS CLI
-
Esempio 1: come creare un’associazione di repository Bitbucket
L’esempio
associate-repositoryseguente crea un’associazione di repository utilizzando un repository Bitbucket esistente.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 }'Output:
{ "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" } }Per ulteriori informazioni, consulta Creare un'associazione di repository Bitbucket in Amazon Reviewer nella Amazon CodeGuru Reviewer User Guide. CodeGuru
Esempio 2: creare un'associazione di repository aziendali GitHub
L'
associate-repositoryesempio seguente crea un'associazione di repository utilizzando un repository GitHub Enterprise esistente.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 }'Output:
{ "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" } }Per ulteriori informazioni, consulta Creare un'associazione di repository GitHub Enterprise Server in Amazon CodeGuru Reviewer nella Amazon Codeguru Reviewer User Guide.
Esempio 3: creare un'associazione di repository AWS CodeCommit
L'
associate-repositoryesempio seguente crea un'associazione di repository utilizzando un repository esistente AWS CodeCommit .aws codeguru-reviewer associate-repository \ --repositoryCodeCommit={Name=mySampleRepo}Output:
{ "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" } }Per ulteriori informazioni, consulta Creare un'associazione di AWS CodeCommit repository in Amazon CodeGuru Reviewer nella Amazon CodeGuru Reviewer User Guide.
-
Per i dettagli sull'API, consulta Command AssociateRepository
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzarecreate-code-review.
- AWS CLI
-
Come creare una revisione del codice.
Quanto segue
create-code-reviewcrea una revisione del codice nelmainlineramo di un AWS CodeCommit repository denominatomy-repository-name.aws codeguru-reviewer create-code-review \ --namemy-code-review\ --repository-association-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111\ --type '{"RepositoryAnalysis": {"RepositoryHead": {"BranchName": "mainline"}}}'Output:
{ "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" } }Per ulteriori informazioni, consulta Create code review in Amazon CodeGuru Reviewer nella Amazon CodeGuru Reviewer User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command CreateCodeReview
Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-code-review.
- AWS CLI
-
Elenca i dettagli relativi alla revisione del codice.
Di seguito
describe-code-reviewsono elencate le informazioni su una revisione del codice nel ramo «mainline» di un AWS CodeCommit repository denominato "»my-repo-name.aws codeguru-reviewer put-recommendation-feedback \ --code-review-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:code-review:RepositoryAnalysis-my-repository-name-branch-abcdefgh12345678\ --recommendation-id3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390eb\ --reactionsThumbsUpOutput
{ "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" } }Per ulteriori informazioni, consulta Visualizza i dettagli della revisione del codice nella Guida per l'utente di Amazon CodeGuru Reviewer.
-
Per i dettagli sull'API, consulta DescribeCodeReview AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-recommendation-feedback.
- AWS CLI
-
Come visualizzare informazioni sul feedback su una raccomandazione
L’esempio
describe-recommendation-feedbackseguente visualizza le informazioni sul feedback relativo a una raccomandazione. Questa raccomandazione ha una sola reazioneThumbsUp.aws codeguru-reviewer describe-recommendation-feedback \ --code-review-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:code-review:RepositoryAnalysis-my-repository-name-branch-abcdefgh12345678\ --recommendation-id3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390ebOutput:
{ "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 } }Per ulteriori informazioni, consulta Visualizzare consigli e fornire feedback e Passaggio 4: fornire feedback nella Amazon CodeGuru Reviewer User Guide.
-
Per i dettagli sull'API, consulta DescribeRecommendationFeedback AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-repository-association.
- AWS CLI
-
Esempio 1: per restituire informazioni su un'associazione di GitHub repository
L'
describe-repository-associationesempio seguente restituisce informazioni su un'associazione di repository che utilizza un repository GitHub Enterprise e si trova nello stato.Associatedaws codeguru-reviewer describe-repository-association \ --association-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111Output:
{ "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" } }Per ulteriori informazioni, consulta Creare un'associazione di repository GitHub Enterprise Server in Amazon CodeGuru Reviewer nella Amazon CodeGuru Reviewer User Guide.
Esempio 2: come restituire informazioni su un’associazione di repository non riuscita
L'
describe-repository-associationesempio seguente restituisce informazioni su un'associazione di repository che utilizza un repository GitHub Enterprise e si trova nello stato.Failedaws codeguru-reviewer describe-repository-association \ --association-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111Output:
{ "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" } }Per ulteriori informazioni, consulta Creare un'associazione di repository GitHub Enterprise Server in Amazon CodeGuru Reviewer nella Amazon CodeGuru Reviewer User Guide.
Esempio 3: come restituire informazioni su un’associazione di repository dissociata
L'
describe-repository-associationesempio seguente restituisce informazioni su un'associazione di repository che utilizza un repository GitHub Enterprise e si trova nello stato.Disassociatingaws codeguru-reviewer describe-repository-association \ --association-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111Output:
{ "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" } }Per ulteriori informazioni, consulta Creare un'associazione di repository GitHub Enterprise Server in Amazon CodeGuru Reviewer nella Amazon CodeGuru Reviewer User Guide.
-
Per i dettagli sull'API, consulta Command DescribeRepositoryAssociation
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzaredisassociate-repository.
- AWS CLI
-
Come annullare un’associazione di repository
Di seguito
disassociate-repositoryviene dissociata un'associazione di repository che utilizza un repository. AWS CodeCommitaws codeguru-reviewer disassociate-repository \ --association-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111Output:
{ "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" } }Per ulteriori informazioni, consulta Dissociare un repository in CodeGuru Reviewer nella Amazon CodeGuru Reviewer User Guide.
-
Per i dettagli sull'API, consulta DisassociateRepository
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzarelist-code-reviews.
- AWS CLI
-
Per elencare le recensioni di codice create nel tuo AWS account negli ultimi 90 giorni.
L’esempio
list-code-reviewsseguente elenca le revisioni del codice create negli ultimi 90 giorni utilizzando richieste pull.aws codeguru-reviewer list-code-reviews \ --typePullRequestOutput:
{ "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" } ] }Per ulteriori informazioni, consulta Visualizza tutte le revisioni del codice nella Amazon CodeGuru Reviewer User Guide.
-
Per i dettagli sull'API, consulta ListCodeReviews AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-recommendation-feedback.
- AWS CLI
-
Come elencare il feedback dei clienti relativo a una raccomandazione su un repository associato
L’esempio
list-recommendation-feedbackseguente elenca i feedback dei clienti per tutte le raccomandazioni relative alla revisione del codice. Questa revisione del codice contiene un feedback, un "ThumbsUp«, da parte di un cliente.aws codeguru-reviewer list-recommendation-feedback \ --code-review-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:code-review:RepositoryAnalysis-my-repository-name-branch-abcdefgh12345678Output:
{ "RecommendationFeedbackSummaries": [ { "RecommendationId": "3be1b2e5d7ef6e298a06499379ee290c9c596cf688fdcadb08285ddb0dd390eb", "Reactions": [ "ThumbsUp" ], "UserId": "aws-user-id" } ] }Per ulteriori informazioni, consulta la Fase 4: Fornire feedback nella Guida per l'utente di Amazon CodeGuru Reviewer.
-
Per i dettagli sull'API, consulta ListRecommendationFeedback AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-recommendations.
- AWS CLI
-
Come elencare le raccomandazioni per completare la revisione del codice
L’esempio
list-recommendationsseguente elenca le raccomandazioni per una revisione del codice completata. Questa revisione del codice contiene una raccomandazione.aws codeguru-reviewer list-recommendations \ --code-review-arnarn:aws:codeguru-reviewer:us-west-2:544120495673:code-review:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111Output:
{ "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" } ] }Per ulteriori informazioni, consulta la Fase 4: Fornire feedback nella Guida per l'utente di Amazon CodeGuru Reviewer.
-
Per i dettagli sull'API, consulta ListRecommendations AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-repository-associations.
- AWS CLI
-
Per elencare le associazioni di repository presenti nel tuo account AWS
L’esempio
list-repository-associationsseguente restituisce un elenco di oggetti di riepilogo dell’associazione di repository nell’account in uso. È possibile filtrare l’elenco restituito perProviderType,Name,StateeOwner.aws codeguru-reviewer list-repository-associationsOutput:
{ "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" } ] }Per ulteriori informazioni, consulta Visualizza tutte le associazioni di repository in CodeGuru Reviewer nella Amazon CodeGuru Reviewer User Guide.
-
Per i dettagli sull'API, consulta Command ListRepositoryAssociations
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzarelist-tags-for-resource.
- AWS CLI
-
Come elencare i tag in un repository associato
L’esempio
list-tags-for-resourceseguente elenca i tag in un repository associato. Questo repository associato ha due tag.aws codeguru-reviewer list-tags-for-resource \ --resource-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111Output:
{ "Tags": { "Status": "Secret", "Team": "Saanvi" } }Per ulteriori informazioni, consulta Visualizza tag per un repository associato a CodeGuru Reviewer (AWS CLI) nella Amazon CodeGuru Reviewer User Guide.
-
Per i dettagli sull'API, consulta ListTagsForResource
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzareput-recommendation-feedback.
- AWS CLI
-
Come aggiungere una raccomandazione a una revisione del codice
L’esempio
put-recommendation-feedbackseguente fornisce una raccomandazioneThumbsUpper una revisione del codice.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\ --reactionsThumbsUpQuesto comando non produce alcun output.
Per ulteriori informazioni, consulta la Fase 4: Fornire feedback nella Guida per l'utente di Amazon CodeGuru Reviewer.
-
Per i dettagli sull'API, consulta PutRecommendationFeedback AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaretag-resource.
- AWS CLI
-
Come aggiungere un tag a un repository associato
L’esempio
tag-resourceseguente aggiunge due tag a un repository associato.aws codeguru-reviewer tag-resource \ --resource-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111\ --tagsStatus=Secret,Team=SaanviQuesto comando non produce alcun output.
Per ulteriori informazioni, consulta Aggiungere un tag a un repository associato a CodeGuru Reviewer (AWS CLI) e Aggiungere o aggiornare tag per un repository CodeGuru associato a Reviewer (AWS CLI) nella Amazon Reviewer User Guide. CodeGuru
-
Per i dettagli sull'API, consulta Command Reference. TagResource
AWS CLI
-
Il seguente esempio di codice mostra come utilizzareuntag-resource.
- AWS CLI
-
Come rimuovere i tag da un repository associato
L’esempio
untag-resourceseguente rimuove due tag con le chiavi “Secret” e “Team” da un repository associato.aws codeguru-reviewer untag-resource \ --resource-arnarn:aws:codeguru-reviewer:us-west-2:123456789012:association:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111\ --tag-keysStatusTeamQuesto comando non produce alcun output.
Per ulteriori informazioni, consulta Rimuovere i tag da un repository associato a CodeGuru Reviewer (AWS CLI) nella Amazon CodeGuru Reviewer User Guide.
-
Per i dettagli sull'API, consulta UntagResource
Command Reference.AWS CLI
-