View Source Mix.NervesHubCLI.Utils (nerves_hub_cli v2.0.1)

Summary

Functions

Return the path to the generated firmware bundle

Read the firmware metadata from the specified firmware bundle

Takes the integer serial representation of a certificate serial number and converts it to a hex string with : separators to match typical output from OpenSSL

Print the API endpoint that's being used to communicate with the NervesHub server

Split up a string of comma-separated tags

Turn map keys into strings

Get User Access Token for use with the session

Functions

Link to this function

fetch_metadata_item(metadata, key)

View Source
@spec fetch_metadata_item(String.t(), String.t()) ::
  {:ok, String.t()} | {:error, :not_found}
@spec firmware() :: Path.t()

Return the path to the generated firmware bundle

Link to this function

get_metadata_item(metadata, key, default \\ nil)

View Source
@spec get_metadata_item(String.t(), String.t(), any()) :: String.t() | nil
@spec metadata(Path.t()) :: {:error, any()} | {:ok, map()}

Read the firmware metadata from the specified firmware bundle

@spec org(keyword()) :: String.t()
@spec product(keyword()) :: String.t()
Link to this function

serial_as_hex(serial_int)

View Source
@spec serial_as_hex(binary() | integer()) :: binary()

Takes the integer serial representation of a certificate serial number and converts it to a hex string with : separators to match typical output from OpenSSL

@spec show_api_endpoint() :: :ok

Print the API endpoint that's being used to communicate with the NervesHub server

@spec split_tag_string(String.t()) :: [String.t()]

Split up a string of comma-separated tags

Invalid tags raise.

iex> Mix.NervesHubCLI.Utils.split_tag_string("a, b, c") ["a", "b", "c"]

iex> Mix.NervesHubCLI.Utils.split_tag_string("a space tag, b, c") ** (RuntimeError) Tag 'a space tag' should not contain white space

iex> Mix.NervesHubCLI.Utils.split_tag_string("\"tag_in_quotes\"") ** (RuntimeError) Tag '"tag_in_quotes"' should not contain quotes

@spec stringify(map()) :: map()

Turn map keys into strings

Get User Access Token for use with the session