9ce5659dc4ffdc21a585ad32cd62ac30ac0cbe0d
[ccsdk/cds.git] / docs / modelingconcepts / expression.rst
1 .. This work is a derivative of https://wiki.onap.org/display/DW/Modeling+Concepts#Concepts-198012600
2 .. This work is licensed under a Creative Commons Attribution 4.0
3 .. International License. http://creativecommons.org/licenses/by/4.0
4 .. Copyright (C) 2020 Deutsche Telekom AG.
5
6 .. _expression:
7
8 Expression
9 ----------
10
11 TOSCA provides for a set of functions to reference elements within the template or to retrieve runtime values.
12
13 **Below is a list of supported expressions**
14
15 .. tabs::
16
17    .. tab:: get_input
18
19       **get_input**
20
21       The **get_input** function is used to retrieve the values of properties declared
22       within the inputs section of a TOSCA Service Template.
23
24       Within CDS, this is mainly Workflow inputs.
25
26       `TOSCA specification
27       <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454178>`_
28
29       **Example:**
30
31       `<https://github.com/onap/ccsdk-cds/blob/master/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/golden-blueprint.json#L210>`_
32
33       .. code-block:: json
34
35          "resolution-key": {
36             "get_input": "resolution-key"
37          }
38
39    .. tab:: get_property
40
41       **get_property**
42
43       The **get_property** function is used to retrieve property values between modelable
44       entities defined in the same service template.
45
46       `TOSCA specification
47       <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454178>`_
48
49       **Example:**
50
51       .. code-block:: json
52
53          "get_property": ["SELF", "property-name"]
54
55    .. tab:: get_attribute
56
57       **get_attribute**
58
59       The **get_attribute** function is used to retrieve the values of named attributes declared
60       by the referenced node or relationship template name.
61
62       `TOSCA specification
63       <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454178>`_
64
65       **Example:**
66
67       `<https://github.com/onap/ccsdk-cds/blob/master/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/golden-blueprint.json#L64-L67>`_
68
69       .. code-block:: json
70
71          "get_attribute": [
72             "resource-assignment",
73             "assignment-params"
74          ]
75
76    .. tab:: get_operation_output
77
78       **get_operation_output**
79
80       The **get_operation_output** function is used to retrieve the values of variables
81       exposed / exported from an interface operation.
82
83       `TOSCA specification
84       <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454180>`_
85
86       **Example:**
87
88       .. code-block:: json
89
90          "get_operation_output": ["SELF", "interface-name", "operation-name", "output-property-name"]
91
92    .. tab:: get_artifact
93
94       **get_artifact**
95
96       The **get_artifact** function is used to retrieve artifact location between modelable
97       entities defined in the same service template.
98
99       `TOSCA specification
100       <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454182>`_
101
102       **Example:**
103
104       .. code-block:: json
105
106          "get_artifact" : ["SELF", "artifact-template", "location", true]