/
awsioteventsactions.go
221 lines (196 loc) · 6.3 KB
/
awsioteventsactions.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
package awsioteventsactions
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
"github.com/aws/aws-cdk-go/awscdk/awsiotevents"
"github.com/aws/aws-cdk-go/awscdk/awsioteventsactions/internal"
"github.com/aws/aws-cdk-go/awscdk/awslambda"
"github.com/aws/constructs-go/constructs/v3"
)
// The action to write the data to an AWS Lambda function.
//
// Example:
// import iotevents "github.com/aws/aws-cdk-go/awscdk"
// import actions "github.com/aws/aws-cdk-go/awscdk"
// import lambda "github.com/aws/aws-cdk-go/awscdk"
//
// var func iFunction
//
//
// input := iotevents.NewInput(this, jsii.String("MyInput"), &inputProps{
// inputName: jsii.String("my_input"),
// // optional
// attributeJsonPaths: []*string{
// jsii.String("payload.deviceId"),
// jsii.String("payload.temperature"),
// },
// })
//
// warmState := iotevents.NewState(&stateProps{
// stateName: jsii.String("warm"),
// onEnter: []event{
// &event{
// eventName: jsii.String("test-enter-event"),
// condition: iotevents.expression.currentInput(input),
// actions: []iAction{
// actions.NewLambdaInvokeAction(func),
// },
// },
// },
// onInput: []*event{
// &event{
// // optional
// eventName: jsii.String("test-input-event"),
// actions: []*iAction{
// actions.NewLambdaInvokeAction(func),
// },
// },
// },
// onExit: []*event{
// &event{
// // optional
// eventName: jsii.String("test-exit-event"),
// actions: []*iAction{
// actions.NewLambdaInvokeAction(func),
// },
// },
// },
// })
// coldState := iotevents.NewState(&stateProps{
// stateName: jsii.String("cold"),
// })
//
// // transit to coldState when temperature is less than 15
// warmState.transitionTo(coldState, &transitionOptions{
// eventName: jsii.String("to_coldState"),
// // optional property, default by combining the names of the States
// when: iotevents.*expression.lt(iotevents.*expression.inputAttribute(input, jsii.String("payload.temperature")), iotevents.*expression.fromString(jsii.String("15"))),
// executing: []*iAction{
// actions.NewLambdaInvokeAction(func),
// },
// })
// // transit to warmState when temperature is greater than or equal to 15
// coldState.transitionTo(warmState, &transitionOptions{
// when: iotevents.*expression.gte(iotevents.*expression.inputAttribute(input, jsii.String("payload.temperature")), iotevents.*expression.fromString(jsii.String("15"))),
// })
//
// iotevents.NewDetectorModel(this, jsii.String("MyDetectorModel"), &detectorModelProps{
// detectorModelName: jsii.String("test-detector-model"),
// // optional
// description: jsii.String("test-detector-model-description"),
// // optional property, default is none
// evaluationMethod: iotevents.eventEvaluation_SERIAL,
// // optional property, default is iotevents.EventEvaluation.BATCH
// detectorKey: jsii.String("payload.deviceId"),
// // optional property, default is none and single detector instance will be created and all inputs will be routed to it
// initialState: warmState,
// })
//
// Experimental.
type LambdaInvokeAction interface {
awsiotevents.IAction
// Returns the AWS IoT Events action specification.
// Experimental.
Bind(_scope constructs.Construct, options *awsiotevents.ActionBindOptions) *awsiotevents.ActionConfig
}
// The jsii proxy struct for LambdaInvokeAction
type jsiiProxy_LambdaInvokeAction struct {
internal.Type__awsioteventsIAction
}
// Experimental.
func NewLambdaInvokeAction(func_ awslambda.IFunction) LambdaInvokeAction {
_init_.Initialize()
j := jsiiProxy_LambdaInvokeAction{}
_jsii_.Create(
"monocdk.aws_iotevents_actions.LambdaInvokeAction",
[]interface{}{func_},
&j,
)
return &j
}
// Experimental.
func NewLambdaInvokeAction_Override(l LambdaInvokeAction, func_ awslambda.IFunction) {
_init_.Initialize()
_jsii_.Create(
"monocdk.aws_iotevents_actions.LambdaInvokeAction",
[]interface{}{func_},
l,
)
}
func (l *jsiiProxy_LambdaInvokeAction) Bind(_scope constructs.Construct, options *awsiotevents.ActionBindOptions) *awsiotevents.ActionConfig {
var returns *awsiotevents.ActionConfig
_jsii_.Invoke(
l,
"bind",
[]interface{}{_scope, options},
&returns,
)
return returns
}
// The action to create a variable with a specified value.
//
// Example:
// // Example automatically generated from non-compiling source. May contain errors.
// import iotevents "github.com/aws/aws-cdk-go/awscdk"
// import actions "github.com/aws/aws-cdk-go/awscdk"
//
// var input iInput
//
//
// state := iotevents.NewState(&stateProps{
// stateName: jsii.String("MyState"),
// onEnter: []event{
// &event{
// eventName: jsii.String("test-event"),
// condition: iotevents.expression.currentInput(input),
// actions: []iAction{
// actions,
// []interface{}{
// actions.NewSetVariableAction(jsii.String("MyVariable"), iotevents.*expression.inputAttribute(input, jsii.String("payload.temperature"))),
// },
// },
// },
// },
// })
//
// Experimental.
type SetVariableAction interface {
awsiotevents.IAction
// Returns the AWS IoT Events action specification.
// Experimental.
Bind(_scope constructs.Construct, _options *awsiotevents.ActionBindOptions) *awsiotevents.ActionConfig
}
// The jsii proxy struct for SetVariableAction
type jsiiProxy_SetVariableAction struct {
internal.Type__awsioteventsIAction
}
// Experimental.
func NewSetVariableAction(variableName *string, value awsiotevents.Expression) SetVariableAction {
_init_.Initialize()
j := jsiiProxy_SetVariableAction{}
_jsii_.Create(
"monocdk.aws_iotevents_actions.SetVariableAction",
[]interface{}{variableName, value},
&j,
)
return &j
}
// Experimental.
func NewSetVariableAction_Override(s SetVariableAction, variableName *string, value awsiotevents.Expression) {
_init_.Initialize()
_jsii_.Create(
"monocdk.aws_iotevents_actions.SetVariableAction",
[]interface{}{variableName, value},
s,
)
}
func (s *jsiiProxy_SetVariableAction) Bind(_scope constructs.Construct, _options *awsiotevents.ActionBindOptions) *awsiotevents.ActionConfig {
var returns *awsiotevents.ActionConfig
_jsii_.Invoke(
s,
"bind",
[]interface{}{_scope, _options},
&returns,
)
return returns
}