ExAzureCore. Credentials. AzureSasCredential
(ex_azure_core v0.3.0)
Copy Markdown
Credential type for Shared Access Signature (SAS) authentication.
Stores a SAS token that can be used with Azure Storage services. The signature is automatically normalized (leading "?" is stripped).
Example
{:ok, credential} = AzureSasCredential.new("sv=2021-06-08&ss=b&srt=sco...")
credential.signature
#=> "sv=2021-06-08&ss=b&srt=sco..."
# Leading "?" is stripped automatically
{:ok, credential} = AzureSasCredential.new("?sv=2021-06-08&ss=b...")
credential.signature
#=> "sv=2021-06-08&ss=b..."
Summary
Functions
Creates a new SAS credential.
Creates a new SAS credential, raising on invalid input.
Updates the signature value, returning a new credential.
Types
@type t() :: %ExAzureCore.Credentials.AzureSasCredential{signature: String.t()}
Functions
@spec new(String.t()) :: {:ok, t()} | {:error, ExAzureCore.Credentials.Errors.CredentialError.t()}
Creates a new SAS credential.
Returns {:ok, credential} if the signature is a non-empty string,
or {:error, CredentialError} otherwise.
The signature is normalized by stripping any leading "?" character.
Creates a new SAS credential, raising on invalid input.
@spec update(t(), String.t()) :: {:ok, t()} | {:error, ExAzureCore.Credentials.Errors.CredentialError.t()}
Updates the signature value, returning a new credential.
This is immutable - returns a new struct rather than modifying in-place.