Amazon CodeGuru Reviewer

2021/04/26 - Amazon CodeGuru Reviewer - 3 updated api methods

Changes  Include KMS Key Details in Repository Association APIs to enable usage of customer managed KMS Keys.

AssociateRepository (updated) Link ¶
Changes (request, response)
Request
{'KMSKeyDetails': {'EncryptionOption': 'AWS_OWNED_CMK | CUSTOMER_MANAGED_CMK',
                   'KMSKeyId': 'string'}}
Response
{'RepositoryAssociation': {'KMSKeyDetails': {'EncryptionOption': 'AWS_OWNED_CMK '
                                                                 '| '
                                                                 'CUSTOMER_MANAGED_CMK',
                                             'KMSKeyId': 'string'}}}

Use to associate an AWS CodeCommit repository or a repostory managed by AWS CodeStar Connections with Amazon CodeGuru Reviewer. When you associate a repository, CodeGuru Reviewer reviews source code changes in the repository's pull requests and provides automatic recommendations. You can view recommendations using the CodeGuru Reviewer console. For more information, see Recommendations in Amazon CodeGuru Reviewer in the Amazon CodeGuru Reviewer User Guide.

If you associate a CodeCommit repository, it must be in the same AWS Region and AWS account where its CodeGuru Reviewer code reviews are configured.

Bitbucket and GitHub Enterprise Server repositories are managed by AWS CodeStar Connections to connect to CodeGuru Reviewer. For more information, see Associate a repository in the Amazon CodeGuru Reviewer User Guide.

Note

You cannot use the CodeGuru Reviewer SDK or the AWS CLI to associate a GitHub repository with Amazon CodeGuru Reviewer. To associate a GitHub repository, use the console. For more information, see Getting started with CodeGuru Reviewer in the CodeGuru Reviewer User Guide.

See also: AWS API Documentation

Request Syntax

client.associate_repository(
    Repository={
        'CodeCommit': {
            'Name': 'string'
        },
        'Bitbucket': {
            'Name': 'string',
            'ConnectionArn': 'string',
            'Owner': 'string'
        },
        'GitHubEnterpriseServer': {
            'Name': 'string',
            'ConnectionArn': 'string',
            'Owner': 'string'
        }
    },
    ClientRequestToken='string',
    Tags={
        'string': 'string'
    },
    KMSKeyDetails={
        'KMSKeyId': 'string',
        'EncryptionOption': 'AWS_OWNED_CMK'|'CUSTOMER_MANAGED_CMK'
    }
)
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. For more information, see repositoryName in the AWS CodeCommit API Reference .

  • Bitbucket (dict) --

    Information about a Bitbucket repository.

    • Name (string) -- [REQUIRED]

      The name of the third party source repository.

    • ConnectionArn (string) -- [REQUIRED]

      The Amazon Resource Name (ARN) of an AWS CodeStar Connections connection. Its format is arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id . For more information, see ` Connection https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html`__ in the AWS CodeStar Connections API Reference .

    • Owner (string) -- [REQUIRED]

      The owner of the repository. For a GitHub, GitHub Enterprise, or Bitbucket repository, this is the username for the account that owns the repository.

  • GitHubEnterpriseServer (dict) --

    Information about a GitHub Enterprise Server repository.

    • Name (string) -- [REQUIRED]

      The name of the third party source repository.

    • ConnectionArn (string) -- [REQUIRED]

      The Amazon Resource Name (ARN) of an AWS CodeStar Connections connection. Its format is arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id . For more information, see ` Connection https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html`__ in the AWS CodeStar Connections API Reference .

    • Owner (string) -- [REQUIRED]

      The owner of the repository. For a GitHub, GitHub Enterprise, or Bitbucket repository, this is the username for the account that owns the repository.

type ClientRequestToken

string

param ClientRequestToken

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.

type Tags

dict

param Tags

An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:

  • A tag key (for example, CostCenter , Environment , Project , or Secret ). Tag keys are case sensitive.

  • An optional field known as a tag value (for example, 111122223333 , Production , or a team name). Omitting the tag value is the same as using an empty string. Like tag keys, tag values are case sensitive.

  • (string) --

    • (string) --

type KMSKeyDetails

dict

param KMSKeyDetails

A KMSKeyDetails object that contains:

  • The encryption option for this repository association. It is either owned by AWS Key Management Service (KMS) (AWS_OWNED_CMK ) or customer managed (CUSTOMER_MANAGED_CMK ).

  • The ID of the AWS KMS key that is associated with this respository association.

  • KMSKeyId (string) --

    The ID of the AWS KMS key that is associated with a respository association.

  • EncryptionOption (string) --

    The encryption option for a repository association. It is either owned by AWS Key Management Service (KMS) (AWS_OWNED_CMK ) or customer managed (CUSTOMER_MANAGED_CMK ).

rtype

dict

returns

Response Syntax

{
    'RepositoryAssociation': {
        'AssociationId': 'string',
        'AssociationArn': 'string',
        'ConnectionArn': 'string',
        'Name': 'string',
        'Owner': 'string',
        'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket'|'GitHubEnterpriseServer',
        'State': 'Associated'|'Associating'|'Failed'|'Disassociating'|'Disassociated',
        'StateReason': 'string',
        'LastUpdatedTimeStamp': datetime(2015, 1, 1),
        'CreatedTimeStamp': datetime(2015, 1, 1),
        'KMSKeyDetails': {
            'KMSKeyId': 'string',
            'EncryptionOption': 'AWS_OWNED_CMK'|'CUSTOMER_MANAGED_CMK'
        }
    },
    'Tags': {
        'string': 'string'
    }
}

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) of an AWS CodeStar Connections connection. Its format is arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id . For more information, see ` Connection https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html`__ in the AWS CodeStar Connections API Reference .

      • Name (string) --

        The name of the repository.

      • Owner (string) --

        The owner of the repository. For an AWS CodeCommit repository, this is the AWS account ID of the account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository.

      • ProviderType (string) --

        The provider type of the repository association.

      • State (string) --

        The state of the repository association.

        The valid repository association states are:

        • Associated : The repository association is complete.

        • Associating : CodeGuru Reviewer is:

          • Setting up pull request notifications. This is required for pull requests to trigger a CodeGuru Reviewer review.

          Note

          If your repository ProviderType is GitHub , GitHub Enterprise Server , or Bitbucket , CodeGuru Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer reviews. If you delete these webhooks, reviews of code in your repository cannot be triggered.

          • Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your repository.

        • Failed : The repository failed to associate or disassociate.

        • Disassociating : CodeGuru Reviewer is removing the repository's pull request notifications and source code access.

        • Disassociated : CodeGuru Reviewer successfully disassociated the repository. You can create a new association with this repository if you want to review source code in it later. You can control access to code reviews created in an associated repository with tags after it has been disassociated. For more information, see Using tags to control access to associated repositories in the Amazon CodeGuru Reviewer User Guide .

      • 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.

      • KMSKeyDetails (dict) --

        A KMSKeyDetails object that contains:

        • The encryption option for this repository association. It is either owned by AWS Key Management Service (KMS) (AWS_OWNED_CMK ) or customer managed (CUSTOMER_MANAGED_CMK ).

        • The ID of the AWS KMS key that is associated with this respository association.

        • KMSKeyId (string) --

          The ID of the AWS KMS key that is associated with a respository association.

        • EncryptionOption (string) --

          The encryption option for a repository association. It is either owned by AWS Key Management Service (KMS) (AWS_OWNED_CMK ) or customer managed (CUSTOMER_MANAGED_CMK ).

    • Tags (dict) --

      An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:

      • A tag key (for example, CostCenter , Environment , Project , or Secret ). Tag keys are case sensitive.

      • An optional field known as a tag value (for example, 111122223333 , Production , or a team name). Omitting the tag value is the same as using an empty string. Like tag keys, tag values are case sensitive.

      • (string) --

        • (string) --

DescribeRepositoryAssociation (updated) Link ¶
Changes (response)
{'RepositoryAssociation': {'KMSKeyDetails': {'EncryptionOption': 'AWS_OWNED_CMK '
                                                                 '| '
                                                                 'CUSTOMER_MANAGED_CMK',
                                             'KMSKeyId': 'string'}}}

Returns a ` RepositoryAssociation https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html`__ object that contains information about the requested 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) of the ` RepositoryAssociation https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html`__ object. You can retrieve this ARN by calling ` ListRepositoryAssociations https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html`__ .

rtype

dict

returns

Response Syntax

{
    'RepositoryAssociation': {
        'AssociationId': 'string',
        'AssociationArn': 'string',
        'ConnectionArn': 'string',
        'Name': 'string',
        'Owner': 'string',
        'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket'|'GitHubEnterpriseServer',
        'State': 'Associated'|'Associating'|'Failed'|'Disassociating'|'Disassociated',
        'StateReason': 'string',
        'LastUpdatedTimeStamp': datetime(2015, 1, 1),
        'CreatedTimeStamp': datetime(2015, 1, 1),
        'KMSKeyDetails': {
            'KMSKeyId': 'string',
            'EncryptionOption': 'AWS_OWNED_CMK'|'CUSTOMER_MANAGED_CMK'
        }
    },
    'Tags': {
        'string': 'string'
    }
}

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) of an AWS CodeStar Connections connection. Its format is arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id . For more information, see ` Connection https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html`__ in the AWS CodeStar Connections API Reference .

      • Name (string) --

        The name of the repository.

      • Owner (string) --

        The owner of the repository. For an AWS CodeCommit repository, this is the AWS account ID of the account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository.

      • ProviderType (string) --

        The provider type of the repository association.

      • State (string) --

        The state of the repository association.

        The valid repository association states are:

        • Associated : The repository association is complete.

        • Associating : CodeGuru Reviewer is:

          • Setting up pull request notifications. This is required for pull requests to trigger a CodeGuru Reviewer review.

          Note

          If your repository ProviderType is GitHub , GitHub Enterprise Server , or Bitbucket , CodeGuru Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer reviews. If you delete these webhooks, reviews of code in your repository cannot be triggered.

          • Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your repository.

        • Failed : The repository failed to associate or disassociate.

        • Disassociating : CodeGuru Reviewer is removing the repository's pull request notifications and source code access.

        • Disassociated : CodeGuru Reviewer successfully disassociated the repository. You can create a new association with this repository if you want to review source code in it later. You can control access to code reviews created in an associated repository with tags after it has been disassociated. For more information, see Using tags to control access to associated repositories in the Amazon CodeGuru Reviewer User Guide .

      • 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.

      • KMSKeyDetails (dict) --

        A KMSKeyDetails object that contains:

        • The encryption option for this repository association. It is either owned by AWS Key Management Service (KMS) (AWS_OWNED_CMK ) or customer managed (CUSTOMER_MANAGED_CMK ).

        • The ID of the AWS KMS key that is associated with this respository association.

        • KMSKeyId (string) --

          The ID of the AWS KMS key that is associated with a respository association.

        • EncryptionOption (string) --

          The encryption option for a repository association. It is either owned by AWS Key Management Service (KMS) (AWS_OWNED_CMK ) or customer managed (CUSTOMER_MANAGED_CMK ).

    • Tags (dict) --

      An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:

      • A tag key (for example, CostCenter , Environment , Project , or Secret ). Tag keys are case sensitive.

      • An optional field known as a tag value (for example, 111122223333 , Production , or a team name). Omitting the tag value is the same as using an empty string. Like tag keys, tag values are case sensitive.

      • (string) --

        • (string) --

DisassociateRepository (updated) Link ¶
Changes (response)
{'RepositoryAssociation': {'KMSKeyDetails': {'EncryptionOption': 'AWS_OWNED_CMK '
                                                                 '| '
                                                                 'CUSTOMER_MANAGED_CMK',
                                             'KMSKeyId': 'string'}}}

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) of the ` RepositoryAssociation https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html`__ object. You can retrieve this ARN by calling ` ListRepositoryAssociations https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html`__ .

rtype

dict

returns

Response Syntax

{
    'RepositoryAssociation': {
        'AssociationId': 'string',
        'AssociationArn': 'string',
        'ConnectionArn': 'string',
        'Name': 'string',
        'Owner': 'string',
        'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket'|'GitHubEnterpriseServer',
        'State': 'Associated'|'Associating'|'Failed'|'Disassociating'|'Disassociated',
        'StateReason': 'string',
        'LastUpdatedTimeStamp': datetime(2015, 1, 1),
        'CreatedTimeStamp': datetime(2015, 1, 1),
        'KMSKeyDetails': {
            'KMSKeyId': 'string',
            'EncryptionOption': 'AWS_OWNED_CMK'|'CUSTOMER_MANAGED_CMK'
        }
    },
    'Tags': {
        'string': 'string'
    }
}

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) of an AWS CodeStar Connections connection. Its format is arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id . For more information, see ` Connection https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html`__ in the AWS CodeStar Connections API Reference .

      • Name (string) --

        The name of the repository.

      • Owner (string) --

        The owner of the repository. For an AWS CodeCommit repository, this is the AWS account ID of the account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository.

      • ProviderType (string) --

        The provider type of the repository association.

      • State (string) --

        The state of the repository association.

        The valid repository association states are:

        • Associated : The repository association is complete.

        • Associating : CodeGuru Reviewer is:

          • Setting up pull request notifications. This is required for pull requests to trigger a CodeGuru Reviewer review.

          Note

          If your repository ProviderType is GitHub , GitHub Enterprise Server , or Bitbucket , CodeGuru Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer reviews. If you delete these webhooks, reviews of code in your repository cannot be triggered.

          • Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your repository.

        • Failed : The repository failed to associate or disassociate.

        • Disassociating : CodeGuru Reviewer is removing the repository's pull request notifications and source code access.

        • Disassociated : CodeGuru Reviewer successfully disassociated the repository. You can create a new association with this repository if you want to review source code in it later. You can control access to code reviews created in an associated repository with tags after it has been disassociated. For more information, see Using tags to control access to associated repositories in the Amazon CodeGuru Reviewer User Guide .

      • 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.

      • KMSKeyDetails (dict) --

        A KMSKeyDetails object that contains:

        • The encryption option for this repository association. It is either owned by AWS Key Management Service (KMS) (AWS_OWNED_CMK ) or customer managed (CUSTOMER_MANAGED_CMK ).

        • The ID of the AWS KMS key that is associated with this respository association.

        • KMSKeyId (string) --

          The ID of the AWS KMS key that is associated with a respository association.

        • EncryptionOption (string) --

          The encryption option for a repository association. It is either owned by AWS Key Management Service (KMS) (AWS_OWNED_CMK ) or customer managed (CUSTOMER_MANAGED_CMK ).

    • Tags (dict) --

      An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:

      • A tag key (for example, CostCenter , Environment , Project , or Secret ). Tag keys are case sensitive.

      • An optional field known as a tag value (for example, 111122223333 , Production , or a team name). Omitting the tag value is the same as using an empty string. Like tag keys, tag values are case sensitive.

      • (string) --

        • (string) --