-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtfaws.w
73 lines (65 loc) · 2.3 KB
/
tfaws.w
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
bring "@cdktf/provider-aws" as aws;
bring "./types.w" as types;
bring aws as awsUtils;
pub class EmailService_tfaws impl types.IEmailService {
new(props: types.EmailServiceProps) {
if let emailIdentities = props.emailIdentities {
for email in emailIdentities {
new aws.sesEmailIdentity.SesEmailIdentity(
email: email
) as "emailIdentity-{email.replaceAll("@", "_")}";
}
}
if let configurationSet = props.configurationSet {
new aws.sesConfigurationSet.SesConfigurationSet(
name: configurationSet.name,
) as "configurationSet";
if let eventDestination = props.eventDestination {
let var cloudwatch: Json? = nil;
if let cloudwatchDestination = eventDestination.cloudwatchDestination {
cloudwatch = {
default_value: cloudwatchDestination.defaultValue,
dimension_name: cloudwatchDestination.dimensionName,
value_source: cloudwatchDestination.valueSource,
};
}
new aws.sesEventDestination.SesEventDestination(
name: eventDestination.name,
configurationSetName: configurationSet.name,
enabled: true,
matchingTypes: eventDestination.matchingTypes,
cloudwatchDestination: cloudwatch,
) as "eventDestination";
}
}
}
pub inflight sendEmail(options: types.SendEmailOptions): str? {
return EmailService_tfaws._sendEmail(options);
}
pub inflight sendRawEmail(options: types.SendRawEmailOptions): str? {
return EmailService_tfaws._sendRawEmail(options);
}
pub onLift(host: std.IInflightHost, ops: Array<str>) {
if let awsFunc = awsUtils.Function.from(host) {
if ops.contains("sendEmail") {
awsFunc.addPolicyStatements({
effect: awsUtils.Effect.ALLOW,
actions: ["ses:SendEmail"],
resources: [
"*"
]
});
} else if ops.contains("sendRawEmail") {
awsFunc.addPolicyStatements({
effect: awsUtils.Effect.ALLOW,
actions: ["ses:SendRawEmail"],
resources: [
"*"
]
});
}
}
}
extern "./aws.js" static inflight _sendEmail(options: types.SendEmailOptions): str?;
extern "./aws.js" static inflight _sendRawEmail(options: types.SendRawEmailOptions): str?;
}