Arke.Utils.Gcp (Arke v0.9.0-rc.2)

Copy Markdown View Source

Google Cloud Storage backend for Arke.Utils.FileStorage.

Talks to the GCS JSON API over Req. The requests it builds are pinned by test/support/fixtures/gcs_requests.exs.

Signed urls use the V4 scheme and last config :arke, :signed_url_ttl seconds (an hour by default, seven days at most), overridable per call with :expires_in.

Summary

Functions

delete_file(file_path, opts \\ [])

get_bucket_file_signed_url(file_path, opts \\ [])

A V4 signed url for the object, valid for :expires_in seconds.

Falls back to config :arke, :signed_url_ttl and then to an hour. Signing is delegated to Arke.Utils.Gcp.Auth.sign/2, which uses the private key when the credentials carry one and the IAM Credentials API otherwise.

get_file(file_path, opts \\ [])

get_public_url(unit, opts \\ [])

upload_file(file_name, file_data, opts \\ [])