Skip to content

botcity.plugins.aws.s3.plugin.BotAWSS3Plugin

bucket_name property writable

Returns the bucket name.

Returns:

Type Description
bucket_name

The bucket name.

s3_client property readonly

Returns the aws client instance.

Returns:

Type Description
boto3_instance

The aws client instance.

__init__(self, region_name='us-east-1', use_credentials_file=True, access_key_id=None, secret_access_key=None) special

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(self, 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(self, 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(self, 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(self, 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(self, 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(self, 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(self, 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:

Type Description
file_path

The downloaded file path

download_folder(self, 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(self, text, regex=False, filter_=<Filter.EQUALS: '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.

<Filter.EQUALS: 'equals'>

filter_files(self, text, bucket_name=None, regex=False, filter_=<Filter.EQUALS: '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.

<Filter.EQUALS: 'equals'>

list_buckets(self)

Returns the list of all buckets.

See Documentation # noqa

Returns:

Type Description
buckets

The list of all buckets.

list_files(self, 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:

Type Description
buckets

The list of buckets.

move_file(self, 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(self, 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(self, 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(self, 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(self, 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