Amazon CodeGuru Reviewer

2020/05/11 - Amazon CodeGuru Reviewer - 6 updated api methods

Changes  Add Bitbucket integration APIs

AssociateRepository (updated) Link ¶
Changes (request, response)
Request
{'Repository': {'Bitbucket': {'ConnectionArn': 'string',
                              'Name': 'string',
                              'Owner': 'string'}}}
Response
{'RepositoryAssociation': {'ConnectionArn': 'string',
                           'ProviderType': {'Bitbucket'}}}

Associates an AWS CodeCommit repository with Amazon CodeGuru Reviewer. When you associate an AWS CodeCommit repository with Amazon CodeGuru Reviewer, Amazon CodeGuru Reviewer will provide recommendations for each pull request raised within the repository. You can view recommendations in the AWS CodeCommit repository.

You can associate a GitHub repository using the Amazon CodeGuru Reviewer console.

See also: AWS API Documentation

Request Syntax

client.associate_repository(
    Repository={
        'CodeCommit': {
            'Name': 'string'
        },
        'Bitbucket': {
            'Name': 'string',
            'ConnectionArn': 'string',
            'Owner': 'string'
        }
    },
    ClientRequestToken='string'
)
type Repository

dict

param Repository

[REQUIRED]

The repository to associate.

  • CodeCommit (dict) --

    Information about an AWS CodeCommit repository.

    • Name (string) -- [REQUIRED]

      The name of the AWS CodeCommit repository.

  • Bitbucket (dict) --

    Information about a Bitbucket Cloud repository.

    • Name (string) -- [REQUIRED]

      The name of the third party source repository.

    • ConnectionArn (string) -- [REQUIRED]

      The Amazon Resource Name (ARN) identifying the repository connection.

    • Owner (string) -- [REQUIRED]

      The username of the owner of the repository.

type ClientRequestToken

string

param ClientRequestToken

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

To add a new repository association, this parameter specifies a unique identifier for the new repository association that helps ensure idempotency.

If you use the AWS CLI or one of the AWS SDKs to call this operation, you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes that in the request. If you don't use the SDK and instead generate a raw HTTP request to the Secrets Manager service endpoint, you must generate a ClientRequestToken yourself for new versions and include that value in the request.

You typically interact with this value if you implement your own retry logic and want to ensure that a given repository association is not created twice. We recommend that you generate a UUID-type value to ensure uniqueness within the specified repository association.

Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate repository associations if there are failures and retries.

This field is autopopulated if not provided.

rtype

dict

returns

Response Syntax

{
    'RepositoryAssociation': {
        'AssociationId': 'string',
        'AssociationArn': 'string',
        'ConnectionArn': 'string',
        'Name': 'string',
        'Owner': 'string',
        'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket',
        'State': 'Associated'|'Associating'|'Failed'|'Disassociating',
        'StateReason': 'string',
        'LastUpdatedTimeStamp': datetime(2015, 1, 1),
        'CreatedTimeStamp': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • RepositoryAssociation (dict) --

      Information about the repository association.

      • AssociationId (string) --

        The ID of the repository association.

      • AssociationArn (string) --

        The Amazon Resource Name (ARN) identifying the repository association.

      • ConnectionArn (string) --

        The Amazon Resource Name (ARN) identifying the repository connection.

      • Name (string) --

        The name of the repository.

      • Owner (string) --

        The owner of the repository.

      • ProviderType (string) --

        The provider type of the repository association.

      • State (string) --

        The state of the repository association.

      • StateReason (string) --

        A description of why the repository association is in the current state.

      • LastUpdatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the repository association was last updated.

      • CreatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the repository association was created.

DescribeCodeReview (updated) Link ¶
Changes (response)
{'CodeReview': {'ProviderType': {'Bitbucket'}}}

Returns the metadaata associated with the code review along with its status.

See also: AWS API Documentation

Request Syntax

client.describe_code_review(
    CodeReviewArn='string'
)
type CodeReviewArn

string

param CodeReviewArn

[REQUIRED]

The Amazon Resource Name (ARN) of the code review to describe.

rtype

dict

returns

Response Syntax

{
    'CodeReview': {
        'Name': 'string',
        'CodeReviewArn': 'string',
        'RepositoryName': 'string',
        'Owner': 'string',
        'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket',
        'State': 'Completed'|'Pending'|'Failed'|'Deleting',
        'StateReason': 'string',
        'CreatedTimeStamp': datetime(2015, 1, 1),
        'LastUpdatedTimeStamp': datetime(2015, 1, 1),
        'Type': 'PullRequest',
        'PullRequestId': 'string',
        'SourceCodeType': {
            'CommitDiff': {
                'SourceCommit': 'string',
                'DestinationCommit': 'string'
            }
        },
        'Metrics': {
            'MeteredLinesOfCodeCount': 123,
            'FindingsCount': 123
        }
    }
}

Response Structure

  • (dict) --

    • CodeReview (dict) --

      Information about the code review.

      • Name (string) --

        The name of the code review.

      • CodeReviewArn (string) --

        The Amazon Resource Name (ARN) of the code review to describe.

      • RepositoryName (string) --

        The name of the repository.

      • Owner (string) --

        The owner of the repository.

      • ProviderType (string) --

        The provider type of the repository association.

      • State (string) --

        The state of the code review.

      • StateReason (string) --

        The reason for the state of the code review.

      • CreatedTimeStamp (datetime) --

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

      • LastUpdatedTimeStamp (datetime) --

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

      • Type (string) --

        The type of code review.

      • PullRequestId (string) --

        The pull request ID for the code review.

      • SourceCodeType (dict) --

        The type of the source code for the code review.

        • CommitDiff (dict) --

          The commit diff for the pull request.

          • SourceCommit (string) --

            Source Commit SHA.

          • DestinationCommit (string) --

            Destination Commit SHA

      • Metrics (dict) --

        The statistics from the code review.

        • MeteredLinesOfCodeCount (integer) --

          Lines of code metered in the code review.

        • FindingsCount (integer) --

          Total number of recommendations found in the code review.

DescribeRepositoryAssociation (updated) Link ¶
Changes (response)
{'RepositoryAssociation': {'ConnectionArn': 'string',
                           'ProviderType': {'Bitbucket'}}}

Describes a repository association.

See also: AWS API Documentation

Request Syntax

client.describe_repository_association(
    AssociationArn='string'
)
type AssociationArn

string

param AssociationArn

[REQUIRED]

The Amazon Resource Name (ARN) identifying the association. You can retrieve this ARN by calling ListRepositories .

rtype

dict

returns

Response Syntax

{
    'RepositoryAssociation': {
        'AssociationId': 'string',
        'AssociationArn': 'string',
        'ConnectionArn': 'string',
        'Name': 'string',
        'Owner': 'string',
        'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket',
        'State': 'Associated'|'Associating'|'Failed'|'Disassociating',
        'StateReason': 'string',
        'LastUpdatedTimeStamp': datetime(2015, 1, 1),
        'CreatedTimeStamp': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • RepositoryAssociation (dict) --

      Information about the repository association.

      • AssociationId (string) --

        The ID of the repository association.

      • AssociationArn (string) --

        The Amazon Resource Name (ARN) identifying the repository association.

      • ConnectionArn (string) --

        The Amazon Resource Name (ARN) identifying the repository connection.

      • Name (string) --

        The name of the repository.

      • Owner (string) --

        The owner of the repository.

      • ProviderType (string) --

        The provider type of the repository association.

      • State (string) --

        The state of the repository association.

      • StateReason (string) --

        A description of why the repository association is in the current state.

      • LastUpdatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the repository association was last updated.

      • CreatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the repository association was created.

DisassociateRepository (updated) Link ¶
Changes (response)
{'RepositoryAssociation': {'ConnectionArn': 'string',
                           'ProviderType': {'Bitbucket'}}}

Removes the association between Amazon CodeGuru Reviewer and a repository.

See also: AWS API Documentation

Request Syntax

client.disassociate_repository(
    AssociationArn='string'
)
type AssociationArn

string

param AssociationArn

[REQUIRED]

The Amazon Resource Name (ARN) identifying the association.

rtype

dict

returns

Response Syntax

{
    'RepositoryAssociation': {
        'AssociationId': 'string',
        'AssociationArn': 'string',
        'ConnectionArn': 'string',
        'Name': 'string',
        'Owner': 'string',
        'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket',
        'State': 'Associated'|'Associating'|'Failed'|'Disassociating',
        'StateReason': 'string',
        'LastUpdatedTimeStamp': datetime(2015, 1, 1),
        'CreatedTimeStamp': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • RepositoryAssociation (dict) --

      Information about the disassociated repository.

      • AssociationId (string) --

        The ID of the repository association.

      • AssociationArn (string) --

        The Amazon Resource Name (ARN) identifying the repository association.

      • ConnectionArn (string) --

        The Amazon Resource Name (ARN) identifying the repository connection.

      • Name (string) --

        The name of the repository.

      • Owner (string) --

        The owner of the repository.

      • ProviderType (string) --

        The provider type of the repository association.

      • State (string) --

        The state of the repository association.

      • StateReason (string) --

        A description of why the repository association is in the current state.

      • LastUpdatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the repository association was last updated.

      • CreatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the repository association was created.

ListCodeReviews (updated) Link ¶
Changes (request, response)
Request
{'ProviderTypes': {'Bitbucket'}}
Response
{'CodeReviewSummaries': {'ProviderType': {'Bitbucket'}}}

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

See also: AWS API Documentation

Request Syntax

client.list_code_reviews(
    ProviderTypes=[
        'CodeCommit'|'GitHub'|'Bitbucket',
    ],
    States=[
        'Completed'|'Pending'|'Failed'|'Deleting',
    ],
    RepositoryNames=[
        'string',
    ],
    Type='PullRequest',
    MaxResults=123,
    NextToken='string'
)
type ProviderTypes

list

param ProviderTypes

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

  • (string) --

type States

list

param States

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

  • (string) --

type RepositoryNames

list

param RepositoryNames

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

  • (string) --

type Type

string

param Type

[REQUIRED]

The type of code reviews to list in the response.

type MaxResults

integer

param MaxResults

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

type NextToken

string

param NextToken

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.

rtype

dict

returns

Response Syntax

{
    'CodeReviewSummaries': [
        {
            'Name': 'string',
            'CodeReviewArn': 'string',
            'RepositoryName': 'string',
            'Owner': 'string',
            'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket',
            'State': 'Completed'|'Pending'|'Failed'|'Deleting',
            'CreatedTimeStamp': datetime(2015, 1, 1),
            'LastUpdatedTimeStamp': datetime(2015, 1, 1),
            'Type': 'PullRequest',
            'PullRequestId': 'string',
            'MetricsSummary': {
                'MeteredLinesOfCodeCount': 123,
                'FindingsCount': 123
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • CodeReviewSummaries (list) --

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

      • (dict) --

        Information about the summary of the code review.

        • Name (string) --

          The name of the code review.

        • CodeReviewArn (string) --

          The Amazon Resource Name (ARN) of the code review to describe.

        • RepositoryName (string) --

          The name of the repository.

        • Owner (string) --

          The owner of the repository.

        • ProviderType (string) --

          The provider type of the repository association.

        • State (string) --

          The state of the code review.

        • CreatedTimeStamp (datetime) --

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

        • LastUpdatedTimeStamp (datetime) --

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

        • Type (string) --

          The type of the code review.

        • PullRequestId (string) --

          The pull request ID for the code review.

        • MetricsSummary (dict) --

          The statistics from the code review.

          • MeteredLinesOfCodeCount (integer) --

            Lines of code metered in the code review.

          • FindingsCount (integer) --

            Total number of recommendations found in the code review.

    • NextToken (string) --

      Pagination token.

ListRepositoryAssociations (updated) Link ¶
Changes (request, response)
Request
{'ProviderTypes': {'Bitbucket'}}
Response
{'RepositoryAssociationSummaries': {'ConnectionArn': 'string',
                                    'ProviderType': {'Bitbucket'}}}

Lists repository associations. You can optionally filter on one or more of the following recommendation properties: provider types, states, names, and owners.

See also: AWS API Documentation

Request Syntax

client.list_repository_associations(
    ProviderTypes=[
        'CodeCommit'|'GitHub'|'Bitbucket',
    ],
    States=[
        'Associated'|'Associating'|'Failed'|'Disassociating',
    ],
    Names=[
        'string',
    ],
    Owners=[
        'string',
    ],
    MaxResults=123,
    NextToken='string'
)
type ProviderTypes

list

param ProviderTypes

List of provider types to use as a filter.

  • (string) --

type States

list

param States

List of states to use as a filter.

  • (string) --

type Names

list

param Names

List of repository names to use as a filter.

  • (string) --

type Owners

list

param Owners

List of owners to use as a filter. For GitHub, this is name of the GitHub account that was used to associate the repository. For AWS CodeCommit, it is the name of the CodeCommit account that was used to associate the repository.

  • (string) --

type MaxResults

integer

param MaxResults

The maximum number of repository association results returned by ListRepositoryAssociations in paginated output. When this parameter is used, ListRepositoryAssociations only returns maxResults results in a single page with a nextToken response element. The remaining results of the initial request can be seen by sending another ListRepositoryAssociations request with the returned nextToken value. This value can be between 1 and 25. If this parameter is not used, ListRepositoryAssociations returns up to 25 results and a nextToken value if applicable.

type NextToken

string

param NextToken

The nextToken value returned from a previous paginated ListRepositoryAssociations request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.

Note

Treat this token as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.

rtype

dict

returns

Response Syntax

{
    'RepositoryAssociationSummaries': [
        {
            'AssociationArn': 'string',
            'ConnectionArn': 'string',
            'LastUpdatedTimeStamp': datetime(2015, 1, 1),
            'AssociationId': 'string',
            'Name': 'string',
            'Owner': 'string',
            'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket',
            'State': 'Associated'|'Associating'|'Failed'|'Disassociating'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • RepositoryAssociationSummaries (list) --

      A list of repository associations that meet the criteria of the request.

      • (dict) --

        Information about a repository association.

        • AssociationArn (string) --

          The Amazon Resource Name (ARN) identifying the repository association.

        • ConnectionArn (string) --

          The Amazon Resource Name (ARN) identifying the repository connection.

        • LastUpdatedTimeStamp (datetime) --

          The time, in milliseconds since the epoch, since the repository association was last updated.

        • AssociationId (string) --

          The repository association ID.

        • Name (string) --

          The name of the repository association.

        • Owner (string) --

          The owner of the repository association.

        • ProviderType (string) --

          The provider type of the repository association.

        • State (string) --

          The state of the repository association.

          Associated

          Amazon CodeGuru Reviewer is associated with the repository.

          Associating

          The association is in progress.

          Failed

          The association failed.

          Disassociating

          Amazon CodeGuru Reviewer is in the process of disassociating with the repository.

    • NextToken (string) --

      The nextToken value to include in a future ListRecommendations request. When the results of a ListRecommendations request exceed maxResults , this value can be used to retrieve the next page of results. This value is null when there are no more results to return.