Runbox.Scenario.Manifest behaviour (runbox v7.0.1)

Behaviour and struct for scenario manifest.

Link to this section Summary

Types

Assets group attributes metadata.

Metadata (template) of assets group.

t()

Callbacks

Invoked to obtain the scenario manifest.

Invoked once when the scenario run starts.

Link to this section Types

Link to this type

attribute_detail()

@type attribute_detail() :: %{
  name: String.t(),
  description: String.t(),
  path: [String.t()],
  type: :string | :number
}

Assets group attributes metadata.

Metadata helps the UI to render form for the group attributes definition. Attributes of the group are saved in asset attributes in Reality Network if group is materialized as asset in Reality Network.

properties

Properties

  • :name - user-friendly attribute name - what is set.
  • :description - longer attribute description - what the attribute does, the unit, ...
  • :path - path to attribute in attributes JSON.
  • :type - type of attribute value (helps the UI to render form input).
Link to this type

group_of_assets()

@type group_of_assets() :: %{
  name: String.t(),
  description: String.t(),
  asset_type: String.t(),
  edge_type: String.t(),
  edge_direction: boolean(),
  attributes: [attribute_detail()]
}

Metadata (template) of assets group.

The scenario should be able to carry a list of groups it uses. These groups can then be easily created in the UI by the user without having to fill in some information manually. Metadata defines these helpers for the UI.

properties

Properties

  • :name - short name of group template for UI.
  • :description - description of assets group.
  • :asset_type - asset type of asset created by the group.
  • :edge_type - edge type for connecting assets in the group.
  • :edge_direction - edge direction (true = from group asset to assets in group).
  • :attributes - description of group attributes.
@type t() :: %Runbox.Scenario.Manifest{
  change_log: term(),
  description: String.t(),
  events: %{
    required(type :: String.t()) => %{name: String.t(), description: String.t()}
  },
  groups: %{required(id :: String.t()) => group_of_assets()},
  id: String.t(),
  incidents: %{
    required(type :: String.t()) => Runbox.Scenario.Manifest.Incident.t()
  },
  name: String.t(),
  required_raw_topics: [String.t()],
  topics: [String.t()],
  type: String.t(),
  version: String.t() | nil
}

Link to this section Callbacks

@callback get_info() :: t()

Invoked to obtain the scenario manifest.

Link to this callback

on_start()

(optional)
@callback on_start() :: :ok | {:error, term()}

Invoked once when the scenario run starts.

Useful for doing any necessary preparations for scenario run.

Warning: Do not rely on any external resources (e.g. SQL queries) which may change the scenario logic.

This callback is optional. If it is not implemented, no action is performed when starting the scenario run.