runway.core.providers.aws.s3 package
AWS S3 objects.
- class runway.core.providers.aws.s3.Bucket[source]
Bases:
runway.mixins.DelCachedPropMixin
AWS S3 bucket.
- __init__(context: typing.Union[<sphinx.util.inspect.TypeAliasForwardRef object at 0x7f5700f17e30>, <sphinx.util.inspect.TypeAliasForwardRef object at 0x7f5702115e50>], name: str, region: typing.Optional[str] = None) None [source]
Instantiate class.
- Parameters
context – Current context object.
name – The name of the bucket.
region – The bucket’s region.
- property client: S3Client
Create or reuse a boto3 client.
- property head
Check if a bucket exists and you have permission to access it.
To use this operation, the user must have permissions to perform the
s3:ListBucket
action.This is a low level action that returns the raw result of the request.
- property session: boto3.Session
Create cached boto3 session.
- create(**kwargs: Any) Optional[CreateBucketOutputTypeDef] [source]
Create an S3 Bucket if it does not already exist.
Bucket creation will be skipped if it already exists or access is forbidden.
Keyword arguments are passed directly to the boto3 method.
- Returns
boto3 response.
- format_bucket_path_uri(*, key: Optional[str] = None, prefix: Optional[str] = None) str [source]
Format bucket path URI.
- Parameters
key – S3 object key.
prefix – Directory tree to append to key.
- Returns
S3 bucket URI in
s3://{bucket-name}/{prefix}/{key}
format
- get_versioning() GetBucketVersioningOutputTypeDef [source]
Get the versioning state of a bucket.
To retrieve the versioning state of a bucket, you must be the bucket owner.
- Returns
The current versioning state of the bucket containing
Status
andMFADelete
(only if this has ever been configured).
- sync_from_local(src_directory: str, *, delete: bool = False, exclude: Optional[List[str]] = None, follow_symlinks: bool = False, include: Optional[List[str]] = None, prefix: Optional[str] = None) None [source]
Sync local directory to the S3 Bucket.
- Parameters
src_directory – Local directory to sync to S3.
delete – If true, files that exist in the destination but not in the source are deleted.
exclude – List of patterns for files/objects to exclude.
follow_symlinks – If symlinks should be followed.
include – List of patterns for files/objects to explicitly include.
prefix – Optional prefix to append to synced objects.
- sync_to_local(dest_directory: str, *, delete: bool = False, exclude: Optional[List[str]] = None, follow_symlinks: bool = False, include: Optional[List[str]] = None, prefix: Optional[str] = None) None [source]
Sync S3 bucket to local directory.
- Parameters
dest_directory – Local directory to sync S3 objects to.
delete – If true, files that exist in the destination but not in the source are deleted.
exclude – List of patterns for files/objects to exclude.
follow_symlinks – If symlinks should be followed.
include – List of patterns for files/objects to explicitly include.
prefix – Optional prefix to append to synced objects.
- __new__(**kwargs)