1
|
|
|
package ses |
2
|
|
|
|
3
|
|
|
import ( |
4
|
|
|
"context" |
5
|
|
|
|
6
|
|
|
SDK "github.com/aws/aws-sdk-go-v2/service/ses" |
7
|
|
|
|
8
|
|
|
"github.com/evalphobia/aws-sdk-go-v2-wrapper/errors" |
9
|
|
|
"github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers" |
10
|
|
|
) |
11
|
|
|
|
12
|
|
|
// SendBulkTemplatedEmail executes `SendBulkTemplatedEmail` operation. |
13
|
|
|
func (svc *SES) SendBulkTemplatedEmail(ctx context.Context, r SendBulkTemplatedEmailRequest) (*SendBulkTemplatedEmailResult, error) { |
14
|
|
|
out, err := svc.RawSendBulkTemplatedEmail(ctx, r.ToInput()) |
15
|
|
|
if err != nil { |
16
|
|
|
err = svc.errWrap(errors.ErrorData{ |
17
|
|
|
Err: err, |
18
|
|
|
AWSOperation: "SendBulkTemplatedEmail", |
19
|
|
|
}) |
20
|
|
|
svc.Errorf(err.Error()) |
|
|
|
|
21
|
|
|
return nil, err |
22
|
|
|
} |
23
|
|
|
return NewSendBulkTemplatedEmailResult(out), nil |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
// SendBulkTemplatedEmailRequest has parameters for `SendBulkTemplatedEmail` operation. |
27
|
|
|
type SendBulkTemplatedEmailRequest struct { |
28
|
|
|
Destinations []BulkEmailDestination |
29
|
|
|
Source string |
30
|
|
|
Template string |
31
|
|
|
|
32
|
|
|
// optional |
33
|
|
|
ConfigurationSetName string |
34
|
|
|
DefaultTags []MessageTag |
35
|
|
|
DefaultTemplateData string |
36
|
|
|
ReplyToAddresses []string |
37
|
|
|
ReturnPath string |
38
|
|
|
ReturnPathARN string |
39
|
|
|
SourceARN string |
40
|
|
|
TemplateARN string |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
func (r SendBulkTemplatedEmailRequest) ToInput() *SDK.SendBulkTemplatedEmailInput { |
|
|
|
|
44
|
|
|
in := &SDK.SendBulkTemplatedEmailInput{} |
45
|
|
|
|
46
|
|
|
if len(r.Destinations) != 0 { |
47
|
|
|
list := make([]SDK.BulkEmailDestination, len(r.Destinations)) |
48
|
|
|
for i, v := range r.Destinations { |
49
|
|
|
list[i] = v.ToSDK() |
50
|
|
|
} |
51
|
|
|
in.Destinations = list |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
if r.Source != "" { |
55
|
|
|
in.Source = pointers.String(r.Source) |
56
|
|
|
} |
57
|
|
|
if r.Template != "" { |
58
|
|
|
in.Template = pointers.String(r.Template) |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
if r.ConfigurationSetName != "" { |
62
|
|
|
in.ConfigurationSetName = pointers.String(r.ConfigurationSetName) |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
if len(r.DefaultTags) != 0 { |
66
|
|
|
list := make([]SDK.MessageTag, len(r.DefaultTags)) |
67
|
|
|
for i, v := range r.DefaultTags { |
68
|
|
|
list[i] = v.ToSDK() |
69
|
|
|
} |
70
|
|
|
in.DefaultTags = list |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
if r.DefaultTemplateData != "" { |
74
|
|
|
in.DefaultTemplateData = pointers.String(r.DefaultTemplateData) |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
in.ReplyToAddresses = r.ReplyToAddresses |
78
|
|
|
|
79
|
|
|
if r.ReturnPath != "" { |
80
|
|
|
in.ReturnPath = pointers.String(r.ReturnPath) |
81
|
|
|
} |
82
|
|
|
if r.ReturnPathARN != "" { |
83
|
|
|
in.ReturnPathArn = pointers.String(r.ReturnPathARN) |
84
|
|
|
} |
85
|
|
|
if r.SourceARN != "" { |
86
|
|
|
in.SourceArn = pointers.String(r.SourceARN) |
87
|
|
|
} |
88
|
|
|
if r.TemplateARN != "" { |
89
|
|
|
in.TemplateArn = pointers.String(r.TemplateARN) |
90
|
|
|
} |
91
|
|
|
return in |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
type SendBulkTemplatedEmailResult struct { |
|
|
|
|
95
|
|
|
Status []BulkEmailDestinationStatus |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
func NewSendBulkTemplatedEmailResult(o *SDK.SendBulkTemplatedEmailResponse) *SendBulkTemplatedEmailResult { |
|
|
|
|
99
|
|
|
result := &SendBulkTemplatedEmailResult{} |
100
|
|
|
if o == nil { |
101
|
|
|
return result |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
result.Status = newBulkEmailDestinationStatuses(o.Status) |
105
|
|
|
return result |
106
|
|
|
} |
107
|
|
|
|