UpdateRepositoryEncryptionKeyCommand

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

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CodeCommitClient, UpdateRepositoryEncryptionKeyCommand } from "@aws-sdk/client-codecommit"; // ES Modules import
// const { CodeCommitClient, UpdateRepositoryEncryptionKeyCommand } = require("@aws-sdk/client-codecommit"); // CommonJS import
const client = new CodeCommitClient(config);
const input = { // UpdateRepositoryEncryptionKeyInput
  repositoryName: "STRING_VALUE", // required
  kmsKeyId: "STRING_VALUE", // required
};
const command = new UpdateRepositoryEncryptionKeyCommand(input);
const response = await client.send(command);
// { // UpdateRepositoryEncryptionKeyOutput
//   repositoryId: "STRING_VALUE",
//   kmsKeyId: "STRING_VALUE",
//   originalKmsKeyId: "STRING_VALUE",
// };

UpdateRepositoryEncryptionKeyCommand Input

Parameter
Type
Description
kmsKeyId
Required
string | undefined

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.

repositoryName
Required
string | undefined

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

UpdateRepositoryEncryptionKeyCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
kmsKeyId
string | undefined

The ID of the encryption key.

originalKmsKeyId
string | undefined

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

repositoryId
string | undefined

The ID of the repository.

Throws

Name
Fault
Details
EncryptionIntegrityChecksFailedException
server

An encryption integrity check failed.

EncryptionKeyAccessDeniedException
client

An encryption key could not be accessed.

EncryptionKeyDisabledException
client

The encryption key is disabled.

EncryptionKeyInvalidIdException
client

The Key Management Service encryption key is not valid.

EncryptionKeyInvalidUsageException
client

A KMS encryption key was used to try and encrypt or decrypt a repository, but either the repository or the key was not in a valid state to support the operation.

EncryptionKeyNotFoundException
client

No encryption key was found.

EncryptionKeyRequiredException
client

A KMS encryption key ID is required but was not specified.

EncryptionKeyUnavailableException
client

The encryption key is not available.

InvalidRepositoryNameException
client

A specified repository name is not valid.

This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.

RepositoryDoesNotExistException
client

The specified repository does not exist.

RepositoryNameRequiredException
client

A repository name is required, but was not specified.

CodeCommitServiceException
Base exception class for all service exceptions from CodeCommit service.