in src/aws_encryption_sdk/materials_managers/caching.py [0:0]
def __attrs_post_init__(self):
"""Applies post-processing which cannot be handled by attrs."""
if self.max_messages_encrypted < 1:
raise ValueError("max_messages_encrypted cannot be less than 1")
if self.max_bytes_encrypted < 0:
raise ValueError("max_bytes_encrypted cannot be less than 0")
if self.max_messages_encrypted > MAX_MESSAGES_PER_KEY:
raise ValueError("max_messages_encrypted cannot exceed {}".format(MAX_MESSAGES_PER_KEY))
if self.max_bytes_encrypted > MAX_BYTES_PER_KEY:
raise ValueError("max_bytes_encrypted cannot exceed {}".format(MAX_BYTES_PER_KEY))
if self.max_age <= 0.0:
raise ValueError("max_age cannot be less than or equal to 0")
if self.backing_materials_manager is None:
if self.master_key_provider is None:
raise TypeError("Either backing_materials_manager or master_key_provider must be defined")
self.backing_materials_manager = DefaultCryptoMaterialsManager(self.master_key_provider)
if self.partition_name is None:
self.partition_name = to_bytes(str(uuid.uuid4()))