nat.plugins.s3.s3_object_store#
Attributes#
Classes#
S3ObjectStore is an ObjectStore implementation that uses S3 as the underlying storage. |
Module Contents#
- logger#
- class S3ObjectStore(
- *,
- bucket_name: str,
- endpoint_url: str | None,
- access_key: str | None,
- secret_key: str | None,
- region: str | None,
Bases:
nat.object_store.interfaces.ObjectStoreS3ObjectStore is an ObjectStore implementation that uses S3 as the underlying storage.
- bucket_name#
- session#
- _client_context = None#
- async put_object(
- key: str,
- item: nat.object_store.models.ObjectStoreItem,
Save an ObjectStoreItem in the object store with the given key. If the key already exists, raise an error.
- Args:
key (str): The key to save the item under. item (ObjectStoreItem): The item to save.
- Raises:
KeyAlreadyExistsError: If the key already exists.
- async upsert_object(
- key: str,
- item: nat.object_store.models.ObjectStoreItem,
Save an ObjectStoreItem in the object store with the given key. If the key already exists, update the item.
- Args:
key (str): The key to save the item under. item (ObjectStoreItem): The item to save.
- async get_object(key: str) nat.object_store.models.ObjectStoreItem#
Get an ObjectStoreItem from the object store by key.
- Args:
key (str): The key to get the item from.
- Returns:
ObjectStoreItem: The item retrieved from the object store.
- Raises:
NoSuchKeyError: If the item does not exist.