mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
feat(ses): implement ContactList CRUD for SES v2 (#1638)
Add the SES v2 contact list management APIs (CreateContactList, GetContactList,
ListContactLists, UpdateContactList, DeleteContactList) under
/v2/email/contact-lists. A contact list holds subscription topics with
OPT_IN/OPT_OUT defaults. Matching real AWS, an account may hold at most one
contact list per region; a second create is rejected with BadRequestException
("A maximum of 1 Lists allowed per account."), a duplicate name with
AlreadyExistsException, and unknown lists with NotFoundException.
Covered by a RestAssured integration test and an AWS Java SDK v2 compatibility
test.
This commit is contained in:
1 parent
8366ac256a
commit
3304184bd3
12 files changed
+1146
-1
No files matched your search
@@ -9,7 +9,9 @@ import io.github.hectorvent.floci.services.ses.model.GuardianOptions;
|
||||
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntry;
|
||||
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntryResult;
|
||||
import io.github.hectorvent.floci.services.ses.model.ConfigurationSet;
|
||||
import io.github.hectorvent.floci.services.ses.model.ContactList;
|
||||
import io.github.hectorvent.floci.services.ses.model.DedicatedIpPool;
|
||||
import io.github.hectorvent.floci.services.ses.model.Topic;
|
||||
import io.github.hectorvent.floci.services.ses.model.DeliveryOptions;
|
||||
import io.github.hectorvent.floci.services.ses.model.EmailTemplate;
|
||||
import io.github.hectorvent.floci.services.ses.model.EventDestination;
|
||||
@@ -1152,6 +1154,146 @@ public class SesController {
|
||||
return Response.ok(objectMapper.createObjectNode()).build();
|
||||
}
|
||||
|
||||
// ─────────────────────────── Contact lists ───────────────────────────
|
||||
|
||||
@POST
|
||||
@Path("/contact-lists")
|
||||
public Response createContactList(@Context HttpHeaders headers, String body) {
|
||||
String region = regionResolver.resolveRegion(headers);
|
||||
try {
|
||||
if (body == null || body.isBlank()) {
|
||||
throw new AwsException("BadRequestException", "Request body is required.", 400);
|
||||
}
|
||||
JsonNode request = objectMapper.readTree(body);
|
||||
requireJsonObject(request);
|
||||
// Read leniently; the service surfaces a missing ContactListName as the AWS Smithy
|
||||
// validation error rather than a custom "required" message.
|
||||
String name = request.path("ContactListName").asText(null);
|
||||
List<Topic> topics = parseTopicsArray(request.path("Topics"));
|
||||
List<Tag> tags = parseTagsArray(request.path("Tags"));
|
||||
String description = request.path("Description").asText(null);
|
||||
sesService.createContactList(name, description, topics, tags, region);
|
||||
LOG.infov("SES V2 CreateContactList: {0}", name);
|
||||
return Response.ok(objectMapper.createObjectNode()).build();
|
||||
} catch (AwsException e) {
|
||||
throw remapV1Exception(e);
|
||||
} catch (com.fasterxml.jackson.core.JsonProcessingException e) {
|
||||
throw new AwsException("BadRequestException", e.getMessage(), 400);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/contact-lists")
|
||||
public Response listContactLists(@Context HttpHeaders headers) {
|
||||
String region = regionResolver.resolveRegion(headers);
|
||||
ObjectNode result = objectMapper.createObjectNode();
|
||||
ArrayNode lists = result.putArray("ContactLists");
|
||||
for (ContactList cl : sesService.listContactLists(region)) {
|
||||
ObjectNode item = lists.addObject();
|
||||
item.put("ContactListName", cl.getContactListName());
|
||||
if (cl.getLastUpdatedTimestamp() != null) {
|
||||
item.put("LastUpdatedTimestamp", cl.getLastUpdatedTimestamp().getEpochSecond());
|
||||
}
|
||||
}
|
||||
return Response.ok(result).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/contact-lists/{contactListName}")
|
||||
public Response getContactList(@Context HttpHeaders headers,
|
||||
@PathParam("contactListName") String contactListName) {
|
||||
String region = regionResolver.resolveRegion(headers);
|
||||
return Response.ok(contactListJson(sesService.getContactList(contactListName, region))).build();
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("/contact-lists/{contactListName}")
|
||||
public Response updateContactList(@Context HttpHeaders headers,
|
||||
@PathParam("contactListName") String contactListName,
|
||||
String body) {
|
||||
String region = regionResolver.resolveRegion(headers);
|
||||
try {
|
||||
JsonNode request = (body == null || body.isBlank())
|
||||
? objectMapper.createObjectNode()
|
||||
: objectMapper.readTree(body);
|
||||
requireJsonObject(request);
|
||||
JsonNode topicsNode = request.path("Topics");
|
||||
// Treat absent or explicit-null Topics as "not provided" (keep existing), consistent
|
||||
// with Description; clearing is done via an explicit empty array [].
|
||||
List<Topic> topics = (topicsNode.isMissingNode() || topicsNode.isNull())
|
||||
? null : parseTopicsArray(topicsNode);
|
||||
JsonNode descNode = request.path("Description");
|
||||
boolean descriptionPresent = !descNode.isMissingNode() && !descNode.isNull();
|
||||
String description = descNode.asText(null);
|
||||
sesService.updateContactList(contactListName, description, descriptionPresent, topics, region);
|
||||
LOG.infov("SES V2 UpdateContactList: {0}", contactListName);
|
||||
return Response.ok(objectMapper.createObjectNode()).build();
|
||||
} catch (AwsException e) {
|
||||
throw remapV1Exception(e);
|
||||
} catch (com.fasterxml.jackson.core.JsonProcessingException e) {
|
||||
throw new AwsException("BadRequestException", e.getMessage(), 400);
|
||||
}
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("/contact-lists/{contactListName}")
|
||||
public Response deleteContactList(@Context HttpHeaders headers,
|
||||
@PathParam("contactListName") String contactListName) {
|
||||
String region = regionResolver.resolveRegion(headers);
|
||||
sesService.deleteContactList(contactListName, region);
|
||||
LOG.infov("SES V2 DeleteContactList: {0}", contactListName);
|
||||
return Response.ok(objectMapper.createObjectNode()).build();
|
||||
}
|
||||
|
||||
private List<Topic> parseTopicsArray(JsonNode topicsNode) {
|
||||
List<Topic> out = new ArrayList<>();
|
||||
if (topicsNode == null || topicsNode.isMissingNode() || topicsNode.isNull()) {
|
||||
return out;
|
||||
}
|
||||
if (!topicsNode.isArray()) {
|
||||
throw new AwsException("BadRequestException", "Topics must be an array.", 400);
|
||||
}
|
||||
for (JsonNode t : topicsNode) {
|
||||
out.add(new Topic(
|
||||
t.path("TopicName").asText(null),
|
||||
t.path("DisplayName").asText(null),
|
||||
t.path("DefaultSubscriptionStatus").asText(null),
|
||||
t.path("Description").asText(null)));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private ObjectNode contactListJson(ContactList cl) {
|
||||
ObjectNode result = objectMapper.createObjectNode();
|
||||
result.put("ContactListName", cl.getContactListName());
|
||||
if (cl.getDescription() != null) {
|
||||
result.put("Description", cl.getDescription());
|
||||
}
|
||||
ArrayNode topics = result.putArray("Topics");
|
||||
for (Topic t : cl.getTopics()) {
|
||||
ObjectNode to = topics.addObject();
|
||||
to.put("TopicName", t.getTopicName());
|
||||
to.put("DisplayName", t.getDisplayName());
|
||||
to.put("DefaultSubscriptionStatus", t.getDefaultSubscriptionStatus());
|
||||
if (t.getDescription() != null) {
|
||||
to.put("Description", t.getDescription());
|
||||
}
|
||||
}
|
||||
if (cl.getCreatedTimestamp() != null) {
|
||||
result.put("CreatedTimestamp", cl.getCreatedTimestamp().getEpochSecond());
|
||||
}
|
||||
if (cl.getLastUpdatedTimestamp() != null) {
|
||||
result.put("LastUpdatedTimestamp", cl.getLastUpdatedTimestamp().getEpochSecond());
|
||||
}
|
||||
ArrayNode tags = result.putArray("Tags");
|
||||
for (Tag tag : cl.getTags()) {
|
||||
ObjectNode tn = tags.addObject();
|
||||
tn.put("Key", tag.key());
|
||||
tn.put("Value", tag.value());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// ──────────────────────────── Account ────────────────────────────
|
||||
|
||||
@GET
|
||||
|
||||
@@ -15,6 +15,7 @@ import io.github.hectorvent.floci.services.ses.model.BulkEmailEntry;
|
||||
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntryResult;
|
||||
import io.github.hectorvent.floci.services.ses.model.CloudWatchDimensionConfiguration;
|
||||
import io.github.hectorvent.floci.services.ses.model.ConfigurationSet;
|
||||
import io.github.hectorvent.floci.services.ses.model.ContactList;
|
||||
import io.github.hectorvent.floci.services.ses.model.DedicatedIpPool;
|
||||
import io.github.hectorvent.floci.services.ses.model.DeliveryOptions;
|
||||
import io.github.hectorvent.floci.services.ses.model.EmailTemplate;
|
||||
@@ -22,6 +23,7 @@ import io.github.hectorvent.floci.services.ses.model.EventDestination;
|
||||
import io.github.hectorvent.floci.services.ses.model.Identity;
|
||||
import io.github.hectorvent.floci.services.ses.model.MessageHeader;
|
||||
import io.github.hectorvent.floci.services.ses.model.MessageTag;
|
||||
import io.github.hectorvent.floci.services.ses.model.Topic;
|
||||
import io.github.hectorvent.floci.services.ses.model.TrackingOptions;
|
||||
import io.github.hectorvent.floci.services.ses.model.VdmOptions;
|
||||
import io.github.hectorvent.floci.services.ses.model.SentEmail;
|
||||
@@ -81,6 +83,9 @@ public class SesService {
|
||||
private final StorageBackend<String, SuppressedDestination> suppressionStore;
|
||||
private final StorageBackend<String, AccountSuppressionAttributes> accountSuppressionStore;
|
||||
private final StorageBackend<String, DedicatedIpPool> dedicatedIpPoolStore;
|
||||
private final StorageBackend<String, ContactList> contactListStore;
|
||||
// Guards the one-list-per-account check-then-create so concurrent creates can't both pass.
|
||||
private final Object contactListCreateLock = new Object();
|
||||
private final SmtpRelay smtpRelay;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final SesEventPublisher eventPublisher;
|
||||
@@ -109,6 +114,8 @@ public class SesService {
|
||||
new TypeReference<Map<String, AccountSuppressionAttributes>>() {});
|
||||
this.dedicatedIpPoolStore = storageFactory.create("ses", "ses-dedicated-ip-pools.json",
|
||||
new TypeReference<Map<String, DedicatedIpPool>>() {});
|
||||
this.contactListStore = storageFactory.create("ses", "ses-contact-lists.json",
|
||||
new TypeReference<Map<String, ContactList>>() {});
|
||||
this.smtpRelay = smtpRelay;
|
||||
this.objectMapper = objectMapper;
|
||||
this.eventPublisher = eventPublisher;
|
||||
@@ -125,11 +132,12 @@ public class SesService {
|
||||
StorageBackend<String, SuppressedDestination> suppressionStore,
|
||||
StorageBackend<String, AccountSuppressionAttributes> accountSuppressionStore,
|
||||
StorageBackend<String, DedicatedIpPool> dedicatedIpPoolStore,
|
||||
StorageBackend<String, ContactList> contactListStore,
|
||||
SmtpRelay smtpRelay,
|
||||
ObjectMapper objectMapper,
|
||||
Clock clock) {
|
||||
this(identityStore, emailStore, accountSettingsStore, templateStore, configSetStore, suppressionStore,
|
||||
accountSuppressionStore, dedicatedIpPoolStore, smtpRelay, objectMapper, null, clock);
|
||||
accountSuppressionStore, dedicatedIpPoolStore, contactListStore, smtpRelay, objectMapper, null, clock);
|
||||
}
|
||||
|
||||
SesService(StorageBackend<String, Identity> identityStore,
|
||||
@@ -140,6 +148,7 @@ public class SesService {
|
||||
StorageBackend<String, SuppressedDestination> suppressionStore,
|
||||
StorageBackend<String, AccountSuppressionAttributes> accountSuppressionStore,
|
||||
StorageBackend<String, DedicatedIpPool> dedicatedIpPoolStore,
|
||||
StorageBackend<String, ContactList> contactListStore,
|
||||
SmtpRelay smtpRelay,
|
||||
ObjectMapper objectMapper,
|
||||
Route53Service route53Service,
|
||||
@@ -152,6 +161,7 @@ public class SesService {
|
||||
this.suppressionStore = suppressionStore;
|
||||
this.accountSuppressionStore = accountSuppressionStore;
|
||||
this.dedicatedIpPoolStore = dedicatedIpPoolStore;
|
||||
this.contactListStore = contactListStore;
|
||||
this.smtpRelay = smtpRelay;
|
||||
this.objectMapper = objectMapper;
|
||||
this.eventPublisher = null;
|
||||
@@ -1217,6 +1227,183 @@ public class SesService {
|
||||
return "dedicatedIpPool::" + region + "::" + name;
|
||||
}
|
||||
|
||||
private static final Set<String> SUBSCRIPTION_STATUSES = Set.of("OPT_IN", "OPT_OUT");
|
||||
private static final Pattern CONTACT_LIST_NAME_CHARS = Pattern.compile("^[A-Za-z0-9_-]{1,64}$");
|
||||
private static final int MAX_TOPICS_PER_LIST = 20;
|
||||
private static final int MAX_DISPLAY_NAME_LENGTH = 128;
|
||||
private static final int MAX_LIST_DESCRIPTION_LENGTH = 500;
|
||||
|
||||
public ContactList createContactList(String name, String description, List<Topic> topics,
|
||||
List<Tag> tags, String region) {
|
||||
validateContactListInput(name, description, topics);
|
||||
ContactList list = new ContactList(name);
|
||||
list.setDescription(description);
|
||||
list.setTopics(topics);
|
||||
list.setTags(tags);
|
||||
Instant now = Instant.now();
|
||||
list.setCreatedTimestamp(now);
|
||||
list.setLastUpdatedTimestamp(now);
|
||||
// AWS allows at most one contact list per account per region (verified against real AWS).
|
||||
// A duplicate name hits this same limit before any "already exists" check, so
|
||||
// AlreadyExistsException is never reachable for contact lists. Lock only the check-then-put
|
||||
// so concurrent calls can't both observe an empty region; building and logging stay outside.
|
||||
synchronized (contactListCreateLock) {
|
||||
if (!listContactLists(region).isEmpty()) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"A maximum of 1 Lists allowed per account.", 400);
|
||||
}
|
||||
contactListStore.put(contactListKey(region, name), list);
|
||||
}
|
||||
LOG.infov("Created SES contact list: {0} in region {1}", name, region);
|
||||
return list;
|
||||
}
|
||||
|
||||
public ContactList getContactList(String name, String region) {
|
||||
return contactListStore.get(contactListKey(region, name))
|
||||
.orElseThrow(() -> contactListNotFound(name));
|
||||
}
|
||||
|
||||
public List<ContactList> listContactLists(String region) {
|
||||
String prefix = "contactList::" + region + "::";
|
||||
return contactListStore.scan(k -> k.startsWith(prefix)).stream()
|
||||
.sorted(Comparator.comparing(ContactList::getContactListName))
|
||||
.toList();
|
||||
}
|
||||
|
||||
public ContactList updateContactList(String name, String description, boolean descriptionPresent,
|
||||
List<Topic> topics, String region) {
|
||||
validateContactListInput(name, description, topics);
|
||||
String key = contactListKey(region, name);
|
||||
ContactList existing = contactListStore.get(key).orElseThrow(() -> contactListNotFound(name));
|
||||
if (topics != null) {
|
||||
existing.setTopics(topics);
|
||||
}
|
||||
if (descriptionPresent) {
|
||||
existing.setDescription(description);
|
||||
}
|
||||
existing.setLastUpdatedTimestamp(Instant.now());
|
||||
contactListStore.put(key, existing);
|
||||
LOG.infov("Updated SES contact list: {0} in region {1}", name, region);
|
||||
return existing;
|
||||
}
|
||||
|
||||
public void deleteContactList(String name, String region) {
|
||||
String key = contactListKey(region, name);
|
||||
if (contactListStore.get(key).isEmpty()) {
|
||||
throw contactListNotFound(name);
|
||||
}
|
||||
contactListStore.delete(key);
|
||||
LOG.infov("Deleted SES contact list: {0} in region {1}", name, region);
|
||||
}
|
||||
|
||||
private static AwsException contactListNotFound(String name) {
|
||||
return new AwsException("NotFoundException",
|
||||
"List with name: " + name + " doesn't exist.", 404);
|
||||
}
|
||||
|
||||
// SES V2 surfaces missing/invalid input as Smithy validation errors. Field paths and the
|
||||
// enum value order are taken verbatim from real AWS.
|
||||
private static AwsException validationError(String fieldPath, String constraint) {
|
||||
return new AwsException("BadRequestException",
|
||||
"1 validation error detected: Value at '" + fieldPath
|
||||
+ "' failed to satisfy constraint: " + constraint, 400);
|
||||
}
|
||||
|
||||
private static void validateContactListName(String name) {
|
||||
if (name == null) {
|
||||
throw validationError("contactListName", "Member must not be null");
|
||||
}
|
||||
if (name.isBlank()) {
|
||||
throw new AwsException("BadRequestException", "ContactListName can't be blank.", 400);
|
||||
}
|
||||
if (!CONTACT_LIST_NAME_CHARS.matcher(name).matches()) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"ContactListName can contain up to 64 characters. Only alphanumeric characters, "
|
||||
+ "underscores(_) and hyphens(-) are allowed.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
private static void validateDescription(String description) {
|
||||
if (description != null && description.length() > MAX_LIST_DESCRIPTION_LENGTH) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"List description can contain up to 500 characters.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
// Validates Create/Update input in the same two-phase order as real AWS (verified by probe):
|
||||
// protocol-layer (Smithy) checks across all fields first, then service-level constraints with
|
||||
// ContactListName ahead of topic/description constraints.
|
||||
private static void validateContactListInput(String name, String description, List<Topic> topics) {
|
||||
// Phase 1 — protocol-layer (Smithy) validation: null members and the subscription-status
|
||||
// enum. AWS reports these before any service-level constraint.
|
||||
if (name == null) {
|
||||
throw validationError("contactListName", "Member must not be null");
|
||||
}
|
||||
if (topics != null) {
|
||||
for (int i = 0; i < topics.size(); i++) {
|
||||
Topic t = topics.get(i);
|
||||
String member = "topics." + (i + 1) + ".member.";
|
||||
if (t.getTopicName() == null) {
|
||||
throw validationError(member + "topicName", "Member must not be null");
|
||||
}
|
||||
if (t.getDisplayName() == null) {
|
||||
throw validationError(member + "displayName", "Member must not be null");
|
||||
}
|
||||
if (t.getDefaultSubscriptionStatus() == null) {
|
||||
throw validationError(member + "defaultSubscriptionStatus", "Member must not be null");
|
||||
}
|
||||
if (!SUBSCRIPTION_STATUSES.contains(t.getDefaultSubscriptionStatus())) {
|
||||
throw validationError(member + "defaultSubscriptionStatus",
|
||||
"Member must satisfy enum value set: [OPT_OUT, OPT_IN]");
|
||||
}
|
||||
}
|
||||
}
|
||||
// Phase 2 — service-level constraints: ContactListName first, then topics, then description.
|
||||
if (name.isBlank()) {
|
||||
throw new AwsException("BadRequestException", "ContactListName can't be blank.", 400);
|
||||
}
|
||||
if (!CONTACT_LIST_NAME_CHARS.matcher(name).matches()) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"ContactListName can contain up to 64 characters. Only alphanumeric characters, "
|
||||
+ "underscores(_) and hyphens(-) are allowed.", 400);
|
||||
}
|
||||
if (topics != null) {
|
||||
if (topics.size() > MAX_TOPICS_PER_LIST) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"Maximum of <" + MAX_TOPICS_PER_LIST + "> topics allowed per ContactList", 400);
|
||||
}
|
||||
Set<String> seenNames = new HashSet<>();
|
||||
for (Topic t : topics) {
|
||||
if (t.getTopicName().isBlank()) {
|
||||
throw new AwsException("BadRequestException", "TopicName can't be blank.", 400);
|
||||
}
|
||||
if (!CONTACT_LIST_NAME_CHARS.matcher(t.getTopicName()).matches()) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"TopicName can contain up to 64 characters. Only alphanumeric characters, "
|
||||
+ "underscores(_) and hyphens(-) are allowed.", 400);
|
||||
}
|
||||
if (t.getDisplayName().length() > MAX_DISPLAY_NAME_LENGTH) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"Topic DisplayName can contain up to <" + MAX_DISPLAY_NAME_LENGTH
|
||||
+ "> characters.", 400);
|
||||
}
|
||||
if (!seenNames.add(t.getTopicName())) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"Duplicate topic names are not allowed within a List.", 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
validateDescription(description);
|
||||
}
|
||||
|
||||
private static String contactListKey(String region, String name) {
|
||||
// Validate in the key builder so Get/Update/Delete reject an invalid ContactListName with
|
||||
// the AWS validation error (400) rather than a 404, matching configSetKey. Verified
|
||||
// against real AWS: read/delete with an invalid name returns the same constraint message.
|
||||
validateContactListName(name);
|
||||
return "contactList::" + region + "::" + name;
|
||||
}
|
||||
|
||||
static void validateConfigurationSetName(String name) {
|
||||
if (name == null || name.isBlank()) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package io.github.hectorvent.floci.services.ses.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A SES V2 contact list: a named container of subscription topics. AWS allows at
|
||||
* most one contact list per account per region.
|
||||
*/
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ContactList {
|
||||
|
||||
@JsonProperty("ContactListName")
|
||||
private String contactListName;
|
||||
|
||||
@JsonProperty("Description")
|
||||
private String description;
|
||||
|
||||
@JsonProperty("Topics")
|
||||
private List<Topic> topics = new ArrayList<>();
|
||||
|
||||
@JsonProperty("Tags")
|
||||
private List<Tag> tags = new ArrayList<>();
|
||||
|
||||
@JsonProperty("CreatedTimestamp")
|
||||
private Instant createdTimestamp;
|
||||
|
||||
@JsonProperty("LastUpdatedTimestamp")
|
||||
private Instant lastUpdatedTimestamp;
|
||||
|
||||
public ContactList() {}
|
||||
|
||||
public ContactList(String contactListName) {
|
||||
this.contactListName = contactListName;
|
||||
}
|
||||
|
||||
public String getContactListName() { return contactListName; }
|
||||
public void setContactListName(String contactListName) { this.contactListName = contactListName; }
|
||||
|
||||
public String getDescription() { return description; }
|
||||
public void setDescription(String description) { this.description = description; }
|
||||
|
||||
public List<Topic> getTopics() { return topics; }
|
||||
public void setTopics(List<Topic> topics) {
|
||||
this.topics = topics == null ? new ArrayList<>() : topics;
|
||||
}
|
||||
|
||||
public List<Tag> getTags() { return tags; }
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags == null ? new ArrayList<>() : tags;
|
||||
}
|
||||
|
||||
public Instant getCreatedTimestamp() { return createdTimestamp; }
|
||||
public void setCreatedTimestamp(Instant createdTimestamp) { this.createdTimestamp = createdTimestamp; }
|
||||
|
||||
public Instant getLastUpdatedTimestamp() { return lastUpdatedTimestamp; }
|
||||
public void setLastUpdatedTimestamp(Instant lastUpdatedTimestamp) {
|
||||
this.lastUpdatedTimestamp = lastUpdatedTimestamp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package io.github.hectorvent.floci.services.ses.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
/**
|
||||
* A subscription topic within a SES V2 contact list. Mirrors the AWS {@code Topic}
|
||||
* shape: a topic name, its display name, the default subscription status
|
||||
* ({@code OPT_IN} or {@code OPT_OUT}), and an optional description.
|
||||
*/
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Topic {
|
||||
|
||||
@JsonProperty("TopicName")
|
||||
private String topicName;
|
||||
|
||||
@JsonProperty("DisplayName")
|
||||
private String displayName;
|
||||
|
||||
@JsonProperty("DefaultSubscriptionStatus")
|
||||
private String defaultSubscriptionStatus;
|
||||
|
||||
@JsonProperty("Description")
|
||||
private String description;
|
||||
|
||||
public Topic() {}
|
||||
|
||||
public Topic(String topicName, String displayName, String defaultSubscriptionStatus,
|
||||
String description) {
|
||||
this.topicName = topicName;
|
||||
this.displayName = displayName;
|
||||
this.defaultSubscriptionStatus = defaultSubscriptionStatus;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getTopicName() { return topicName; }
|
||||
public void setTopicName(String topicName) { this.topicName = topicName; }
|
||||
|
||||
public String getDisplayName() { return displayName; }
|
||||
public void setDisplayName(String displayName) { this.displayName = displayName; }
|
||||
|
||||
public String getDefaultSubscriptionStatus() { return defaultSubscriptionStatus; }
|
||||
public void setDefaultSubscriptionStatus(String defaultSubscriptionStatus) {
|
||||
this.defaultSubscriptionStatus = defaultSubscriptionStatus;
|
||||
}
|
||||
|
||||
public String getDescription() { return description; }
|
||||
public void setDescription(String description) { this.description = description; }
|
||||
}
|
||||
Reference in new issue
Block a user