mirror of
https://github.com/floci-io/floci.git
synced 2026-11-28 16:11:48 -05:00
3b4e73ca5a52e2b69b522e729a39dfdae3e0dfe3
22
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
35f597addd |
feat(ses): publish events to Firehose, EventBridge, CloudWatch (#1188)
* feat(ses): publish events to Firehose, EventBridge, and CloudWatch destinations
Extend SES V2 configuration set event publishing so destinations beyond
SnsDestination actually deliver. Previously KinesisFirehoseDestination,
EventBridgeDestination, and CloudWatchDestination were stored but the
publisher logged a warning and skipped. PinpointDestination still skips.
- KinesisFirehoseDestination → single Firehose PutRecord per event;
S3-backed streams flush accumulated records as NDJSON once the default
count threshold is reached.
- EventBridgeDestination → PutEvents entry with Source=aws.ses,
DetailType="Email <EventTypeLabel>", payload as Detail. Region is
stamped on the entry (so matchesPattern + envelope agree on a
non-default region) and Resources is always present (empty when
sourceArn is null — matchesPattern's resources-filter branch casts
entry.get("Resources") unconditionally).
- CloudWatchDestination → MetricDatum to AWS/SES with Unit=Count.
Dimensions resolved from DimensionConfigurations against EmailTags
(MESSAGE_TAG / messageTag), email headers (EMAIL_HEADER / emailHeader),
or ses:configuration-set, falling back to DefaultDimensionValue.
Timestamp left to putMetricData's epoch-seconds default.
Tests
- SesEventPublishingV2IntegrationTest @Order 14-28: per-destination
setup → send → assert, plus a cross-region (eu-west-1) EventBridge
case pinning region propagation end-to-end.
- SesEventPublisherTest (Mockito ArgumentCaptor): the EB PutEvents
entry always carries Resources as an ArrayNode — integration tests
cannot pin this because EventBridgeService.buildEventEnvelope
defaults a missing key via getOrDefault.
Docs
- docs/services/ses.md: replace the SNS-only claim with the four
supported destination types.
* fix(ses): use AWS past-tense detail-type for EventBridge SES events
The EventBridge publisher was emitting "Email Send", "Email Delivery",
etc — derived from the SNS notification eventType vocabulary by
prepending "Email ". AWS uses a separate past-tense vocabulary on
EventBridge: "Email Sent", "Email Delivered", "Email Bounced", "Email
Complaint Received", "Email Rejected", "Email Opened", "Email Clicked",
"Email Rendering Failed", "Email Delivery Delayed", "Email Subscribed"
(see https://docs.aws.amazon.com/eventbridge/latest/ref/events-ref-ses.html).
A customer rule pattern keyed on the AWS value
({"source":["aws.ses"],"detail-type":["Email Delivered"]}) would
silently fail to match Floci events.
Changes:
- Add SesEventPayload.eventBridgeDetailType returning the past-tense
EventBridge vocabulary. Kept separate from eventTypeLabel (which
remains correct for SNS notifications and CloudWatch metric names).
- SesEventPublisher.publishEventBridge uses the new mapping.
Tests
- SesEventPayloadTest.eventBridgeDetailType_matchesAwsPastTenseVocabulary:
pins all 10 mappings against AWS docs.
- SesEventPublishingV2IntegrationTest @Order 29
(eventBridge_detailTypePattern_keyedOnAwsSentValue_matches):
structural pin — creates a rule with EventPattern
{"source":["aws.ses"],"detail-type":["Email Sent"]} and asserts the
SQS target receives the SEND envelope. A regression to "Email Send"
would cause the rule to silently drop the event, failing the test
without relying on any hard-coded assertion string.
- Existing tests updated to assert the AWS values:
SesEventPublishingV2IntegrationTest 4 assertions; sdk-test-java
SesEventPublishingTest 3 assertions.
* fix(ses): emit CloudWatch metric name "RenderingFailure" without space
AWS CloudWatch metric publishing for SES uses "RenderingFailure" (no
space) for the RENDERING_FAILURE event type — verified against real
AWS by configuring a CW event destination on a configuration set,
sending a templated email with a missing TemplateData key to trigger
the rendering failure path, and capturing the new metric name from
`aws cloudwatch list-metrics --namespace AWS/SES`.
Floci's publisher was previously sourcing the CW MetricName from
SesEventPayload.eventTypeLabel, which returns "Rendering Failure" (with
space). That spelling is correct for the SNS notification's eventType
field but wrong for CloudWatch — customer dashboards / alarms keyed on
the AWS-correct "RenderingFailure" never see Floci's metric.
Changes:
- Add SesEventPayload.cloudWatchMetricName returning the CW spelling.
Mirrors eventTypeLabel for every other case so the two stay aligned
in shape; only RENDERING_FAILURE differs.
- SesEventPublisher.publishCloudWatch uses the new mapping.
- SesEventPayloadTest.cloudWatchMetricName_matchesAwsCwSpelling pins
all 10 mappings; RENDERING_FAILURE expectation comes from the live
AWS capture rather than an AWS docs guess.
DELIVERY_DELAY remains as "DeliveryDelay" in this commit — it could
not be triggered conveniently from the SES sandbox (needs genuine SES
backoff), so leaving the existing value rather than guessing. Flagged
in code comments as needing future verification.
The other simple metric names (Send, Delivery, Bounce, Complaint) were
also verified against the same AWS capture and match Floci's existing
spelling byte-for-byte — no change needed for those.
|
||
|
|
e36576c2a4 |
feat(ses): per-configuration-set sending toggle (v1 + v2) (#1193)
Add UpdateConfigurationSetSendingEnabled (SES v1 Query) and
PutConfigurationSetSendingOptions (SES v2 REST, PUT
/v2/email/configuration-sets/{name}/sending) to toggle email sending
on a single configuration set, complementing the existing
account-level UpdateAccountSendingEnabled / PutAccountSendingAttributes
toggle. The two APIs share state: both write
`ConfigurationSet.sendingEnabled` (Boolean, null/true = enabled).
Enforcement is centralized in SesService.validateConfigurationSet,
which is called by SendEmail, SendRawEmail, and SendBulkTemplatedEmail
(v1 and v2 paths). When the CS's sendingEnabled is false, the send is
rejected with SendingPausedException + "Sending is paused for
configuration set <name>" — matching the exact wire shape AWS returns
in production (verified via `aws sesv2 send-email` against an AWS
account with a disabled CS; both ErrorCode and Message reproduce as-is).
Read-back paths:
- v2 GetConfigurationSet returns SendingOptions: {SendingEnabled}
- v1 DescribeConfigurationSet with `reputationOptions` attribute
returns ReputationOptions/SendingEnabled (matches the AWS v1 wire
contract where SendingEnabled lives under ReputationOptions)
The v1 action is also added to AwsQueryController.SES_ACTIONS so that
action-name-based service routing recognizes it.
Tests
- SesConfigurationSetSendingOptionsV2IntegrationTest (13 cases): toggle
via both APIs, cross-API state sharing, SendEmail rejection with
SendingPausedException when disabled, read-back via Get/Describe,
bad-request validation, unknown CS returns 404 via v2.
- SesConfigurationSetSendingTest (SDK compat, 9 cases): AWS Java SDK
v2 marshalling of both APIs, with sendEmail rejection asserted as
`SendingPausedException` (the AWS SDK class corresponding to the
matched server-side error code).
Docs
- docs/services/ses.md: list both APIs in their respective tables.
|
||
|
|
68c9dcc6fb |
docs(ses): list v1 ConfigurationSetEventDestination actions (#1192)
The v1 Query handler dispatches Create / Update / Delete ConfigurationSetEventDestination at SesQueryHandler.java:85-90 but the Supported Actions table in docs/services/ses.md did not list them, leaving the v1 surface under-documented compared to v2 (which already has the equivalent REST endpoints listed). |
||
|
|
19b0432b8c |
feat(ses): apply suppression list during send with per-CS SuppressionOptions override (#1109)
When SendEmail / SendRawEmail is called with a recipient on the
account-level suppression list whose reason matches the effective
SuppressedReasons (the configuration set's SuppressionOptions
override if present, else the account-level reasons), Floci now:
1. Emits a synthetic Bounce or Complaint event (per the suppression
reason) through the configured event destinations alongside the
always-emitted Send event.
2. Drops the suppressed recipient from the SMTP relay step, while
still delivering the message to non-suppressed recipients on the
same send.
The SendEmail API response (200 + MessageId), the stored SentEmail
(used by the LocalStack-compatible /_aws/ses inspection endpoint),
and the published event's mail.destination all continue to reflect
the original recipient list — matching how AWS reports the message
at the API and event layers.
This PR bundles two related pieces:
- The per-configuration-set SuppressionOptions block (Put endpoint +
GetConfigurationSet response shape + getEffectiveSuppressedReasons
helper). Mirrors AWS V2 PutConfigurationSetSuppressionOptions:
empty list = explicit "no suppression filtering" for this CS,
unset block = fall back to account-level reasons. The validation
message for the new endpoint matches the AWS V2 natural-language
form ("Reason <X> is invalid, must be one of [BOUNCE, COMPLAINT].")
which is distinct from the V1-style nested message returned by the
three older suppression endpoints; both forms were verified
against live AWS on 2026-06-03.
- The send-time filter + synthetic-event partitioning, plumbed
through getEffectiveSuppressedReasons so the override takes effect
per-send. collectSuppressedReasons and resolveSuppressionReason
now both take configurationSetName, hitting the per-CS override
when present and falling back to the account-level reasons
otherwise.
Per-recipient: when only some recipients are suppressed, the
non-suppressed ones still reach smtpRelay.relay() / relayRaw().
The relay is skipped entirely only when every recipient is
suppressed.
- Recipient suppressed with reason BOUNCE (and BOUNCE in the
effective reasons) -> synthetic Bounce event; not relayed.
- Recipient suppressed with reason COMPLAINT (and COMPLAINT in the
effective reasons) -> synthetic Complaint event; not relayed.
- Reason mismatch or address not on the list -> Send only; relayed
normally.
- Simulator-address recipients and suppression-listed recipients
are unioned into the same event's recipient list, deduplicated.
Tests
- SesConfigurationSetSuppressionOptionsV2IntegrationTest (16 cases)
for the CRUD + helper.
- SesConfigurationSetTest SDK compat (6 V2 cases) using
SesV2Client.PutConfigurationSetSuppressionOptions and the typed
SuppressionListReason enum (+ the WithStrings escape hatch for
the server-side validation path).
- SesServiceSmtpTest grows four cases pinning the send-time
override behaviour: empty list on the CS disables filtering and
the relay receives the address; BOUNCE-only override leaves
COMPLAINT-suppressed addresses unfiltered; a CS without an
override falls back to account-level (parity with no-CS sends);
raw-send mirrors the JSON-send path.
- SesEventPayload / SesEventPublishingV2IntegrationTest / further
send-path coverage from the original suppression PR is preserved.
- All 452 SES tests pass.
|
||
|
|
35211adc4a |
feat(ses): publish SES events to SNS configuration set destinations (#1106)
* feat(ses): publish SES events to SNS configuration set destinations Add SES V2 event publishing to SnsDestination targets configured on a ConfigurationSet. When SendEmail / SendRawEmail / SendTemplatedEmail / SendBulkEmail is invoked with a ConfigurationSetName, Floci builds the matching AWS-format event payload (a `mail` block plus an event-type- specific block) and publishes it to each enabled SNS destination whose MatchingEventTypes includes that event. Events emitted - SEND on every successful send. - DELIVERY / BOUNCE / COMPLAINT / REJECT when a recipient matches the corresponding AWS mailbox simulator address (success@ / bounce@ / complaint@ / suppressionlist@simulator.amazonses.com). - Per-event-type recipient lists (delivery.recipients, bounce.bouncedRecipients, complaint.complainedRecipients) are filtered to only the simulator address that triggered the event and emitted in their canonical trimmed form; mail.destination carries the full envelope. Wire-level fidelity - Event payload mirrors the AWS SES SNS notification format documented at https://docs.aws.amazon.com/ses/latest/dg/event-publishing-retrieving-sns-examples.html. - mail.tags includes user-supplied EmailTags / DefaultEmailTags / ReplacementTags (V2) and Tags.member.N / DefaultTags.member.N / Destinations.member.N.ReplacementTags (V1 Query). Each tag emits as {Name: [Value]}. - mail.headers[] appends user-supplied Content.Simple.Headers and Content.Template.Headers after the auto-emitted From/To/Cc/Subject; null/blank Names are rejected with "The header name must be specified." (BadRequestException 400). - V2 SendBulkEmail BulkEmailEntries accept ReplacementTags (merged by Name onto DefaultEmailTags) and ReplacementHeaders (merged case-insensitively per RFC 5322 onto DefaultContent.Template.Headers). - mail.sendingAccountId resolves from EmulatorConfig.defaultAccountId(). - ConfigurationSet existence is validated up-front on sendEmail / sendRawEmail / sendBulkTemplatedEmail — an unknown name fails fast with ConfigurationSetDoesNotExist (V2 controller remaps to NotFoundException 404, V1 returns 400) before any message is stored or relayed. Validation errors aligned with live AWS - EmailTags blank Name: BadRequestException 400 "The tag name must be specified." (V2) / InvalidParameterValue 400 same message (V1). - ConfigurationSetName not found: same error code, status, and message as AWS. Raw email handling - For V2 SendEmail with Raw content (and V1 SendRawEmail), when the caller did not provide Destinations, Floci falls back to To/Cc/Bcc parsed from the raw MIME via SmtpRelay.parseRawHeaders (extracted from the existing relay logic). MIME parsing is only invoked when needed (no explicit Destinations or event publishing active). Internal shape - New records: model/MessageTag (Name, Value, for EmailTags) and model/MessageHeader (Name, Value, for Content.Headers) — kept distinct from the resource-tag Tag (Key, Value). - SesEventPublisher dispatches to SnsService; non-SNS destination types log a warning and are skipped (Firehose / EventBridge / CloudWatch / Pinpoint), and missing SnsDestination.TopicArn likewise warns instead of silently dropping. Failures preserve the throwable in the warn log. Tests - SesEventPayloadTest covers mail/commonHeaders/headers/tags shape, per-event filtering, and the headers/tags propagation paths. - SesServiceMergeEmailTagsTest / SesServiceMergeHeadersTest pin Bulk Default vs per-entry merge semantics (tags by Name case-sensitive, headers by Name case-insensitive per RFC 5322). - SesEventPublishingV2IntegrationTest exercises Send / Delivery / Bounce / SendOnly / mixed-recipient / disabled-destination / V1-MIME-fallback / EmailTags / V1-Tags / Simple.Headers paths end-to-end through SES -> SNS -> SQS. - compatibility-tests/sdk-test-java/SesEventPublishingTest validates SendEmail with EmailTags/Headers and SendBulkEmail with per-entry ReplacementHeaders override using AWS Java SDK V2 clients. * fix(ses): address Copilot review on upstream PR #1106 - SesService.validateConfigurationSet: clarify the Javadoc — the helper always throws with httpStatus = 400, and the V2 controller's remapV1Exception is what turns ConfigurationSetDoesNotExist into NotFoundException 404. The previous "(404 in V2, 400 in V1)" hint read as if the helper itself picked the status, which is misleading. - SesController.parseEmailTagsArray: reject non-object entries with "<fieldName> entries must be JSON objects.", mirroring the existing parseHeadersArray check. Previously a string/number element would hit the blank-Name path and report a less specific message. - SesService.mergeHeaders / mergeEmailTags: also skip entries whose name is the empty string, not just null. Both parsers reject blank names at the boundary, but defending the merge helpers keeps them safe for direct callers (e.g., future tests) and matches the intent of the boundary validation. |
||
|
|
bd6ec2d5c6 |
feat(ses): add SES V2 configuration set event destination operations (#1079)
* feat(ses): add SES V2 configuration set event destination operations Implement CreateConfigurationSetEventDestination, GetConfigurationSetEventDestinations, UpdateConfigurationSetEventDestination, and DeleteConfigurationSetEventDestination on the SES V2 REST JSON API. Event destinations are stored on the configuration set; validation and error messages mirror the real AWS SESv2 responses. Includes REST integration, service unit, and AWS SDK compatibility tests. * fix(ses): return defensive copy from event destination getter and preserve order on update GetConfigurationSetEventDestinations now returns an unmodifiable copy so callers cannot mutate stored state outside the service. UpdateConfigurationSetEventDestination replaces the destination in place (by index) instead of remove+add, keeping the list order stable when a configuration set has multiple event destinations. |
||
|
|
010bbd15cd |
feat(ses): add v2 PutAccountSuppressionAttributes (#853)
Implements PUT /v2/email/account/suppression so callers can change the account-level suppression list reasons (BOUNCE / COMPLAINT). Entries are persisted per region in ses-account-suppression.json via a new AccountSuppressionAttributes model. GetAccount's response is extended with a SuppressionAttributes object that carries the stored SuppressedReasons. The setting itself is metadata-only — floci does not synthesise bounce/complaint events so no auto-suppression is triggered; the configuration round-trips for SDK users and tooling that introspects account-level settings. Behaviour aligned with real-AWS verification: - SuppressedReasons accepts BOUNCE / COMPLAINT, validated against the AWS-canonical nested "Member must satisfy constraint: [Member must satisfy enum value set: [BOUNCE, COMPLAINT]]" wording (verbatim match against real AWS). - SuppressedReasons may be omitted (treated as empty list) or supplied as an empty array (clears the reasons) — both return 200. - Non-textual array members (JSON null, numeric, etc.) are rejected with BadRequestException. - Fresh regions report the AWS-default [BOUNCE, COMPLAINT] via GetAccount; an explicit PUT (including an empty list) overrides it. - The optional ValidationAttributes body field is accepted but not parsed (Tier S scope). Tests: - SesV2IntegrationTest gains nine cases covering store-and-list, clear-with-empty-array, missing field defaulting to empty, invalid Reason (with the AWS-canonical nested message asserted), non-array SuppressedReasons, JSON null array member, numeric array member, optional ValidationAttributes, and the default-on-fresh-region assertion in the existing getAccount case. - SesAccountSuppressionTest exercises the Java SDK round trip and an explicit empty list through SesV2Client; @BeforeAll captures the caller's existing SuppressedReasons and @AfterAll restores it with failures surfaced so a real-AWS run cannot silently leave the account with auto-suppression disabled. |
||
|
|
944f82a6a4 |
feat(ses): add v2 suppression list endpoints (#813)
* feat(ses): add v2 suppression list endpoints
Implements the v2 SES suppression list management plane at
/v2/email/suppression/addresses:
- PUT /v2/email/suppression/addresses PutSuppressedDestination
- GET /v2/email/suppression/addresses/{EmailAddress} GetSuppressedDestination
- DELETE /v2/email/suppression/addresses/{EmailAddress} DeleteSuppressedDestination
- GET /v2/email/suppression/addresses ListSuppressedDestinations
(repeated Reason filter)
Entries are persisted per region in ses-suppression.json. A repeat Put for
the same EmailAddress updates the existing entry's Reason and LastUpdateTime.
List responses are sorted by LastUpdateTime then EmailAddress for stable
output across runs.
Behaviour aligned with real AWS responses:
- EmailAddress is silently trimmed of leading/trailing whitespace on Put
/ Get / Delete; whitespace-only is rejected with BadRequestException.
- Reason validation errors use the AWS-canonical "1 validation error
detected: Value at '<field>' failed to satisfy constraint: Member must
satisfy enum value set: [BOUNCE, COMPLAINT]" wording, with the nested
"Member must satisfy constraint: [...]" wrapping AWS emits for the
list-typed reasons filter.
- ListSuppressedDestinations accepts a repeated Reason query param (the
Java SDK's .reasons(...) varargs serialise this way) and applies
OR-semantics across the supplied values.
- GetSuppressedDestination and DeleteSuppressedDestination return
NotFoundException with "Email address <X> does not exist on your
suppression list." for unknown addresses — Delete is not idempotent
on AWS so floci matches.
SendEmail integration is intentionally out of scope: suppressed addresses
are still delivered locally so that existing send tests remain unaffected.
A follow-up PR can wire suppression checks into the send path along with
the PutAccount/ConfigurationSetSuppressionOptions configuration endpoints.
Tests:
- SesSuppressionV2IntegrationTest covers Put/Get/Delete lifecycle, List
sort order, single- and multi-Reason filter (with OR semantics), Put
updates, trim-on-Put, idempotent-Get-on-known, and validation errors.
- SesSuppressionListTest exercises the same surface through the Java SDK
v2 SesV2Client.
* fix(ses): reject null and non-object bodies on PutSuppressedDestination
Jackson's NullNode.asText("default") returns the literal string "null"
rather than the default, so a body like
{"EmailAddress": null, "Reason": "BOUNCE"}
silently stored an entry under the email address "null". Validate the
body is a JSON object via requireJsonObject and require both
EmailAddress and Reason to be present and textual via a new
readRequiredStringField helper.
SesSuppressionV2IntegrationTest gains three cases covering null
EmailAddress, null Reason, and a non-object root body.
|
||
|
|
9e35046647 |
Docs/enviroment instead yml (#764)
* docs: moving all config to env instead of yml * docs: sync with main and new features * docs: reverting docker-compose.yml |
||
|
|
bcc36c08e0 |
feat(ses): extend tag endpoints to v2 EmailIdentity ARNs (#760)
* feat(ses): extend tag endpoints to v2 EmailIdentity ARNs Adds support for arn:aws:ses:<region>:<account>:identity/<email-or-domain> ARNs across TagResource / UntagResource / ListTagsForResource. Behaviour was verified against real AWS via aws sesv2 commands and matches the EmailTemplate routing exactly: - Tag region mismatch -> BadRequestException "Failed to tag resource" - Untag region mismatch -> BadRequestException "Failed to untag resource" - List region mismatch -> Tags resolved against the signing region - Missing identity -> NotFoundException with "No EmailIdentity present with name: <identity>" Identity gains a tags field. CreateEmailIdentity accepts an optional Tags array (validated via the existing validateTag()) and persists it on the freshly verified Identity record. GetEmailIdentity surfaces stored tags in the existing Tags response field. Tests: - SesTagsV2IntegrationTest gains identity lifecycle, identity-not-found, and identity-specific region-mismatch / signing-region-lookup cases. - SesIdentityAttributesV2IntegrationTest covers create-with-tags -> Get/ListTagsForResource round-trip. - SesTagResourceTest (Java SDK compat) exercises CreateEmailIdentity with Tags and the Tag/Untag lifecycle on the identity ARN. * test(ses): move identity tags round-trip test next to other createEmailIdentity cases The Tags-on-create round-trip case fits better next to the existing createEmailIdentity_* cases at the top of SesV2IntegrationTest than it does in the attributes-focused SesIdentityAttributesV2IntegrationTest, where DKIM / MAIL FROM / Feedback validation lives. * chore(ses): drop dead identity.setTags call after CreateEmailIdentity setIdentityTags already persists the tag list on the stored Identity, and CreateEmailIdentity does not surface Tags in its response per the AWS spec, so the in-memory mutation that followed had no observable effect. |
||
|
|
646b4199df |
feat(ses): extend tag endpoints to v2 EmailTemplate ARNs (#759)
Adds support for arn:aws:ses:<region>:<account>:template/<name> ARNs across TagResource / UntagResource / ListTagsForResource. Behaviour was verified against real AWS via aws sesv2 commands and aligned where it diverged. - EmailTemplate gains a tags field. CreateEmailTemplate accepts an optional Tags array; tag validation reuses validateTag(). - UpdateEmailTemplate intentionally preserves the existing tags so that AWS-style "tags only mutated via Tag/UntagResource" semantics hold. - GetEmailTemplate response surfaces stored tags. - Missing templates return NotFoundException with the AWS-canonical "No Template present with name: <name>" message — AWS uses the bare "Template" (not "EmailTemplate") for tag-endpoint lookups even though the SDK type is EmailTemplate. Resource-type-specific routing in the tag endpoints: - TagResource on a template ARN strictly validates ARN/signing region match (BadRequestException "Failed to tag resource" on mismatch), matching the existing ConfigurationSet behaviour. - UntagResource on a template ARN strictly validates ARN/signing region match (BadRequestException "Failed to untag resource"), whereas ConfigurationSet's lenient ARN-region lookup is preserved. AWS treats the two resource types asymmetrically here. - ListTagsForResource on a template ARN ignores the ARN region and resolves the template against the signing region. ConfigurationSet continues to route by ARN region. Three small refactors that fall out naturally from adding a second taggable resource: - Tag is promoted from ConfigurationSet.Tag to a top-level services/ses/model/Tag so EmailTemplate and the shared helpers no longer reference a Configuration-scoped name. JSON serialization is unchanged. - A private mergeTags(existing, incoming) helper centralizes the LinkedHashMap merge previously duplicated between tagConfigurationSet and tagEmailTemplate. - A private parseTagsArray(JsonNode) helper centralizes the JSON Tags array parse previously duplicated across createConfigurationSet, createEmailTemplate, and tagResource. The helper returns null for missing/null nodes; the required caller (tagResource) treats null as BadRequestException. Tests: - SesTagsV2IntegrationTest gains a template lifecycle case, a template-not-found assertion, and the two template-specific region-mismatch / signing-region-lookup cases. - SesTemplateV2IntegrationTest covers create-with-tags, list-via-tags endpoint, and update-preserves-tags round-trips. - SesTagResourceTest (Java SDK compat) exercises CreateEmailTemplate with Tags and the Tag/Untag lifecycle on the template ARN. |
||
|
|
9b68bd0377 |
feat(ses): add v2 TagResource / UntagResource / ListTagsForResource (#749)
* feat(ses): add v2 TagResource / UntagResource / ListTagsForResource
Implements the v2 SES tag endpoints at /v2/email/tags. Initial scope
covers ConfigurationSet ARNs only
(arn:aws:ses:<region>:<account>:configuration-set/<name>); other
resource types return NotFoundException so follow-up PRs can extend
coverage to Identity, EmailTemplate, etc.
Behavior aligned with observed AWS responses:
- TagResource enforces ARN/signing region match strictly and rejects
mismatches with BadRequestException ("Failed to tag resource").
- UntagResource and ListTagsForResource route lookups to the ARN's
region instead, so a region mismatch surfaces as NotFoundException
with the resource-specific message (e.g. "No ConfigurationSet
present with name: <name>").
- TagResource merges by key (existing keys are replaced, others
retained); UntagResource silently skips keys not present.
- Empty Tags / TagKeys lists are rejected with BadRequestException to
match AWS validation.
- ARN parsing uses the shared AwsArnUtils helper; missing region or
account in the ARN is rejected as BadRequest, matching AWS.
Tests:
- New SesTagsV2IntegrationTest for endpoint-focused coverage (lifecycle,
region-mismatch asymmetry, validation errors).
- Cross-feature round-trip in SesConfigurationSetV2IntegrationTest
verifying that tags supplied to CreateConfigurationSet are reachable
via ListTagsForResource.
- New SesTagResourceTest in the Java SDK compatibility suite.
* refactor(ses): drop unused region parameter from list/untag tag service methods
listResourceTags and untagResource route lookups by the ARN's region, so
the request signing region they accepted was never read. Remove it and
stop resolving it in the controller. tagResource still takes region
because it strictly validates it against the ARN.
|
||
|
|
d971288d02 |
feat(ses): add UpdateAccountSendingEnabled (v1) (#737)
Implements the v1 Query action mirroring the existing v2 PUT /v2/email/account/sending endpoint. The Enabled parameter is optional per AWS docs; missing or empty is treated as false. Adds integration tests and a Java SDK compatibility test that exercises both v1 UpdateAccountSendingEnabled and verifies state is shared with the v2 GetAccount / PutAccountSendingAttributes path. |
||
|
|
bd3a33326c |
feat(ses): add MAIL FROM domain and identity attribute operations (#716)
* feat(ses): add MAIL FROM domain and identity attribute operations
v1 (Query):
- SetIdentityMailFromDomain / GetIdentityMailFromDomainAttributes
- SetIdentityFeedbackForwardingEnabled
- SetIdentityHeadersInNotificationsEnabled
- GetIdentityNotificationAttributes now reflects the stored
feedbackForwardingEnabled and per-NotificationType
headersInNotificationsEnabled flags instead of hard-coded defaults
v2 (REST JSON):
- PUT /v2/email/identities/{id}/mail-from -> PutEmailIdentityMailFromAttributes
- GetEmailIdentity response surfaces real MailFromAttributes
(MailFromDomain / MailFromDomainStatus / BehaviorOnMxFailure) instead
of the previously hard-coded "" / NOT_STARTED / USE_DEFAULT_VALUE
- v1 PascalCase <-> v2 SCREAMING_SNAKE BehaviorOnMxFailure values are
translated at the controller boundary, with both ends rejecting
unknown enum values
Identity gains mailFromDomain, behaviorOnMxFailure (v1 form),
mailFromDomainStatus, and headersInNotificationsEnabled fields. The
service layer normalizes BehaviorOnMxFailure to the canonical SESv1
enum values (UseDefaultValue / RejectMessage), so storage is
consistent regardless of which protocol wrote it.
Validation (verified against live aws-cli output):
- ForwardingEnabled / Enabled / MailFromDomain are required on the
matching v1 setters; missing values produce InvalidParameterValue
rather than silently being treated as false / null
- An empty-string MailFromDomain remains the documented "clear" path,
distinct from a missing parameter; whitespace-only values are
rejected (only "" or null clear the setting)
- BehaviorOnMxFailure / NotificationType enum violations return the
AWS-canonical "1 validation error detected: Value at '<param>' failed
to satisfy constraint: Member must satisfy enum value set: [...]"
message: ValidationError on v1, BadRequestException on v2
- Unknown identity on v1 setters returns InvalidParameterValue with
the AWS-canonical "Identity <X> does not exist." form (HTTP 400)
- v2 PutEmailIdentityMailFromAttributes follows the same wire mapping:
unknown identity surfaces as BadRequestException (HTTP 400) via
remapV1Exception, with the same "Identity <X> does not exist."
message text. Schema / enum validation runs before the service call
so an unknown enum on a missing identity still surfaces as an enum
error rather than as the identity error
- v2 controller validates that MailFromDomain and BehaviorOnMxFailure
are JSON strings; non-textual values produce BadRequestException
- AwsQueryController.SES_ACTIONS picks up the new v1 actions for the
auth-less fallback dispatch
Tests: 21 v1 integration cases, 9 v2 integration cases, 4 SDK compat
cases (AWS Java SDK 2.42.24).
* fix(ses): align identity-setter missing-identity errors with live AWS
Previously setFeedbackForwardingEnabled threw NotFoundException/404 and
setHeadersInNotificationsEnabled threw a Floci-specific
"Identity <X> does not exist." message. Real AWS verified via
aws-cli returns InvalidParameterValue (HTTP 400) for both, but with
*different* operation-specific message texts:
- SetIdentityFeedbackForwardingEnabled (also v2 PUT /feedback after
remapV1Exception):
Identity X is invalid. Must be a verified email address or domain.
- SetIdentityHeadersInNotificationsEnabled:
Identity X is invalid. It must be a verified email address or domain.
- SetIdentityMailFromDomain (unchanged in this commit):
Identity <X> does not exist.
Update the service-level throws so each setter emits its operation's
exact wire shape. setFeedbackForwardingEnabled now also benefits the
pre-existing v2 PUT /feedback endpoint, which previously surfaced
NotFoundException/404 instead of BadRequestException/400.
Tests:
- v1 unknown-identity coverage for SetIdentityFeedbackForwardingEnabled
(new) and updated message-text assertion for HeadersInNotificationsEnabled
- v2 unknown-identity coverage for PUT /feedback
- SDK compat additions: getIdentityNotificationAttributes round-trip
exercising forwarding/header flags, and v2
PutEmailIdentityMailFromAttributes unknown-identity throwing
BadRequestException
* test(ses): update putFeedbackAttributes_notFound to expect BadRequest
The previous commit changed setFeedbackForwardingEnabled to throw
InvalidParameterValue (HTTP 400) for missing identities to match real
AWS, which propagates through remapV1Exception as BadRequestException
on the v2 PUT /feedback path. The pre-existing
SesV2IntegrationTest.putFeedbackAttributes_notFound still asserted the
old 404 / NotFoundException behavior, so it began failing in CI.
Update the test to expect 400 / BadRequestException, matching the
verified live AWS response.
|
||
|
|
ac891db5a7 |
feat(ses): add TestRenderTemplate (v1) and TestRenderEmailTemplate (v2) (#692)
* feat(ses): add TestRenderTemplate (v1) and TestRenderEmailTemplate (v2)
Render a stored SES template against caller-supplied data and return the
resulting MIME message. v1 is dispatched via the Query protocol; v2 is
exposed at POST /v2/email/templates/{name}/render.
Template variable substitution is now strict: a missing attribute in the
rendering data raises MissingRenderingAttribute (mapped to BadRequestException
on v2), matching AWS / moto / LocalStack semantics. Invalid TemplateData
JSON raises InvalidRenderingParameter; non-object TemplateData is rejected
with operation-appropriate errors on the send paths (InvalidParameterValue
on v1, BadRequestException on v2).
The rendered output is a hand-rolled multipart/alternative MIME with a
Date header (UTC), Subject header, and text/plain + text/html parts.
Transfer encoding is auto-selected (7bit for ASCII bodies, 8bit for UTF-8)
matching moto's encode_7or8bit. Body line endings are normalized to CRLF.
Subject control characters and XML 1.0 invalid characters in the rendered
output are stripped to keep the response parseable by SDK clients.
Bulk per-entry rendering errors (MissingRenderingAttribute /
InvalidRenderingParameter raised at apply time) surface as INVALID_PARAMETER
in BulkEmailEntryResults rather than generic FAILED.
No new dependencies are introduced.
* test(ses): consolidate new SesServiceTemplateTest cases via @ParameterizedTest
Group 23 of the new unit tests added in this PR into 6
@ParameterizedTest methods driven by MethodSource data sets:
- pickTransferEncoding (ascii vs non-ascii) -> 1 test, 4 cases
- parseRenderingData invalid inputs -> 1 test, 5 cases
- normalizeToCrlf line-ending variants -> 1 test, 4 cases
- mapErrorCodeToBulkStatus -> 1 test, 4 cases
- sanitizeSubject control / DEL / Unicode preservation -> 1 test,
6 cases (null-input case kept separate)
- stripXml10InvalidChars C0 / noncharacters / surrogates -> 1 test,
11 cases
Coverage is preserved (every input that was exercised before is still
exercised; surfacing each case as an individual test makes the run
report show 58 cases instead of 49 for this file). The remaining
tests -- buildTestRenderMime structure assertions and the original
applyTemplateData edge cases -- stay as individual @Test methods
because they have distinct multi-step assertions.
* test(ses): address upstream Copilot style nits
- Remove unused containsString static import in
SesTestRenderV2IntegrationTest after the parameterized refactor
- Replace assertEquals(true/false, ...) with assertTrue/assertFalse in
SesServiceTemplateTest for clearer intent and better failure output
|
||
|
|
44eb8d2379 |
feat(ses): add SendBulkEmail (v2) and SendBulkTemplatedEmail (v1) (#645)
* feat(ses): add SendBulkEmail (v2) and SendBulkTemplatedEmail (v1) Adds bulk templated email support for both the SES v1 Query API (SendBulkTemplatedEmail) and the SES v2 REST JSON API (POST /v2/email/outbound-bulk-emails). The two endpoints share a single SesService.sendBulkTemplatedEmail method that resolves the template upfront, merges DefaultTemplateData with each entry's ReplacementTemplateData at the JSON-key level (replacement wins), renders subject/text/html via the existing applyTemplateData helper, and reuses sendEmail per destination so each successful entry appears in the existing /_aws/ses inspection mailbox with a unique MessageId. Per-entry results are returned in the BulkEmailEntryResult shape with status mapped to the AWS wire format expected by each protocol (CamelCase for v1, SCREAMING_SNAKE for v2). Per-entry AwsException codes are mapped to the closest BulkEmailEntryResult.Status (e.g. InvalidParameterValue -> INVALID_PARAMETER, which renders as "InvalidParameterValue" on v1), falling back to FAILED for unexpected exceptions. Template lookup failures and account-sending-paused conditions are top-level errors on both protocols, with v1 raising AccountSendingPausedException to match AWS semantics. * fix(ses): enforce account sending check in v1 SendEmail/SendRawEmail/SendTemplatedEmail v1 Query SES handlers previously sent mail even when account-level sending was disabled, while v2 REST JSON handlers and the new SendBulkTemplatedEmail correctly return AccountSendingPausedException. Add the same guard at the top of handleSendEmail, handleSendRawEmail, and handleSendTemplatedEmail to align v1 with v2 and AWS semantics. |
||
|
|
cd42caa254 |
feat(ses): add ConfigurationSet CRUD on v1 Query and v2 REST JSON (#631)
* feat(ses): add ConfigurationSet CRUD on v1 Query and v2 REST JSON
Adds Configuration Set name management on both protocols:
- v1 Query: CreateConfigurationSet, DescribeConfigurationSet,
ListConfigurationSets, DeleteConfigurationSet
- v2 REST JSON: POST/GET (single)/GET (list)/DELETE under
/v2/email/configuration-sets[/{name}]
Storage is region-scoped and shared across both protocols, with name as
the primary key. Tags are persisted on v2 create and returned on v2 get;
v1 only round-trips the name (real SES v1 has no tags on configuration
sets). Errors map ConfigurationSetAlreadyExists / ConfigurationSetDoesNotExist
(v1) onto AlreadyExistsException 400 and NotFoundException 404 (v2)
via the existing SesController remap helper.
Field validation (per AWS limits): ConfigurationSetName must match
^[A-Za-z0-9_-]{1,64}$; each Tag Key is 1-128 chars and each Tag Value is
0-256 chars; non-array Tags are rejected with BadRequestException.
Out of scope (future PRs): SendingOptions / EventDestinations /
TrackingOptions / DeliveryOptions / ReputationOptions / SuppressionOptions /
VdmOptions, and ConfigurationSetName validation in the Send* APIs.
* fix(ses): allow Tag without Value on ConfigurationSet create
AWS SDKs commonly omit Tag.Value when only the key matters
(Tag.builder().key("env").build()), serialising the request without a
Value field. Floci was rejecting these calls with "Tag Value is
required", diverging from typical SDK and LocalStack behaviour. Drop
the required-value check; the 0-256 length constraint still applies
when a value is present.
|
||
|
|
88f40a839b |
docs: update Docker image references to floci/floci (#595)
* docs: update Docker image references to floci/floci * docs: keep README Docker Hub badges pointing to hectorvent/floci The hectorvent/floci image has accumulated pull and size metrics; switch the badges to floci/floci once the new image has comparable numbers. |
||
|
|
763ea379d7 |
feat(ses): implement email template CRUD with stored, inline, and ARN variants (#573)
* feat(ses): implement email template CRUD with stored, inline, and ARN variants
Adds CreateTemplate / GetTemplate / UpdateTemplate /
DeleteTemplate / ListTemplates on both V2 REST JSON
(/v2/email/templates) and V1 Query.
SendEmail / SendTemplatedEmail resolve templates in three forms
with Mustache-style {{var}} substitution against TemplateData:
- TemplateName references a stored template
- TemplateArn extracts the name from the template/<name>
segment of an SES template ARN (region and account segments
are not validated, mirroring how KMS / Secrets Manager
handle ARNs in Floci)
- TemplateContent (V2 only) supplies inline subject / text /
html without storing the template first
V2 Content.Template requires exactly one of TemplateName,
TemplateArn, or TemplateContent; violations return
BadRequestException (400). V1 SendTemplatedEmail accepts
TemplateArn either alone or alongside Template (name) — the
name is used for resolution when both are present, matching
AWS where boto3 and the Java SDK keep Template as a required
field and treat TemplateArn as supplementary for cross-account
addressing.
Templates persist region-scoped via StorageFactory in
ses-templates.json. Template names reject leading/trailing
whitespace (same rule as identities) and are validated through
a single validateTemplateName helper reachable from every
resolution path. listTemplates is sorted by CreatedTimestamp
with TemplateName as a tiebreaker for deterministic output.
Error codes: the service layer throws V1-style codes
(TemplateDoesNotExist / AlreadyExists / InvalidTemplate /
InvalidParameterValue); SesController remaps them to
NotFoundException (404) / AlreadyExistsException (400) /
BadRequestException (400) for V2 callers.
* test(ses): add Python and Java SDK compatibility tests for templates
Covers boto3 (ses / sesv2) and AWS Java SDK v2 (SesClient /
SesV2Client) against the SES email template CRUD, inline
TemplateContent, and TemplateArn paths. Happy path,
duplicate-create rejection, missing-template lookups,
Mustache-style variable substitution, and 3-way selector
conflicts on V2 Content.Template are exercised on both SDK
surfaces.
Adds:
- Python: ses_client / sesv2_client conftest fixtures and a
tests/test_ses_templates.py suite covering V1 + V2
- Java: sesv2 Maven dependency, SesV2Client factory in
TestFixtures, and a SesTemplateTest covering V1 + V2
* docs(ses): document email template CRUD and templated send
Adds the new V1 template actions (CreateTemplate / GetTemplate
/ UpdateTemplate / DeleteTemplate / ListTemplates /
SendTemplatedEmail) and the V2 /v2/email/templates endpoints
to the SES service reference, and extends the README service
matrix to mention template support on the SES / SES v2 rows.
* fix(ses): add template actions to SES_ACTIONS for unsigned request routing
Unsigned clients (curl, aws --no-sign-request) were falling through to
the SQS handler because the six template Query actions were not
registered in SES_ACTIONS.
* fix(ses): narrow exception catch to JsonProcessingException in template endpoints
Broad Exception catch was masking unexpected errors (e.g. NPE) as 400
responses. Narrowed to JsonProcessingException which is the only
checked exception from objectMapper.readTree().
* test(ses): add template variable substitution edge cases and cross-region isolation
Add SesServiceTemplateTest with 14 unit tests for applyTemplateData
covering undefined variables, spaced/hyphenated names, unclosed braces,
non-string JSON values, regex metacharacters, and case sensitivity.
Add cross-region isolation integration test verifying templates created
in one region are not visible in another.
* test(ses): add awscli compatibility tests for template CRUD and templated send
Cover create, get, update, list, delete template and send-templated-email
via the AWS CLI. Uses JSON parameter format to avoid awscli parser issues
with Mustache-style {{variable}} syntax.
---------
Co-authored-by: Kenshin OKINAKA <kenshin_okinaka@realcross.co.jp>
|
||
|
|
c69580764e |
feat(ses): SMTP relay for SendEmail and SendRawEmail (#534)
* feat(ses): add SMTP relay configuration to EmulatorConfig Add smtp-host, smtp-port, smtp-user, smtp-pass, and smtp-starttls settings to SesServiceConfig. smtp-host is Optional — when absent or empty, relay is disabled and emails are stored only (existing behavior). * feat(ses): implement SMTP relay with Vert.x MailClient and Mime4j Add SmtpRelay that forwards SES emails to a configured SMTP server using a dedicated Vert.x MailClient built from EmulatorConfig settings. Simple emails are sent as MailMessage with From/To/Cc/Bcc/ReplyTo/ Subject/Text/Html. Raw MIME emails are parsed with Apache Mime4j to extract headers and body, then sent via the same MailClient. When SES Destinations is provided, it is used as the authoritative envelope recipient list (MIME Cc headers do not add extra SMTP recipients). Relay is dispatched asynchronously on a dedicated daemon thread with a 30-second send timeout. Failures are logged with stack traces but never affect the API response. The executor and MailClient are only created when smtp-host is configured and ses.enabled is true, and shut down in @PreDestroy. SesService calls SmtpRelay.relay/relayRaw after storing emails so the inspection endpoint always has the data regardless of relay. Tests: SmtpRelayTest (12 cases) covers simple/raw relay, disabled path, error swallowing, base64 decoding, HTML content type, envelope fallback. SesServiceSmtpTest (5 cases) verifies relay integration and store persistence. * docs(ses): document SMTP relay configuration Add SMTP Relay section to docs/services/ses.md with configuration example, docker-compose snippet with Mailpit, and behavioral notes. Add SMTP settings to the YAML sample and environment variable table in docs/configuration/application-yml.md. * fix(ses): preserve body against attachment overwrite and extract Bcc from raw MIME - extractBodyFromEntity now only sets text/html when not already set, so a text-typed attachment in multipart/mixed cannot clobber the body picked up from multipart/alternative. - doRelayRaw now reads Bcc from MIME headers alongside To/Cc when the caller did not supply Destinations. * fix(ses): initialize Vert.x NTLMEngineImpl at run time for native image The vertx-mail-client dependency brings in io.vertx.ext.mail.impl.sasl.NTLMEngineImpl, whose static state embeds a SecureRandom instance. GraalVM native-image rejects build-time Random/SecureRandom objects because the cached seed makes runtime behavior unpredictable. Mark the class for run-time initialization, matching the existing entry for the Apache HttpClient NTLM engine. |
||
|
|
a32b7f1f3b |
docs: comprehensive audit sweep + CHANGELOG backfill (1.1.0-1.5.2) (#326)
CHANGELOG.md was empty for the 1.1.0-1.5.2 release cycle and service docs had drifted from code behaviour. This sweep reconciles docs against the current codebase on upstream/main. - Backfill CHANGELOG.md for 1.1.0 through 1.5.2 from git history - Correct exact operation counts in docs/services/index.md: S3 (~30 -> 58), Lambda (~25 -> 30), API Gateway v1 (~24 -> 62). Counts now come from the actual dispatch handlers rather than @Path annotation counts. - Rewrite README "Supported Services" table to drop per-service op counts (they drift too fast); point readers at docs/services/index.md - Update 24 service docs for accuracy, add "Not Implemented" sections where relevant (s3.md, lambda.md, api-gateway.md) - Refresh configuration and getting-started docs - Add EventBridge Scheduler and AppConfig to mkdocs nav - Add AppConfig / AppConfigData rows to README and services index following the 1.5.2 upstream release |
||
|
|
fe2480e596 |
docs: add SES documentation (#181)
* docs: introduce SES (Simple Email Service) documentation * docs: integrate SES into service lists and navigation |