GcsSignedUrl.generate_v4

You're seeing just the function generate_v4, go back to GcsSignedUrl module for more information.
Link to this function

generate_v4(client, bucket, filename, opts \\ [])

View Source

Specs

generate_v4(GcsSignedUrl.Client.t(), String.t(), String.t(), sign_v4_opts()) ::
  String.t()
generate_v4(
  GcsSignedUrl.SignBlob.OAuthConfig.t(),
  String.t(),
  String.t(),
  sign_v4_opts()
) :: {:ok, String.t()} | {:error, String.t()}

If the first argument is a GcsSignedUrl.Client{}: Generate V4 signed url using its private key.

If the first argument is a %GcsSignedUrl.SignBlob.OAuthConfig{}: Generate V4 signed url using the Google IAM REST API with a OAuth2 token of a service account.

Examples

iex> client = GcsSignedUrl.Client.load(%{private_key: "...", client_email: "..."})
iex> GcsSignedUrl.generate_v4(client, "my-bucket", "my-object.mp4", verb: "PUT", expires: 1800, headers: ["Content-Type": "application/json"])
"https://storage.googleapis.com/my-bucket/my-object.mp4?X-Goog-Expires=1800..."

iex> oauth_config = %GcsSignedUrl.SignBlob.OAuthConfig{service_account: "...", access_token: "..."}
iex> GcsSignedUrl.generate_v4(oauth_config, "my-bucket", "my-object.mp4", verb: "PUT", expires: 1800, headers: ["Content-Type": "application/json"])
{:ok, "https://storage.googleapis.com/my-bucket/my-object.mp4?X-Goog-Expires=1800..."}