-
Notifications
You must be signed in to change notification settings - Fork 151
/
emailChannel.go
334 lines (288 loc) · 13 KB
/
emailChannel.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package pinpoint
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Pinpoint Email Channel resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/iam"
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/pinpoint"
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ses"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// app, err := pinpoint.NewApp(ctx, "app", nil)
// if err != nil {
// return err
// }
// role, err := iam.NewRole(ctx, "role", &iam.RoleArgs{
// AssumeRolePolicy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Statement\": [\n", " {\n", " \"Action\": \"sts:AssumeRole\",\n", " \"Principal\": {\n", " \"Service\": \"pinpoint.amazonaws.com\"\n", " },\n", " \"Effect\": \"Allow\",\n", " \"Sid\": \"\"\n", " }\n", " ]\n", "}\n")),
// })
// if err != nil {
// return err
// }
// _, err = pinpoint.NewEmailChannel(ctx, "email", &pinpoint.EmailChannelArgs{
// ApplicationId: app.ApplicationId,
// FromAddress: pulumi.String("user@example.com"),
// RoleArn: role.Arn,
// })
// if err != nil {
// return err
// }
// _, err = ses.NewDomainIdentity(ctx, "identity", &ses.DomainIdentityArgs{
// Domain: pulumi.String("example.com"),
// })
// if err != nil {
// return err
// }
// _, err = iam.NewRolePolicy(ctx, "rolePolicy", &iam.RolePolicyArgs{
// Role: role.ID(),
// Policy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Statement\": {\n", " \"Action\": [\n", " \"mobileanalytics:PutEvents\",\n", " \"mobileanalytics:PutItems\"\n", " ],\n", " \"Effect\": \"Allow\",\n", " \"Resource\": [\n", " \"*\"\n", " ]\n", " }\n", "}\n")),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Pinpoint Email Channel can be imported using the `application-id`, e.g.,
//
// ```sh
// $ pulumi import aws:pinpoint/emailChannel:EmailChannel email application-id
// ```
type EmailChannel struct {
pulumi.CustomResourceState
// The application ID.
ApplicationId pulumi.StringOutput `pulumi:"applicationId"`
// The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
ConfigurationSet pulumi.StringPtrOutput `pulumi:"configurationSet"`
// Whether the channel is enabled or disabled. Defaults to `true`.
Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
// The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
FromAddress pulumi.StringOutput `pulumi:"fromAddress"`
// The ARN of an identity verified with SES.
Identity pulumi.StringOutput `pulumi:"identity"`
// Messages per second that can be sent.
MessagesPerSecond pulumi.IntOutput `pulumi:"messagesPerSecond"`
// The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
RoleArn pulumi.StringPtrOutput `pulumi:"roleArn"`
}
// NewEmailChannel registers a new resource with the given unique name, arguments, and options.
func NewEmailChannel(ctx *pulumi.Context,
name string, args *EmailChannelArgs, opts ...pulumi.ResourceOption) (*EmailChannel, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ApplicationId == nil {
return nil, errors.New("invalid value for required argument 'ApplicationId'")
}
if args.FromAddress == nil {
return nil, errors.New("invalid value for required argument 'FromAddress'")
}
if args.Identity == nil {
return nil, errors.New("invalid value for required argument 'Identity'")
}
var resource EmailChannel
err := ctx.RegisterResource("aws:pinpoint/emailChannel:EmailChannel", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetEmailChannel gets an existing EmailChannel 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 GetEmailChannel(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EmailChannelState, opts ...pulumi.ResourceOption) (*EmailChannel, error) {
var resource EmailChannel
err := ctx.ReadResource("aws:pinpoint/emailChannel:EmailChannel", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering EmailChannel resources.
type emailChannelState struct {
// The application ID.
ApplicationId *string `pulumi:"applicationId"`
// The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
ConfigurationSet *string `pulumi:"configurationSet"`
// Whether the channel is enabled or disabled. Defaults to `true`.
Enabled *bool `pulumi:"enabled"`
// The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
FromAddress *string `pulumi:"fromAddress"`
// The ARN of an identity verified with SES.
Identity *string `pulumi:"identity"`
// Messages per second that can be sent.
MessagesPerSecond *int `pulumi:"messagesPerSecond"`
// The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
RoleArn *string `pulumi:"roleArn"`
}
type EmailChannelState struct {
// The application ID.
ApplicationId pulumi.StringPtrInput
// The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
ConfigurationSet pulumi.StringPtrInput
// Whether the channel is enabled or disabled. Defaults to `true`.
Enabled pulumi.BoolPtrInput
// The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
FromAddress pulumi.StringPtrInput
// The ARN of an identity verified with SES.
Identity pulumi.StringPtrInput
// Messages per second that can be sent.
MessagesPerSecond pulumi.IntPtrInput
// The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
RoleArn pulumi.StringPtrInput
}
func (EmailChannelState) ElementType() reflect.Type {
return reflect.TypeOf((*emailChannelState)(nil)).Elem()
}
type emailChannelArgs struct {
// The application ID.
ApplicationId string `pulumi:"applicationId"`
// The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
ConfigurationSet *string `pulumi:"configurationSet"`
// Whether the channel is enabled or disabled. Defaults to `true`.
Enabled *bool `pulumi:"enabled"`
// The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
FromAddress string `pulumi:"fromAddress"`
// The ARN of an identity verified with SES.
Identity string `pulumi:"identity"`
// The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
RoleArn *string `pulumi:"roleArn"`
}
// The set of arguments for constructing a EmailChannel resource.
type EmailChannelArgs struct {
// The application ID.
ApplicationId pulumi.StringInput
// The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
ConfigurationSet pulumi.StringPtrInput
// Whether the channel is enabled or disabled. Defaults to `true`.
Enabled pulumi.BoolPtrInput
// The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
FromAddress pulumi.StringInput
// The ARN of an identity verified with SES.
Identity pulumi.StringInput
// The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
RoleArn pulumi.StringPtrInput
}
func (EmailChannelArgs) ElementType() reflect.Type {
return reflect.TypeOf((*emailChannelArgs)(nil)).Elem()
}
type EmailChannelInput interface {
pulumi.Input
ToEmailChannelOutput() EmailChannelOutput
ToEmailChannelOutputWithContext(ctx context.Context) EmailChannelOutput
}
func (*EmailChannel) ElementType() reflect.Type {
return reflect.TypeOf((**EmailChannel)(nil)).Elem()
}
func (i *EmailChannel) ToEmailChannelOutput() EmailChannelOutput {
return i.ToEmailChannelOutputWithContext(context.Background())
}
func (i *EmailChannel) ToEmailChannelOutputWithContext(ctx context.Context) EmailChannelOutput {
return pulumi.ToOutputWithContext(ctx, i).(EmailChannelOutput)
}
// EmailChannelArrayInput is an input type that accepts EmailChannelArray and EmailChannelArrayOutput values.
// You can construct a concrete instance of `EmailChannelArrayInput` via:
//
// EmailChannelArray{ EmailChannelArgs{...} }
type EmailChannelArrayInput interface {
pulumi.Input
ToEmailChannelArrayOutput() EmailChannelArrayOutput
ToEmailChannelArrayOutputWithContext(context.Context) EmailChannelArrayOutput
}
type EmailChannelArray []EmailChannelInput
func (EmailChannelArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EmailChannel)(nil)).Elem()
}
func (i EmailChannelArray) ToEmailChannelArrayOutput() EmailChannelArrayOutput {
return i.ToEmailChannelArrayOutputWithContext(context.Background())
}
func (i EmailChannelArray) ToEmailChannelArrayOutputWithContext(ctx context.Context) EmailChannelArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(EmailChannelArrayOutput)
}
// EmailChannelMapInput is an input type that accepts EmailChannelMap and EmailChannelMapOutput values.
// You can construct a concrete instance of `EmailChannelMapInput` via:
//
// EmailChannelMap{ "key": EmailChannelArgs{...} }
type EmailChannelMapInput interface {
pulumi.Input
ToEmailChannelMapOutput() EmailChannelMapOutput
ToEmailChannelMapOutputWithContext(context.Context) EmailChannelMapOutput
}
type EmailChannelMap map[string]EmailChannelInput
func (EmailChannelMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EmailChannel)(nil)).Elem()
}
func (i EmailChannelMap) ToEmailChannelMapOutput() EmailChannelMapOutput {
return i.ToEmailChannelMapOutputWithContext(context.Background())
}
func (i EmailChannelMap) ToEmailChannelMapOutputWithContext(ctx context.Context) EmailChannelMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(EmailChannelMapOutput)
}
type EmailChannelOutput struct{ *pulumi.OutputState }
func (EmailChannelOutput) ElementType() reflect.Type {
return reflect.TypeOf((**EmailChannel)(nil)).Elem()
}
func (o EmailChannelOutput) ToEmailChannelOutput() EmailChannelOutput {
return o
}
func (o EmailChannelOutput) ToEmailChannelOutputWithContext(ctx context.Context) EmailChannelOutput {
return o
}
type EmailChannelArrayOutput struct{ *pulumi.OutputState }
func (EmailChannelArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EmailChannel)(nil)).Elem()
}
func (o EmailChannelArrayOutput) ToEmailChannelArrayOutput() EmailChannelArrayOutput {
return o
}
func (o EmailChannelArrayOutput) ToEmailChannelArrayOutputWithContext(ctx context.Context) EmailChannelArrayOutput {
return o
}
func (o EmailChannelArrayOutput) Index(i pulumi.IntInput) EmailChannelOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EmailChannel {
return vs[0].([]*EmailChannel)[vs[1].(int)]
}).(EmailChannelOutput)
}
type EmailChannelMapOutput struct{ *pulumi.OutputState }
func (EmailChannelMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EmailChannel)(nil)).Elem()
}
func (o EmailChannelMapOutput) ToEmailChannelMapOutput() EmailChannelMapOutput {
return o
}
func (o EmailChannelMapOutput) ToEmailChannelMapOutputWithContext(ctx context.Context) EmailChannelMapOutput {
return o
}
func (o EmailChannelMapOutput) MapIndex(k pulumi.StringInput) EmailChannelOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EmailChannel {
return vs[0].(map[string]*EmailChannel)[vs[1].(string)]
}).(EmailChannelOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*EmailChannelInput)(nil)).Elem(), &EmailChannel{})
pulumi.RegisterInputType(reflect.TypeOf((*EmailChannelArrayInput)(nil)).Elem(), EmailChannelArray{})
pulumi.RegisterInputType(reflect.TypeOf((*EmailChannelMapInput)(nil)).Elem(), EmailChannelMap{})
pulumi.RegisterOutputType(EmailChannelOutput{})
pulumi.RegisterOutputType(EmailChannelArrayOutput{})
pulumi.RegisterOutputType(EmailChannelMapOutput{})
}