-
Notifications
You must be signed in to change notification settings - Fork 14
/
lib.w
41 lines (36 loc) · 1.2 KB
/
lib.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
bring util;
bring "./types.w" as types;
bring "./sim.w" as sim;
bring "./tfaws.w" as tfaws;
/// EmailService can used for defining and interacting with AWS SES.
/// When running the simulator in a non test environment, it will use the
/// actual cloud implementation.
pub class EmailService impl types.IEmailService {
inner: types.IEmailService;
new(props: types.EmailServiceProps) {
let target = util.env("WING_TARGET");
if target == "sim" {
if nodeof(this).app.isTestEnvironment {
this.inner = new sim.EmailService_sim(props);
} else {
this.inner = new tfaws.EmailService_tfaws(props);
}
} else if target == "tf-aws" {
this.inner = new tfaws.EmailService_tfaws(props);
} else {
throw "Unknown target: {target}";
}
nodeof(this.inner).hidden = true;
nodeof(this).icon = "inbox";
nodeof(this).color = "pink";
}
pub inflight sendEmail(options: types.SendEmailOptions): str? {
return this.inner.sendEmail(options);
}
pub inflight sendRawEmail(options: types.SendRawEmailOptions): str? {
return this.inner.sendRawEmail(options);
}
pub onLift(host: std.IInflightHost, ops: Array<str>) {
this.inner.onLift(host, ops);
}
}