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
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.
get_release_scenarios(release_dir)
@spec get_release_scenarios(String.t()) :: {:ok, [Runbox.Scenario.t()]} | {:error, term()}
Retrieves information about scenarios in a release.
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.
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.
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.
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.
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.
load_scenario_notification_spec(node, scenario_id)
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
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.
save_entity(run_context, entity, timestamp)
@spec save_entity( Runbox.RunContext.t(), Runbox.StateStore.Entity.t(), Runbox.StateStore.ScheduleUtils.epoch_ms() ) :: :ok
Saves entity state to state store running on run master node.
This call is called from slave to master.
start_link_run_environment(run_id, release_dir)
@spec start_link_run_environment(String.t(), String.t()) :: {:ok, Runbox.RunContext.t()} | {:error, term()}
Starts new environment for run.
Every run runs on own slave node. Caller process is linked with supervisor started during this call. Started supervisor will supervise all run components running on slave node.
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"]]
).
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.