¶
botcity.plugins.aws.s3.BotAWSS3Plugin
¶
bucket_name
property
writable
¶
Returns the bucket name.
Returns:
| Name | Type | Description |
|---|---|---|
bucket_name |
The bucket name. |
s3_client
property
¶
Returns the aws client instance.
Returns:
| Name | Type | Description |
|---|---|---|
boto3_instance |
The aws client instance. |
__init__(region_name='us-east-1', use_credentials_file=True, access_key_id=None, secret_access_key=None)
¶
BotAWSS3Plugin
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region_name
|
str
|
Default region when creating new connections. |
'us-east-1'
|
use_credentials_file
|
bool
|
If set to True will make authentication via AWS credentials file. |
True
|
access_key_id
|
str
|
AWS access key ID. |
None
|
secret_access_key
|
str
|
AWS secret access key. |
None
|
copy_file(filename, target_filename, bucket_name=None, target_bucket_name=None, extra_args=None)
¶
Copy the file to another bucket or in the same bucket.
See Documentation # noqa
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The original filename in the bucket. |
required |
target_filename
|
str
|
The new copy of the file. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
target_bucket_name
|
str
|
The another bucket to save this copy. |
None
|
extra_args
|
Dict
|
Extra arguments that may be passed to the client operation. Learn more about ALLOWED_DOWNLOAD_ARGS |
None
|
copy_folder(folder_path, target_folder_name, bucket_name=None, target_bucket_name=None, max_workers=1, extra_args=None)
¶
Copy the folder to another bucket or in the same bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_path
|
str
|
The original folder name in the bucket. |
required |
target_folder_name
|
str
|
The new copy of the folder. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
target_bucket_name
|
str
|
The another bucket to save this copy. |
None
|
max_workers
|
int
|
The maximum number of threads that can be used to execute the given calls. |
1
|
extra_args
|
Dict
|
Extra arguments that may be passed to the client operation. |
None
|
create_bucket(bucket_name=None, **kwargs)
¶
Create new bucket.
See Documentation # noqa
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bucket_name
|
str
|
The new bucket name to be created. |
None
|
kwargs
|
dict
|
The dict for bucket permissions. |
{}
|
delete_bucket(bucket_name=None, **kwargs)
¶
Delete the bucket.
See Documentation # noqa
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bucket_name
|
str
|
The new bucket name to be created. |
None
|
delete_file(filename, bucket_name=None, **kwargs)
¶
Delete file from the bucket.
See Documentation # noqa
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The filename in the bucket. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
delete_folder(folder_name, bucket_name=None, max_workers=1)
¶
Delete folder from the bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_name
|
str
|
The folder name to be deleted. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
max_workers
|
int
|
The maximum number of threads that can be used to execute the given calls. |
1
|
download_file(filename, path_to_save, bucket_name=None, extra_args=None)
¶
Download file from the bucket.
See Documentation # noqa
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The filename in the bucket. |
required |
path_to_save
|
str
|
The local path to save. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
extra_args
|
Dict
|
Extra arguments that may be passed to the client operation. Learn more about ALLOWED_DOWNLOAD_ARGS |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
file_path |
None
|
The downloaded file path |
download_folder(bucket_folder, path_to_save, bucket_name=None, max_workers=1, extra_args=None)
¶
Download all files from the folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bucket_folder
|
str
|
The folder name in the bucket. |
required |
path_to_save
|
str
|
The local path to save. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
max_workers
|
int
|
The maximum number of threads that can be used to execute the given calls. |
1
|
extra_args
|
Dict
|
Extra arguments that may be passed to the client operation. Learn more about ALLOWED_DOWNLOAD_ARGS # noqa |
None
|
filter_buckets(text, regex=False, filter_=Filter.EQUALS)
¶
Filter buckets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The element to filter. |
required |
regex
|
bool
|
True to enable regex search. See for regex details |
False
|
filter_
|
Filter
|
Filter pattern without user using regex. |
EQUALS
|
filter_files(text, bucket_name=None, regex=False, filter_=Filter.EQUALS, **kwargs)
¶
Filter files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The element to filter. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
regex
|
bool
|
True to enable regex search. See for regex details |
False
|
filter_
|
Filter
|
Filter pattern without user using regex. |
EQUALS
|
list_buckets()
¶
Returns the list of all buckets.
See Documentation # noqa
Returns:
| Name | Type | Description |
|---|---|---|
buckets |
List[str]
|
The list of all buckets. |
list_files(bucket_name=None, **kwargs)
¶
Returns the list of files.
See Documentation # noqa
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bucket_name
|
str
|
The bucket name. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
buckets |
List[str]
|
The list of buckets. |
move_file(filename, target_filename, bucket_name=None, target_bucket_name=None, extra_args=None, **kwargs)
¶
Move the file to another bucket or in the same bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The filename in the bucket. |
required |
target_filename
|
str
|
The new copy of the file. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
target_bucket_name
|
str
|
The another bucket to save this copy. |
None
|
extra_args
|
Dict
|
Extra arguments that may be passed to the client operation. Learn more about ALLOWED_DOWNLOAD_ARGS # noqa |
None
|
move_folder(folder_path, target_folder_name, bucket_name=None, target_bucket_name=None, max_workers=1, extra_args=None, **kwargs)
¶
Move the folder to another bucket or in the same bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_path
|
str
|
The original folder name in the bucket. |
required |
target_folder_name
|
str
|
The new copy of the folder. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
target_bucket_name
|
str
|
The another bucket to save this copy. |
None
|
max_workers
|
int
|
The maximum number of threads that can be used to execute the given calls. |
1
|
extra_args
|
Dict
|
Extra arguments that may be passed to the client operation. |
None
|
rename_folder(folder_path, target_folder_name, bucket_name=None, max_workers=1, extra_args=None, **kwargs)
¶
Rename the folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_path
|
str
|
The original folder name in the bucket. |
required |
target_folder_name
|
str
|
The new copy of the folder. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
max_workers
|
int
|
The maximum number of threads that can be used to execute the given calls. |
1
|
extra_args
|
Dict
|
Extra arguments that may be passed to the client operation. |
None
|
upload_file(file_path, bucket_name=None, bucket_filename=None, extra_args=None)
¶
Upload file to bucket.
See Documentation # noqa
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
The local file path. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
bucket_filename
|
str
|
The new filename in the bucket. |
None
|
extra_args
|
Dict
|
Extra arguments that may be passed to the client operation. Learn more about ALLOWED_UPLOAD_ARGS |
None
|
upload_folder(bucket_folder, folder_path, bucket_name=None, max_workers=1, extra_args=None)
¶
Upload folder to bucket. Empty directories are ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bucket_folder
|
str
|
The new folder name in the bucket. |
required |
folder_path
|
str
|
The local folder path. |
required |
bucket_name
|
str
|
The bucket name. |
None
|
max_workers
|
int
|
The maximum number of threads that can be used to execute the given calls. |
1
|
extra_args
|
Dict
|
Extra arguments that may be passed to the client operation. Learn more about ALLOWED_UPLOAD_ARGS # noqa |
None
|