View Source Runbox (runbox v21.2.0)

Runbox allows working with scenario releases. It can load scenario releases and provide information about the individual scenarios within them.

Summary

Functions

Retrieves information about scenarios in a release.

Lists all channels with templates defined for scenario, notification type and template type.

Lists all template languages defined for scenario, notification type, template type and channel.

Lists all template types of the specified notification.

Lists all notification types for a scenario.

Lists all template files defined for a particular scenario.

Loads and evaluates templates specified by scenario, notification type, template type, channel and language.

Runs on_start function of scenario on run slave node.

Saves entity state to state store running on run master node.

Starts slave node for release in release_dir.

Starts scenario component on slave node.

Functions

Link to this function

get_release_scenarios(release_dir)

View Source
@spec get_release_scenarios(String.t()) ::
  {:ok, [Runbox.Scenario.t()]} | {:error, term()}

Retrieves information about scenarios in a release.

@spec get_runbox_version() :: Version.t()
Link to this function

list_scenario_notification_channels(node, scenario_id, notification_type, template_type)

View Source
@spec list_scenario_notification_channels(node(), String.t(), String.t(), String.t()) ::
  {:ok, [String.t()]} | {:error, File.posix()}

Lists all channels with templates defined for scenario, notification type and template type.

Link to this function

list_scenario_notification_languages(node, scenario_id, notification_type, template_type, channel)

View Source
@spec list_scenario_notification_languages(
  node(),
  String.t(),
  String.t(),
  String.t(),
  String.t()
) :: {:ok, [String.t()]} | {:error, File.posix()}

Lists all template languages defined for scenario, notification type, template type and channel.

Link to this function

list_scenario_notification_template_types(node, scenario_id, notification_type)

View Source
@spec list_scenario_notification_template_types(node(), String.t(), String.t()) ::
  {:ok, [String.t()]} | {:error, File.posix()}

Lists all template types of the specified notification.

Link to this function

list_scenario_notification_types(node, scenario_id)

View Source
@spec list_scenario_notification_types(node(), String.t()) ::
  {:ok, [String.t()]} | {:error, File.posix()}

Lists all notification types for a scenario.

Link to this function

list_templates(node, scenario_id)

View Source
@spec list_templates(node(), String.t()) :: [Runbox.Scenario.Notification.template()]

Lists all template files defined for a particular scenario.

It returns both templates from the scenario and overrides from the deployment. The source can be discriminated using the :defined_in key.

Link to this function

load_and_eval_scenario_notification_templates(node, scenario_id, notification_type, template_type, channel, language, data, fallback_language)

View Source
@spec load_and_eval_scenario_notification_templates(
  node(),
  scenario_id :: String.t(),
  notification_type :: String.t(),
  template_type :: String.t(),
  channel :: String.t(),
  language :: String.t(),
  data :: keyword(),
  fallback_language :: String.t()
) :: {:ok, %{required(String.t()) => String.t()}} | {:error, atom(), String.t()}

Loads and evaluates templates specified by scenario, notification type, template type, channel and language.

If language is not defined or does not exist, fallback_language is used.

Link to this function

run_on_start(run_context, arg)

View Source
@spec run_on_start(Runbox.RunContext.t(), {module(), atom(), list()}) ::
  :ok | {:error, term()}

Runs on_start function of scenario on run slave node.

Link to this function

save_entity(run_context, entity, timestamp)

View Source

Saves entity state to state store running on run master node.

This call is called from slave to master.

Link to this function

start_release_node(release_dir, app_env \\ [])

View Source
@spec start_release_node(String.t(), [
  {Application.app(), [{Application.key(), Application.value()}]}
]) ::
  {:ok, %{node: node(), scenarios: [scenario_id :: String.t()]}}
  | {:error, term()}

Starts slave node for release in release_dir.

If app_env is set, configured applications env variables are set on slave node (for example ui_url variable is needed to be set in runbox application env if node is used for notifications evaluation, i.e. app_env must be set to [runbox: [ui_url: "https://some_url"]]).

Link to this function

start_run_component(runbox_ctx, comp_def, start_ctx)

View Source
@spec start_run_component(
  Runbox.RunContext.t(),
  Runbox.Scenario.component_def(),
  Runbox.RunStartContext.t()
) :: {:ok, pid()} | {:error, term()}

Starts scenario component on slave node.