generated from pulumi/pulumi-tf-provider-boilerplate
/
trigger.go
388 lines (329 loc) · 16.9 KB
/
trigger.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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
// 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 fc
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Import
//
// Function Compute trigger can be imported using the id, e.g.
//
// ```sh
//
// $ pulumi import alicloud:fc/trigger:Trigger foo my-fc-service:hello-world:hello-trigger
//
// ```
type Trigger struct {
pulumi.CustomResourceState
// The config of Function Compute trigger.It is valid when `type` is not "mnsTopic".See [Configure triggers and events](https://www.alibabacloud.com/help/doc-detail/70140.htm) for more details.
Config pulumi.StringPtrOutput `pulumi:"config"`
// The config of Function Compute trigger when the type is "mnsTopic".It is conflict with `config`.
ConfigMns pulumi.StringPtrOutput `pulumi:"configMns"`
// The Function Compute function name.
Function pulumi.StringOutput `pulumi:"function"`
// The date this resource was last modified.
LastModified pulumi.StringOutput `pulumi:"lastModified"`
// The Function Compute trigger name. It is the only in one service and is conflict with "namePrefix".
Name pulumi.StringOutput `pulumi:"name"`
// Setting a prefix to get a only trigger name. It is conflict with "name".
NamePrefix pulumi.StringPtrOutput `pulumi:"namePrefix"`
// RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
Role pulumi.StringPtrOutput `pulumi:"role"`
// The Function Compute service name.
Service pulumi.StringOutput `pulumi:"service"`
// Event source resource address. See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
SourceArn pulumi.StringPtrOutput `pulumi:"sourceArn"`
// The Function Compute trigger ID.
TriggerId pulumi.StringOutput `pulumi:"triggerId"`
// The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mnsTopic", "cdnEvents", "eventbridge"].
Type pulumi.StringOutput `pulumi:"type"`
UrlInternet pulumi.StringOutput `pulumi:"urlInternet"`
UrlIntranet pulumi.StringOutput `pulumi:"urlIntranet"`
}
// NewTrigger registers a new resource with the given unique name, arguments, and options.
func NewTrigger(ctx *pulumi.Context,
name string, args *TriggerArgs, opts ...pulumi.ResourceOption) (*Trigger, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Function == nil {
return nil, errors.New("invalid value for required argument 'Function'")
}
if args.Service == nil {
return nil, errors.New("invalid value for required argument 'Service'")
}
if args.Type == nil {
return nil, errors.New("invalid value for required argument 'Type'")
}
opts = pkgResourceDefaultOpts(opts)
var resource Trigger
err := ctx.RegisterResource("alicloud:fc/trigger:Trigger", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTrigger gets an existing Trigger 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 GetTrigger(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TriggerState, opts ...pulumi.ResourceOption) (*Trigger, error) {
var resource Trigger
err := ctx.ReadResource("alicloud:fc/trigger:Trigger", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Trigger resources.
type triggerState struct {
// The config of Function Compute trigger.It is valid when `type` is not "mnsTopic".See [Configure triggers and events](https://www.alibabacloud.com/help/doc-detail/70140.htm) for more details.
Config *string `pulumi:"config"`
// The config of Function Compute trigger when the type is "mnsTopic".It is conflict with `config`.
ConfigMns *string `pulumi:"configMns"`
// The Function Compute function name.
Function *string `pulumi:"function"`
// The date this resource was last modified.
LastModified *string `pulumi:"lastModified"`
// The Function Compute trigger name. It is the only in one service and is conflict with "namePrefix".
Name *string `pulumi:"name"`
// Setting a prefix to get a only trigger name. It is conflict with "name".
NamePrefix *string `pulumi:"namePrefix"`
// RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
Role *string `pulumi:"role"`
// The Function Compute service name.
Service *string `pulumi:"service"`
// Event source resource address. See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
SourceArn *string `pulumi:"sourceArn"`
// The Function Compute trigger ID.
TriggerId *string `pulumi:"triggerId"`
// The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mnsTopic", "cdnEvents", "eventbridge"].
Type *string `pulumi:"type"`
UrlInternet *string `pulumi:"urlInternet"`
UrlIntranet *string `pulumi:"urlIntranet"`
}
type TriggerState struct {
// The config of Function Compute trigger.It is valid when `type` is not "mnsTopic".See [Configure triggers and events](https://www.alibabacloud.com/help/doc-detail/70140.htm) for more details.
Config pulumi.StringPtrInput
// The config of Function Compute trigger when the type is "mnsTopic".It is conflict with `config`.
ConfigMns pulumi.StringPtrInput
// The Function Compute function name.
Function pulumi.StringPtrInput
// The date this resource was last modified.
LastModified pulumi.StringPtrInput
// The Function Compute trigger name. It is the only in one service and is conflict with "namePrefix".
Name pulumi.StringPtrInput
// Setting a prefix to get a only trigger name. It is conflict with "name".
NamePrefix pulumi.StringPtrInput
// RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
Role pulumi.StringPtrInput
// The Function Compute service name.
Service pulumi.StringPtrInput
// Event source resource address. See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
SourceArn pulumi.StringPtrInput
// The Function Compute trigger ID.
TriggerId pulumi.StringPtrInput
// The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mnsTopic", "cdnEvents", "eventbridge"].
Type pulumi.StringPtrInput
UrlInternet pulumi.StringPtrInput
UrlIntranet pulumi.StringPtrInput
}
func (TriggerState) ElementType() reflect.Type {
return reflect.TypeOf((*triggerState)(nil)).Elem()
}
type triggerArgs struct {
// The config of Function Compute trigger.It is valid when `type` is not "mnsTopic".See [Configure triggers and events](https://www.alibabacloud.com/help/doc-detail/70140.htm) for more details.
Config *string `pulumi:"config"`
// The config of Function Compute trigger when the type is "mnsTopic".It is conflict with `config`.
ConfigMns *string `pulumi:"configMns"`
// The Function Compute function name.
Function string `pulumi:"function"`
// The Function Compute trigger name. It is the only in one service and is conflict with "namePrefix".
Name *string `pulumi:"name"`
// Setting a prefix to get a only trigger name. It is conflict with "name".
NamePrefix *string `pulumi:"namePrefix"`
// RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
Role *string `pulumi:"role"`
// The Function Compute service name.
Service string `pulumi:"service"`
// Event source resource address. See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
SourceArn *string `pulumi:"sourceArn"`
// The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mnsTopic", "cdnEvents", "eventbridge"].
Type string `pulumi:"type"`
}
// The set of arguments for constructing a Trigger resource.
type TriggerArgs struct {
// The config of Function Compute trigger.It is valid when `type` is not "mnsTopic".See [Configure triggers and events](https://www.alibabacloud.com/help/doc-detail/70140.htm) for more details.
Config pulumi.StringPtrInput
// The config of Function Compute trigger when the type is "mnsTopic".It is conflict with `config`.
ConfigMns pulumi.StringPtrInput
// The Function Compute function name.
Function pulumi.StringInput
// The Function Compute trigger name. It is the only in one service and is conflict with "namePrefix".
Name pulumi.StringPtrInput
// Setting a prefix to get a only trigger name. It is conflict with "name".
NamePrefix pulumi.StringPtrInput
// RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
Role pulumi.StringPtrInput
// The Function Compute service name.
Service pulumi.StringInput
// Event source resource address. See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
SourceArn pulumi.StringPtrInput
// The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mnsTopic", "cdnEvents", "eventbridge"].
Type pulumi.StringInput
}
func (TriggerArgs) ElementType() reflect.Type {
return reflect.TypeOf((*triggerArgs)(nil)).Elem()
}
type TriggerInput interface {
pulumi.Input
ToTriggerOutput() TriggerOutput
ToTriggerOutputWithContext(ctx context.Context) TriggerOutput
}
func (*Trigger) ElementType() reflect.Type {
return reflect.TypeOf((**Trigger)(nil)).Elem()
}
func (i *Trigger) ToTriggerOutput() TriggerOutput {
return i.ToTriggerOutputWithContext(context.Background())
}
func (i *Trigger) ToTriggerOutputWithContext(ctx context.Context) TriggerOutput {
return pulumi.ToOutputWithContext(ctx, i).(TriggerOutput)
}
// TriggerArrayInput is an input type that accepts TriggerArray and TriggerArrayOutput values.
// You can construct a concrete instance of `TriggerArrayInput` via:
//
// TriggerArray{ TriggerArgs{...} }
type TriggerArrayInput interface {
pulumi.Input
ToTriggerArrayOutput() TriggerArrayOutput
ToTriggerArrayOutputWithContext(context.Context) TriggerArrayOutput
}
type TriggerArray []TriggerInput
func (TriggerArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Trigger)(nil)).Elem()
}
func (i TriggerArray) ToTriggerArrayOutput() TriggerArrayOutput {
return i.ToTriggerArrayOutputWithContext(context.Background())
}
func (i TriggerArray) ToTriggerArrayOutputWithContext(ctx context.Context) TriggerArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TriggerArrayOutput)
}
// TriggerMapInput is an input type that accepts TriggerMap and TriggerMapOutput values.
// You can construct a concrete instance of `TriggerMapInput` via:
//
// TriggerMap{ "key": TriggerArgs{...} }
type TriggerMapInput interface {
pulumi.Input
ToTriggerMapOutput() TriggerMapOutput
ToTriggerMapOutputWithContext(context.Context) TriggerMapOutput
}
type TriggerMap map[string]TriggerInput
func (TriggerMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Trigger)(nil)).Elem()
}
func (i TriggerMap) ToTriggerMapOutput() TriggerMapOutput {
return i.ToTriggerMapOutputWithContext(context.Background())
}
func (i TriggerMap) ToTriggerMapOutputWithContext(ctx context.Context) TriggerMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TriggerMapOutput)
}
type TriggerOutput struct{ *pulumi.OutputState }
func (TriggerOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Trigger)(nil)).Elem()
}
func (o TriggerOutput) ToTriggerOutput() TriggerOutput {
return o
}
func (o TriggerOutput) ToTriggerOutputWithContext(ctx context.Context) TriggerOutput {
return o
}
// The config of Function Compute trigger.It is valid when `type` is not "mnsTopic".See [Configure triggers and events](https://www.alibabacloud.com/help/doc-detail/70140.htm) for more details.
func (o TriggerOutput) Config() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringPtrOutput { return v.Config }).(pulumi.StringPtrOutput)
}
// The config of Function Compute trigger when the type is "mnsTopic".It is conflict with `config`.
func (o TriggerOutput) ConfigMns() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringPtrOutput { return v.ConfigMns }).(pulumi.StringPtrOutput)
}
// The Function Compute function name.
func (o TriggerOutput) Function() pulumi.StringOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringOutput { return v.Function }).(pulumi.StringOutput)
}
// The date this resource was last modified.
func (o TriggerOutput) LastModified() pulumi.StringOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringOutput { return v.LastModified }).(pulumi.StringOutput)
}
// The Function Compute trigger name. It is the only in one service and is conflict with "namePrefix".
func (o TriggerOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Setting a prefix to get a only trigger name. It is conflict with "name".
func (o TriggerOutput) NamePrefix() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringPtrOutput { return v.NamePrefix }).(pulumi.StringPtrOutput)
}
// RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
func (o TriggerOutput) Role() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringPtrOutput { return v.Role }).(pulumi.StringPtrOutput)
}
// The Function Compute service name.
func (o TriggerOutput) Service() pulumi.StringOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringOutput { return v.Service }).(pulumi.StringOutput)
}
// Event source resource address. See [Create a trigger](https://www.alibabacloud.com/help/doc-detail/53102.htm) for more details.
func (o TriggerOutput) SourceArn() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringPtrOutput { return v.SourceArn }).(pulumi.StringPtrOutput)
}
// The Function Compute trigger ID.
func (o TriggerOutput) TriggerId() pulumi.StringOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringOutput { return v.TriggerId }).(pulumi.StringOutput)
}
// The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mnsTopic", "cdnEvents", "eventbridge"].
func (o TriggerOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
}
func (o TriggerOutput) UrlInternet() pulumi.StringOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringOutput { return v.UrlInternet }).(pulumi.StringOutput)
}
func (o TriggerOutput) UrlIntranet() pulumi.StringOutput {
return o.ApplyT(func(v *Trigger) pulumi.StringOutput { return v.UrlIntranet }).(pulumi.StringOutput)
}
type TriggerArrayOutput struct{ *pulumi.OutputState }
func (TriggerArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Trigger)(nil)).Elem()
}
func (o TriggerArrayOutput) ToTriggerArrayOutput() TriggerArrayOutput {
return o
}
func (o TriggerArrayOutput) ToTriggerArrayOutputWithContext(ctx context.Context) TriggerArrayOutput {
return o
}
func (o TriggerArrayOutput) Index(i pulumi.IntInput) TriggerOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Trigger {
return vs[0].([]*Trigger)[vs[1].(int)]
}).(TriggerOutput)
}
type TriggerMapOutput struct{ *pulumi.OutputState }
func (TriggerMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Trigger)(nil)).Elem()
}
func (o TriggerMapOutput) ToTriggerMapOutput() TriggerMapOutput {
return o
}
func (o TriggerMapOutput) ToTriggerMapOutputWithContext(ctx context.Context) TriggerMapOutput {
return o
}
func (o TriggerMapOutput) MapIndex(k pulumi.StringInput) TriggerOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Trigger {
return vs[0].(map[string]*Trigger)[vs[1].(string)]
}).(TriggerOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TriggerInput)(nil)).Elem(), &Trigger{})
pulumi.RegisterInputType(reflect.TypeOf((*TriggerArrayInput)(nil)).Elem(), TriggerArray{})
pulumi.RegisterInputType(reflect.TypeOf((*TriggerMapInput)(nil)).Elem(), TriggerMap{})
pulumi.RegisterOutputType(TriggerOutput{})
pulumi.RegisterOutputType(TriggerArrayOutput{})
pulumi.RegisterOutputType(TriggerMapOutput{})
}