IMDS.Providers (imds v1.0.0)

Copy Markdown

The registry of the provider implementations.

The order of all/0 is the probe order of IMDS.detect/1.

Summary

Functions

Return the provider identifiers and their modules, in probe order.

Return the provider identifiers, in probe order.

Return the module of a provider name, or accept a module itself.

Functions

all()

@spec all() :: [{IMDS.Provider.provider(), module()}]

Return the provider identifiers and their modules, in probe order.

names()

@spec names() :: [IMDS.Provider.provider()]

Return the provider identifiers, in probe order.

resolve(name)

@spec resolve(IMDS.Provider.provider() | module() | binary()) ::
  {:ok, module()} | {:error, {:unknown_provider, term()}}

Return the module of a provider name, or accept a module itself.

The name can be an atom or a binary. A module MUST export every callback of IMDS.Provider.

Examples

iex> IMDS.Providers.resolve(:gce)
{:ok, IMDS.Providers.GCE}

iex> IMDS.Providers.resolve("gce")
{:ok, IMDS.Providers.GCE}

iex> IMDS.Providers.resolve(:nope)
{:error, {:unknown_provider, :nope}}