AWS CodeCommit

2023/12/21 - AWS CodeCommit - 1 new3 updated api methods

Changes  AWS CodeCommit now supports customer managed keys from AWS Key Management Service. UpdateRepositoryEncryptionKey is added for updating the key configuration. CreateRepository, GetRepository, BatchGetRepositories are updated with new input or output parameters.

UpdateRepositoryEncryptionKey (new) Link ¶

Updates the Key Management Service encryption key used to encrypt and decrypt a CodeCommit repository.

See also: AWS API Documentation

Request Syntax

client.update_repository_encryption_key(
    repositoryName='string',
    kmsKeyId='string'
)
type repositoryName:

string

param repositoryName:

[REQUIRED]

The name of the repository for which you want to update the KMS encryption key used to encrypt and decrypt the repository.

type kmsKeyId:

string

param kmsKeyId:

[REQUIRED]

The ID of the encryption key. You can view the ID of an encryption key in the KMS console, or use the KMS APIs to programmatically retrieve a key ID. For more information about acceptable values for keyID, see KeyId in the Decrypt API description in the Key Management Service API Reference.

rtype:

dict

returns:

Response Syntax

{
    'repositoryId': 'string',
    'kmsKeyId': 'string',
    'originalKmsKeyId': 'string'
}

Response Structure

  • (dict) --

    • repositoryId (string) --

      The ID of the repository.

    • kmsKeyId (string) --

      The ID of the encryption key.

    • originalKmsKeyId (string) --

      The ID of the encryption key formerly used to encrypt and decrypt the repository.

BatchGetRepositories (updated) Link ¶
Changes (response)
{'errors': [{'errorCode': 'EncryptionIntegrityChecksFailedException | '
                          'EncryptionKeyAccessDeniedException | '
                          'EncryptionKeyDisabledException | '
                          'EncryptionKeyNotFoundException | '
                          'EncryptionKeyUnavailableException | '
                          'RepositoryDoesNotExistException',
             'errorMessage': 'string',
             'repositoryId': 'string',
             'repositoryName': 'string'}],
 'repositories': {'kmsKeyId': 'string'}}

Returns information about one or more repositories.

See also: AWS API Documentation

Request Syntax

client.batch_get_repositories(
    repositoryNames=[
        'string',
    ]
)
type repositoryNames:

list

param repositoryNames:

[REQUIRED]

The names of the repositories to get information about.

  • (string) --

rtype:

dict

returns:

Response Syntax

{
    'repositories': [
        {
            'accountId': 'string',
            'repositoryId': 'string',
            'repositoryName': 'string',
            'repositoryDescription': 'string',
            'defaultBranch': 'string',
            'lastModifiedDate': datetime(2015, 1, 1),
            'creationDate': datetime(2015, 1, 1),
            'cloneUrlHttp': 'string',
            'cloneUrlSsh': 'string',
            'Arn': 'string',
            'kmsKeyId': 'string'
        },
    ],
    'repositoriesNotFound': [
        'string',
    ],
    'errors': [
        {
            'repositoryId': 'string',
            'repositoryName': 'string',
            'errorCode': 'EncryptionIntegrityChecksFailedException'|'EncryptionKeyAccessDeniedException'|'EncryptionKeyDisabledException'|'EncryptionKeyNotFoundException'|'EncryptionKeyUnavailableException'|'RepositoryDoesNotExistException',
            'errorMessage': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    Represents the output of a batch get repositories operation.

    • repositories (list) --

      A list of repositories returned by the batch get repositories operation.

      • (dict) --

        Information about a repository.

        • accountId (string) --

          The ID of the Amazon Web Services account associated with the repository.

        • repositoryId (string) --

          The ID of the repository.

        • repositoryName (string) --

          The repository's name.

        • repositoryDescription (string) --

          A comment or description about the repository.

        • defaultBranch (string) --

          The repository's default branch name.

        • lastModifiedDate (datetime) --

          The date and time the repository was last modified, in timestamp format.

        • creationDate (datetime) --

          The date and time the repository was created, in timestamp format.

        • cloneUrlHttp (string) --

          The URL to use for cloning the repository over HTTPS.

        • cloneUrlSsh (string) --

          The URL to use for cloning the repository over SSH.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the repository.

        • kmsKeyId (string) --

          The ID of the Key Management Service encryption key used to encrypt and decrypt the repository.

    • repositoriesNotFound (list) --

      Returns a list of repository names for which information could not be found.

      • (string) --

    • errors (list) --

      Returns information about any errors returned when attempting to retrieve information about the repositories.

      • (dict) --

        Returns information about errors in a BatchGetRepositories operation.

        • repositoryId (string) --

          The ID of a repository that either could not be found or was not in a valid state.

        • repositoryName (string) --

          The name of a repository that either could not be found or was not in a valid state.

        • errorCode (string) --

          An error code that specifies the type of failure.

        • errorMessage (string) --

          An error message that provides detail about why the repository either was not found or was not in a valid state.

CreateRepository (updated) Link ¶
Changes (request, response)
Request
{'kmsKeyId': 'string'}
Response
{'repositoryMetadata': {'kmsKeyId': 'string'}}

Creates a new, empty repository.

See also: AWS API Documentation

Request Syntax

client.create_repository(
    repositoryName='string',
    repositoryDescription='string',
    tags={
        'string': 'string'
    },
    kmsKeyId='string'
)
type repositoryName:

string

param repositoryName:

[REQUIRED]

The name of the new repository to be created.

type repositoryDescription:

string

param repositoryDescription:

A comment or description about the new repository.

type tags:

dict

param tags:

One or more tag key-value pairs to use when tagging this repository.

  • (string) --

    • (string) --

type kmsKeyId:

string

param kmsKeyId:

The ID of the encryption key. You can view the ID of an encryption key in the KMS console, or use the KMS APIs to programmatically retrieve a key ID. For more information about acceptable values for kmsKeyID, see KeyId in the Decrypt API description in the Key Management Service API Reference.

If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.

rtype:

dict

returns:

Response Syntax

{
    'repositoryMetadata': {
        'accountId': 'string',
        'repositoryId': 'string',
        'repositoryName': 'string',
        'repositoryDescription': 'string',
        'defaultBranch': 'string',
        'lastModifiedDate': datetime(2015, 1, 1),
        'creationDate': datetime(2015, 1, 1),
        'cloneUrlHttp': 'string',
        'cloneUrlSsh': 'string',
        'Arn': 'string',
        'kmsKeyId': 'string'
    }
}

Response Structure

  • (dict) --

    Represents the output of a create repository operation.

    • repositoryMetadata (dict) --

      Information about the newly created repository.

      • accountId (string) --

        The ID of the Amazon Web Services account associated with the repository.

      • repositoryId (string) --

        The ID of the repository.

      • repositoryName (string) --

        The repository's name.

      • repositoryDescription (string) --

        A comment or description about the repository.

      • defaultBranch (string) --

        The repository's default branch name.

      • lastModifiedDate (datetime) --

        The date and time the repository was last modified, in timestamp format.

      • creationDate (datetime) --

        The date and time the repository was created, in timestamp format.

      • cloneUrlHttp (string) --

        The URL to use for cloning the repository over HTTPS.

      • cloneUrlSsh (string) --

        The URL to use for cloning the repository over SSH.

      • Arn (string) --

        The Amazon Resource Name (ARN) of the repository.

      • kmsKeyId (string) --

        The ID of the Key Management Service encryption key used to encrypt and decrypt the repository.

GetRepository (updated) Link ¶
Changes (response)
{'repositoryMetadata': {'kmsKeyId': 'string'}}

Returns information about a repository.

See also: AWS API Documentation

Request Syntax

client.get_repository(
    repositoryName='string'
)
type repositoryName:

string

param repositoryName:

[REQUIRED]

The name of the repository to get information about.

rtype:

dict

returns:

Response Syntax

{
    'repositoryMetadata': {
        'accountId': 'string',
        'repositoryId': 'string',
        'repositoryName': 'string',
        'repositoryDescription': 'string',
        'defaultBranch': 'string',
        'lastModifiedDate': datetime(2015, 1, 1),
        'creationDate': datetime(2015, 1, 1),
        'cloneUrlHttp': 'string',
        'cloneUrlSsh': 'string',
        'Arn': 'string',
        'kmsKeyId': 'string'
    }
}

Response Structure

  • (dict) --

    Represents the output of a get repository operation.

    • repositoryMetadata (dict) --

      Information about the repository.

      • accountId (string) --

        The ID of the Amazon Web Services account associated with the repository.

      • repositoryId (string) --

        The ID of the repository.

      • repositoryName (string) --

        The repository's name.

      • repositoryDescription (string) --

        A comment or description about the repository.

      • defaultBranch (string) --

        The repository's default branch name.

      • lastModifiedDate (datetime) --

        The date and time the repository was last modified, in timestamp format.

      • creationDate (datetime) --

        The date and time the repository was created, in timestamp format.

      • cloneUrlHttp (string) --

        The URL to use for cloning the repository over HTTPS.

      • cloneUrlSsh (string) --

        The URL to use for cloning the repository over SSH.

      • Arn (string) --

        The Amazon Resource Name (ARN) of the repository.

      • kmsKeyId (string) --

        The ID of the Key Management Service encryption key used to encrypt and decrypt the repository.