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 new environment for run.
Starts slave node for release in release_dir
.
Starts scenario component on slave node.
Functions
@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()
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.
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.
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.
@spec list_scenario_notification_types(node(), String.t()) :: {:ok, [String.t()]} | {:error, File.posix()}
Lists all notification types for a scenario.
@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.
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.
@spec run_on_start(Runbox.RunContext.t(), {module(), atom(), list()}) :: :ok | {:error, term()}
Runs on_start
function of scenario on run slave node.
@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, user_action_signer)
View Source@spec start_link_run_environment( run_id :: String.t(), release_dir :: String.t(), user_action_signer :: {node(), module(), function :: atom()} ) :: {: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.
@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"]]
).
@spec start_run_component( Runbox.RunContext.t(), Runbox.Scenario.component_def(), Runbox.RunStartContext.t() ) :: {:ok, pid()} | {:error, term()}
Starts scenario component on slave node.