/
triggerActions.go
313 lines (265 loc) · 12.2 KB
/
triggerActions.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package auth0
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// With this resource, you can bind actions to a trigger. Once actions are created and deployed, they can be attached (i.e. bound) to a trigger so that it will be executed as part of a flow. The list of actions reflects the order in which they will be executed during the appropriate flow.
//
// !> This resource manages all the action bindings to a trigger. In contrast, the `TriggerAction` resource only
// appends an action to the trigger binding. To avoid potential issues, it is recommended not to use this resource in
// conjunction with the `TriggerAction` resource when binding actions to the same trigger.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// actionFoo, err := auth0.NewAction(ctx, "actionFoo", &auth0.ActionArgs{
// Code: pulumi.String("exports.onContinuePostLogin = async (event, api) => {\n console.log(\"foo\");\n};\"\n"),
// Deploy: pulumi.Bool(true),
// SupportedTriggers: &auth0.ActionSupportedTriggersArgs{
// Id: pulumi.String("post-login"),
// Version: pulumi.String("v3"),
// },
// })
// if err != nil {
// return err
// }
// actionBar, err := auth0.NewAction(ctx, "actionBar", &auth0.ActionArgs{
// Code: pulumi.String("exports.onContinuePostLogin = async (event, api) => {\n console.log(\"bar\");\n};\"\n"),
// Deploy: pulumi.Bool(true),
// SupportedTriggers: &auth0.ActionSupportedTriggersArgs{
// Id: pulumi.String("post-login"),
// Version: pulumi.String("v3"),
// },
// })
// if err != nil {
// return err
// }
// _, err = auth0.NewTriggerActions(ctx, "loginFlow", &auth0.TriggerActionsArgs{
// Trigger: pulumi.String("post-login"),
// Actions: auth0.TriggerActionsActionArray{
// &auth0.TriggerActionsActionArgs{
// Id: actionFoo.ID(),
// DisplayName: actionFoo.Name,
// },
// &auth0.TriggerActionsActionArgs{
// Id: actionBar.ID(),
// DisplayName: actionBar.Name,
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// This resource can be imported using the bindings trigger ID.
//
// #
//
// Example:
//
// ```sh
// $ pulumi import auth0:index/triggerActions:TriggerActions example "post-login"
// ```
type TriggerActions struct {
pulumi.CustomResourceState
// The list of actions bound to this trigger.
Actions TriggerActionsActionArrayOutput `pulumi:"actions"`
// The ID of the trigger to bind with. Options include: `post-login`, `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, `send-phone-message`, `password-reset-post-challenge`, `iga-approval` , `iga-certification` , `iga-fulfillment-assignment`, `iga-fulfillment-execution`.
Trigger pulumi.StringOutput `pulumi:"trigger"`
}
// NewTriggerActions registers a new resource with the given unique name, arguments, and options.
func NewTriggerActions(ctx *pulumi.Context,
name string, args *TriggerActionsArgs, opts ...pulumi.ResourceOption) (*TriggerActions, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Actions == nil {
return nil, errors.New("invalid value for required argument 'Actions'")
}
if args.Trigger == nil {
return nil, errors.New("invalid value for required argument 'Trigger'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource TriggerActions
err := ctx.RegisterResource("auth0:index/triggerActions:TriggerActions", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTriggerActions gets an existing TriggerActions resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetTriggerActions(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TriggerActionsState, opts ...pulumi.ResourceOption) (*TriggerActions, error) {
var resource TriggerActions
err := ctx.ReadResource("auth0:index/triggerActions:TriggerActions", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering TriggerActions resources.
type triggerActionsState struct {
// The list of actions bound to this trigger.
Actions []TriggerActionsAction `pulumi:"actions"`
// The ID of the trigger to bind with. Options include: `post-login`, `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, `send-phone-message`, `password-reset-post-challenge`, `iga-approval` , `iga-certification` , `iga-fulfillment-assignment`, `iga-fulfillment-execution`.
Trigger *string `pulumi:"trigger"`
}
type TriggerActionsState struct {
// The list of actions bound to this trigger.
Actions TriggerActionsActionArrayInput
// The ID of the trigger to bind with. Options include: `post-login`, `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, `send-phone-message`, `password-reset-post-challenge`, `iga-approval` , `iga-certification` , `iga-fulfillment-assignment`, `iga-fulfillment-execution`.
Trigger pulumi.StringPtrInput
}
func (TriggerActionsState) ElementType() reflect.Type {
return reflect.TypeOf((*triggerActionsState)(nil)).Elem()
}
type triggerActionsArgs struct {
// The list of actions bound to this trigger.
Actions []TriggerActionsAction `pulumi:"actions"`
// The ID of the trigger to bind with. Options include: `post-login`, `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, `send-phone-message`, `password-reset-post-challenge`, `iga-approval` , `iga-certification` , `iga-fulfillment-assignment`, `iga-fulfillment-execution`.
Trigger string `pulumi:"trigger"`
}
// The set of arguments for constructing a TriggerActions resource.
type TriggerActionsArgs struct {
// The list of actions bound to this trigger.
Actions TriggerActionsActionArrayInput
// The ID of the trigger to bind with. Options include: `post-login`, `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, `send-phone-message`, `password-reset-post-challenge`, `iga-approval` , `iga-certification` , `iga-fulfillment-assignment`, `iga-fulfillment-execution`.
Trigger pulumi.StringInput
}
func (TriggerActionsArgs) ElementType() reflect.Type {
return reflect.TypeOf((*triggerActionsArgs)(nil)).Elem()
}
type TriggerActionsInput interface {
pulumi.Input
ToTriggerActionsOutput() TriggerActionsOutput
ToTriggerActionsOutputWithContext(ctx context.Context) TriggerActionsOutput
}
func (*TriggerActions) ElementType() reflect.Type {
return reflect.TypeOf((**TriggerActions)(nil)).Elem()
}
func (i *TriggerActions) ToTriggerActionsOutput() TriggerActionsOutput {
return i.ToTriggerActionsOutputWithContext(context.Background())
}
func (i *TriggerActions) ToTriggerActionsOutputWithContext(ctx context.Context) TriggerActionsOutput {
return pulumi.ToOutputWithContext(ctx, i).(TriggerActionsOutput)
}
// TriggerActionsArrayInput is an input type that accepts TriggerActionsArray and TriggerActionsArrayOutput values.
// You can construct a concrete instance of `TriggerActionsArrayInput` via:
//
// TriggerActionsArray{ TriggerActionsArgs{...} }
type TriggerActionsArrayInput interface {
pulumi.Input
ToTriggerActionsArrayOutput() TriggerActionsArrayOutput
ToTriggerActionsArrayOutputWithContext(context.Context) TriggerActionsArrayOutput
}
type TriggerActionsArray []TriggerActionsInput
func (TriggerActionsArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*TriggerActions)(nil)).Elem()
}
func (i TriggerActionsArray) ToTriggerActionsArrayOutput() TriggerActionsArrayOutput {
return i.ToTriggerActionsArrayOutputWithContext(context.Background())
}
func (i TriggerActionsArray) ToTriggerActionsArrayOutputWithContext(ctx context.Context) TriggerActionsArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TriggerActionsArrayOutput)
}
// TriggerActionsMapInput is an input type that accepts TriggerActionsMap and TriggerActionsMapOutput values.
// You can construct a concrete instance of `TriggerActionsMapInput` via:
//
// TriggerActionsMap{ "key": TriggerActionsArgs{...} }
type TriggerActionsMapInput interface {
pulumi.Input
ToTriggerActionsMapOutput() TriggerActionsMapOutput
ToTriggerActionsMapOutputWithContext(context.Context) TriggerActionsMapOutput
}
type TriggerActionsMap map[string]TriggerActionsInput
func (TriggerActionsMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*TriggerActions)(nil)).Elem()
}
func (i TriggerActionsMap) ToTriggerActionsMapOutput() TriggerActionsMapOutput {
return i.ToTriggerActionsMapOutputWithContext(context.Background())
}
func (i TriggerActionsMap) ToTriggerActionsMapOutputWithContext(ctx context.Context) TriggerActionsMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TriggerActionsMapOutput)
}
type TriggerActionsOutput struct{ *pulumi.OutputState }
func (TriggerActionsOutput) ElementType() reflect.Type {
return reflect.TypeOf((**TriggerActions)(nil)).Elem()
}
func (o TriggerActionsOutput) ToTriggerActionsOutput() TriggerActionsOutput {
return o
}
func (o TriggerActionsOutput) ToTriggerActionsOutputWithContext(ctx context.Context) TriggerActionsOutput {
return o
}
// The list of actions bound to this trigger.
func (o TriggerActionsOutput) Actions() TriggerActionsActionArrayOutput {
return o.ApplyT(func(v *TriggerActions) TriggerActionsActionArrayOutput { return v.Actions }).(TriggerActionsActionArrayOutput)
}
// The ID of the trigger to bind with. Options include: `post-login`, `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, `send-phone-message`, `password-reset-post-challenge`, `iga-approval` , `iga-certification` , `iga-fulfillment-assignment`, `iga-fulfillment-execution`.
func (o TriggerActionsOutput) Trigger() pulumi.StringOutput {
return o.ApplyT(func(v *TriggerActions) pulumi.StringOutput { return v.Trigger }).(pulumi.StringOutput)
}
type TriggerActionsArrayOutput struct{ *pulumi.OutputState }
func (TriggerActionsArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*TriggerActions)(nil)).Elem()
}
func (o TriggerActionsArrayOutput) ToTriggerActionsArrayOutput() TriggerActionsArrayOutput {
return o
}
func (o TriggerActionsArrayOutput) ToTriggerActionsArrayOutputWithContext(ctx context.Context) TriggerActionsArrayOutput {
return o
}
func (o TriggerActionsArrayOutput) Index(i pulumi.IntInput) TriggerActionsOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TriggerActions {
return vs[0].([]*TriggerActions)[vs[1].(int)]
}).(TriggerActionsOutput)
}
type TriggerActionsMapOutput struct{ *pulumi.OutputState }
func (TriggerActionsMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*TriggerActions)(nil)).Elem()
}
func (o TriggerActionsMapOutput) ToTriggerActionsMapOutput() TriggerActionsMapOutput {
return o
}
func (o TriggerActionsMapOutput) ToTriggerActionsMapOutputWithContext(ctx context.Context) TriggerActionsMapOutput {
return o
}
func (o TriggerActionsMapOutput) MapIndex(k pulumi.StringInput) TriggerActionsOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TriggerActions {
return vs[0].(map[string]*TriggerActions)[vs[1].(string)]
}).(TriggerActionsOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TriggerActionsInput)(nil)).Elem(), &TriggerActions{})
pulumi.RegisterInputType(reflect.TypeOf((*TriggerActionsArrayInput)(nil)).Elem(), TriggerActionsArray{})
pulumi.RegisterInputType(reflect.TypeOf((*TriggerActionsMapInput)(nil)).Elem(), TriggerActionsMap{})
pulumi.RegisterOutputType(TriggerActionsOutput{})
pulumi.RegisterOutputType(TriggerActionsArrayOutput{})
pulumi.RegisterOutputType(TriggerActionsMapOutput{})
}