View Source Momento.Auth.CredentialProvider (Momento Elixir SDK v0.8.0)
Handles decoding and managing Momento authentication credentials.
Link to this section Summary
Functions
Constructs a credential provider from the given v2 api key and endpoint.
Parses the given disposable token into a credential provider.
Fetches the given environment variable and parses it into a credential.
Fetches the Momento service endpoint and v2 api key stored in the given environment variables in order to construct a credential provider.
Parses the given string into a credential.
Link to this section Types
@opaque t()
Link to this section Functions
Constructs a credential provider from the given v2 api key and endpoint.
Returns the credential or raises an exception.
examples
Examples
iex> valid_token = "valid_token" # This should be a valid Momento v2 api key.
iex> Momento.Auth.CredentialProvider.from_api_key_v2!(valid_token, "momento.endpoint.here")
%Momento.Auth.CredentialProvider{}
Parses the given disposable token into a credential provider.
Returns the credential provider or raises an exception.
examples
Examples
iex> valid_token = "valid_token" # This should be a valid Momento auth token.
iex> Momento.Auth.CredentialProvider.from_disposable_token!(valid_token)
%Momento.Auth.CredentialProvider{}
@spec from_env_var!( env_var :: String.t(), opts :: [control_endpoint: String.t(), cache_endpoint: String.t()] ) :: t()
Fetches the given environment variable and parses it into a credential.
Returns the credential or raises an exception.
Supply control_endpoint or cache_endpoint in the options to override them.
examples
Examples
iex> Momento.Auth.CredentialProvider.from_env_var!("MOMENTO_AUTH_TOKEN")
%Momento.Auth.CredentialProvider{}
from_env_var_v2!(api_key_env_var \\ "MOMENTO_API_KEY", endpoint_env_var \\ "MOMENTO_ENDPOINT")
View SourceFetches the Momento service endpoint and v2 api key stored in the given environment variables in order to construct a credential provider.
Returns the credential provider or raises an exception.
examples
Examples
iex> Momento.Auth.CredentialProvider.from_env_var_v2!("MOMENTO_API_KEY", "MOMENTO_ENDPOINT")
%Momento.Auth.CredentialProvider{}
Parses the given string into a credential.
Returns the credential or raises an exception.
Supply control_endpoint or cache_endpoint in the options to override them.
examples
Examples
iex> valid_token = "valid_token" # This should be a valid Momento auth token.
iex> Momento.Auth.Credential.from_string!(valid_token)
%Momento.Auth.Credential{}