forked from CiscoCloud/toscalib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tosca_functions.go
57 lines (49 loc) · 1.77 KB
/
tosca_functions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package toscalib
const (
// Self is ref for a TOSCA orchestrator will interpret this keyword as the Node or Relationship Template
// instance that contains the function at the time the function is evaluated
Self = "SELF"
// Source is a ref a TOSCA orchestrator will interpret this keyword as the Node Template instance
// that is at the source end of the relationship that contains the referencing function.
Source = "SOURCE"
// Target is a ref a TOSCA orchestrator will interpret this keyword as the Node Template instance
// that is at the source end of the relationship that contains the referencing function.
Target = "TARGET"
// Host is a ref a TOSCA orchestrator will interpret this keyword to refer to the all nodes
// that “host” the node using this reference (i.e., as identified by its HostedOn relationship).
Host = "HOST"
// LocalFile will indicate the orchestrator is responsible for providing a path as the result of the
// get_artifact call where the artifact file can be accessed. The orchestrator will also remove (by default)
// the artifact from this location at the end of the operation.
LocalFile = "LOCAL_FILE"
)
// Defines Tosca Function Names
const (
ConcatFunc = "concat"
TokenFunc = "token"
GetInputFunc = "get_input"
GetPropFunc = "get_property"
GetAttrFunc = "get_attribute"
GetOpOutputFunc = "get_operation_output"
GetNodesOfTypeFunc = "get_nodes_of_type"
GetArtifactFunc = "get_artifact"
)
// Functions is the list of Tosca Functions
var Functions = []string{
ConcatFunc,
TokenFunc,
GetInputFunc,
GetPropFunc,
GetAttrFunc,
GetOpOutputFunc,
GetNodesOfTypeFunc,
GetArtifactFunc,
}
func isFunction(f string) bool {
for _, v := range Functions {
if v == f {
return true
}
}
return false
}