/
receiptRule.go
477 lines (416 loc) · 17.6 KB
/
receiptRule.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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
// 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 ses
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an SES receipt rule resource
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ses"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ses.NewReceiptRule(ctx, "store", &ses.ReceiptRuleArgs{
// AddHeaderActions: ses.ReceiptRuleAddHeaderActionArray{
// &ses.ReceiptRuleAddHeaderActionArgs{
// HeaderName: pulumi.String("Custom-Header"),
// HeaderValue: pulumi.String("Added by SES"),
// Position: pulumi.Int(1),
// },
// },
// Enabled: pulumi.Bool(true),
// Recipients: pulumi.StringArray{
// pulumi.String("karen@example.com"),
// },
// RuleSetName: pulumi.String("default-rule-set"),
// S3Actions: ses.ReceiptRuleS3ActionArray{
// &ses.ReceiptRuleS3ActionArgs{
// BucketName: pulumi.String("emails"),
// Position: pulumi.Int(2),
// },
// },
// ScanEnabled: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// SES receipt rules can be imported using the ruleset name and rule name separated by `:`.
//
// ```sh
//
// $ pulumi import aws:ses/receiptRule:ReceiptRule my_rule my_rule_set:my_rule
//
// ```
type ReceiptRule struct {
pulumi.CustomResourceState
// A list of Add Header Action blocks. Documented below.
AddHeaderActions ReceiptRuleAddHeaderActionArrayOutput `pulumi:"addHeaderActions"`
// The name of the rule to place this rule after
After pulumi.StringPtrOutput `pulumi:"after"`
// The SES receipt rule ARN.
Arn pulumi.StringOutput `pulumi:"arn"`
// A list of Bounce Action blocks. Documented below.
BounceActions ReceiptRuleBounceActionArrayOutput `pulumi:"bounceActions"`
// If true, the rule will be enabled
Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
// A list of Lambda Action blocks. Documented below.
LambdaActions ReceiptRuleLambdaActionArrayOutput `pulumi:"lambdaActions"`
// The name of the rule
Name pulumi.StringOutput `pulumi:"name"`
// A list of email addresses
Recipients pulumi.StringArrayOutput `pulumi:"recipients"`
// The name of the rule set
RuleSetName pulumi.StringOutput `pulumi:"ruleSetName"`
// A list of S3 Action blocks. Documented below.
S3Actions ReceiptRuleS3ActionArrayOutput `pulumi:"s3Actions"`
// If true, incoming emails will be scanned for spam and viruses
ScanEnabled pulumi.BoolPtrOutput `pulumi:"scanEnabled"`
// A list of SNS Action blocks. Documented below.
SnsActions ReceiptRuleSnsActionArrayOutput `pulumi:"snsActions"`
// A list of Stop Action blocks. Documented below.
StopActions ReceiptRuleStopActionArrayOutput `pulumi:"stopActions"`
// `Require` or `Optional`
TlsPolicy pulumi.StringOutput `pulumi:"tlsPolicy"`
// A list of WorkMail Action blocks. Documented below.
WorkmailActions ReceiptRuleWorkmailActionArrayOutput `pulumi:"workmailActions"`
}
// NewReceiptRule registers a new resource with the given unique name, arguments, and options.
func NewReceiptRule(ctx *pulumi.Context,
name string, args *ReceiptRuleArgs, opts ...pulumi.ResourceOption) (*ReceiptRule, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.RuleSetName == nil {
return nil, errors.New("invalid value for required argument 'RuleSetName'")
}
var resource ReceiptRule
err := ctx.RegisterResource("aws:ses/receiptRule:ReceiptRule", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetReceiptRule gets an existing ReceiptRule 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 GetReceiptRule(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ReceiptRuleState, opts ...pulumi.ResourceOption) (*ReceiptRule, error) {
var resource ReceiptRule
err := ctx.ReadResource("aws:ses/receiptRule:ReceiptRule", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ReceiptRule resources.
type receiptRuleState struct {
// A list of Add Header Action blocks. Documented below.
AddHeaderActions []ReceiptRuleAddHeaderAction `pulumi:"addHeaderActions"`
// The name of the rule to place this rule after
After *string `pulumi:"after"`
// The SES receipt rule ARN.
Arn *string `pulumi:"arn"`
// A list of Bounce Action blocks. Documented below.
BounceActions []ReceiptRuleBounceAction `pulumi:"bounceActions"`
// If true, the rule will be enabled
Enabled *bool `pulumi:"enabled"`
// A list of Lambda Action blocks. Documented below.
LambdaActions []ReceiptRuleLambdaAction `pulumi:"lambdaActions"`
// The name of the rule
Name *string `pulumi:"name"`
// A list of email addresses
Recipients []string `pulumi:"recipients"`
// The name of the rule set
RuleSetName *string `pulumi:"ruleSetName"`
// A list of S3 Action blocks. Documented below.
S3Actions []ReceiptRuleS3Action `pulumi:"s3Actions"`
// If true, incoming emails will be scanned for spam and viruses
ScanEnabled *bool `pulumi:"scanEnabled"`
// A list of SNS Action blocks. Documented below.
SnsActions []ReceiptRuleSnsAction `pulumi:"snsActions"`
// A list of Stop Action blocks. Documented below.
StopActions []ReceiptRuleStopAction `pulumi:"stopActions"`
// `Require` or `Optional`
TlsPolicy *string `pulumi:"tlsPolicy"`
// A list of WorkMail Action blocks. Documented below.
WorkmailActions []ReceiptRuleWorkmailAction `pulumi:"workmailActions"`
}
type ReceiptRuleState struct {
// A list of Add Header Action blocks. Documented below.
AddHeaderActions ReceiptRuleAddHeaderActionArrayInput
// The name of the rule to place this rule after
After pulumi.StringPtrInput
// The SES receipt rule ARN.
Arn pulumi.StringPtrInput
// A list of Bounce Action blocks. Documented below.
BounceActions ReceiptRuleBounceActionArrayInput
// If true, the rule will be enabled
Enabled pulumi.BoolPtrInput
// A list of Lambda Action blocks. Documented below.
LambdaActions ReceiptRuleLambdaActionArrayInput
// The name of the rule
Name pulumi.StringPtrInput
// A list of email addresses
Recipients pulumi.StringArrayInput
// The name of the rule set
RuleSetName pulumi.StringPtrInput
// A list of S3 Action blocks. Documented below.
S3Actions ReceiptRuleS3ActionArrayInput
// If true, incoming emails will be scanned for spam and viruses
ScanEnabled pulumi.BoolPtrInput
// A list of SNS Action blocks. Documented below.
SnsActions ReceiptRuleSnsActionArrayInput
// A list of Stop Action blocks. Documented below.
StopActions ReceiptRuleStopActionArrayInput
// `Require` or `Optional`
TlsPolicy pulumi.StringPtrInput
// A list of WorkMail Action blocks. Documented below.
WorkmailActions ReceiptRuleWorkmailActionArrayInput
}
func (ReceiptRuleState) ElementType() reflect.Type {
return reflect.TypeOf((*receiptRuleState)(nil)).Elem()
}
type receiptRuleArgs struct {
// A list of Add Header Action blocks. Documented below.
AddHeaderActions []ReceiptRuleAddHeaderAction `pulumi:"addHeaderActions"`
// The name of the rule to place this rule after
After *string `pulumi:"after"`
// A list of Bounce Action blocks. Documented below.
BounceActions []ReceiptRuleBounceAction `pulumi:"bounceActions"`
// If true, the rule will be enabled
Enabled *bool `pulumi:"enabled"`
// A list of Lambda Action blocks. Documented below.
LambdaActions []ReceiptRuleLambdaAction `pulumi:"lambdaActions"`
// The name of the rule
Name *string `pulumi:"name"`
// A list of email addresses
Recipients []string `pulumi:"recipients"`
// The name of the rule set
RuleSetName string `pulumi:"ruleSetName"`
// A list of S3 Action blocks. Documented below.
S3Actions []ReceiptRuleS3Action `pulumi:"s3Actions"`
// If true, incoming emails will be scanned for spam and viruses
ScanEnabled *bool `pulumi:"scanEnabled"`
// A list of SNS Action blocks. Documented below.
SnsActions []ReceiptRuleSnsAction `pulumi:"snsActions"`
// A list of Stop Action blocks. Documented below.
StopActions []ReceiptRuleStopAction `pulumi:"stopActions"`
// `Require` or `Optional`
TlsPolicy *string `pulumi:"tlsPolicy"`
// A list of WorkMail Action blocks. Documented below.
WorkmailActions []ReceiptRuleWorkmailAction `pulumi:"workmailActions"`
}
// The set of arguments for constructing a ReceiptRule resource.
type ReceiptRuleArgs struct {
// A list of Add Header Action blocks. Documented below.
AddHeaderActions ReceiptRuleAddHeaderActionArrayInput
// The name of the rule to place this rule after
After pulumi.StringPtrInput
// A list of Bounce Action blocks. Documented below.
BounceActions ReceiptRuleBounceActionArrayInput
// If true, the rule will be enabled
Enabled pulumi.BoolPtrInput
// A list of Lambda Action blocks. Documented below.
LambdaActions ReceiptRuleLambdaActionArrayInput
// The name of the rule
Name pulumi.StringPtrInput
// A list of email addresses
Recipients pulumi.StringArrayInput
// The name of the rule set
RuleSetName pulumi.StringInput
// A list of S3 Action blocks. Documented below.
S3Actions ReceiptRuleS3ActionArrayInput
// If true, incoming emails will be scanned for spam and viruses
ScanEnabled pulumi.BoolPtrInput
// A list of SNS Action blocks. Documented below.
SnsActions ReceiptRuleSnsActionArrayInput
// A list of Stop Action blocks. Documented below.
StopActions ReceiptRuleStopActionArrayInput
// `Require` or `Optional`
TlsPolicy pulumi.StringPtrInput
// A list of WorkMail Action blocks. Documented below.
WorkmailActions ReceiptRuleWorkmailActionArrayInput
}
func (ReceiptRuleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*receiptRuleArgs)(nil)).Elem()
}
type ReceiptRuleInput interface {
pulumi.Input
ToReceiptRuleOutput() ReceiptRuleOutput
ToReceiptRuleOutputWithContext(ctx context.Context) ReceiptRuleOutput
}
func (*ReceiptRule) ElementType() reflect.Type {
return reflect.TypeOf((**ReceiptRule)(nil)).Elem()
}
func (i *ReceiptRule) ToReceiptRuleOutput() ReceiptRuleOutput {
return i.ToReceiptRuleOutputWithContext(context.Background())
}
func (i *ReceiptRule) ToReceiptRuleOutputWithContext(ctx context.Context) ReceiptRuleOutput {
return pulumi.ToOutputWithContext(ctx, i).(ReceiptRuleOutput)
}
// ReceiptRuleArrayInput is an input type that accepts ReceiptRuleArray and ReceiptRuleArrayOutput values.
// You can construct a concrete instance of `ReceiptRuleArrayInput` via:
//
// ReceiptRuleArray{ ReceiptRuleArgs{...} }
type ReceiptRuleArrayInput interface {
pulumi.Input
ToReceiptRuleArrayOutput() ReceiptRuleArrayOutput
ToReceiptRuleArrayOutputWithContext(context.Context) ReceiptRuleArrayOutput
}
type ReceiptRuleArray []ReceiptRuleInput
func (ReceiptRuleArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ReceiptRule)(nil)).Elem()
}
func (i ReceiptRuleArray) ToReceiptRuleArrayOutput() ReceiptRuleArrayOutput {
return i.ToReceiptRuleArrayOutputWithContext(context.Background())
}
func (i ReceiptRuleArray) ToReceiptRuleArrayOutputWithContext(ctx context.Context) ReceiptRuleArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ReceiptRuleArrayOutput)
}
// ReceiptRuleMapInput is an input type that accepts ReceiptRuleMap and ReceiptRuleMapOutput values.
// You can construct a concrete instance of `ReceiptRuleMapInput` via:
//
// ReceiptRuleMap{ "key": ReceiptRuleArgs{...} }
type ReceiptRuleMapInput interface {
pulumi.Input
ToReceiptRuleMapOutput() ReceiptRuleMapOutput
ToReceiptRuleMapOutputWithContext(context.Context) ReceiptRuleMapOutput
}
type ReceiptRuleMap map[string]ReceiptRuleInput
func (ReceiptRuleMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ReceiptRule)(nil)).Elem()
}
func (i ReceiptRuleMap) ToReceiptRuleMapOutput() ReceiptRuleMapOutput {
return i.ToReceiptRuleMapOutputWithContext(context.Background())
}
func (i ReceiptRuleMap) ToReceiptRuleMapOutputWithContext(ctx context.Context) ReceiptRuleMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ReceiptRuleMapOutput)
}
type ReceiptRuleOutput struct{ *pulumi.OutputState }
func (ReceiptRuleOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ReceiptRule)(nil)).Elem()
}
func (o ReceiptRuleOutput) ToReceiptRuleOutput() ReceiptRuleOutput {
return o
}
func (o ReceiptRuleOutput) ToReceiptRuleOutputWithContext(ctx context.Context) ReceiptRuleOutput {
return o
}
// A list of Add Header Action blocks. Documented below.
func (o ReceiptRuleOutput) AddHeaderActions() ReceiptRuleAddHeaderActionArrayOutput {
return o.ApplyT(func(v *ReceiptRule) ReceiptRuleAddHeaderActionArrayOutput { return v.AddHeaderActions }).(ReceiptRuleAddHeaderActionArrayOutput)
}
// The name of the rule to place this rule after
func (o ReceiptRuleOutput) After() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ReceiptRule) pulumi.StringPtrOutput { return v.After }).(pulumi.StringPtrOutput)
}
// The SES receipt rule ARN.
func (o ReceiptRuleOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *ReceiptRule) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// A list of Bounce Action blocks. Documented below.
func (o ReceiptRuleOutput) BounceActions() ReceiptRuleBounceActionArrayOutput {
return o.ApplyT(func(v *ReceiptRule) ReceiptRuleBounceActionArrayOutput { return v.BounceActions }).(ReceiptRuleBounceActionArrayOutput)
}
// If true, the rule will be enabled
func (o ReceiptRuleOutput) Enabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *ReceiptRule) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
}
// A list of Lambda Action blocks. Documented below.
func (o ReceiptRuleOutput) LambdaActions() ReceiptRuleLambdaActionArrayOutput {
return o.ApplyT(func(v *ReceiptRule) ReceiptRuleLambdaActionArrayOutput { return v.LambdaActions }).(ReceiptRuleLambdaActionArrayOutput)
}
// The name of the rule
func (o ReceiptRuleOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *ReceiptRule) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// A list of email addresses
func (o ReceiptRuleOutput) Recipients() pulumi.StringArrayOutput {
return o.ApplyT(func(v *ReceiptRule) pulumi.StringArrayOutput { return v.Recipients }).(pulumi.StringArrayOutput)
}
// The name of the rule set
func (o ReceiptRuleOutput) RuleSetName() pulumi.StringOutput {
return o.ApplyT(func(v *ReceiptRule) pulumi.StringOutput { return v.RuleSetName }).(pulumi.StringOutput)
}
// A list of S3 Action blocks. Documented below.
func (o ReceiptRuleOutput) S3Actions() ReceiptRuleS3ActionArrayOutput {
return o.ApplyT(func(v *ReceiptRule) ReceiptRuleS3ActionArrayOutput { return v.S3Actions }).(ReceiptRuleS3ActionArrayOutput)
}
// If true, incoming emails will be scanned for spam and viruses
func (o ReceiptRuleOutput) ScanEnabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *ReceiptRule) pulumi.BoolPtrOutput { return v.ScanEnabled }).(pulumi.BoolPtrOutput)
}
// A list of SNS Action blocks. Documented below.
func (o ReceiptRuleOutput) SnsActions() ReceiptRuleSnsActionArrayOutput {
return o.ApplyT(func(v *ReceiptRule) ReceiptRuleSnsActionArrayOutput { return v.SnsActions }).(ReceiptRuleSnsActionArrayOutput)
}
// A list of Stop Action blocks. Documented below.
func (o ReceiptRuleOutput) StopActions() ReceiptRuleStopActionArrayOutput {
return o.ApplyT(func(v *ReceiptRule) ReceiptRuleStopActionArrayOutput { return v.StopActions }).(ReceiptRuleStopActionArrayOutput)
}
// `Require` or `Optional`
func (o ReceiptRuleOutput) TlsPolicy() pulumi.StringOutput {
return o.ApplyT(func(v *ReceiptRule) pulumi.StringOutput { return v.TlsPolicy }).(pulumi.StringOutput)
}
// A list of WorkMail Action blocks. Documented below.
func (o ReceiptRuleOutput) WorkmailActions() ReceiptRuleWorkmailActionArrayOutput {
return o.ApplyT(func(v *ReceiptRule) ReceiptRuleWorkmailActionArrayOutput { return v.WorkmailActions }).(ReceiptRuleWorkmailActionArrayOutput)
}
type ReceiptRuleArrayOutput struct{ *pulumi.OutputState }
func (ReceiptRuleArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ReceiptRule)(nil)).Elem()
}
func (o ReceiptRuleArrayOutput) ToReceiptRuleArrayOutput() ReceiptRuleArrayOutput {
return o
}
func (o ReceiptRuleArrayOutput) ToReceiptRuleArrayOutputWithContext(ctx context.Context) ReceiptRuleArrayOutput {
return o
}
func (o ReceiptRuleArrayOutput) Index(i pulumi.IntInput) ReceiptRuleOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ReceiptRule {
return vs[0].([]*ReceiptRule)[vs[1].(int)]
}).(ReceiptRuleOutput)
}
type ReceiptRuleMapOutput struct{ *pulumi.OutputState }
func (ReceiptRuleMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ReceiptRule)(nil)).Elem()
}
func (o ReceiptRuleMapOutput) ToReceiptRuleMapOutput() ReceiptRuleMapOutput {
return o
}
func (o ReceiptRuleMapOutput) ToReceiptRuleMapOutputWithContext(ctx context.Context) ReceiptRuleMapOutput {
return o
}
func (o ReceiptRuleMapOutput) MapIndex(k pulumi.StringInput) ReceiptRuleOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ReceiptRule {
return vs[0].(map[string]*ReceiptRule)[vs[1].(string)]
}).(ReceiptRuleOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ReceiptRuleInput)(nil)).Elem(), &ReceiptRule{})
pulumi.RegisterInputType(reflect.TypeOf((*ReceiptRuleArrayInput)(nil)).Elem(), ReceiptRuleArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ReceiptRuleMapInput)(nil)).Elem(), ReceiptRuleMap{})
pulumi.RegisterOutputType(ReceiptRuleOutput{})
pulumi.RegisterOutputType(ReceiptRuleArrayOutput{})
pulumi.RegisterOutputType(ReceiptRuleMapOutput{})
}