Skip to content

Commit

Permalink
Merge branch 'master' of github.com:CargoSense/ex_aws
Browse files Browse the repository at this point in the history
  • Loading branch information
benwilson512 committed Jun 1, 2016
2 parents 7be12c0 + cbce71e commit cf2cfea
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ex_aws/s3/client.ex
Expand Up @@ -225,6 +225,13 @@ defmodule ExAws.S3.Client do
bucket :: binary,
objects :: [binary | {binary, binary}, ...], opts :: [quiet: true]):: ExAws.Request.response_t

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

@type get_object_response_opts :: [
{:content_language, binary}
| {:expires, binary}
Expand Down
14 changes: 14 additions & 0 deletions lib/ex_aws/s3/impl.ex
Expand Up @@ -234,6 +234,20 @@ defmodule ExAws.S3.Impl do
request(client, :post, bucket, "/?delete", body: body_binary, headers: %{"content-md5" => content_md5})
end

def delete_all_objects(client, bucket, objects, opts \\ []) do
do_delete_all(client, bucket, objects, opts, [])
end

defp do_delete_all(_client, _bucket, [], _opts, acc) do
{:ok, Enum.reverse(acc)}
end
defp do_delete_all(client, bucket, objects, opts, acc) do
{objects, rest} = Enum.split(objects, 1000)
with {:ok, result} <- delete_multiple_objects(client, bucket, objects, opts) do
do_delete_all(client, bucket, rest, opts, [result | acc])
end
end

@response_params [:content_type, :content_language, :expires, :cache_control, :content_disposition, :content_encoding]
@request_headers [:range, :if_modified_since, :if_unmodified_since, :if_match, :if_none_match]
def get_object(client, bucket, object, opts \\ []) do
Expand Down

0 comments on commit cf2cfea

Please sign in to comment.