AWS S3
https://github.com/samoconnor/AWSS3.jl
AWSS3.s3_arn
AWSS3.s3_copy
AWSS3.s3_create_bucket
AWSS3.s3_delete
AWSS3.s3_delete_bucket
AWSS3.s3_delete_tags
AWSS3.s3_enable_versioning
AWSS3.s3_exists
AWSS3.s3_get
AWSS3.s3_get_file
AWSS3.s3_get_meta
AWSS3.s3_get_tags
AWSS3.s3_list_buckets
AWSS3.s3_list_objects
AWSS3.s3_list_versions
AWSS3.s3_purge_versions
AWSS3.s3_put
AWSS3.s3_put_cors
AWSS3.s3_put_tags
AWSS3.s3_sign_url
AWS S3 Objects
AWSS3.s3_get
— Function.s3_get([::AWSConfig], bucket, path; <keyword arguments>)
Get Object from path
in bucket
.
Optional Arguments
version=
: version of object to get.retry=true
: try again on "NoSuchBucket", "NoSuchKey" (common if object was recently created).raw=false
: return response asVector{UInt8}
(by default return type depends onContent-Type
header).
AWSS3.s3_get_file
— Function.s3_get_file([::AWSConfig], bucket, path, filename; [version=])
Like s3_get
but streams result directly to filename
.
AWSS3.s3_get_meta
— Function.s3_get_meta([::AWSConfig], bucket, path; [version=])
Retrieves metadata from an object without returning the object itself.
AWSS3.s3_exists
— Function.s3_exists([::AWSConfig], bucket, path [version=])
Is there an object in bucket
at path
?
AWSS3.s3_put
— Function.s3_put([::AWSConfig], bucket, path, data; <keyword arguments>
PUT Object data
at path
in bucket
.
Optional Arguments
data_type=
;Content-Type
header.encoding=
;Content-Encoding
header.metadata::Dict=
;x-amz-meta-
headers.tags::Dict=
;x-amz-tagging-
headers (see alsos3_put_tags
ands3_get_tags
).
AWSS3.s3_purge_versions
— Function.s3_purge_versions([::AWSConfig], bucket, [path [, pattern]])
DELETE all object versions except for the latest version.
AWSS3.s3_delete
— Function.s3_delete([::AWSConfig], bucket, path; [version=]
AWSS3.s3_copy
— Function.s3_copy([::AWSConfig], bucket, path; to_bucket=bucket, to_path=path)
Optional Arguments
metadata::Dict=
; optionalx-amz-meta-
headers.
AWSS3.s3_sign_url
— Function.s3_sign_url([::AWSConfig], bucket, path, [seconds=3600];
[verb="GET"], [content_type="application/octet-stream"])
Create a pre-signed url for bucket
and path
(expires after for seconds
).
To create an upload URL use verb="PUT"
and set content_type
to match the type used in the Content-Type
header of the PUT request.
url = s3_sign_url("my_bucket", "my_file.txt"; verb="PUT")
Requests.put(URI(url), "Hello!")
url = s3_sign_url("my_bucket", "my_file.txt";
verb="PUT", content_type="text/plain")
Requests.put(URI(url), "Hello!";
headers=Dict("Content-Type" => "text/plain"))
AWS S3 Buckets
AWSS3.s3_list_buckets
— Function.s3_list_buckets([::AWSConfig])
AWSS3.s3_list_objects
— Function.s3_list_objects([::AWSConfig], bucket, [path_prefix])
List Objects in bucket
with optional path_prefix
.
Returns Vector{Dict}
with keys Key
, LastModified
, ETag
, Size
, Owner
, StorageClass
.
AWSS3.s3_list_versions
— Function.s3_list_versions([::AWSConfig], bucket, [path_prefix])
List object versions in bucket
with optional path_prefix
.
AWSS3.s3_create_bucket
— Function.s3_create_bucket([:AWSConfig], bucket)
AWSS3.s3_put_cors
— Function.s3_put_cors([::AWSConfig], bucket, cors_config)
s3_put_cors("my_bucket", """
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>http://my.domain.com</AllowedOrigin>
<AllowedOrigin>http://my.other.domain.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
<ExposeHeader>Content-Range</ExposeHeader>
</CORSRule>
</CORSConfiguration>
"""
AWSS3.s3_enable_versioning
— Function.s3_enable_versioning([::AWSConfig], bucket)
AWSS3.s3_delete_bucket
— Function.s3_delete_bucket([::AWSConfig], "bucket")
AWS S3 Bucket and Object Tagging
AWSS3.s3_put_tags
— Function.s3_put_tags([::AWSConfig], bucket, [path,] tags::Dict)
PUT tags
on bucket
or object (path
).
See also tags=
option on s3_put
.
AWSS3.s3_get_tags
— Function.s3_get_tags([::AWSConfig], bucket, [path])
Get tags from bucket
or object (path
).
AWSS3.s3_delete_tags
— Function.s3_delete_tags([::AWSConfig], bucket, [path])
Delete tags from bucket
or object (path
).
AWSS3 Internals
AWSS3.s3_arn
— Function.s3_arn(resource)
s3_arn(bucket,path)
Amazon Resource Name for S3 resource
or bucket
and path
.
s3_arn("my_bucket/foo/bar.txt")
"arn:aws:s3:::my_bucket/foo/bar.txt"
s3_arn("my_bucket","foo/bar.txt")
"arn:aws:s3:::my_bucket/foo/bar.txt"