ExAzureCore. Credentials. AzureKeyCredential
(ex_azure_core v0.2.0)
Copy Markdown
Credential type for API key authentication.
Stores a single API key that can be used with services requiring
api-key, Ocp-Apim-Subscription-Key, or similar header-based authentication.
Example
{:ok, credential} = AzureKeyCredential.new("my-secret-key")
credential.key
#=> "my-secret-key"
# Update returns a new credential (immutable)
{:ok, updated} = AzureKeyCredential.update(credential, "new-key")
Summary
Functions
Creates a new key credential.
Creates a new key credential, raising on invalid input.
Updates the key value, returning a new credential.
Types
@type t() :: %ExAzureCore.Credentials.AzureKeyCredential{key: String.t()}
Functions
@spec new(String.t()) :: {:ok, t()} | {:error, ExAzureCore.Credentials.Errors.CredentialError.t()}
Creates a new key credential.
Returns {:ok, credential} if the key is a non-empty string,
or {:error, CredentialError} otherwise.
Creates a new key credential, raising on invalid input.
@spec update(t(), String.t()) :: {:ok, t()} | {:error, ExAzureCore.Credentials.Errors.CredentialError.t()}
Updates the key value, returning a new credential.
This is immutable - returns a new struct rather than modifying in-place.