AWS S3 Utilities
airtable_apply_annotations.s3_utils
bulk_s3_actions(action, bucket, files, sources, targets=None)
Applies a bulk S3 CRUD action for all files
in sources
and optionally, targets
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action |
Callable
|
Function calling an S3 CRUD operation. |
required |
bucket |
str
|
S3 bucket name. |
required |
files |
List[str]
|
List of files in |
required |
sources |
List[str]
|
Source folders in |
required |
targets |
List[str]
|
Target folders in |
None
|
Source code in src/airtable_apply_annotations/s3_utils.py
copy_file(bucket, file, source, destination)
Copy file
in bucket
from source
to destination
folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bucket |
str
|
S3 bucket name. |
required |
file |
str
|
Name of file to be copied (without full-path). |
required |
source |
str
|
Source folder in S3 bucket. |
required |
destination |
str
|
Destination folder in S3 bucket. |
required |
Source code in src/airtable_apply_annotations/s3_utils.py
delete_file(bucket, file, source)
Delete file
in bucket
from source
folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bucket |
str
|
S3 bucket name. |
required |
file |
str
|
Name of file to be deleted (without full-path). |
required |
source |
str
|
Source folder in S3 bucket. |
required |
Source code in src/airtable_apply_annotations/s3_utils.py
move_file(bucket, file, source, destination)
Move file
in bucket
from source
to destination
folder
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bucket |
str
|
S3 bucket name. |
required |
file |
str
|
Name of file to be moved (without full-path). |
required |
source |
str
|
Source folder in S3 bucket. |
required |
destination |
str
|
Destination folder in S3 bucket. |
required |
Source code in src/airtable_apply_annotations/s3_utils.py
write_file(bucket, file_content, destination, save_file_name)
Writes file_content
to save_file_name
to bucket
at destination
folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bucket |
str
|
S3 bucket name. |
required |
file_content |
str
|
Content of file to write. |
required |
destination |
str
|
Destination folder in S3 bucket. |
required |
save_file_name |
str
|
Save file name |
required |