ExOss.StorageTask (ExOss v1.2.0)

Copy Markdown View Source

Storage task struct for file transfer operations.

Location Types

  • {:cloud, bucket, res_key} - Cloud storage
  • {:remote, url} - Remote URL
  • {:file, path} - Local file
  • {:content, binary} - Raw content

Upload options accept headers: %{"content-type" => "image/png"} (or a list of string pairs). Outer options can also use "headers" / "content_type" string keys in a map. Legacy content_type is retained; explicit headers win. Headers are passed through without provider translation. Multipart object headers are sent on initiation, not every part.

Examples

# Upload from URL
%StorageTask{source: {:remote, url}, target: {:cloud, bucket, key}}

# Delete
%StorageTask{source: {:cloud, bucket, key}, target: nil}

# Delete after N days
%StorageTask{source: {:cloud, bucket, key}, target: nil, opts: [days: 7]}

Summary

Types

object()

@type object() ::
  {:cloud, bucket :: binary(), res_key :: binary()}
  | {:remote, url :: binary()}
  | {:file, path :: binary()}
  | {:content, content :: binary()}

t()

@type t() :: %ExOss.StorageTask{
  opts: ExOss.Options.t(),
  policy: term(),
  source: object(),
  target: object() | nil
}