@@ -304,7 +304,7 @@ async def close(self) -> None:
304
304
305
305
306
306
class RewrapManyDataKeyResult :
307
- """Result object returned by a :meth:`~ClientEncryption .rewrap_many_data_key` operation.
307
+ """Result object returned by a :meth:`~AsyncClientEncryption .rewrap_many_data_key` operation.
308
308
309
309
.. versionadded:: 4.2
310
310
"""
@@ -316,7 +316,7 @@ def __init__(self, bulk_write_result: Optional[BulkWriteResult] = None) -> None:
316
316
def bulk_write_result (self ) -> Optional [BulkWriteResult ]:
317
317
"""The result of the bulk write operation used to update the key vault
318
318
collection with one or more rewrapped data keys. If
319
- :meth:`~ClientEncryption .rewrap_many_data_key` does not find any matching keys to rewrap,
319
+ :meth:`~AsyncClientEncryption .rewrap_many_data_key` does not find any matching keys to rewrap,
320
320
no bulk write operation will be executed and this field will be
321
321
``None``.
322
322
"""
@@ -506,7 +506,7 @@ def _create_mongocrypt_options(**kwargs: Any) -> MongoCryptOptions:
506
506
return opts
507
507
508
508
509
- class ClientEncryption (Generic [_DocumentType ]):
509
+ class AsyncClientEncryption (Generic [_DocumentType ]):
510
510
"""Explicit client-side field level encryption."""
511
511
512
512
def __init__ (
@@ -519,7 +519,7 @@ def __init__(
519
519
) -> None :
520
520
"""Explicit client-side field level encryption.
521
521
522
- The ClientEncryption class encapsulates explicit operations on a key
522
+ The AsyncClientEncryption class encapsulates explicit operations on a key
523
523
vault collection that cannot be done directly on an AsyncMongoClient. Similar
524
524
to configuring auto encryption on an AsyncMongoClient, it is constructed with
525
525
an AsyncMongoClient (to a MongoDB cluster containing the key vault
@@ -1126,23 +1126,23 @@ async def rewrap_many_data_key(
1126
1126
result = await self ._key_vault_coll .bulk_write (replacements )
1127
1127
return RewrapManyDataKeyResult (result )
1128
1128
1129
- async def __aenter__ (self ) -> ClientEncryption [_DocumentType ]:
1129
+ async def __aenter__ (self ) -> AsyncClientEncryption [_DocumentType ]:
1130
1130
return self
1131
1131
1132
1132
async def __aexit__ (self , exc_type : Any , exc_val : Any , exc_tb : Any ) -> None :
1133
1133
await self .close ()
1134
1134
1135
1135
def _check_closed (self ) -> None :
1136
1136
if self ._encryption is None :
1137
- raise InvalidOperation ("Cannot use closed ClientEncryption " )
1137
+ raise InvalidOperation ("Cannot use closed AsyncClientEncryption " )
1138
1138
1139
1139
async def close (self ) -> None :
1140
1140
"""Release resources.
1141
1141
1142
1142
Note that using this class in a with-statement will automatically call
1143
1143
:meth:`close`::
1144
1144
1145
- with ClientEncryption (...) as client_encryption:
1145
+ with AsyncClientEncryption (...) as client_encryption:
1146
1146
encrypted = client_encryption.encrypt(value, ...)
1147
1147
decrypted = client_encryption.decrypt(encrypted)
1148
1148
0 commit comments