updateRepositoryEncryptionKey method

Future<UpdateRepositoryEncryptionKeyOutput> updateRepositoryEncryptionKey({
  1. required String kmsKeyId,
  2. required String repositoryName,
})

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

May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyInvalidIdException. May throw EncryptionKeyInvalidUsageException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyRequiredException. May throw EncryptionKeyUnavailableException. May throw InvalidRepositoryNameException. May throw RepositoryDoesNotExistException. May throw RepositoryNameRequiredException.

Parameter 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 keyID, see KeyId in the Decrypt API description in the Key Management Service API Reference.

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

Implementation

Future<UpdateRepositoryEncryptionKeyOutput> updateRepositoryEncryptionKey({
  required String kmsKeyId,
  required String repositoryName,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeCommit_20150413.UpdateRepositoryEncryptionKey'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'kmsKeyId': kmsKeyId,
      'repositoryName': repositoryName,
    },
  );

  return UpdateRepositoryEncryptionKeyOutput.fromJson(jsonResponse.body);
}