guss v0.1.6 Guss.Resource View Source

Data structure for Signed URL components.

Link to this section Summary

Types

A request header that applies predefined (canned) ACLs to a bucket or object when you upload it or create it.

Predefined (canned) access control policies.

Canonical extension headers provide extended request functionality.

HTTP verbs for Signed URLs.

Custom metadata for resource requests/responses.

t()

Components of a GCS Resource URL

Functions

Get a list of canonical headers for the given resource.

Link to this section Types

Link to this type

acl_header()

View Source
acl_header() :: {:acl, acl_policy()}

A request header that applies predefined (canned) ACLs to a bucket or object when you upload it or create it.

For more information, see x-goog-acl.

Link to this type

acl_policy()

View Source
acl_policy() ::
  :private
  | :project_private
  | :public_read
  | :public_read_write
  | :authenticated_read
  | :bucket_owner_read
  | :bucket_owner_full_control
  | String.t()

Predefined (canned) access control policies.

Link to this type

extension_header()

View Source
extension_header() :: [
  acl_header() | meta_header() | {atom() | String.t(), atom() | String.t()}
]
Link to this type

extensions()

View Source
extensions() :: [extension_header()]

Canonical extension headers provide extended request functionality.

For more information, see Canonical Extension Headers.

Link to this type

http_verb()

View Source
http_verb() :: :get | :post | :put | :delete

HTTP verbs for Signed URLs.

Link to this type

meta_header()

View Source
meta_header() :: {:meta, list()}

Custom metadata for resource requests/responses.

For more information, see x-goog-meta-

Link to this type

t()

View Source
t() :: %Guss.Resource{
  account: nil | atom() | String.t(),
  base_url: String.t(),
  bucket: String.t(),
  content_md5: nil | String.t(),
  content_type: nil | String.t(),
  expires: nil | non_neg_integer(),
  extensions: extensions(),
  http_verb: http_verb(),
  objectname: String.t()
}

Components of a GCS Resource URL

For more information, see String Components.

Link to this section Functions

Link to this function

signed_headers(resource)

View Source

Get a list of canonical headers for the given resource.

This function returns a list of tuples for all headers defined on a Guss.Resource. The list maintains the ordering of custom extensions. To ensure full compatibility, the request using the Signed URL should apply the signed headers in the order returned.

For more information, see Guss.CanonicalData.

Examples

iex> Guss.put("b", "o.txt")
...> |> Guss.Resource.signed_headers()
[]

iex> Guss.Resource.signed_headers(Guss.put("b", "o.txt", content_type: "text/plain"))
[{"content-type", "text/plain"}]