cosmotech.coal.aws¶
cosmotech.coal.aws.s3.S3
¶
Methods:
| Name | Description |
|---|---|
upload_file |
Upload a single file to an S3 bucket. |
upload_folder |
Upload files from a folder to an S3 bucket. |
download_files |
Download files from an S3 bucket to a local folder. |
upload_data_stream |
Upload a data stream to an S3 bucket. |
delete_objects |
Delete objects from an S3 bucket, optionally filtered by prefix. |
Attributes:
| Name | Type | Description |
|---|---|---|
file_prefix |
|
|
use_ssl |
|
|
ssl_cert_bundle |
|
|
access_key_id |
|
|
endpoint_url |
|
|
bucket_name |
|
|
secret_access_key |
|
|
output_type |
|
|
client |
client
|
|
resource |
resource
|
|
file_prefix
property
writable
¶
use_ssl
property
¶
ssl_cert_bundle
property
¶
access_key_id
property
¶
endpoint_url
property
¶
bucket_name
property
¶
secret_access_key
property
¶
output_type
property
¶
client
property
¶
resource
property
¶
upload_file(file_path)
¶
Upload a single file to an S3 bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
Path to the file to upload |
required |
upload_folder(source_folder, recursive=False)
¶
Upload files from a folder to an S3 bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_folder
|
str
|
Path to the folder containing files to upload |
required |
recursive
|
bool
|
Whether to recursively upload files from subdirectories |
False
|
download_files(destination_folder)
¶
Download files from an S3 bucket to a local folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
destination_folder
|
str
|
Local folder to download files to |
required |
upload_data_stream(data_stream, file_name)
¶
Upload a data stream to an S3 bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_stream
|
BytesIO
|
BytesIO stream containing the data to upload |
required |
file_name
|
str
|
Name of the file to create in the bucket |
required |
delete_objects()
¶
Delete objects from an S3 bucket, optionally filtered by prefix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bucket_name
|
Name of the S3 bucket |
required | |
s3_resource
|
S3 resource object |
required | |
file_prefix
|
Optional prefix to filter objects to delete |
required |