ExAws v0.4.19 ExAws.S3.Client behaviour

The purpose of this module is to surface the ExAws.S3 API tied to a single configuration chosen, such that it does not need passed in with every request.

Usage:

defmodule MyApp.S3 do
  use ExAws.S3.Client, otp_app: :my_otp_app
end

In your config

config :my_otp_app, :ex_aws,
  s3: [], # S3 config goes here

You can now use MyApp.S3 as the root module for the S3 api without needing to pass in a particular configuration. This enables different otp apps to configure their AWS configuration separately.

The alignment with a particular OTP app while convenient is however entirely optional. The following also works:

defmodule MyApp.S3 do
  use ExAws.S3.Client

  def config_root do
    Application.get_all_env(:my_aws_config_root)
  end
end

ExAws now expects the config for that S3 client to live under

config :my_aws_config_root
  s3: [] # S3 config goes here

This is in fact how the functions in ExAws.S3 that do not require a config work. Default config values can be found in ExAws.Config. The default configuration is always used, and then the configuration of a particular client is merged in and overrides the defaults.

Summary

Callbacks

Retrieves the root AWS config for this client

Delete a bucket

Delete a bucket cors

Delete a bucket lifecycle

Delete a bucket policy

Delete a bucket replication

Delete a bucket tagging

Delete a bucket website

Delete multiple objects within a bucket

Delete object object in bucket

Same as delete_object/2 but returns just the response or raises on error

Get bucket acl

Get bucket cors

Get bucket lifecycle

Get bucket location

Get bucket logging

Get bucket notification

Get bucket object versions

Get bucket policy

Get bucket replication

Get bucket payment configuration

Get bucket tagging

Get bucket versioning

Get bucket website

Get an object from a bucket

Same as get_object/2,3 but returns just the response or raises on error

Get an object’s access control policy

Get a torrent for a bucket

Determine if a bucket exists

Determine of an object exists

Initiate a multipart upload

List buckets

List multipart uploads for a bucket

List objects in bucket

Same as list_objects/1,2 but returns the result and raises on failure

List the parts of a multipart upload

Determine the CORS configuration for an object

Restore an object to a particular version FIXME

Generates a pre-signed URL for this object

Creates a bucket. Same as create_bucket/2

Update or create a bucket bucket access control

Update or create a bucket CORS policy

Update or create a bucket lifecycle configuration

Update or create a bucket logging configuration

Update or create a bucket notification configuration

Update or create a bucket policy configuration

Update or create a bucket replication configuration

Update or create a bucket requestPayment configuration

Update or create a bucket tagging configuration

Update or create a bucket versioning configuration

Update or create a bucket website configuration

Create an object within a bucket

Same as put_object/2 but returns just the response or raises on error

Create or update an object’s access control FIXME

Same as put_object_acl/3 but raise on error

Same as put_object_copy but raise on error

Enables custom request handling

Stream list of objects in bucket

Upload a part for a multipart upload

Types

acl_opts :: [{:acl, canned_acl} | grant]
amz_meta_opts :: [{atom, binary} | {binary, binary}, ...]
canned_acl ::
  :private |
  :public_read |
  :public_read_write |
  :authenticated_read |
  :bucket_owner_read |
  :bucket_owner_full_control
customer_encryption_opts :: [customer_algorithm: binary, customer_key: binary, customer_key_md5: binary]
encryption_opts ::
  binary |
  [{:aws_kms_key_id, binary}] |
  customer_encryption_opts
get_object_response_opts :: [content_language: binary, expires: binary, cach_control: binary, content_disposition: binary, content_encoding: binary]
grant ::
  {:grant_read, grantee} |
  {:grant_read_acp, grantee} |
  {:grant_write_acp, grantee} |
  {:grant_full_control, grantee}
grantee :: [email: binary, id: binary, uri: binary]
head_object_opts :: [encryption: customer_encryption_opts, range: binary, if_modified_since: binary, if_unmodified_since: binary, if_match: binary, if_none_match: binary]
initiate_multipart_upload_opts :: [{:cache_control, binary} | {:content_disposition, binary} | {:content_encoding, binary} | {:content_type, binary} | {:expires, binary} | {:storage_class, :standard | :redunced_redundancy} | {:website_redirect_location, binary} | {:encryption, encryption_opts} | acl_opts]
list_objects_opts :: [delimiter: binary, encoding_type: binary, marker: binary, max_keys: 0..1000, prefix: binary]
presigned_url_opts :: [expires_in: integer, virtual_host: boolean]
pub_object_copy_opts :: [{:metadata_directive, :COPY | :REPLACE} | {:copy_source_if_modified_since, binary} | {:copy_source_if_unmodified_since, binary} | {:copy_source_if_match, binary} | {:copy_source_if_none_match, binary} | {:website_redirect_location, binary} | {:destination_encryption, encryption_opts} | {:source_encryption, customer_encryption_opts} | {:cache_control, binary} | {:content_disposition, binary} | {:content_encoding, binary} | {:content_length, binary} | {:content_type, binary} | {:expect, binary} | {:expires, binary} | {:storage_class, :standard | :redunced_redundancy} | {:website_redirect_location, binary} | {:meta, amz_meta_opts} | acl_opts]
put_object_opts :: [{:cache_control, binary} | {:content_disposition, binary} | {:content_encoding, binary} | {:content_length, binary} | {:content_type, binary} | {:expect, binary} | {:expires, binary} | {:storage_class, :standard | :redunced_redundancy} | {:website_redirect_location, binary} | {:encryption, encryption_opts} | {:meta, amz_meta_opts} | acl_opts]
upload_part_copy_opts :: [copy_source_range: Range.t, copy_source_if_modified_since: binary, copy_source_if_unmodified_since: binary, copy_source_if_match: binary, copy_source_if_none_match: binary, destination_encryption: encryption_opts, source_encryption: customer_encryption_opts]

Callbacks

abort_multipart_upload(bucket, object, upload_id)

Specs

abort_multipart_upload(bucket :: binary, object :: binary, upload_id :: binary) :: ExAws.Request.response_t

Abort a multipart upload

complete_multipart_upload(bucket, object, upload_id, parts)

Specs

complete_multipart_upload(bucket :: binary, object :: binary, upload_id :: binary, parts :: [{binary | pos_integer, binary}, ...]) :: ExAws.Request.response_t

Complete a multipart upload

config_root()

Specs

config_root :: Keyword.t

Retrieves the root AWS config for this client

delete_all_objects(bucket, objects)

Specs

delete_all_objects(bucket :: binary, objects :: [binary | {binary, binary}, ...]) ::
  {:ok, [ExAws.Request.success_content, ...]} |
  ExAws.Request.error_t
delete_all_objects(bucket, objects, opts)

Specs

delete_all_objects(bucket :: binary, objects :: [binary | {binary, binary}, ...], opts :: [{:quiet, true}]) ::
  {:ok, [ExAws.Request.success_content, ...]} |
  ExAws.Request.error_t
delete_bucket(bucket)

Specs

delete_bucket(bucket :: binary) :: ExAws.Request.response_t

Delete a bucket

delete_bucket_cors(bucket)

Specs

delete_bucket_cors(bucket :: binary) :: ExAws.Request.response_t

Delete a bucket cors

delete_bucket_lifecycle(bucket)

Specs

delete_bucket_lifecycle(bucket :: binary) :: ExAws.Request.response_t

Delete a bucket lifecycle

delete_bucket_policy(bucket)

Specs

delete_bucket_policy(bucket :: binary) :: ExAws.Request.response_t

Delete a bucket policy

delete_bucket_replication(bucket)

Specs

delete_bucket_replication(bucket :: binary) :: ExAws.Request.response_t

Delete a bucket replication

delete_bucket_tagging(bucket)

Specs

delete_bucket_tagging(bucket :: binary) :: ExAws.Request.response_t

Delete a bucket tagging

delete_bucket_website(bucket)

Specs

delete_bucket_website(bucket :: binary) :: ExAws.Request.response_t

Delete a bucket website

delete_multiple_objects(bucket, objects)

Specs

delete_multiple_objects(bucket :: binary, objects :: [binary | {binary, binary}, ...]) :: ExAws.Request.response_t

Delete multiple objects within a bucket

delete_multiple_objects(bucket, objects, opts)

Specs

delete_multiple_objects(bucket :: binary, objects :: [binary | {binary, binary}, ...], opts :: [{:quiet, true}]) :: ExAws.Request.response_t
delete_object(bucket, object)

Specs

delete_object(bucket :: binary, object :: binary) :: ExAws.Request.response_t

Delete object object in bucket

delete_object!(bucket, object)

Specs

delete_object!(bucket :: binary, object :: binary) :: ExAws.Request.success_content

Same as delete_object/2 but returns just the response or raises on error

get_bucket_acl(bucket)

Specs

get_bucket_acl(bucket :: binary) :: ExAws.Request.response_t

Get bucket acl

get_bucket_cors(bucket)

Specs

get_bucket_cors(bucket :: binary) :: ExAws.Request.response_t

Get bucket cors

get_bucket_lifecycle(bucket)

Specs

get_bucket_lifecycle(bucket :: binary) :: ExAws.Request.response_t

Get bucket lifecycle

get_bucket_location(bucket)

Specs

get_bucket_location(bucket :: binary) :: ExAws.Request.response_t

Get bucket location

get_bucket_logging(bucket)

Specs

get_bucket_logging(bucket :: binary) :: ExAws.Request.response_t

Get bucket logging

get_bucket_notification(bucket)

Specs

get_bucket_notification(bucket :: binary) :: ExAws.Request.response_t

Get bucket notification

get_bucket_object_versions(bucket)

Specs

get_bucket_object_versions(bucket :: binary) :: ExAws.Request.response_t

Get bucket object versions

get_bucket_object_versions(bucket, opts)

Specs

get_bucket_object_versions(bucket :: binary, opts :: Keyword.t) :: ExAws.Request.response_t
get_bucket_policy(bucket)

Specs

get_bucket_policy(bucket :: binary) :: ExAws.Request.response_t

Get bucket policy

get_bucket_replication(bucket)

Specs

get_bucket_replication(bucket :: binary) :: ExAws.Request.response_t

Get bucket replication

get_bucket_request_payment(bucket)

Specs

get_bucket_request_payment(bucket :: binary) :: ExAws.Request.response_t

Get bucket payment configuration

get_bucket_tagging(bucket)

Specs

get_bucket_tagging(bucket :: binary) :: ExAws.Request.response_t

Get bucket tagging

get_bucket_versioning(bucket)

Specs

get_bucket_versioning(bucket :: binary) :: ExAws.Request.response_t

Get bucket versioning

get_bucket_website(bucket)

Specs

get_bucket_website(bucket :: binary) :: ExAws.Request.response_t

Get bucket website

get_object(bucket, object)

Specs

get_object(bucket :: binary, object :: binary) :: ExAws.Request.response_t

Get an object from a bucket

get_object(bucket, object, opts)

Specs

get_object(bucket :: binary, object :: binary, opts :: get_object_opts) :: ExAws.Request.response_t
get_object!(bucket, object)

Specs

get_object!(bucket :: binary, object :: binary) :: ExAws.Request.success_content

Same as get_object/2,3 but returns just the response or raises on error

get_object!(bucket, object, opts)

Specs

get_object!(bucket :: binary, object :: binary, opts :: get_object_opts) :: ExAws.Request.success_content
get_object_acl(bucket, object)

Specs

get_object_acl(bucket :: binary, object :: binary) :: ExAws.Request.response_t

Get an object’s access control policy

get_object_acl(bucket, object, opts)

Specs

get_object_acl(bucket :: binary, object :: binary, opts :: Keyword.t) :: ExAws.Request.response_t
get_object_torrent(bucket, object)

Specs

get_object_torrent(bucket :: binary, object :: binary) :: ExAws.Request.response_t

Get a torrent for a bucket

head_bucket(bucket)

Specs

head_bucket(bucket :: binary) :: ExAws.Request.response_t

Determine if a bucket exists

head_object(bucket, object)

Specs

head_object(bucket :: binary, object :: binary) :: ExAws.Request.response_t

Determine of an object exists

head_object(bucket, object, opts)

Specs

head_object(bucket :: binary, object :: binary, opts :: head_object_opts) :: ExAws.Request.response_t
initiate_multipart_upload(bucket, object)

Specs

initiate_multipart_upload(bucket :: binary, object :: binary) :: ExAws.Request.response_t

Initiate a multipart upload

initiate_multipart_upload(bucket, object, opts)

Specs

initiate_multipart_upload(bucket :: binary, object :: binary, opts :: initiate_multipart_upload_opts) :: ExAws.Request.response_t
list_buckets()

Specs

list_buckets :: ExAws.Request.response_t

List buckets

list_buckets(opts)

Specs

list_buckets(opts :: Keyword.t) :: ExAws.Request.response_t
list_multipart_uploads(bucket)

Specs

list_multipart_uploads(bucket :: binary) :: ExAws.Request.response_t

List multipart uploads for a bucket

list_multipart_uploads(bucket, opts)

Specs

list_multipart_uploads(bucket :: binary, opts :: Keyword.t) :: ExAws.Request.response_t
list_objects(bucket)

Specs

list_objects(bucket :: binary) :: ExAws.Request.response_t

List objects in bucket

list_objects(bucket, opts)

Specs

list_objects(bucket :: binary, opts :: list_objects_opts) :: ExAws.Request.response_t
list_objects!(bucket)

Specs

list_objects!(bucket :: binary) :: ExAws.Request.success_content

Same as list_objects/1,2 but returns the result and raises on failure.

list_objects!(bucket, opts)

Specs

list_objects!(bucket :: binary, opts :: list_objects_opts) :: ExAws.Request.success_content
list_parts(bucket, object, upload_id)

Specs

list_parts(bucket :: binary, object :: binary, upload_id :: binary) :: ExAws.Request.response_t

List the parts of a multipart upload

list_parts(bucket, object, upload_id, opts)

Specs

list_parts(bucket :: binary, object :: binary, upload_id :: binary, opts :: Keyword.t) :: ExAws.Request.response_t
options_object(bucket, object, origin, request_method)

Specs

options_object(bucket :: binary, object :: binary, origin :: binary, request_method :: atom) :: ExAws.Request.response_t

Determine the CORS configuration for an object

options_object(bucket, object, origin, request_method, request_headers)

Specs

options_object(bucket :: binary, object :: binary, origin :: binary, request_method :: atom, request_headers :: [binary, ...]) :: ExAws.Request.response_t
post_object_restore(bucket, object, version_id, number_of_days)

Specs

post_object_restore(bucket :: binary, object :: binary, version_id :: binary, number_of_days :: pos_integer) :: ExAws.Request.response_t

Restore an object to a particular version FIXME

presigned_url(http_method, bucket, object, opts)

Specs

presigned_url(http_method :: atom, bucket :: binary, object :: binary, opts :: presigned_url_opts) ::
  {:ok, binary} |
  {:error, binary}

Generates a pre-signed URL for this object.

When option param :virtual_host is true, the {#bucket} name will be used as the hostname. This will cause the returned URL to be ‘http’ and not ‘https’.

put_bucket(bucket, region)

Specs

put_bucket(bucket :: binary, region :: binary) :: ExAws.Request.response_t

Creates a bucket. Same as create_bucket/2

put_bucket_acl(bucket, opts)

Specs

put_bucket_acl(bucket :: binary, opts :: acl_opts) :: ExAws.Request.response_t

Update or create a bucket bucket access control

put_bucket_cors(bucket, cors_config)

Specs

put_bucket_cors(bucket :: binary, cors_config :: %{}) :: ExAws.Request.response_t

Update or create a bucket CORS policy

put_bucket_lifecycle(bucket, lifecycle_config)

Specs

put_bucket_lifecycle(bucket :: binary, lifecycle_config :: %{}) :: ExAws.Request.response_t

Update or create a bucket lifecycle configuration

put_bucket_logging(bucket, logging_config)

Specs

put_bucket_logging(bucket :: binary, logging_config :: %{}) :: ExAws.Request.response_t

Update or create a bucket logging configuration

put_bucket_notification(bucket, notification_config)

Specs

put_bucket_notification(bucket :: binary, notification_config :: %{}) :: ExAws.Request.response_t

Update or create a bucket notification configuration

put_bucket_policy(bucket, policy)

Specs

put_bucket_policy(bucket :: binary, policy :: %{}) :: ExAws.Request.response_t

Update or create a bucket policy configuration

put_bucket_replication(bucket, replication_config)

Specs

put_bucket_replication(bucket :: binary, replication_config :: %{}) :: ExAws.Request.response_t

Update or create a bucket replication configuration

put_bucket_request_payment(bucket, payer)

Specs

put_bucket_request_payment(bucket :: binary, payer :: :requester | :bucket_owner) :: ExAws.Request.response_t

Update or create a bucket requestPayment configuration

put_bucket_tagging(bucket, tags)

Specs

put_bucket_tagging(bucket :: binary, tags :: %{}) :: ExAws.Request.response_t

Update or create a bucket tagging configuration

put_bucket_versioning(bucket, version_config)

Specs

put_bucket_versioning(bucket :: binary, version_config :: binary) :: ExAws.Request.response_t

Update or create a bucket versioning configuration

put_bucket_website(bucket, website_config)

Specs

put_bucket_website(bucket :: binary, website_config :: binary) :: ExAws.Request.response_t

Update or create a bucket website configuration

put_object(bucket, object, body)

Specs

put_object(bucket :: binary, object :: binary, body :: binary) :: ExAws.Request.response_t

Create an object within a bucket

put_object(bucket, object, body, opts)

Specs

put_object(bucket :: binary, object :: binary, body :: binary, opts :: put_object_opts) :: ExAws.Request.response_t
put_object!(bucket, object, body)

Specs

put_object!(bucket :: binary, object :: binary, body :: binary) :: ExAws.Request.success_content

Same as put_object/2 but returns just the response or raises on error

put_object!(bucket, object, body, opts)

Specs

put_object!(bucket :: binary, object :: binary, body :: binary, opts :: put_object_opts) :: ExAws.Request.success_content
put_object_acl(bucket, object, acl)

Specs

put_object_acl(bucket :: binary, object :: binary, acl :: acl_opts) :: ExAws.Request.response_t

Create or update an object’s access control FIXME

put_object_acl!(bucket, object, acl)

Specs

put_object_acl!(bucket :: binary, object :: binary, acl :: acl_opts) :: ExAws.Request.success_content

Same as put_object_acl/3 but raise on error

put_object_copy(dest_bucket, dest_object, src_bucket, src_object)

Specs

put_object_copy(dest_bucket :: binary, dest_object :: binary, src_bucket :: binary, src_object :: binary) :: ExAws.Request.response_t

Copy an object

put_object_copy(dest_bucket, dest_object, src_bucket, src_object, opts)

Specs

put_object_copy(dest_bucket :: binary, dest_object :: binary, src_bucket :: binary, src_object :: binary, opts :: pub_object_copy_opts) :: ExAws.Request.response_t
put_object_copy!(dest_bucket, dest_object, src_bucket, src_object)

Specs

put_object_copy!(dest_bucket :: binary, dest_object :: binary, src_bucket :: binary, src_object :: binary) :: ExAws.Request.success_content

Same as put_object_copy but raise on error

put_object_copy!(dest_bucket, dest_object, src_bucket, src_object, opts)

Specs

put_object_copy!(dest_bucket :: binary, dest_object :: binary, src_bucket :: binary, src_object :: binary, opts :: pub_object_copy_opts) :: ExAws.Request.success_content
request(client, http_method, bucket, path)

Specs

request(client :: %{}, http_method :: atom, bucket :: binary, path :: binary) :: ExAws.Request.response_t

Enables custom request handling.

By default this just forwards the request to the ExAws.S3.Request.request/4. However, this can be overriden in your client to provide pre-request adjustments to headers, params, etc.

request(client, http_method, bucket, path, data)

Specs

request(client :: %{}, http_method :: atom, bucket :: binary, path :: binary, data :: Keyword.t) :: ExAws.Request.response_t
stream_objects!(bucket)

Specs

stream_objects!(bucket :: binary) :: Enumerable.t

Stream list of objects in bucket

stream_objects!(bucket, opts)

Specs

stream_objects!(bucket :: binary, opts :: list_objects_opts) :: Enumerable.t
upload_part(bucket, object, upload_id, part_number, body)

Specs

upload_part(bucket :: binary, object :: binary, upload_id :: binary, part_number :: pos_integer, body :: binary) :: ExAws.Request.response_t

Upload a part for a multipart upload

upload_part(bucket, object, upload_id, part_number, body, opts)

Specs

upload_part(bucket :: binary, object :: binary, upload_id :: binary, part_number :: pos_integer, body :: binary, opts :: [encryption_opts | {:expect, binary}]) :: ExAws.Request.response_t
upload_part_copy(dest_bucket, dest_object, src_bucket, src_object)

Specs

upload_part_copy(dest_bucket :: binary, dest_object :: binary, src_bucket :: binary, src_object :: binary) :: ExAws.Request.response_t

Upload a part for a multipart copy

upload_part_copy(dest_bucket, dest_object, src_bucket, src_object, opts)

Specs

upload_part_copy(dest_bucket :: binary, dest_object :: binary, src_bucket :: binary, src_object :: binary, opts :: upload_part_copy_opts) :: ExAws.Request.response_t