View Source Momento.Auth.CredentialProvider (Momento Elixir SDK v0.6.6)

Handles decoding and managing Momento authentication credentials.

Link to this section Summary

Functions

Fetches the given environment variable and parses it into a credential.

Parses the given string into a credential.

Link to this section Types

@opaque t()

Link to this section Functions

Link to this function

auth_token(credential_provider)

View Source
@spec auth_token(credential_provider :: t()) :: String.t()
Link to this function

cache_endpoint(credential_provider)

View Source
@spec cache_endpoint(credential_provider :: t()) :: String.t()
Link to this function

control_endpoint(credential_provider)

View Source
@spec control_endpoint(credential_provider :: t()) :: String.t()
Link to this function

from_env_var!(env_var, opts \\ [])

View Source
@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{}
Link to this function

from_string!(token, opts \\ [])

View Source
@spec from_string!(
  String.t(),
  keyword()
) :: t()

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{}