uri#
S3 URI (Uniform Resource Identifier), ARN (Amazon Resource Name), console URL related API.
- class s3pathlib.core.uri.UriAPIMixin[source]#
A mixin class that implements the S3 URI, ARN, console url etc …
- bucket[source]#
Return bucket name as string, if available.
Example:
>>> S3Path("bucket/folder/file.txt").bucket 'bucket'
New in version 1.0.1.
- key[source]#
Return object or directory key as string, if available.
Examples:
# a s3 object >>> S3Path("bucket/folder/file.txt").key 'folder/file.txt' # a s3 object >>> S3Path("bucket/folder/").key 'folder/file.txt' # a relative path >>> S3Path("bucket/folder/file.txt").relative_to(S3Path("bucket")).key 'folder/file.txt >>> S3Path("bucket/folder/").relative_to(S3Path("bucket")).key 'folder/' # an empty S3Path >>> S3Path().key ''
New in version 1.0.1.
- uri[source]#
Return AWS S3 URI.
for regular s3 object, it returns
"s3://{bucket}/{key}"
if it is a directory, the s3 uri always ends with
"/"
.if it is bucket only (no key), it returns
"s3://{bucket}/"
if it is not an concrete S3Path, it returns
None
- it has to have bucket, if not (usually because it is an relative path)
it returns
None
Examples:
>>> S3Path("bucket", "folder", "file.txt").uri 's3://bucket/folder/file.txt' >>> S3Path("bucket", "folder/").uri 's3://bucket/folder/' >>> S3Path("bucket").uri 's3://bucket/' # void path doesn't have uri >>> S3Path().uri None # relative path doesn't have uri >>> S3Path("bucket/folder/file.txt").relative_to(S3Path("bucket")).uri None
New in version 1.0.1.
- property console_url: str | None#
Return an url that can inspect the object, directory details in AWS Console.
New in version 1.0.1.
Changed in version 2.0.1: now take the version id into consideration.
- property us_gov_cloud_console_url: str | None#
Return a Gov Cloud url that can inspect the object, directory details in AWS Console.
New in version 1.0.5.
Changed in version 2.0.1: now take the version id into consideration.
- property s3_select_console_url: str | None#
Return an AWS US Gov Cloud S3 Console url that can inspect data with s3 select.
New in version 1.0.12.
- property s3_select_us_gov_cloud_console_url: str | None#
Return an AWS S3 Console url that can inspect data with s3 select.
New in version 1.0.12.
- arn[source]#
Return an AWS S3 Resource ARN. See ARN definition here
New in version 1.0.1.