Merge "Improve Murano PL docs"

This commit is contained in:
Jenkins 2015-07-24 09:26:58 +00:00 committed by Gerrit Code Review
commit 7945e23d35

View File

@ -321,11 +321,11 @@ strings as all their keys.
The following block constructs are available: The following block constructs are available:
+-----------------------------+---------------------------------------------------------------------------------------+ +---------------------------+---------------------------------------------------------------------------------------+
| Assignment | Explanation | | Assignment | Explanation |
+=============================+=======================================================================================+ +===========================+=======================================================================================+
| | Return: value | | returns value from a method | | | Return: value | | Returns value from a method |
+-----------------------------+---------------------------------------------------------------------------------------+ +---------------------------+---------------------------------------------------------------------------------------+
| | If: predicate() | | ``predicate()`` is a YAQL expression that must be evaluated to ``True`` or ``False``| | | If: predicate() | | ``predicate()`` is a YAQL expression that must be evaluated to ``True`` or ``False``|
| | Then: | | | | Then: | |
| | - code | | The ``Else`` section is optional | | | - code | | The ``Else`` section is optional |
@ -333,37 +333,37 @@ The following block constructs are available:
| | Else: | | | | Else: | |
| | - code | | | | - code | |
| | - block | | | | - block | |
+-----------------------------+---------------------------------------------------------------------------------------+ +---------------------------+---------------------------------------------------------------------------------------+
| | While: predicate() | | ``predicate()`` must be evaluated to ``True`` or ``False`` | | | While: predicate() | | ``predicate()`` must be evaluated to ``True`` or ``False`` |
| | Do: | | | | Do: | |
| | - code | | | | - code | |
| | - block | | | | - block | |
+-----------------------------+---------------------------------------------------------------------------------------+ +---------------------------+---------------------------------------------------------------------------------------+
| | For: variableName | | ``collection`` must be a YAQL expression returning iterable collection or | | | For: variableName | | ``collection`` must be a YAQL expression returning iterable collection or |
| | In: collection | evaluatable array as in assignment instructions, for example, ``[1, 2, $x]`` | | | In: collection | evaluatable array as in assignment instructions, for example, ``[1, 2, $x]`` |
| | Do: | | | | Do: | |
| | - code | | Inside a code block loop, a variable is accessible as ``$variableName`` | | | - code | | Inside a code block loop, a variable is accessible as ``$variableName`` |
| | - block | | | | - block | |
+-----------------------------+---------------------------------------------------------------------------------------+ +---------------------------+---------------------------------------------------------------------------------------+
| | Repeat: | | Repeats the code block specified number of times | | | Repeat: | | Repeats the code block specified number of times |
| | Do: | | | | Do: | |
| | - code | | | | - code | |
| | - block | | | | - block | |
+-----------------------------+---------------------------------------------------------------------------------------+ +---------------------------+---------------------------------------------------------------------------------------+
| | Break: | | Breaks from loop | | | Break: | | Breaks from loop |
+-----------------------------+---------------------------------------------------------------------------------------+ +---------------------------+---------------------------------------------------------------------------------------+
| | Match: | | Matches the result of ``$valueExpression()`` against a set of possible values | | | Match: | | Matches the result of ``$valExpression()`` against a set of possible values |
| | case1: | (cases). The code block of first matched case is executed. | | | case1: | (cases). The code block of first matched case is executed. |
| | - code | | | | - code | |
| | - block | | If no case matched and the default key is present | | | - block | | If no case matched and the default key is present |
| | case2: | than the ``Default`` code block get executed. | | | case2: | than the ``Default`` code block get executed. |
| | - code | | The case values are constant values (not expressions). | | | - code | | The case values are constant values (not expressions). |
| | - block | | | | - block | |
| | Value: $valueExpression() | | | | Value: $valExpression() | |
| | Default: | | | | Default: | |
| | - code | | | | - code | |
| | - block | | | | - block | |
+-----------------------------+---------------------------------------------------------------------------------------+ +---------------------------+---------------------------------------------------------------------------------------+
| | Switch: | | All code blocks that have their predicate evaluated to ``True`` are executed, | | | Switch: | | All code blocks that have their predicate evaluated to ``True`` are executed, |
| | $predicate1(): | but the order of predicate evaluation is not fixed. | | | $predicate1(): | but the order of predicate evaluation is not fixed. |
| | - code | | | | - code | |
@ -374,12 +374,41 @@ The following block constructs are available:
| | Default: | | The ``Default`` key is optional. | | | Default: | | The ``Default`` key is optional. |
| | - code | | | | - code | |
| | - block | | If no predicate evaluated to ``True``, the ``Default`` code block get executed. | | | - block | | If no predicate evaluated to ``True``, the ``Default`` code block get executed. |
+-----------------------------+---------------------------------------------------------------------------------------+ +---------------------------+---------------------------------------------------------------------------------------+
| | Parallel: | | Executes all instructions in code block in a separate green threads in parallel. | | | Parallel: | | Executes all instructions in code block in a separate green threads in parallel. |
| | - code | | | | - code | |
| | - block | | | | - block | |
| | Limit: 5 | | The limit is optional and means the maximum number of concurrent green threads. | | | Limit: 5 | | The limit is optional and means the maximum number of concurrent green threads. |
+-----------------------------+---------------------------------------------------------------------------------------+ +---------------------------+---------------------------------------------------------------------------------------+
| | Try: | | Try and Catch are keywords that represent the handling of exceptions due to data |
| | - code | or coding errors during program execution. A ``Try`` block is the block of code in |
| | - block | which exceptions occur. A ``Catch`` block is the block of code, that is executed if |
| | Catch: | an exception occurred. |
| | With: keyError | | Exceptions are not declared in Murano PL. It means that exceptions of any types can |
| | As: e | be handled and generated. Generating of exception can be done with construct: |
| | Do: | ``Throw: keyError``. |
| | - code | |
| | - block | |
| | Else: | | The ``Else`` is optional block. ``Else`` block is executed if no exception occurred.|
| | - code | |
| | - block | |
| | Finally: | | The ``Finally`` also is optional. It's a place to put any code that will |
| | - code | be executed, whether the try-block raised an exception or not. |
| | - block | |
+---------------------------+---------------------------------------------------------------------------------------+
Notice, that if you have more then one block construct in your workflow, you
need to insert dashes before each construct. For example::
Body:
- If: predicate1()
Then:
- code
- block
- While: predicate2()
Do:
- code
- block
Object model Object model
------------ ------------