feat: MSK, MSK CONNECT and SES

This commit is contained in:
Zakaria
2026-10-05 11:06:57 -04:00
parent 2d8ff50a99
commit c0d3e5f402
84 changed files with 3513 additions and 195 deletions
+55
View File
@@ -0,0 +1,55 @@
import {Hono} from "hono";
import {
sesService,
type RawEmailInput,
} from "../services/ses";
import type {
CreateConfigurationSetCommandInput,
CreateConfigurationSetEventDestinationCommandInput,
CreateEmailIdentityCommandInput,
CreateEmailTemplateCommandInput,
PutSuppressedDestinationCommandInput,
SendEmailCommandInput,
TestRenderEmailTemplateCommandInput,
UpdateEmailTemplateCommandInput,
} from "@aws-sdk/client-sesv2";
type SesService = typeof sesService;
export function createSesRouter(service: SesService = sesService) {
const app = new Hono();
app.get("/identities", async (c) => c.json(await service.listIdentities()));
app.post("/identities", async (c) => c.json(await service.createIdentity(await c.req.json<CreateEmailIdentityCommandInput>()), 201));
app.delete("/identities/:identity", async (c) => c.json(await service.deleteIdentity(c.req.param("identity"))));
app.post("/emails/simple", async (c) => c.json(await service.sendSimple(await c.req.json<SendEmailCommandInput>()), 201));
app.post("/emails/raw", async (c) => c.json(await service.sendRaw(await c.req.json<RawEmailInput>()), 201));
app.post("/emails/template", async (c) => c.json(await service.sendTemplate(await c.req.json<SendEmailCommandInput>()), 201));
app.get("/suppressions", async (c) => c.json(await service.listSuppressedDestinations()));
app.post("/suppressions", async (c) => c.json(await service.createSuppression(await c.req.json<PutSuppressedDestinationCommandInput>()), 201));
app.delete("/suppressions/:emailAddress", async (c) => c.json(await service.deleteSuppression(c.req.param("emailAddress"))));
app.get("/templates", async (c) => c.json(await service.listTemplates()));
app.get("/templates/:templateName", async (c) => c.json(await service.getTemplate(c.req.param("templateName"))));
app.post("/templates", async (c) => c.json(await service.createTemplate(await c.req.json<CreateEmailTemplateCommandInput>()), 201));
app.put("/templates/:templateName", async (c) => c.json(await service.updateTemplate(c.req.param("templateName"), await c.req.json<Omit<UpdateEmailTemplateCommandInput, "TemplateName">>())));
app.delete("/templates/:templateName", async (c) => c.json(await service.deleteTemplate(c.req.param("templateName"))));
app.post("/templates/test-render", async (c) => c.json(await service.testRenderTemplate(await c.req.json<TestRenderEmailTemplateCommandInput>())));
app.get("/configuration-sets", async (c) => c.json(await service.listConfigurationSets()));
app.post("/configuration-sets", async (c) => c.json(await service.createConfigurationSet(await c.req.json<CreateConfigurationSetCommandInput>()), 201));
app.delete("/configuration-sets/:configurationSetName", async (c) => c.json(await service.deleteConfigurationSet(c.req.param("configurationSetName"))));
app.get("/configuration-sets/:configurationSetName/event-destinations", async (c) => c.json(await service.listEventDestinations(c.req.param("configurationSetName"))));
app.post("/configuration-sets/:configurationSetName/event-destinations", async (c) => c.json(await service.createEventDestination(c.req.param("configurationSetName"), await c.req.json<Omit<CreateConfigurationSetEventDestinationCommandInput, "ConfigurationSetName">>()), 201));
app.delete("/configuration-sets/:configurationSetName/event-destinations/:eventDestinationName", async (c) => c.json(await service.deleteEventDestination(c.req.param("configurationSetName"), c.req.param("eventDestinationName"))));
app.get("/inventory/sns-topics", async (c) => c.json(await service.listSnsTopics()));
app.get("/inventory/event-buses", async (c) => c.json(await service.listEventBuses()));
app.get("/inventory/cloudwatch-metrics", async (c) => c.json(await service.listSesMetrics()));
return app;
}
export default createSesRouter();