Skip to content

update_repository_encryption_key async

update_repository_encryption_key(
    repository_name: RepositoryName,
    kms_key_id: KmsKeyId,
    *,
    config_overrides: Optional[AsyncCodeCommitClientConfig] = None,
) -> UpdateRepositoryEncryptionKeyOutput

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

Parameters:

  • repository_name (RepositoryName) –

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

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

Raises:

Source code in docs_src/capo_codecommit/_services/async_code_commit.py
async def update_repository_encryption_key(
    self,
    repository_name: "capo_codecommit.types.repository_name.RepositoryName",
    kms_key_id: "capo_codecommit.types.kms_key_id.KmsKeyId",
    *,
    config_overrides: Optional[AsyncCodeCommitClientConfig] = None,
) -> "capo_codecommit.types.update_repository_encryption_key_output.UpdateRepositoryEncryptionKeyOutput":
    """<p>Updates the Key Management Service encryption key used to encrypt and decrypt a CodeCommit repository.</p>

    Args:
        repository_name: <p>The name of the repository for which you want to update the KMS encryption key used to encrypt and decrypt the repository.</p>
        kms_key_id: <p>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 <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html#KMS-Decrypt-request-KeyId">KeyId</a> in the Decrypt API description in the <i>Key Management Service API Reference</i>.</p>

    Raises:
        capo_codecommit.errors.encryption_integrity_checks_failed_exception.EncryptionIntegrityChecksFailedException: <p>An encryption integrity check failed.</p>
        capo_codecommit.errors.encryption_key_access_denied_exception.EncryptionKeyAccessDeniedException: <p>An encryption key could not be accessed.</p>
        capo_codecommit.errors.encryption_key_disabled_exception.EncryptionKeyDisabledException: <p>The encryption key is disabled.</p>
        capo_codecommit.errors.encryption_key_invalid_id_exception.EncryptionKeyInvalidIdException: <p>The Key Management Service encryption key is not valid.</p>
        capo_codecommit.errors.encryption_key_invalid_usage_exception.EncryptionKeyInvalidUsageException: <p>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.</p>
        capo_codecommit.errors.encryption_key_not_found_exception.EncryptionKeyNotFoundException: <p>No encryption key was found.</p>
        capo_codecommit.errors.encryption_key_required_exception.EncryptionKeyRequiredException: <p>A KMS encryption key ID is required but was not specified.</p>
        capo_codecommit.errors.encryption_key_unavailable_exception.EncryptionKeyUnavailableException: <p>The encryption key is not available.</p>
        capo_codecommit.errors.invalid_repository_name_exception.InvalidRepositoryNameException: <p>A specified repository name is not valid.</p> <note> <p>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.</p> </note>
        capo_codecommit.errors.repository_does_not_exist_exception.RepositoryDoesNotExistException: <p>The specified repository does not exist.</p>
        capo_codecommit.errors.repository_name_required_exception.RepositoryNameRequiredException: <p>A repository name is required, but was not specified.</p>
        capo_codecommit.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codecommit.types.update_repository_encryption_key_input.UpdateRepositoryEncryptionKeyInput]",
    ) -> AsyncOperationResponse[
        "capo_codecommit.types.update_repository_encryption_key_output.UpdateRepositoryEncryptionKeyOutput"
    ]:
        import capo_codecommit._operations.code_commit_20150413.update_repository_encryption_key

        (
            output,
            http_response,
        ) = await capo_codecommit._operations.code_commit_20150413.update_repository_encryption_key.async_update_repository_encryption_key(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateRepositoryEncryptionKey")
    )
    input_: capo_codecommit.types.update_repository_encryption_key_input.UpdateRepositoryEncryptionKeyInput = {
        "repository_name": repository_name,
        "kms_key_id": kms_key_id,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output