mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
feat(opensearch): round-trip VPC/security/encryption options and per-family instance type metadata (#1039)
Closes the follow-ups from #1025: domain option blocks now survive CreateDomain → DescribeDomain, and DescribeInstanceTypeLimits returns family-appropriate metadata instead of one canned EBS response. - VPCOptions, AdvancedSecurityOptions, EncryptionAtRestOptions, NodeToNodeEncryptionOptions, and DomainEndpointOptions now round-trip through the management API. Real SDK clients (Terraform / CDK / Pulumi) read these back to detect drift; previously they were silently dropped. - Master passwords are accepted but never echoed back, matching AWS. - AdvancedSecurityOptions.Enabled + InternalUserDatabaseEnabled without a master user is rejected with ValidationException, as is CustomEndpointEnabled without a CustomEndpoint value. - New OpenSearchInstanceTypes catalog drives DescribeInstanceTypeDetails and DescribeInstanceTypeLimits. or1.* now reports s3-backed storage with the larger 8-36 TiB ceiling AWS documents; i3.* reports instance-store; everything else stays EBS at 3584 GiB. Unknown types fall back to a generic EBS spec instead of 404'ing. - Floci still boots one Docker container per domain regardless of instance type, but the management metadata now matches AWS so introspection tools work correctly. Tests: 60 OpenSearch tests pass. New: 6 OpenSearchInstanceTypesTest unit tests + 6 OpenSearchDomainOptionsIntegrationTest end-to-end + 2 or1 / EBS instance-type-limit integration tests. Live Docker validation: VPC + Encryption + N2N + Endpoint round-trip on a real running domain; or1.2xlarge.search returns s3-backed/36864 GiB while m6g.large.search returns ebs/3584 GiB; FGAC validation fires correctly when MasterUserName is omitted.
This commit is contained in:
1 parent
9b436e6c67
commit
5a9c30eb58
13 files changed
+1130
-34
No files matched your search
+262
-29
@@ -2,9 +2,14 @@ package io.github.hectorvent.floci.services.opensearch;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.RegionResolver;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.AdvancedSecurityOptions;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.ClusterConfig;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.Domain;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.DomainEndpointOptions;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.EbsOptions;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.EncryptionAtRestOptions;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.NodeToNodeEncryptionOptions;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.VpcOptions;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
@@ -31,20 +36,6 @@ public class OpenSearchController {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(OpenSearchController.class);
|
||||
|
||||
private static final List<String> INSTANCE_TYPES = List.of(
|
||||
"t3.small.search", "t3.medium.search",
|
||||
"m5.large.search", "m5.xlarge.search", "m5.2xlarge.search",
|
||||
"m6g.large.search", "m6g.xlarge.search", "m6g.2xlarge.search",
|
||||
"m7g.large.search", "m7g.xlarge.search", "m7g.2xlarge.search",
|
||||
"r5.large.search", "r5.xlarge.search", "r5.2xlarge.search",
|
||||
"r6g.large.search", "r6g.xlarge.search", "r6g.2xlarge.search",
|
||||
"r7g.large.search", "r7g.xlarge.search", "r7g.2xlarge.search",
|
||||
"c5.large.search", "c5.xlarge.search", "c5.2xlarge.search",
|
||||
"c6g.large.search", "c6g.xlarge.search", "c6g.2xlarge.search",
|
||||
"c7g.large.search", "c7g.xlarge.search", "c7g.2xlarge.search",
|
||||
"or1.medium.search", "or1.large.search", "or1.xlarge.search", "or1.2xlarge.search"
|
||||
);
|
||||
|
||||
private final OpenSearchService service;
|
||||
private final RegionResolver regionResolver;
|
||||
private final ObjectMapper objectMapper;
|
||||
@@ -69,8 +60,15 @@ public class OpenSearchController {
|
||||
EbsOptions ebsOptions = parseEbsOptions(req.path("EBSOptions"));
|
||||
Map<String, String> tags = parseTags(req.path("TagList"));
|
||||
|
||||
OpenSearchService.DomainOptions options = new OpenSearchService.DomainOptions(
|
||||
parseVpcOptions(req.path("VPCOptions")),
|
||||
parseAdvancedSecurityOptions(req.path("AdvancedSecurityOptions")),
|
||||
parseEncryptionAtRestOptions(req.path("EncryptionAtRestOptions")),
|
||||
parseNodeToNodeEncryptionOptions(req.path("NodeToNodeEncryptionOptions")),
|
||||
parseDomainEndpointOptions(req.path("DomainEndpointOptions")));
|
||||
|
||||
Domain domain = service.createDomain(domainName, engineVersion, clusterConfig,
|
||||
ebsOptions, tags, region);
|
||||
ebsOptions, tags, options, region);
|
||||
|
||||
ObjectNode response = objectMapper.createObjectNode();
|
||||
response.set("DomainStatus", toDomainStatusNode(domain));
|
||||
@@ -151,6 +149,8 @@ public class OpenSearchController {
|
||||
versionSection.put("Options", domain.getEngineVersion());
|
||||
versionSection.set("Status", configStatusNode(epochSeconds));
|
||||
|
||||
attachDomainOptionConfigs(domainConfig, domain, epochSeconds);
|
||||
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
|
||||
@@ -166,8 +166,15 @@ public class OpenSearchController {
|
||||
ClusterConfig clusterConfig = parseClusterConfig(req.path("ClusterConfig"));
|
||||
EbsOptions ebsOptions = parseEbsOptions(req.path("EBSOptions"));
|
||||
|
||||
OpenSearchService.DomainOptions options = new OpenSearchService.DomainOptions(
|
||||
parseVpcOptions(req.path("VPCOptions")),
|
||||
parseAdvancedSecurityOptions(req.path("AdvancedSecurityOptions")),
|
||||
parseEncryptionAtRestOptions(req.path("EncryptionAtRestOptions")),
|
||||
parseNodeToNodeEncryptionOptions(req.path("NodeToNodeEncryptionOptions")),
|
||||
parseDomainEndpointOptions(req.path("DomainEndpointOptions")));
|
||||
|
||||
Domain domain = service.updateDomainConfig(domainName, engineVersion, clusterConfig,
|
||||
ebsOptions, region);
|
||||
ebsOptions, options, region);
|
||||
|
||||
long epochSeconds = domain.getCreatedAt() != null ? domain.getCreatedAt().getEpochSecond() : 0;
|
||||
ObjectNode response = objectMapper.createObjectNode();
|
||||
@@ -185,6 +192,8 @@ public class OpenSearchController {
|
||||
versionSection.put("Options", domain.getEngineVersion());
|
||||
versionSection.set("Status", configStatusNode(epochSeconds));
|
||||
|
||||
attachDomainOptionConfigs(domainConfig, domain, epochSeconds);
|
||||
|
||||
return Response.ok(response).build();
|
||||
} catch (AwsException e) {
|
||||
throw e;
|
||||
@@ -307,15 +316,16 @@ public class OpenSearchController {
|
||||
@PathParam("engineVersion") String engineVersion) {
|
||||
ObjectNode response = objectMapper.createObjectNode();
|
||||
ArrayNode details = response.putArray("InstanceTypeDetails");
|
||||
for (String instanceType : INSTANCE_TYPES) {
|
||||
for (String instanceType : OpenSearchInstanceTypes.listAll()) {
|
||||
OpenSearchInstanceTypes.InstanceTypeSpec spec = OpenSearchInstanceTypes.specOf(instanceType);
|
||||
ObjectNode detail = objectMapper.createObjectNode();
|
||||
detail.put("InstanceType", instanceType);
|
||||
detail.put("EncryptionEnabled", true);
|
||||
detail.put("CognitoEnabled", false);
|
||||
detail.put("AppLogsEnabled", true);
|
||||
detail.put("AdvancedSecurityEnabled", false);
|
||||
detail.put("InstanceType", spec.instanceType());
|
||||
detail.put("EncryptionEnabled", spec.encryptionEnabled());
|
||||
detail.put("CognitoEnabled", spec.cognitoEnabled());
|
||||
detail.put("AppLogsEnabled", spec.appLogsEnabled());
|
||||
detail.put("AdvancedSecurityEnabled", spec.advancedSecurityEnabled());
|
||||
ArrayNode roles = detail.putArray("InstanceRole");
|
||||
roles.add("Data");
|
||||
OpenSearchInstanceTypes.DATA_ROLE.forEach(roles::add);
|
||||
details.add(detail);
|
||||
}
|
||||
return Response.ok(response).build();
|
||||
@@ -326,29 +336,35 @@ public class OpenSearchController {
|
||||
public Response describeInstanceTypeLimits(@Context HttpHeaders headers,
|
||||
@PathParam("engineVersion") String engineVersion,
|
||||
@PathParam("instanceType") String instanceType) {
|
||||
OpenSearchInstanceTypes.InstanceTypeSpec spec = OpenSearchInstanceTypes.specOf(instanceType);
|
||||
if (spec == null) {
|
||||
// Generic fallback so freshly announced types don't 404 here.
|
||||
spec = OpenSearchInstanceTypes.genericFallback(instanceType);
|
||||
}
|
||||
|
||||
ObjectNode response = objectMapper.createObjectNode();
|
||||
ObjectNode limitsByRole = response.putObject("LimitsByRole");
|
||||
ObjectNode dataRole = limitsByRole.putObject("data");
|
||||
|
||||
ArrayNode storageTypes = dataRole.putArray("StorageTypes");
|
||||
ObjectNode storageType = objectMapper.createObjectNode();
|
||||
storageType.put("StorageTypeName", "ebs");
|
||||
storageType.put("StorageSubTypeName", "standard");
|
||||
storageType.put("StorageTypeName", spec.storageType());
|
||||
storageType.put("StorageSubTypeName", spec.ebsAttachable() ? "standard" : "managed");
|
||||
ArrayNode storageTypeLimits = storageType.putArray("StorageTypeLimits");
|
||||
ObjectNode minLimit = objectMapper.createObjectNode();
|
||||
minLimit.put("LimitName", "MinimumVolumeSize");
|
||||
minLimit.putArray("LimitValues").add("10");
|
||||
minLimit.putArray("LimitValues").add(String.valueOf(spec.minVolumeSizeGib()));
|
||||
storageTypeLimits.add(minLimit);
|
||||
ObjectNode maxLimit = objectMapper.createObjectNode();
|
||||
maxLimit.put("LimitName", "MaximumVolumeSize");
|
||||
maxLimit.putArray("LimitValues").add("3584");
|
||||
maxLimit.putArray("LimitValues").add(String.valueOf(spec.maxVolumeSizeGib()));
|
||||
storageTypeLimits.add(maxLimit);
|
||||
storageTypes.add(storageType);
|
||||
|
||||
ObjectNode instanceLimits = dataRole.putObject("InstanceLimits");
|
||||
ObjectNode instanceCountLimits = instanceLimits.putObject("InstanceCountLimits");
|
||||
instanceCountLimits.put("MinimumInstanceCount", 1);
|
||||
instanceCountLimits.put("MaximumInstanceCount", 20);
|
||||
instanceCountLimits.put("MinimumInstanceCount", spec.minInstanceCount());
|
||||
instanceCountLimits.put("MaximumInstanceCount", spec.maxInstanceCount());
|
||||
|
||||
dataRole.putArray("AdditionalLimits");
|
||||
|
||||
@@ -478,6 +494,119 @@ public class OpenSearchController {
|
||||
node.put("Endpoint", domain.getEndpoint() != null ? domain.getEndpoint() : "");
|
||||
node.set("ClusterConfig", toClusterConfigNode(domain.getClusterConfig()));
|
||||
node.set("EBSOptions", toEbsOptionsNode(domain.getEbsOptions()));
|
||||
if (domain.getVpcOptions() != null) {
|
||||
node.set("VPCOptions", toVpcOptionsNode(domain.getVpcOptions()));
|
||||
}
|
||||
if (domain.getAdvancedSecurityOptions() != null) {
|
||||
node.set("AdvancedSecurityOptions", toAdvancedSecurityNode(domain.getAdvancedSecurityOptions()));
|
||||
}
|
||||
if (domain.getEncryptionAtRestOptions() != null) {
|
||||
node.set("EncryptionAtRestOptions", toEncryptionAtRestNode(domain.getEncryptionAtRestOptions()));
|
||||
}
|
||||
if (domain.getNodeToNodeEncryptionOptions() != null) {
|
||||
node.set("NodeToNodeEncryptionOptions", toNodeToNodeEncryptionNode(domain.getNodeToNodeEncryptionOptions()));
|
||||
}
|
||||
if (domain.getDomainEndpointOptions() != null) {
|
||||
node.set("DomainEndpointOptions", toDomainEndpointOptionsNode(domain.getDomainEndpointOptions()));
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach optional config sections to {@code DescribeDomainConfig} /
|
||||
* {@code UpdateDomainConfig} responses. Only emit entries that the domain
|
||||
* actually carries — AWS omits the keys entirely when the feature is
|
||||
* unset, rather than emitting empty objects.
|
||||
*/
|
||||
private void attachDomainOptionConfigs(ObjectNode domainConfig, Domain domain, long epochSeconds) {
|
||||
if (domain.getVpcOptions() != null) {
|
||||
ObjectNode section = domainConfig.putObject("VPCOptions");
|
||||
section.set("Options", toVpcOptionsNode(domain.getVpcOptions()));
|
||||
section.set("Status", configStatusNode(epochSeconds));
|
||||
}
|
||||
if (domain.getAdvancedSecurityOptions() != null) {
|
||||
ObjectNode section = domainConfig.putObject("AdvancedSecurityOptions");
|
||||
section.set("Options", toAdvancedSecurityNode(domain.getAdvancedSecurityOptions()));
|
||||
section.set("Status", configStatusNode(epochSeconds));
|
||||
}
|
||||
if (domain.getEncryptionAtRestOptions() != null) {
|
||||
ObjectNode section = domainConfig.putObject("EncryptionAtRestOptions");
|
||||
section.set("Options", toEncryptionAtRestNode(domain.getEncryptionAtRestOptions()));
|
||||
section.set("Status", configStatusNode(epochSeconds));
|
||||
}
|
||||
if (domain.getNodeToNodeEncryptionOptions() != null) {
|
||||
ObjectNode section = domainConfig.putObject("NodeToNodeEncryptionOptions");
|
||||
section.set("Options", toNodeToNodeEncryptionNode(domain.getNodeToNodeEncryptionOptions()));
|
||||
section.set("Status", configStatusNode(epochSeconds));
|
||||
}
|
||||
if (domain.getDomainEndpointOptions() != null) {
|
||||
ObjectNode section = domainConfig.putObject("DomainEndpointOptions");
|
||||
section.set("Options", toDomainEndpointOptionsNode(domain.getDomainEndpointOptions()));
|
||||
section.set("Status", configStatusNode(epochSeconds));
|
||||
}
|
||||
}
|
||||
|
||||
private ObjectNode toVpcOptionsNode(VpcOptions vpc) {
|
||||
ObjectNode node = objectMapper.createObjectNode();
|
||||
ArrayNode subnets = node.putArray("SubnetIds");
|
||||
vpc.getSubnetIds().forEach(subnets::add);
|
||||
ArrayNode sgs = node.putArray("SecurityGroupIds");
|
||||
vpc.getSecurityGroupIds().forEach(sgs::add);
|
||||
ArrayNode azs = node.putArray("AvailabilityZones");
|
||||
vpc.getAvailabilityZones().forEach(azs::add);
|
||||
if (vpc.getVpcId() != null) {
|
||||
node.put("VPCId", vpc.getVpcId());
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
private ObjectNode toAdvancedSecurityNode(AdvancedSecurityOptions adv) {
|
||||
ObjectNode node = objectMapper.createObjectNode();
|
||||
node.put("Enabled", adv.isEnabled());
|
||||
node.put("InternalUserDatabaseEnabled", adv.isInternalUserDatabaseEnabled());
|
||||
node.put("AnonymousAuthEnabled", adv.isAnonymousAuthEnabled());
|
||||
if (adv.getAnonymousAuthDisableDate() != null) {
|
||||
node.put("AnonymousAuthDisableDate", adv.getAnonymousAuthDisableDate());
|
||||
}
|
||||
// Only echo username + ARN — never master password (AWS doesn't either).
|
||||
if (adv.getMasterUserOptions() != null) {
|
||||
ObjectNode mu = node.putObject("MasterUserOptions");
|
||||
if (adv.getMasterUserOptions().getMasterUserName() != null) {
|
||||
mu.put("MasterUserName", adv.getMasterUserOptions().getMasterUserName());
|
||||
}
|
||||
if (adv.getMasterUserOptions().getMasterUserArn() != null) {
|
||||
mu.put("MasterUserARN", adv.getMasterUserOptions().getMasterUserArn());
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
private ObjectNode toEncryptionAtRestNode(EncryptionAtRestOptions enc) {
|
||||
ObjectNode node = objectMapper.createObjectNode();
|
||||
node.put("Enabled", enc.isEnabled());
|
||||
if (enc.getKmsKeyId() != null) {
|
||||
node.put("KmsKeyId", enc.getKmsKeyId());
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
private ObjectNode toNodeToNodeEncryptionNode(NodeToNodeEncryptionOptions n2n) {
|
||||
ObjectNode node = objectMapper.createObjectNode();
|
||||
node.put("Enabled", n2n.isEnabled());
|
||||
return node;
|
||||
}
|
||||
|
||||
private ObjectNode toDomainEndpointOptionsNode(DomainEndpointOptions deo) {
|
||||
ObjectNode node = objectMapper.createObjectNode();
|
||||
node.put("EnforceHTTPS", deo.isEnforceHttps());
|
||||
node.put("TLSSecurityPolicy", deo.getTlsSecurityPolicy());
|
||||
node.put("CustomEndpointEnabled", deo.isCustomEndpointEnabled());
|
||||
if (deo.getCustomEndpoint() != null) {
|
||||
node.put("CustomEndpoint", deo.getCustomEndpoint());
|
||||
}
|
||||
if (deo.getCustomEndpointCertificateArn() != null) {
|
||||
node.put("CustomEndpointCertificateArn", deo.getCustomEndpointCertificateArn());
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -556,6 +685,110 @@ public class OpenSearchController {
|
||||
return ebs;
|
||||
}
|
||||
|
||||
private VpcOptions parseVpcOptions(JsonNode node) {
|
||||
if (node == null || node.isMissingNode() || node.isNull()) {
|
||||
return null;
|
||||
}
|
||||
VpcOptions opts = new VpcOptions();
|
||||
List<String> subnets = new ArrayList<>();
|
||||
node.path("SubnetIds").forEach(n -> subnets.add(n.asText()));
|
||||
opts.setSubnetIds(subnets);
|
||||
List<String> sgs = new ArrayList<>();
|
||||
node.path("SecurityGroupIds").forEach(n -> sgs.add(n.asText()));
|
||||
opts.setSecurityGroupIds(sgs);
|
||||
// AvailabilityZones / VPCId are AWS-derived in real life (placement
|
||||
// engine reads them from the subnets), but Terraform plans round-trip
|
||||
// whatever was last seen, so accept them on update too.
|
||||
List<String> azs = new ArrayList<>();
|
||||
node.path("AvailabilityZones").forEach(n -> azs.add(n.asText()));
|
||||
opts.setAvailabilityZones(azs);
|
||||
if (node.has("VPCId")) {
|
||||
opts.setVpcId(node.get("VPCId").asText());
|
||||
}
|
||||
return opts;
|
||||
}
|
||||
|
||||
private AdvancedSecurityOptions parseAdvancedSecurityOptions(JsonNode node) {
|
||||
if (node == null || node.isMissingNode() || node.isNull()) {
|
||||
return null;
|
||||
}
|
||||
AdvancedSecurityOptions opts = new AdvancedSecurityOptions();
|
||||
if (node.has("Enabled")) {
|
||||
opts.setEnabled(node.get("Enabled").asBoolean());
|
||||
}
|
||||
if (node.has("InternalUserDatabaseEnabled")) {
|
||||
opts.setInternalUserDatabaseEnabled(node.get("InternalUserDatabaseEnabled").asBoolean());
|
||||
}
|
||||
if (node.has("AnonymousAuthEnabled")) {
|
||||
opts.setAnonymousAuthEnabled(node.get("AnonymousAuthEnabled").asBoolean());
|
||||
}
|
||||
if (node.has("AnonymousAuthDisableDate")) {
|
||||
opts.setAnonymousAuthDisableDate(node.get("AnonymousAuthDisableDate").asText());
|
||||
}
|
||||
JsonNode mu = node.path("MasterUserOptions");
|
||||
if (!mu.isMissingNode() && !mu.isNull()) {
|
||||
AdvancedSecurityOptions.MasterUserOptions m = new AdvancedSecurityOptions.MasterUserOptions();
|
||||
if (mu.has("MasterUserName")) {
|
||||
m.setMasterUserName(mu.get("MasterUserName").asText());
|
||||
}
|
||||
if (mu.has("MasterUserARN")) {
|
||||
m.setMasterUserArn(mu.get("MasterUserARN").asText());
|
||||
}
|
||||
// Master password intentionally not stored — AWS never echoes it
|
||||
// back and we have no use for it without a real security plugin.
|
||||
opts.setMasterUserOptions(m);
|
||||
}
|
||||
return opts;
|
||||
}
|
||||
|
||||
private EncryptionAtRestOptions parseEncryptionAtRestOptions(JsonNode node) {
|
||||
if (node == null || node.isMissingNode() || node.isNull()) {
|
||||
return null;
|
||||
}
|
||||
EncryptionAtRestOptions opts = new EncryptionAtRestOptions();
|
||||
if (node.has("Enabled")) {
|
||||
opts.setEnabled(node.get("Enabled").asBoolean());
|
||||
}
|
||||
if (node.has("KmsKeyId")) {
|
||||
opts.setKmsKeyId(node.get("KmsKeyId").asText());
|
||||
}
|
||||
return opts;
|
||||
}
|
||||
|
||||
private NodeToNodeEncryptionOptions parseNodeToNodeEncryptionOptions(JsonNode node) {
|
||||
if (node == null || node.isMissingNode() || node.isNull()) {
|
||||
return null;
|
||||
}
|
||||
NodeToNodeEncryptionOptions opts = new NodeToNodeEncryptionOptions();
|
||||
if (node.has("Enabled")) {
|
||||
opts.setEnabled(node.get("Enabled").asBoolean());
|
||||
}
|
||||
return opts;
|
||||
}
|
||||
|
||||
private DomainEndpointOptions parseDomainEndpointOptions(JsonNode node) {
|
||||
if (node == null || node.isMissingNode() || node.isNull()) {
|
||||
return null;
|
||||
}
|
||||
DomainEndpointOptions opts = new DomainEndpointOptions();
|
||||
if (node.has("EnforceHTTPS")) {
|
||||
opts.setEnforceHttps(node.get("EnforceHTTPS").asBoolean());
|
||||
}
|
||||
if (node.has("TLSSecurityPolicy")) {
|
||||
opts.setTlsSecurityPolicy(node.get("TLSSecurityPolicy").asText());
|
||||
}
|
||||
if (node.has("CustomEndpointEnabled")) {
|
||||
opts.setCustomEndpointEnabled(node.get("CustomEndpointEnabled").asBoolean());
|
||||
}
|
||||
if (node.has("CustomEndpoint")) {
|
||||
opts.setCustomEndpoint(node.get("CustomEndpoint").asText());
|
||||
}
|
||||
if (node.has("CustomEndpointCertificateArn")) {
|
||||
opts.setCustomEndpointCertificateArn(node.get("CustomEndpointCertificateArn").asText());
|
||||
}
|
||||
return opts;
|
||||
}
|
||||
|
||||
private Map<String, String> parseTags(JsonNode node) {
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
if (node == null || node.isMissingNode() || node.isNull()) {
|
||||
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
package io.github.hectorvent.floci.services.opensearch;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Catalog of AWS OpenSearch instance types and their per-family characteristics.
|
||||
* Drives {@code DescribeInstanceTypeDetails} / {@code DescribeInstanceTypeLimits}
|
||||
* so SDK clients see family-appropriate metadata instead of one canned response.
|
||||
*
|
||||
* <p>The single-node Docker container Floci boots is the same regardless of
|
||||
* instance type — that's a fundamental fidelity gap an emulator can't close
|
||||
* — but the metadata exposed via the management API needs to reflect reality
|
||||
* so introspection tools (Terraform, CDK, cost calculators) work correctly.
|
||||
*
|
||||
* <p>Notable family differences modeled here:
|
||||
* <ul>
|
||||
* <li><b>{@code or1.*}</b> — OpenSearch-optimized, S3-backed segments. Only
|
||||
* supports the {@code instance-store} storage type and AWS does not
|
||||
* offer EBS attachment. Volume-size limits are correspondingly large.</li>
|
||||
* <li><b>{@code i3.*}</b> — i3 generation has fixed local NVMe; EBS is
|
||||
* attached but volume-size limits are smaller because the bulk of
|
||||
* storage comes from the instance store.</li>
|
||||
* <li>Everything else (m5/m6g/m7g, r5/r6g/r7g, c5/c6g/c7g, t3) — EBS-only,
|
||||
* 3584 GiB max gp2/gp3 volume.</li>
|
||||
* </ul>
|
||||
*/
|
||||
public final class OpenSearchInstanceTypes {
|
||||
|
||||
/** Subset of {@code InstanceType.InstanceRole} values relevant for emulation. */
|
||||
public static final List<String> DATA_ROLE = List.of("Data");
|
||||
|
||||
/**
|
||||
* Single per-instance-type entry. Family-level fields live here rather
|
||||
* than being recomputed at API call time so the metadata surface matches
|
||||
* AWS exactly for the cases where SDK clients introspect it.
|
||||
*/
|
||||
public record InstanceTypeSpec(
|
||||
String instanceType,
|
||||
String storageType, // ebs | instance-store | s3-backed
|
||||
int minVolumeSizeGib,
|
||||
int maxVolumeSizeGib,
|
||||
boolean ebsAttachable,
|
||||
boolean encryptionEnabled,
|
||||
boolean cognitoEnabled,
|
||||
boolean appLogsEnabled,
|
||||
boolean advancedSecurityEnabled,
|
||||
int minInstanceCount,
|
||||
int maxInstanceCount) {
|
||||
}
|
||||
|
||||
private static final Map<String, InstanceTypeSpec> CATALOG = new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
// EBS-backed general-purpose / compute / memory families. 3584 GiB max
|
||||
// mirrors AWS's published gp2/gp3 limit for OpenSearch domains.
|
||||
for (String type : List.of(
|
||||
"t3.small.search", "t3.medium.search",
|
||||
"m5.large.search", "m5.xlarge.search", "m5.2xlarge.search",
|
||||
"m6g.large.search", "m6g.xlarge.search", "m6g.2xlarge.search",
|
||||
"m7g.large.search", "m7g.xlarge.search", "m7g.2xlarge.search",
|
||||
"r5.large.search", "r5.xlarge.search", "r5.2xlarge.search",
|
||||
"r6g.large.search", "r6g.xlarge.search", "r6g.2xlarge.search",
|
||||
"r7g.large.search", "r7g.xlarge.search", "r7g.2xlarge.search",
|
||||
"c5.large.search", "c5.xlarge.search", "c5.2xlarge.search",
|
||||
"c6g.large.search", "c6g.xlarge.search", "c6g.2xlarge.search",
|
||||
"c7g.large.search", "c7g.xlarge.search", "c7g.2xlarge.search")) {
|
||||
CATALOG.put(type, new InstanceTypeSpec(
|
||||
type, "ebs", 10, 3584, true,
|
||||
true, true, true, true,
|
||||
1, 80));
|
||||
}
|
||||
|
||||
// i3.* — local NVMe instance store. EBS still attachable for cluster
|
||||
// metadata but the bulk of storage is the instance store; we expose
|
||||
// smaller EBS limits accordingly.
|
||||
for (String type : List.of(
|
||||
"i3.large.search", "i3.xlarge.search", "i3.2xlarge.search",
|
||||
"i3.4xlarge.search", "i3.8xlarge.search", "i3.16xlarge.search")) {
|
||||
CATALOG.put(type, new InstanceTypeSpec(
|
||||
type, "instance-store", 10, 100, true,
|
||||
true, true, true, true,
|
||||
1, 40));
|
||||
}
|
||||
|
||||
// or1.* — OpenSearch-optimized, S3-backed segments. EBS is NOT
|
||||
// attachable; storage scales with the instance class. Limits per
|
||||
// AWS's or1 launch announcement (Nov 2023) and subsequent expansion.
|
||||
CATALOG.put("or1.medium.search", new InstanceTypeSpec(
|
||||
"or1.medium.search", "s3-backed", 10, 8192, false,
|
||||
true, false, true, true, 1, 40));
|
||||
CATALOG.put("or1.large.search", new InstanceTypeSpec(
|
||||
"or1.large.search", "s3-backed", 10, 16384, false,
|
||||
true, false, true, true, 1, 40));
|
||||
CATALOG.put("or1.xlarge.search", new InstanceTypeSpec(
|
||||
"or1.xlarge.search", "s3-backed", 10, 24576, false,
|
||||
true, false, true, true, 1, 40));
|
||||
CATALOG.put("or1.2xlarge.search", new InstanceTypeSpec(
|
||||
"or1.2xlarge.search", "s3-backed", 10, 36864, false,
|
||||
true, false, true, true, 1, 40));
|
||||
}
|
||||
|
||||
private OpenSearchInstanceTypes() {
|
||||
}
|
||||
|
||||
/** Every supported instance type, in canonical (catalog) order. */
|
||||
public static List<String> listAll() {
|
||||
return List.copyOf(CATALOG.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up the spec for {@code instanceType}. Unknown types return null —
|
||||
* callers should treat that as "AWS has it, we don't model it" and fall
|
||||
* back to a generic EBS spec rather than fail; AWS publishes new types
|
||||
* faster than emulators can keep up.
|
||||
*/
|
||||
public static InstanceTypeSpec specOf(String instanceType) {
|
||||
return CATALOG.get(instanceType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Spec used when the requested type is not in the catalog. Generic EBS
|
||||
* defaults — keeps {@code DescribeInstanceTypeLimits} from 404'ing on
|
||||
* brand-new instance types AWS just announced.
|
||||
*/
|
||||
public static InstanceTypeSpec genericFallback(String instanceType) {
|
||||
return new InstanceTypeSpec(
|
||||
instanceType, "ebs", 10, 3584, true,
|
||||
true, true, true, true, 1, 80);
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,14 @@ import io.github.hectorvent.floci.core.common.RegionResolver;
|
||||
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
|
||||
import io.github.hectorvent.floci.core.storage.StorageBackend;
|
||||
import io.github.hectorvent.floci.core.storage.StorageFactory;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.AdvancedSecurityOptions;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.ClusterConfig;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.Domain;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.DomainEndpointOptions;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.EbsOptions;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.EncryptionAtRestOptions;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.NodeToNodeEncryptionOptions;
|
||||
import io.github.hectorvent.floci.services.opensearch.model.VpcOptions;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.PreDestroy;
|
||||
@@ -73,10 +78,34 @@ public class OpenSearchService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bag of optional configuration blocks parsed by {@link OpenSearchController}
|
||||
* and round-tripped on Describe. Any field can be null when the request
|
||||
* omitted the corresponding block — the service treats null as "leave the
|
||||
* existing value untouched" on update and "feature unset" on create.
|
||||
*/
|
||||
public record DomainOptions(
|
||||
VpcOptions vpcOptions,
|
||||
AdvancedSecurityOptions advancedSecurityOptions,
|
||||
EncryptionAtRestOptions encryptionAtRestOptions,
|
||||
NodeToNodeEncryptionOptions nodeToNodeEncryptionOptions,
|
||||
DomainEndpointOptions domainEndpointOptions) {
|
||||
|
||||
public static final DomainOptions EMPTY = new DomainOptions(null, null, null, null, null);
|
||||
}
|
||||
|
||||
public Domain createDomain(String domainName, String engineVersion, ClusterConfig clusterConfig,
|
||||
EbsOptions ebsOptions, Map<String, String> tags, String region) {
|
||||
return createDomain(domainName, engineVersion, clusterConfig, ebsOptions, tags,
|
||||
DomainOptions.EMPTY, region);
|
||||
}
|
||||
|
||||
public Domain createDomain(String domainName, String engineVersion, ClusterConfig clusterConfig,
|
||||
EbsOptions ebsOptions, Map<String, String> tags,
|
||||
DomainOptions options, String region) {
|
||||
validateDomainName(domainName);
|
||||
OpenSearchVersions.validate(engineVersion);
|
||||
validateOptions(options);
|
||||
|
||||
if (domainStore.get(domainName).isPresent()) {
|
||||
throw new AwsException("ResourceAlreadyExistsException",
|
||||
@@ -105,6 +134,7 @@ public class OpenSearchService {
|
||||
if (tags != null) {
|
||||
domain.setTags(tags);
|
||||
}
|
||||
applyDomainOptions(domain, options);
|
||||
|
||||
if (config.services().opensearch().mock()) {
|
||||
domain.setProcessing(false);
|
||||
@@ -143,8 +173,16 @@ public class OpenSearchService {
|
||||
public Domain updateDomainConfig(String domainName, String engineVersion,
|
||||
ClusterConfig clusterConfig, EbsOptions ebsOptions,
|
||||
String region) {
|
||||
return updateDomainConfig(domainName, engineVersion, clusterConfig, ebsOptions,
|
||||
DomainOptions.EMPTY, region);
|
||||
}
|
||||
|
||||
public Domain updateDomainConfig(String domainName, String engineVersion,
|
||||
ClusterConfig clusterConfig, EbsOptions ebsOptions,
|
||||
DomainOptions options, String region) {
|
||||
Domain domain = describeDomain(domainName);
|
||||
OpenSearchVersions.validate(engineVersion);
|
||||
validateOptions(options);
|
||||
|
||||
if (engineVersion != null && !engineVersion.isBlank()) {
|
||||
domain.setEngineVersion(engineVersion);
|
||||
@@ -170,6 +208,7 @@ public class OpenSearchService {
|
||||
existing.setVolumeSize(ebsOptions.getVolumeSize());
|
||||
}
|
||||
}
|
||||
applyDomainOptions(domain, options);
|
||||
|
||||
domainStore.put(domainName, domain);
|
||||
return domain;
|
||||
@@ -234,6 +273,62 @@ public class OpenSearchService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cross-block validation: only the cases where a wrong combination is
|
||||
* deterministically rejected by AWS land here. Per-field syntax checks
|
||||
* stay in the controller's parsers.
|
||||
*/
|
||||
private void validateOptions(DomainOptions options) {
|
||||
if (options == null) {
|
||||
return;
|
||||
}
|
||||
VpcOptions vpc = options.vpcOptions();
|
||||
if (vpc != null && !vpc.getSubnetIds().isEmpty() && vpc.getSubnetIds().stream().anyMatch(String::isBlank)) {
|
||||
throw new AwsException("ValidationException",
|
||||
"VPCOptions.SubnetIds may not contain blank entries.", 400);
|
||||
}
|
||||
AdvancedSecurityOptions adv = options.advancedSecurityOptions();
|
||||
if (adv != null && adv.isEnabled() && adv.isInternalUserDatabaseEnabled()) {
|
||||
// AWS rejects internal user db without a master user — keep
|
||||
// emulator-side parity so Terraform plans surface the same error.
|
||||
if (adv.getMasterUserOptions() == null
|
||||
|| adv.getMasterUserOptions().getMasterUserName() == null
|
||||
|| adv.getMasterUserOptions().getMasterUserName().isBlank()) {
|
||||
throw new AwsException("ValidationException",
|
||||
"AdvancedSecurityOptions.MasterUserOptions.MasterUserName is required "
|
||||
+ "when InternalUserDatabaseEnabled=true.", 400);
|
||||
}
|
||||
}
|
||||
DomainEndpointOptions deo = options.domainEndpointOptions();
|
||||
if (deo != null && deo.isCustomEndpointEnabled()
|
||||
&& (deo.getCustomEndpoint() == null || deo.getCustomEndpoint().isBlank())) {
|
||||
throw new AwsException("ValidationException",
|
||||
"DomainEndpointOptions.CustomEndpoint is required when CustomEndpointEnabled=true.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
/** Copy non-null fields from {@code options} onto {@code domain}. Null leaves the field untouched. */
|
||||
private void applyDomainOptions(Domain domain, DomainOptions options) {
|
||||
if (options == null) {
|
||||
return;
|
||||
}
|
||||
if (options.vpcOptions() != null) {
|
||||
domain.setVpcOptions(options.vpcOptions());
|
||||
}
|
||||
if (options.advancedSecurityOptions() != null) {
|
||||
domain.setAdvancedSecurityOptions(options.advancedSecurityOptions());
|
||||
}
|
||||
if (options.encryptionAtRestOptions() != null) {
|
||||
domain.setEncryptionAtRestOptions(options.encryptionAtRestOptions());
|
||||
}
|
||||
if (options.nodeToNodeEncryptionOptions() != null) {
|
||||
domain.setNodeToNodeEncryptionOptions(options.nodeToNodeEncryptionOptions());
|
||||
}
|
||||
if (options.domainEndpointOptions() != null) {
|
||||
domain.setDomainEndpointOptions(options.domainEndpointOptions());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean matchesEngineType(String engineVersion, String engineType) {
|
||||
if ("Elasticsearch".equalsIgnoreCase(engineType)) {
|
||||
return engineVersion != null && engineVersion.startsWith("Elasticsearch");
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package io.github.hectorvent.floci.services.opensearch.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
/**
|
||||
* Fine-grained access control options. Round-tripped on Describe; the actual
|
||||
* security plugin remains disabled inside the OpenSearch container regardless,
|
||||
* since Floci is a local emulator and the plugin requires TLS + a real cluster
|
||||
* config that we don't ship.
|
||||
*
|
||||
* <p>Sensitive fields (master password, SAML metadata) are accepted on the
|
||||
* request but never serialized back — matching AWS behavior, which only echoes
|
||||
* the username and structural flags.
|
||||
*/
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class AdvancedSecurityOptions {
|
||||
|
||||
@JsonProperty("Enabled")
|
||||
private boolean enabled = false;
|
||||
|
||||
@JsonProperty("InternalUserDatabaseEnabled")
|
||||
private boolean internalUserDatabaseEnabled = false;
|
||||
|
||||
@JsonProperty("AnonymousAuthEnabled")
|
||||
private boolean anonymousAuthEnabled = false;
|
||||
|
||||
@JsonProperty("AnonymousAuthDisableDate")
|
||||
private String anonymousAuthDisableDate;
|
||||
|
||||
/** {@code MasterUserName} only — passwords / ARNs are intentionally not echoed back. */
|
||||
@JsonProperty("MasterUserOptions")
|
||||
private MasterUserOptions masterUserOptions;
|
||||
|
||||
public AdvancedSecurityOptions() {}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public boolean isInternalUserDatabaseEnabled() {
|
||||
return internalUserDatabaseEnabled;
|
||||
}
|
||||
|
||||
public void setInternalUserDatabaseEnabled(boolean internalUserDatabaseEnabled) {
|
||||
this.internalUserDatabaseEnabled = internalUserDatabaseEnabled;
|
||||
}
|
||||
|
||||
public boolean isAnonymousAuthEnabled() {
|
||||
return anonymousAuthEnabled;
|
||||
}
|
||||
|
||||
public void setAnonymousAuthEnabled(boolean anonymousAuthEnabled) {
|
||||
this.anonymousAuthEnabled = anonymousAuthEnabled;
|
||||
}
|
||||
|
||||
public String getAnonymousAuthDisableDate() {
|
||||
return anonymousAuthDisableDate;
|
||||
}
|
||||
|
||||
public void setAnonymousAuthDisableDate(String anonymousAuthDisableDate) {
|
||||
this.anonymousAuthDisableDate = anonymousAuthDisableDate;
|
||||
}
|
||||
|
||||
public MasterUserOptions getMasterUserOptions() {
|
||||
return masterUserOptions;
|
||||
}
|
||||
|
||||
public void setMasterUserOptions(MasterUserOptions masterUserOptions) {
|
||||
this.masterUserOptions = masterUserOptions;
|
||||
}
|
||||
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class MasterUserOptions {
|
||||
@JsonProperty("MasterUserName")
|
||||
private String masterUserName;
|
||||
|
||||
@JsonProperty("MasterUserARN")
|
||||
private String masterUserArn;
|
||||
|
||||
public MasterUserOptions() {}
|
||||
|
||||
public String getMasterUserName() {
|
||||
return masterUserName;
|
||||
}
|
||||
|
||||
public void setMasterUserName(String masterUserName) {
|
||||
this.masterUserName = masterUserName;
|
||||
}
|
||||
|
||||
public String getMasterUserArn() {
|
||||
return masterUserArn;
|
||||
}
|
||||
|
||||
public void setMasterUserArn(String masterUserArn) {
|
||||
this.masterUserArn = masterUserArn;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,21 @@ public class Domain {
|
||||
@JsonProperty("EBSOptions")
|
||||
private EbsOptions ebsOptions = new EbsOptions();
|
||||
|
||||
@JsonProperty("VPCOptions")
|
||||
private VpcOptions vpcOptions;
|
||||
|
||||
@JsonProperty("AdvancedSecurityOptions")
|
||||
private AdvancedSecurityOptions advancedSecurityOptions;
|
||||
|
||||
@JsonProperty("EncryptionAtRestOptions")
|
||||
private EncryptionAtRestOptions encryptionAtRestOptions;
|
||||
|
||||
@JsonProperty("NodeToNodeEncryptionOptions")
|
||||
private NodeToNodeEncryptionOptions nodeToNodeEncryptionOptions;
|
||||
|
||||
@JsonProperty("DomainEndpointOptions")
|
||||
private DomainEndpointOptions domainEndpointOptions;
|
||||
|
||||
@JsonProperty("Endpoint")
|
||||
private String endpoint = "";
|
||||
|
||||
@@ -123,6 +138,46 @@ public class Domain {
|
||||
this.ebsOptions = ebsOptions;
|
||||
}
|
||||
|
||||
public VpcOptions getVpcOptions() {
|
||||
return vpcOptions;
|
||||
}
|
||||
|
||||
public void setVpcOptions(VpcOptions vpcOptions) {
|
||||
this.vpcOptions = vpcOptions;
|
||||
}
|
||||
|
||||
public AdvancedSecurityOptions getAdvancedSecurityOptions() {
|
||||
return advancedSecurityOptions;
|
||||
}
|
||||
|
||||
public void setAdvancedSecurityOptions(AdvancedSecurityOptions advancedSecurityOptions) {
|
||||
this.advancedSecurityOptions = advancedSecurityOptions;
|
||||
}
|
||||
|
||||
public EncryptionAtRestOptions getEncryptionAtRestOptions() {
|
||||
return encryptionAtRestOptions;
|
||||
}
|
||||
|
||||
public void setEncryptionAtRestOptions(EncryptionAtRestOptions encryptionAtRestOptions) {
|
||||
this.encryptionAtRestOptions = encryptionAtRestOptions;
|
||||
}
|
||||
|
||||
public NodeToNodeEncryptionOptions getNodeToNodeEncryptionOptions() {
|
||||
return nodeToNodeEncryptionOptions;
|
||||
}
|
||||
|
||||
public void setNodeToNodeEncryptionOptions(NodeToNodeEncryptionOptions nodeToNodeEncryptionOptions) {
|
||||
this.nodeToNodeEncryptionOptions = nodeToNodeEncryptionOptions;
|
||||
}
|
||||
|
||||
public DomainEndpointOptions getDomainEndpointOptions() {
|
||||
return domainEndpointOptions;
|
||||
}
|
||||
|
||||
public void setDomainEndpointOptions(DomainEndpointOptions domainEndpointOptions) {
|
||||
this.domainEndpointOptions = domainEndpointOptions;
|
||||
}
|
||||
|
||||
public String getEndpoint() {
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package io.github.hectorvent.floci.services.opensearch.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
/**
|
||||
* HTTPS / TLS-policy endpoint options. Round-tripped only — Floci serves the
|
||||
* domain over plain HTTP regardless of {@code EnforceHTTPS}. SDK clients still
|
||||
* need the field to round-trip so {@code DescribeDomain} confirms the
|
||||
* intended configuration.
|
||||
*/
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DomainEndpointOptions {
|
||||
|
||||
@JsonProperty("EnforceHTTPS")
|
||||
private boolean enforceHttps = false;
|
||||
|
||||
@JsonProperty("TLSSecurityPolicy")
|
||||
private String tlsSecurityPolicy = "Policy-Min-TLS-1-0-2019-07";
|
||||
|
||||
@JsonProperty("CustomEndpointEnabled")
|
||||
private boolean customEndpointEnabled = false;
|
||||
|
||||
@JsonProperty("CustomEndpoint")
|
||||
private String customEndpoint;
|
||||
|
||||
@JsonProperty("CustomEndpointCertificateArn")
|
||||
private String customEndpointCertificateArn;
|
||||
|
||||
public DomainEndpointOptions() {}
|
||||
|
||||
public boolean isEnforceHttps() {
|
||||
return enforceHttps;
|
||||
}
|
||||
|
||||
public void setEnforceHttps(boolean enforceHttps) {
|
||||
this.enforceHttps = enforceHttps;
|
||||
}
|
||||
|
||||
public String getTlsSecurityPolicy() {
|
||||
return tlsSecurityPolicy;
|
||||
}
|
||||
|
||||
public void setTlsSecurityPolicy(String tlsSecurityPolicy) {
|
||||
this.tlsSecurityPolicy = tlsSecurityPolicy;
|
||||
}
|
||||
|
||||
public boolean isCustomEndpointEnabled() {
|
||||
return customEndpointEnabled;
|
||||
}
|
||||
|
||||
public void setCustomEndpointEnabled(boolean customEndpointEnabled) {
|
||||
this.customEndpointEnabled = customEndpointEnabled;
|
||||
}
|
||||
|
||||
public String getCustomEndpoint() {
|
||||
return customEndpoint;
|
||||
}
|
||||
|
||||
public void setCustomEndpoint(String customEndpoint) {
|
||||
this.customEndpoint = customEndpoint;
|
||||
}
|
||||
|
||||
public String getCustomEndpointCertificateArn() {
|
||||
return customEndpointCertificateArn;
|
||||
}
|
||||
|
||||
public void setCustomEndpointCertificateArn(String customEndpointCertificateArn) {
|
||||
this.customEndpointCertificateArn = customEndpointCertificateArn;
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package io.github.hectorvent.floci.services.opensearch.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
/**
|
||||
* Encryption-at-rest options. Round-tripped only — the underlying Docker
|
||||
* volume is not actually encrypted. Real AWS would back the domain by an
|
||||
* encrypted EBS volume and refuse to disable encryption once turned on; we
|
||||
* accept whatever was last set so SDK clients can confirm their config.
|
||||
*/
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class EncryptionAtRestOptions {
|
||||
|
||||
@JsonProperty("Enabled")
|
||||
private boolean enabled = false;
|
||||
|
||||
@JsonProperty("KmsKeyId")
|
||||
private String kmsKeyId;
|
||||
|
||||
public EncryptionAtRestOptions() {}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getKmsKeyId() {
|
||||
return kmsKeyId;
|
||||
}
|
||||
|
||||
public void setKmsKeyId(String kmsKeyId) {
|
||||
this.kmsKeyId = kmsKeyId;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package io.github.hectorvent.floci.services.opensearch.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
/**
|
||||
* Node-to-node TLS encryption flag. Round-tripped only — Floci runs the
|
||||
* domain as a single Docker container, so there are no node-to-node
|
||||
* connections to encrypt.
|
||||
*/
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class NodeToNodeEncryptionOptions {
|
||||
|
||||
@JsonProperty("Enabled")
|
||||
private boolean enabled = false;
|
||||
|
||||
public NodeToNodeEncryptionOptions() {}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package io.github.hectorvent.floci.services.opensearch.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* VPC placement options for an OpenSearch domain. Stored verbatim from the
|
||||
* {@code CreateDomain} / {@code UpdateDomainConfig} request and round-tripped on
|
||||
* {@code DescribeDomain} / {@code DescribeDomainConfig}. Floci does not actually
|
||||
* place containers inside the requested VPC — the domain still runs as a
|
||||
* single Docker container — but real SDK clients (Terraform, CDK, Pulumi) read
|
||||
* these fields back to confirm config and fail when they're empty.
|
||||
*/
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class VpcOptions {
|
||||
|
||||
@JsonProperty("SubnetIds")
|
||||
private List<String> subnetIds = new ArrayList<>();
|
||||
|
||||
@JsonProperty("SecurityGroupIds")
|
||||
private List<String> securityGroupIds = new ArrayList<>();
|
||||
|
||||
@JsonProperty("AvailabilityZones")
|
||||
private List<String> availabilityZones = new ArrayList<>();
|
||||
|
||||
@JsonProperty("VPCId")
|
||||
private String vpcId;
|
||||
|
||||
public VpcOptions() {}
|
||||
|
||||
public List<String> getSubnetIds() {
|
||||
return subnetIds;
|
||||
}
|
||||
|
||||
public void setSubnetIds(List<String> subnetIds) {
|
||||
this.subnetIds = subnetIds != null ? new ArrayList<>(subnetIds) : new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<String> getSecurityGroupIds() {
|
||||
return securityGroupIds;
|
||||
}
|
||||
|
||||
public void setSecurityGroupIds(List<String> securityGroupIds) {
|
||||
this.securityGroupIds = securityGroupIds != null ? new ArrayList<>(securityGroupIds) : new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<String> getAvailabilityZones() {
|
||||
return availabilityZones;
|
||||
}
|
||||
|
||||
public void setAvailabilityZones(List<String> availabilityZones) {
|
||||
this.availabilityZones = availabilityZones != null ? new ArrayList<>(availabilityZones) : new ArrayList<>();
|
||||
}
|
||||
|
||||
public String getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
public void setVpcId(String vpcId) {
|
||||
this.vpcId = vpcId;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user