resourceTypes() {
return Set.of(DISTRIBUTION, RESPONSE_HEADERS_POLICY, CACHE_POLICY, ORIGIN_REQUEST_POLICY,
- ORIGIN_ACCESS_CONTROL, PUBLIC_KEY, KEY_GROUP, FUNCTION, CONNECTION_GROUP);
+ ORIGIN_ACCESS_CONTROL, PUBLIC_KEY, KEY_GROUP, FUNCTION, CONNECTION_GROUP, DISTRIBUTION_TENANT);
}
@Override
@@ -107,6 +110,7 @@ public class CloudFrontCfnProvisioner implements CfnResourceProvisioner {
case KEY_GROUP -> provisionKeyGroup(r, props, ctx);
case FUNCTION -> provisionFunction(r, props, ctx);
case CONNECTION_GROUP -> provisionConnectionGroup(r, props, ctx);
+ case DISTRIBUTION_TENANT -> provisionDistributionTenant(r, props, ctx);
default -> throw new IllegalArgumentException("Unsupported resource type: " + r.getResourceType());
}
ReplacementCleanup.record(r, ctx, attributesBefore);
@@ -191,6 +195,7 @@ public class CloudFrontCfnProvisioner implements CfnResourceProvisioner {
cloudFrontService::deleteKeyGroup, NO_SUCH_KEY_GROUP);
case FUNCTION -> deleteFunction(physicalId);
case CONNECTION_GROUP -> deleteConnectionGroup(physicalId);
+ case DISTRIBUTION_TENANT -> deleteDistributionTenant(physicalId);
default -> { }
}
}
@@ -273,6 +278,128 @@ public class CloudFrontCfnProvisioner implements CfnResourceProvisioner {
provisioned.getLastModifiedTime() == null ? "" : provisioned.getLastModifiedTime().toString());
}
+ /**
+ * An enabled tenant refuses its delete with {@code ResourceNotDisabled}, so a stack delete, a
+ * replacement cleanup or a rollback disables it first with the etag it carries and deletes it
+ * with the fresh one the disable minted, as the registry schema's delete handler does (it asks
+ * for {@code UpdateDistributionTenant} as well as {@code DeleteDistributionTenant}). The tags
+ * kept under the ARN go with the tenant. Only the type's own not-found code is tolerated.
+ */
+ private void deleteDistributionTenant(String physicalId) {
+ CfnDeletes.safeDelete("distribution tenant", physicalId, () -> {
+ DistributionTenant tenant = cloudFrontService.getDistributionTenant(physicalId);
+ String etag = tenant.getEtag();
+ if (Boolean.TRUE.equals(tenant.getEnabled())) {
+ etag = cloudFrontService.updateDistributionTenant(physicalId, etag, null, null, null, null,
+ null, false).getEtag();
+ }
+ cloudFrontService.deleteDistributionTenant(physicalId, etag);
+ }, ENTITY_NOT_FOUND);
+ }
+
+ /**
+ * The tenant the template names is created on first use and updated in place afterwards:
+ * {@code Name} is the only create-only property the registry schema declares, so an update whose
+ * resolved {@code Name} differs from the prior tenant's replaces it, and the engine's
+ * replacement cleanup deletes the old tenant through {@link #deleteDistributionTenant} once the
+ * update commits. Otherwise the physical id only changes when the prior tenant is already gone.
+ * The schema's read-only members ({@code Id}, {@code Arn}, {@code ETag}, {@code Status} and the
+ * two timestamps) travel to {@code Fn::GetAtt} from the provisioned object; {@code DomainResults}
+ * is a list, which attributes as Floci keeps them (text) cannot hold.
+ *
+ * An update is declarative: it drives the tags, {@code Customizations} and {@code Parameters}
+ * to the template's set, so a template that drops one clears it, and it reads an absent
+ * {@code Enabled} as the default, true, and a dropped {@code ConnectionGroupId} as the account's
+ * default connection group, which is what a create picks. {@code ManagedCertificateRequest},
+ * {@code DomainMappings} and {@code OnDomainTakeover} are accepted and ignored: Floci issues no
+ * managed certificates and serves every domain the same way.
+ */
+ private void provisionDistributionTenant(StackResource r, JsonNode props, ProvisionContext ctx) {
+ String distributionId = requireText(DISTRIBUTION_TENANT, "DistributionId", props, ctx);
+ String name = requireText(DISTRIBUTION_TENANT, "Name", props, ctx);
+ List domains = tenantDomains(props, ctx);
+ TenantCustomizations customizations = tenantCustomizations(props, ctx);
+ Map parameters = tenantParameters(props, ctx);
+ String connectionGroupId = ctx.resolveOptional(props, "ConnectionGroupId");
+ Boolean enabled = ctx.resolveOptionalBoolean(props, "Enabled");
+ Map tags = ctx.resolveTags(props, "Tags");
+
+ DistributionTenant provisioned;
+ DistributionTenant prior = prior(ctx, "distribution tenant",
+ cloudFrontService::getDistributionTenant, ENTITY_NOT_FOUND);
+ if (prior == null || !name.equals(prior.getName())) {
+ provisioned = cloudFrontService.createDistributionTenant(distributionId, name, domains, tags,
+ customizations, parameters, connectionGroupId, enabled);
+ } else {
+ String groupId = connectionGroupId == null || connectionGroupId.isBlank()
+ ? cloudFrontService.ensureDefaultConnectionGroup().getId() : connectionGroupId;
+ provisioned = cloudFrontService.updateDistributionTenant(prior.getId(), prior.getEtag(),
+ distributionId, domains, customizations == null ? new TenantCustomizations() : customizations,
+ parameters == null ? Map.of() : parameters, groupId,
+ enabled == null ? Boolean.TRUE : enabled);
+ reconcileTags(provisioned.getArn(), tags);
+ }
+ r.setPhysicalId(provisioned.getId());
+ r.getAttributes().put("Id", provisioned.getId());
+ r.getAttributes().put("Arn", provisioned.getArn());
+ r.getAttributes().put("ETag", provisioned.getEtag());
+ r.getAttributes().put("Status", provisioned.getStatus());
+ r.getAttributes().put("CreatedTime",
+ provisioned.getCreatedTime() == null ? "" : provisioned.getCreatedTime().toString());
+ r.getAttributes().put("LastModifiedTime",
+ provisioned.getLastModifiedTime() == null ? "" : provisioned.getLastModifiedTime().toString());
+ }
+
+ private static List tenantDomains(JsonNode props, ProvisionContext ctx) {
+ JsonNode raw = props.get("Domains");
+ JsonNode resolved = raw == null || raw.isNull() ? null : ctx.engine().resolveNode(raw);
+ if (resolved == null || !resolved.isArray() || resolved.isEmpty()) {
+ throw new AwsException("ValidationError", DISTRIBUTION_TENANT + " requires Domains", 400);
+ }
+ List domains = new ArrayList<>();
+ for (JsonNode domain : resolved) {
+ domains.add(domain.asText());
+ }
+ return domains;
+ }
+
+ private static Map tenantParameters(JsonNode props, ProvisionContext ctx) {
+ JsonNode raw = props.get("Parameters");
+ JsonNode resolved = raw == null || raw.isNull() ? null : ctx.engine().resolveNode(raw);
+ if (resolved == null || !resolved.isArray()) {
+ return null;
+ }
+ Map parameters = new LinkedHashMap<>();
+ for (JsonNode parameter : resolved) {
+ parameters.put(text(parameter, "Name"), text(parameter, "Value"));
+ }
+ return parameters;
+ }
+
+ private static TenantCustomizations tenantCustomizations(JsonNode props, ProvisionContext ctx) {
+ JsonNode raw = props.get("Customizations");
+ JsonNode resolved = raw == null || raw.isNull() ? null : ctx.engine().resolveNode(raw);
+ if (resolved == null || !resolved.isObject()) {
+ return null;
+ }
+ TenantCustomizations customizations = new TenantCustomizations();
+ JsonNode webAcl = resolved.get("WebAcl");
+ if (webAcl != null && webAcl.isObject()) {
+ customizations.setWebAclAction(text(webAcl, "Action"));
+ customizations.setWebAclArn(text(webAcl, "Arn"));
+ }
+ JsonNode certificate = resolved.get("Certificate");
+ if (certificate != null && certificate.isObject()) {
+ customizations.setCertificateArn(text(certificate, "Arn"));
+ }
+ JsonNode geo = resolved.get("GeoRestrictions");
+ if (geo != null && geo.isObject()) {
+ customizations.setGeoRestrictionType(text(geo, "RestrictionType"));
+ customizations.setGeoLocations(textList(geo, "Locations"));
+ }
+ return customizations;
+ }
+
private static void requireConnectionGroupName(String name) {
if (name == null || name.isBlank()) {
throw new AwsException("ValidationError", CONNECTION_GROUP + " requires Name", 400);
@@ -415,7 +542,7 @@ public class CloudFrontCfnProvisioner implements CfnResourceProvisioner {
if (autoPublish) {
cloudFrontService.publishFunction(name, provisioned.getEtag());
}
- reconcileFunctionTags(arn, tags);
+ reconcileTags(arn, tags);
} catch (RuntimeException failure) {
if (prior == null) {
// The stack keeps its prior id when this resource fails, so nothing else would
@@ -454,7 +581,7 @@ public class CloudFrontCfnProvisioner implements CfnResourceProvisioner {
return arn.substring(arn.lastIndexOf('/') + 1);
}
- private void reconcileFunctionTags(String arn, Map desired) {
+ private void reconcileTags(String arn, Map desired) {
List stale = ProvisionContext.staleTagKeys(cloudFrontService.listTagsForResource(arn), desired);
if (!stale.isEmpty()) {
cloudFrontService.untagResource(arn, stale);
diff --git a/src/main/java/io/floci/aws/services/cloudfront/CloudFrontController.java b/src/main/java/io/floci/aws/services/cloudfront/CloudFrontController.java
index 1f66bc619b..f5901b1699 100644
--- a/src/main/java/io/floci/aws/services/cloudfront/CloudFrontController.java
+++ b/src/main/java/io/floci/aws/services/cloudfront/CloudFrontController.java
@@ -329,6 +329,149 @@ public class CloudFrontController {
return Response.ok(xml.build(), XML).build();
}
+ // ── Distribution tenants ──────────────────────────────────────────────────
+
+ @POST
+ @Path("/distribution-tenant")
+ public Response createDistributionTenant(String body) {
+ try {
+ XmlParser.XmlElement request = XmlParser.extractElementTree(body, "CreateDistributionTenantRequest");
+ DistributionTenant tenant = service.createDistributionTenant(
+ tenantText(request, "DistributionId"),
+ tenantText(request, "Name"),
+ tenantDomains(request),
+ parseTags(body),
+ tenantCustomizations(request),
+ tenantParameters(request),
+ tenantText(request, "ConnectionGroupId"),
+ xmlBoolean(tenantText(request, "Enabled")));
+ return Response.created(URI.create("/2020-05-31/distribution-tenant/" + tenant.getId()))
+ .type(XML)
+ .header("ETag", tenant.getEtag())
+ .entity(xmlDistributionTenant(tenant))
+ .build();
+ } catch (AwsException e) {
+ return xmlErrorResponse(e);
+ }
+ }
+
+ @GET
+ @Path("/distribution-tenant/{Identifier}")
+ public Response getDistributionTenant(@PathParam("Identifier") String identifier) {
+ try {
+ DistributionTenant tenant = service.getDistributionTenant(identifier);
+ return Response.ok(xmlDistributionTenant(tenant), XML)
+ .header("ETag", tenant.getEtag())
+ .build();
+ } catch (AwsException e) {
+ return xmlErrorResponse(e);
+ }
+ }
+
+ @GET
+ @Path("/distribution-tenant")
+ public Response getDistributionTenantByDomain(@QueryParam("domain") String domain) {
+ try {
+ DistributionTenant tenant = service.getDistributionTenantByDomain(domain);
+ return Response.ok(xmlDistributionTenant(tenant), XML)
+ .header("ETag", tenant.getEtag())
+ .build();
+ } catch (AwsException e) {
+ return xmlErrorResponse(e);
+ }
+ }
+
+ @PUT
+ @Path("/distribution-tenant/{Id}")
+ public Response updateDistributionTenant(@PathParam("Id") String id,
+ @HeaderParam("If-Match") String ifMatch,
+ String body) {
+ try {
+ XmlParser.XmlElement request = XmlParser.extractElementTree(body, "UpdateDistributionTenantRequest");
+ DistributionTenant tenant = service.updateDistributionTenant(id, ifMatch,
+ tenantText(request, "DistributionId"),
+ tenantDomains(request),
+ tenantCustomizations(request),
+ tenantParameters(request),
+ tenantText(request, "ConnectionGroupId"),
+ xmlBoolean(tenantText(request, "Enabled")));
+ return Response.ok(xmlDistributionTenant(tenant), XML)
+ .header("ETag", tenant.getEtag())
+ .build();
+ } catch (AwsException e) {
+ return xmlErrorResponse(e);
+ }
+ }
+
+ @DELETE
+ @Path("/distribution-tenant/{Id}")
+ public Response deleteDistributionTenant(@PathParam("Id") String id,
+ @HeaderParam("If-Match") String ifMatch) {
+ try {
+ service.deleteDistributionTenant(id, ifMatch);
+ return Response.noContent().build();
+ } catch (AwsException e) {
+ return xmlErrorResponse(e);
+ }
+ }
+
+ @POST
+ @Path("/distribution-tenants")
+ public Response listDistributionTenants(String body) {
+ try {
+ Map request = XmlParser.extractGroups(body, "ListDistributionTenantsRequest")
+ .stream().findFirst().orElse(Map.of());
+ String distributionId = null;
+ String connectionGroupId = null;
+ for (Map filter : XmlParser.extractGroups(body, "AssociationFilter")) {
+ distributionId = blankToNull(filter.get("DistributionId"));
+ connectionGroupId = blankToNull(filter.get("ConnectionGroupId"));
+ }
+ int pageSize = pageSizeOf(parseMaxItems(request.get("MaxItems")));
+ Page page = page(
+ service.listDistributionTenants(request.get("Marker"), paginationFetchLimit(pageSize),
+ distributionId, connectionGroupId),
+ pageSize, DistributionTenant::getName);
+ return distributionTenantListResponse("ListDistributionTenantsResult", page);
+ } catch (AwsException e) {
+ return xmlErrorResponse(e);
+ }
+ }
+
+ @POST
+ @Path("/distribution-tenants-by-customization")
+ public Response listDistributionTenantsByCustomization(String body) {
+ try {
+ Map request =
+ XmlParser.extractGroups(body, "ListDistributionTenantsByCustomizationRequest")
+ .stream().findFirst().orElse(Map.of());
+ int pageSize = pageSizeOf(parseMaxItems(request.get("MaxItems")));
+ Page page = page(
+ service.listDistributionTenantsByCustomization(request.get("Marker"),
+ paginationFetchLimit(pageSize), blankToNull(request.get("WebACLArn")),
+ blankToNull(request.get("CertificateArn"))),
+ pageSize, DistributionTenant::getName);
+ return distributionTenantListResponse("ListDistributionTenantsByCustomizationResult", page);
+ } catch (AwsException e) {
+ return xmlErrorResponse(e);
+ }
+ }
+
+ private static int pageSizeOf(Integer maxItems) {
+ return maxItems == null ? 100 : maxItems;
+ }
+
+ private Response distributionTenantListResponse(String root, Page page) {
+ XmlBuilder xml = new XmlBuilder()
+ .start(root, NS)
+ .elem("NextMarker", page.nextMarker())
+ .start("DistributionTenantList");
+ for (DistributionTenant tenant : page.items()) {
+ xml.raw(xmlDistributionTenantSummary(tenant));
+ }
+ return Response.ok(xml.end("DistributionTenantList").end(root).build(), XML).build();
+ }
+
// ── Invalidations ─────────────────────────────────────────────────────────
@POST
@@ -4197,4 +4340,165 @@ public class CloudFrontController {
}
return null;
}
+
+ private static String tenantText(XmlParser.XmlElement request, String name) {
+ XmlParser.XmlElement child = request == null ? null : request.child(name);
+ return child == null || child.text().isEmpty() ? null : child.text();
+ }
+
+ /** The {@code Domains} members, or null when the request carries no {@code Domains}. */
+ private static List tenantDomains(XmlParser.XmlElement request) {
+ XmlParser.XmlElement domains = request == null ? null : request.child("Domains");
+ if (domains == null) {
+ return null;
+ }
+ List result = new ArrayList<>();
+ for (XmlParser.XmlElement item : domains.children()) {
+ XmlParser.XmlElement domain = item.child("Domain");
+ result.add(domain == null ? null : domain.text());
+ }
+ return result;
+ }
+
+ private static Map tenantParameters(XmlParser.XmlElement request) {
+ XmlParser.XmlElement parameters = request == null ? null : request.child("Parameters");
+ if (parameters == null) {
+ return null;
+ }
+ Map result = new LinkedHashMap<>();
+ for (XmlParser.XmlElement parameter : parameters.children()) {
+ result.put(tenantText(parameter, "Name"), tenantText(parameter, "Value"));
+ }
+ return result;
+ }
+
+ private static TenantCustomizations tenantCustomizations(XmlParser.XmlElement request) {
+ XmlParser.XmlElement element = request == null ? null : request.child("Customizations");
+ if (element == null) {
+ return null;
+ }
+ TenantCustomizations customizations = new TenantCustomizations();
+ XmlParser.XmlElement webAcl = element.child("WebAcl");
+ if (webAcl != null) {
+ customizations.setWebAclAction(tenantText(webAcl, "Action"));
+ customizations.setWebAclArn(tenantText(webAcl, "Arn"));
+ }
+ XmlParser.XmlElement certificate = element.child("Certificate");
+ if (certificate != null) {
+ customizations.setCertificateArn(tenantText(certificate, "Arn"));
+ }
+ XmlParser.XmlElement geo = element.child("GeoRestrictions");
+ if (geo != null) {
+ customizations.setGeoRestrictionType(tenantText(geo, "RestrictionType"));
+ XmlParser.XmlElement locations = geo.child("Locations");
+ if (locations != null) {
+ List codes = new ArrayList<>();
+ for (XmlParser.XmlElement location : locations.children()) {
+ codes.add(location.text());
+ }
+ customizations.setGeoLocations(codes);
+ }
+ }
+ return customizations;
+ }
+
+ private String xmlDistributionTenant(DistributionTenant tenant) {
+ XmlBuilder xml = new XmlBuilder().start("DistributionTenant", NS)
+ .elem("Id", tenant.getId())
+ .elem("DistributionId", tenant.getDistributionId())
+ .elem("Name", tenant.getName())
+ .elem("Arn", tenant.getArn());
+ appendTenantDomains(xml, tenant);
+ Map tags = service.listTagsForResource(tenant.getArn());
+ if (!tags.isEmpty()) {
+ xml.start("Tags").start("Items");
+ for (Map.Entry tag : tags.entrySet()) {
+ xml.start("Tag")
+ .elem("Key", tag.getKey())
+ .elem("Value", tag.getValue())
+ .end("Tag");
+ }
+ xml.end("Items").end("Tags");
+ }
+ appendTenantCustomizations(xml, tenant);
+ if (tenant.getParameters() != null && !tenant.getParameters().isEmpty()) {
+ xml.start("Parameters");
+ for (Map.Entry parameter : tenant.getParameters().entrySet()) {
+ xml.start("member")
+ .elem("Name", parameter.getKey())
+ .elem("Value", parameter.getValue())
+ .end("member");
+ }
+ xml.end("Parameters");
+ }
+ xml.elem("ConnectionGroupId", tenant.getConnectionGroupId())
+ .elem("CreatedTime", tenant.getCreatedTime().toString())
+ .elem("LastModifiedTime", tenant.getLastModifiedTime().toString())
+ .elem("Enabled", tenant.getEnabled())
+ .elem("Status", tenant.getStatus());
+ return xml.end("DistributionTenant").build();
+ }
+
+ private static String xmlDistributionTenantSummary(DistributionTenant tenant) {
+ XmlBuilder xml = new XmlBuilder().start("DistributionTenantSummary", NS)
+ .elem("Id", tenant.getId())
+ .elem("DistributionId", tenant.getDistributionId())
+ .elem("Name", tenant.getName())
+ .elem("Arn", tenant.getArn());
+ appendTenantDomains(xml, tenant);
+ xml.elem("ConnectionGroupId", tenant.getConnectionGroupId());
+ appendTenantCustomizations(xml, tenant);
+ xml.elem("CreatedTime", tenant.getCreatedTime().toString())
+ .elem("LastModifiedTime", tenant.getLastModifiedTime().toString())
+ .elem("ETag", tenant.getEtag())
+ .elem("Enabled", tenant.getEnabled())
+ .elem("Status", tenant.getStatus());
+ return xml.end("DistributionTenantSummary").build();
+ }
+
+ /**
+ * Every domain reads back {@code active}: Floci performs no DNS or certificate validation. The
+ * {@code Domains} and {@code Parameters} lists declare no member name, so the SDKs read their
+ * items as {@code member} elements; requests are read by position, whatever the items are called.
+ */
+ private static void appendTenantDomains(XmlBuilder xml, DistributionTenant tenant) {
+ xml.start("Domains");
+ for (String domain : tenant.getDomains()) {
+ xml.start("member")
+ .elem("Domain", domain)
+ .elem("Status", "active")
+ .end("member");
+ }
+ xml.end("Domains");
+ }
+
+ private static void appendTenantCustomizations(XmlBuilder xml, DistributionTenant tenant) {
+ TenantCustomizations customizations = tenant.getCustomizations();
+ if (customizations == null || customizations.isEmpty()) {
+ return;
+ }
+ xml.start("Customizations");
+ if (customizations.getWebAclAction() != null) {
+ xml.start("WebAcl").elem("Action", customizations.getWebAclAction());
+ if (customizations.getWebAclArn() != null) {
+ xml.elem("Arn", customizations.getWebAclArn());
+ }
+ xml.end("WebAcl");
+ }
+ if (customizations.getCertificateArn() != null) {
+ xml.start("Certificate").elem("Arn", customizations.getCertificateArn()).end("Certificate");
+ }
+ if (customizations.getGeoRestrictionType() != null) {
+ xml.start("GeoRestrictions").elem("RestrictionType", customizations.getGeoRestrictionType());
+ if (customizations.getGeoLocations() != null && !customizations.getGeoLocations().isEmpty()) {
+ xml.start("Locations");
+ for (String location : customizations.getGeoLocations()) {
+ xml.elem("Location", location);
+ }
+ xml.end("Locations");
+ }
+ xml.end("GeoRestrictions");
+ }
+ xml.end("Customizations");
+ }
}
diff --git a/src/main/java/io/floci/aws/services/cloudfront/CloudFrontService.java b/src/main/java/io/floci/aws/services/cloudfront/CloudFrontService.java
index 0e147937a8..cdf5c3ffc6 100644
--- a/src/main/java/io/floci/aws/services/cloudfront/CloudFrontService.java
+++ b/src/main/java/io/floci/aws/services/cloudfront/CloudFrontService.java
@@ -23,6 +23,7 @@ import io.floci.aws.services.cloudfront.model.ContinuousDeploymentPolicy;
import io.floci.aws.services.cloudfront.model.DefaultCacheBehavior;
import io.floci.aws.services.cloudfront.model.Distribution;
import io.floci.aws.services.cloudfront.model.DistributionConfig;
+import io.floci.aws.services.cloudfront.model.DistributionTenant;
import io.floci.aws.services.cloudfront.model.FieldLevelEncryptionConfig;
import io.floci.aws.services.cloudfront.model.FieldLevelEncryptionProfile;
import io.floci.aws.services.cloudfront.model.Invalidation;
@@ -36,6 +37,7 @@ import io.floci.aws.services.cloudfront.model.PublicKey;
import io.floci.aws.services.cloudfront.model.RealtimeLogConfig;
import io.floci.aws.services.cloudfront.model.ResponseHeadersPolicy;
import io.floci.aws.services.cloudfront.model.StreamingDistribution;
+import io.floci.aws.services.cloudfront.model.TenantCustomizations;
import io.floci.aws.services.iam.IamService;
import io.floci.aws.services.iam.ServerCertificateReferenceProvider;
import jakarta.enterprise.context.ApplicationScoped;
@@ -95,6 +97,15 @@ public class CloudFrontService implements ServerCertificateReferenceProvider {
private static final Set CONNECTION_MODES = Set.of("direct", "tenant-only");
/** AWS names the account's automatically created connection group "default". */
private static final String DEFAULT_CONNECTION_GROUP_NAME = "default";
+ /** A distribution tenant's Name: the pattern its request shape declares (3 to 128 characters). */
+ private static final Pattern TENANT_NAME = Pattern.compile("[a-zA-Z0-9][a-zA-Z0-9-.]{1,126}[a-zA-Z0-9]");
+ /** The pattern a tenant parameter's Name declares, and the length its Value is held to. */
+ private static final Pattern TENANT_PARAMETER_NAME = Pattern.compile("[a-zA-Z0-9-_]{1,128}");
+ private static final int TENANT_PARAMETER_VALUE_MAX_LENGTH = 256;
+ /** UpdateDistributionTenant documents "up to 5 domains" for a tenant. */
+ private static final int TENANT_MAX_DOMAINS = 5;
+ private static final Set TENANT_WEB_ACL_ACTIONS = Set.of("override", "disable");
+ private static final Set TENANT_GEO_RESTRICTION_TYPES = Set.of("blacklist", "whitelist", "none");
/** The documented maximum a connection group's Name may reach (AWS's own limit). */
private static final int CONNECTION_GROUP_NAME_MAX_LENGTH = 256;
/**
@@ -157,6 +168,7 @@ public class CloudFrontService implements ServerCertificateReferenceProvider {
private final AccountAwareStorageBackend distStore;
private final AccountAwareStorageBackend connectionGroupStore;
+ private final AccountAwareStorageBackend tenantStore;
private final StorageBackend> invalidationStore;
private final StorageBackend cachePolicyStore;
private final StorageBackend orpStore;
@@ -207,6 +219,8 @@ public class CloudFrontService implements ServerCertificateReferenceProvider {
new TypeReference