Skip to content

StorageProxyS3«

StorageProxyS3 (StorageProxy) «

S3 storage proxy used to communicate with AWS S3 to manage data.

Attributes:

Name Type Description
root_dir str

Root directory to read and write objects to.

bucket_name str

Name of bucket on AWS.

client StorageProxy

Client communicating with storage, ie. Path.

__init__(self, bucket_name, root_dir, client) special «

Parameters:

Name Type Description Default
bucket_name str

Name of bucket on AWS.

required
root_dir str

Root directory to read and write objects to.

required
client StorageProxy

Client communicating with storage, ie. Path.

required

delete_file(self, filename) «

Remove file from storage.

Parameters:

Name Type Description Default
filename str

Name of file, ie. image.jpeg

required

Returns:

Type Description
None

Raises StorageProxyException if error occured.

get_bytes(self, filename) «

Fetch bytes data from storage.

Parameters:

Name Type Description Default
filename str

Name of file, ie. image.jpeg

required

Returns:

Type Description
bytes

bytes data requested, raises StorageProxyException if not found.

get_json(self, filename) «

Fetch JSON data from storage.

Parameters:

Name Type Description Default
filename str

Name of file, ie. index.json

required

Returns:

Type Description
dict

JSON data requested, raises StorageProxyException if not found.

list_files(self) «

List all files in directory.

Returns:

Type Description
list

List of all paths in directory.

save_bytes(self, bytes, filename) «

Save bytes data to storage.

Parameters:

Name Type Description Default
body bytes

Filename to be used to save object, ie. image.jpeg

required
filename str

Name of file, ie. index.json

required

Returns:

Type Description
None

Raises StorageProxyException if error occured.

save_json(self, body, filename) «

Save JSON data to storage.

Parameters:

Name Type Description Default
body dict

Filename to be used to save object, ie. index.json

required
filename str

Name of file, ie. index.json

required

Returns:

Type Description
None

Raises StorageProxyException if error occured.

Back to top