Workflow consists of rules. Rule is a function with the following parameters:
match - JSONPath expression to be executed relative to current cursor position
desc - optional human-readable free-form rule description
id - optional rule ID (auto-generated if not provided)
for example
<rule match="$.services[?(@.type == 'msSqlClusterServer' and @.domain)].units[*]" desc="Units of SQL Server Cluster services which are part of the domain"> <set path="domain"> <select path="::domain"/> </set> </rule>
The logic of rule is simple:
Execute given JSONPath expression
For each of matched objects make current cursor position point to it and then execute function XML body
If JSONPath hasn't matched any object execute
<empty>...</empty>
block if present
Rules can be nested. In this case nested rule's JSONPath expression would be executed relative to parent's rule current cursor position. For outermost rules current cursor position is the Object Model itself.
Rules are grouped into workflows:
<workflow> <rule id="rule1" match="..."> … </rule> <rule id="rule2" match="..."> … </rule> </workflow>
Workflow which is happen to be a XML DSL function and also a root element of workflow XML files. Workflow function executes rules one by one. If one of the rules has modified some part of Object Model then all rules executed once again. This repeats until there are no more actions that can be performed by workflow. At this point all pending actions (e.g. all the invocations of update-cf-stack, send-command etc.) got executed and the workflow loop is repeated. When there no more actions that can be performed by workflow and also no pending commands then we are done and Object Model with all modifications made by workflows (except for "temp" attributes) returned back to Murano API service.