Runbox (runbox v7.0.1)

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

Link to this section Summary

Functions

Generates initial state for run component on run slave node.

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 senario, notification type, template type and channel.

Lists all template types of the specified notification.

Lists all notification types for a scenario.

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

Tries to load the notification spec of the given scenario.

Runs on_start function of scenario on run slave node.

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

Starts new environment for run.

Starts slave node for release in release_dir.

Starts scenario component on slave node.

Link to this section Functions

Link to this function

generate_state_for_run_component(run_context, arg)

@spec generate_state_for_run_component(
  Runbox.RunContext.t(),
  {module(), atom(), list()}
) :: term()

Generates initial state for run component on run slave node.

Because function should be called from code implementing scenario type (for example stage based), returned value is also specific for scenario type.

Link to this function

get_release_scenarios(release_dir)

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

Retrieves information about scenarios in a release.

Link to this function

list_scenario_notification_channels(node, scenario_id, notification_type, template_type)

@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)

@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 senario, notification type, template type and channel.

Link to this function

list_scenario_notification_template_types(node, scenario_id, notification_type)

@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)

@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

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

@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

load_scenario_notification_spec(node, scenario_id)

@spec load_scenario_notification_spec(node(), String.t()) ::
  {:ok, any()} | {:error, atom(), any()}

Tries to load the notification spec of the given scenario.

Returns

  • {:ok, notification_spec} if the spec is found
  • {:error, :cannot_load, exception} if the spec file cannot be found
  • {:error, :bad_syntax, exception} if the spec file was found but contains syntactic errors
Link to this function

run_on_start(run_context, arg)

@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)

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 \\ [])

@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)

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

Starts scenario component on slave node.