forked from aws/aws-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
funcs.go
109 lines (90 loc) · 3.27 KB
/
funcs.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package cfn
// Ref returns a reference to the given resource.
func Ref(resource interface{}) interface{} {
return map[string]interface{}{"Ref": resource}
}
// Fn returns a function with the given name and body.
func Fn(name string, body interface{}) interface{} {
return map[string]interface{}{"Fn::" + name: body}
}
// Base64 returns the argument, encoded with Base64.
func Base64(v interface{}) interface{} {
return Fn("Base64", v)
}
// And returns the conjunction of the terms.
func And(v []interface{}) interface{} {
return Fn("And", v)
}
// Or returns the disjunction of the terms.
func Or(v []interface{}) interface{} {
return Fn("Or", v)
}
// Equals returns true if the arguments are equal.
func Equals(a, b interface{}) interface{} {
return Fn("Equals", []interface{}{a, b})
}
// If returns the t argument if the condition is true; otherwise, it returns the
// f argument.
func If(cond, t, f interface{}) interface{} {
return Fn("If", []interface{}{cond, t, f})
}
// Not returns the negation of the argument.
func Not(v interface{}) interface{} {
return Fn("Not", v)
}
// FindInMap returns the value corresponding to keys in a two-level map that is
// declared in the Mappings section of a template.
func FindInMap(name, key, subkey interface{}) interface{} {
return Fn("FindInMap", []interface{}{name, key, subkey})
}
// GetAtt returns the value of an attribute from a resource in the template.
func GetAtt(name, attribute interface{}) interface{} {
return Fn("GetAtt", []interface{}{name, attribute})
}
// GetAZs returns an array that lists Availability Zones for a specified
// region. For the EC2-VPC platform, GetAZs returns only the Availablity Zones
// that have default subnets. For the EC2-Classic platform, GetAZs returns all
// Availability Zones for a region.
func GetAZs(region interface{}) interface{} {
return Fn("GetAZs", region)
}
// Join appends a set of values into a single value, separated by the specified
// delimiter. If a delimiter is the empty string, the set of values are
// concatenated with no delimiter.
func Join(delim interface{}, values ...interface{}) interface{} {
return Fn("Join", []interface{}{delim, values})
}
// Select returns a single object from a list of objects by index.
func Select(index, values interface{}) interface{} {
return Fn("Select", []interface{}{index, values})
}
// AccountID returns the AWS account ID of the account in which the stack is
// being created.
func AccountID() interface{} {
return Ref("AWS::AccountId")
}
// NotificationARNs returns the list of notification Amazon Resource Names
// (ARNs) for the current stack.
func NotificationARNs() interface{} {
return Ref("AWS::NotificationARNs")
}
// NoValue removes the corresponding resource property when specified as a
// return value in the If function.
func NoValue() interface{} {
return Ref("AWS::NoValue")
}
// Region returns a string representing the AWS Region in which the encompassing
// resource is being created.
func Region() interface{} {
return Ref("AWS::Region")
}
// StackID returns the ID of the stack as specified with the CreateStack
// operation.
func StackID() interface{} {
return Ref("AWS::StackId")
}
// StackName returns the name of the stack as specified with the CreateStack
// operation.
func StackName() interface{} {
return Ref("AWS::StackName")
}