View Source Azurex.Blob.SharedAccessSignature (AzureX v1.1.0)

Implements shared access signatures (SAS) on Blob Storage resources.

Based on: https://learn.microsoft.com/en-us/rest/api/storageservices/create-service-sas

Summary

Functions

Generates a SAS url on a resource in a given container.

Functions

Link to this function

sas_url(container, resource, opts \\ [])

View Source
@spec sas_url(String.t(), String.t(), [{atom(), any()}]) :: String.t()

Generates a SAS url on a resource in a given container.

Params

  • container: the storage container name
  • resource: the path to the resource (blob, container, directory...)
  • opts: an optional keyword list with following options
    • resource_type: one of :blob / :blob_version / :blob_snapshot / :container / directory Defaults to :container
    • permissions: a list of permissions. Defaults to [:read]
    • from: a tuple to defined when the SAS url validity begins. Defaults to now.
    • expiry: a tuple to set how long before the SAS url expires. Defaults to {:second, 3600}.

Examples

  • SharedAccessSignature.sas_url("my_container", "/", permissions: [:write], expiry: {:day, 2})
  • SharedAccessSignature.sas_url("my_container", "foo/song.mp3", resource_type: :blob)