Bucket operations for the Google Cloud Storage JSON API.
Responses are the decoded JSON
Bucket resource
as a map with string keys (e.g. %{"name" => ..., "location" => ...}).
These functions are exposed through the top-level GcpGcs module; call them
there unless you need the focused namespace.
Summary
Functions
Creates a bucket in project_id.
Deletes a bucket. Returns :ok on success.
Gets a bucket's metadata.
Lists buckets in project_id.
Patches a bucket's metadata with attrs (a map of Bucket resource fields).
Functions
@spec create(String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GcpGcs.Error.t()}
Creates a bucket in project_id.
Options
:location— e.g."US","EU","us-central1":storage_class— e.g."STANDARD","NEARLINE","COLDLINE","ARCHIVE":predefined_acl— e.g."private","publicRead":attrs— a map of any additional Bucket resource fields, merged into the request body:timeout— request timeout in ms
@spec delete( String.t(), keyword() ) :: :ok | {:error, GcpGcs.Error.t()}
Deletes a bucket. Returns :ok on success.
@spec get( String.t(), keyword() ) :: {:ok, map()} | {:error, GcpGcs.Error.t()}
Gets a bucket's metadata.
@spec list( String.t(), keyword() ) :: {:ok, %{items: list(), next_page_token: String.t() | nil}} | {:error, GcpGcs.Error.t()}
Lists buckets in project_id.
Options
:prefix— filter results to names starting with this prefix:page_size— maximum results per page (maps tomaxResults):page_token— pagination token
Returns {:ok, %{items: [...], next_page_token: token}}.
@spec update(String.t(), map(), keyword()) :: {:ok, map()} | {:error, GcpGcs.Error.t()}
Patches a bucket's metadata with attrs (a map of Bucket resource fields).