diff --git a/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java b/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java
index 2eaf3c5c95..e6e84d26c2 100644
--- a/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java
+++ b/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java
@@ -239,6 +239,7 @@ public interface EmulatorConfig {
ResourceGroupsTaggingServiceConfig tagging();
BedrockRuntimeServiceConfig bedrockRuntime();
EksServiceConfig eks();
+ PipesServiceConfig pipes();
}
interface SsmServiceConfig {
@@ -600,6 +601,11 @@ public interface EmulatorConfig {
boolean enabled();
}
+ interface PipesServiceConfig {
+ @WithDefault("true")
+ boolean enabled();
+ }
+
interface EksServiceConfig {
@WithDefault("true")
boolean enabled();
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java b/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java
index 7b41c3e444..56a7425de8 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.services.bedrockruntime.BedrockRuntimeControll
import io.github.hectorvent.floci.services.cognito.CognitoOAuthController;
import io.github.hectorvent.floci.services.cognito.CognitoWellKnownController;
import io.github.hectorvent.floci.services.eks.EksController;
+import io.github.hectorvent.floci.services.pipes.PipesController;
import io.github.hectorvent.floci.services.lambda.LambdaController;
import io.github.hectorvent.floci.services.opensearch.OpenSearchController;
import io.github.hectorvent.floci.services.ses.SesController;
@@ -198,7 +199,11 @@ public class ResolvedServiceCatalog {
descriptor("eks", "eks", config.services().eks().enabled(), true,
"eks", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
- Set.of(), Set.of("eks"), Set.of(), Set.of(EksController.class))
+ Set.of(), Set.of("eks"), Set.of(), Set.of(EksController.class)),
+ descriptor("pipes", "pipes", config.services().pipes().enabled(), true,
+ "pipes", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON,
+ protocols(ServiceProtocol.REST_JSON),
+ Set.of(), Set.of("pipes"), Set.of(), Set.of(PipesController.class))
));
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/pipes/PipesController.java b/src/main/java/io/github/hectorvent/floci/services/pipes/PipesController.java
new file mode 100644
index 0000000000..53c2b6e2d3
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/services/pipes/PipesController.java
@@ -0,0 +1,268 @@
+package io.github.hectorvent.floci.services.pipes;
+
+import io.github.hectorvent.floci.core.common.AwsException;
+import io.github.hectorvent.floci.core.common.AwsErrorResponse;
+import io.github.hectorvent.floci.core.common.RegionResolver;
+import io.github.hectorvent.floci.services.pipes.model.DesiredState;
+import io.github.hectorvent.floci.services.pipes.model.Pipe;
+import io.github.hectorvent.floci.services.pipes.model.PipeState;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.*;
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.HttpHeaders;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import org.jboss.logging.Logger;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * EventBridge Pipes REST-JSON controller.
+ *
+ *
Pipes uses standard HTTP verbs with JSON bodies — not JSON 1.1 (X-Amz-Target) or Query protocol.
+ */
+@Path("/")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public class PipesController {
+
+ private static final Logger LOG = Logger.getLogger(PipesController.class);
+
+ private final PipesService pipesService;
+ private final RegionResolver regionResolver;
+ private final ObjectMapper objectMapper;
+
+ @Inject
+ public PipesController(PipesService pipesService, RegionResolver regionResolver, ObjectMapper objectMapper) {
+ this.pipesService = pipesService;
+ this.regionResolver = regionResolver;
+ this.objectMapper = objectMapper;
+ }
+
+ @POST
+ @Path("/v1/pipes/{name}")
+ public Response createPipe(@PathParam("name") String name,
+ @Context HttpHeaders headers,
+ String body) {
+ String region = regionResolver.resolveRegion(headers);
+ try {
+ JsonNode request = objectMapper.readTree(body);
+ String source = textOrNull(request, "Source");
+ String target = textOrNull(request, "Target");
+ String roleArn = textOrNull(request, "RoleArn");
+ String description = textOrNull(request, "Description");
+ String enrichment = textOrNull(request, "Enrichment");
+ DesiredState desiredState = parseDesiredState(textOrNull(request, "DesiredState"));
+ JsonNode sourceParameters = request.path("SourceParameters").isMissingNode() ? null : request.get("SourceParameters");
+ JsonNode targetParameters = request.path("TargetParameters").isMissingNode() ? null : request.get("TargetParameters");
+ JsonNode enrichmentParameters = request.path("EnrichmentParameters").isMissingNode() ? null : request.get("EnrichmentParameters");
+ Map tags = parseTags(request.get("Tags"));
+
+ Pipe pipe = pipesService.createPipe(name, source, target, roleArn, description,
+ desiredState, enrichment, sourceParameters, targetParameters,
+ enrichmentParameters, tags, region);
+
+ return Response.ok(buildPipeResponse(pipe)).build();
+ } catch (AwsException e) {
+ return Response.status(e.getHttpStatus())
+ .entity(new AwsErrorResponse(e.getErrorCode(), e.getMessage()))
+ .build();
+ } catch (Exception e) {
+ LOG.errorv("Error creating pipe: {0}", e.getMessage());
+ return Response.status(500)
+ .entity(new AwsErrorResponse("InternalException", e.getMessage()))
+ .build();
+ }
+ }
+
+ @GET
+ @Path("/v1/pipes/{name}")
+ public Response describePipe(@PathParam("name") String name,
+ @Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ try {
+ Pipe pipe = pipesService.describePipe(name, region);
+ return Response.ok(pipe).build();
+ } catch (AwsException e) {
+ return Response.status(e.getHttpStatus())
+ .entity(new AwsErrorResponse(e.getErrorCode(), e.getMessage()))
+ .build();
+ }
+ }
+
+ @PUT
+ @Path("/v1/pipes/{name}")
+ public Response updatePipe(@PathParam("name") String name,
+ @Context HttpHeaders headers,
+ String body) {
+ String region = regionResolver.resolveRegion(headers);
+ try {
+ JsonNode request = objectMapper.readTree(body);
+ String target = textOrNull(request, "Target");
+ String roleArn = textOrNull(request, "RoleArn");
+ String description = textOrNull(request, "Description");
+ String enrichment = textOrNull(request, "Enrichment");
+ DesiredState desiredState = parseDesiredState(textOrNull(request, "DesiredState"));
+ JsonNode sourceParameters = request.path("SourceParameters").isMissingNode() ? null : request.get("SourceParameters");
+ JsonNode targetParameters = request.path("TargetParameters").isMissingNode() ? null : request.get("TargetParameters");
+ JsonNode enrichmentParameters = request.path("EnrichmentParameters").isMissingNode() ? null : request.get("EnrichmentParameters");
+
+ Pipe pipe = pipesService.updatePipe(name, target, roleArn, description,
+ desiredState, enrichment, sourceParameters, targetParameters,
+ enrichmentParameters, region);
+
+ return Response.ok(buildPipeResponse(pipe)).build();
+ } catch (AwsException e) {
+ return Response.status(e.getHttpStatus())
+ .entity(new AwsErrorResponse(e.getErrorCode(), e.getMessage()))
+ .build();
+ } catch (Exception e) {
+ LOG.errorv("Error updating pipe: {0}", e.getMessage());
+ return Response.status(500)
+ .entity(new AwsErrorResponse("InternalException", e.getMessage()))
+ .build();
+ }
+ }
+
+ @DELETE
+ @Path("/v1/pipes/{name}")
+ public Response deletePipe(@PathParam("name") String name,
+ @Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ try {
+ pipesService.deletePipe(name, region);
+ return Response.ok(objectMapper.createObjectNode()).build();
+ } catch (AwsException e) {
+ return Response.status(e.getHttpStatus())
+ .entity(new AwsErrorResponse(e.getErrorCode(), e.getMessage()))
+ .build();
+ }
+ }
+
+ @GET
+ @Path("/v1/pipes")
+ public Response listPipes(@QueryParam("NamePrefix") String namePrefix,
+ @QueryParam("SourcePrefix") String sourcePrefix,
+ @QueryParam("TargetPrefix") String targetPrefix,
+ @QueryParam("DesiredState") String desiredStateStr,
+ @QueryParam("CurrentState") String currentStateStr,
+ @Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ try {
+ DesiredState desiredState = parseDesiredState(desiredStateStr);
+ PipeState currentState = parsePipeState(currentStateStr);
+ List pipes = pipesService.listPipes(namePrefix, sourcePrefix, targetPrefix,
+ desiredState, currentState, region);
+
+ ObjectNode response = objectMapper.createObjectNode();
+ var pipesArray = response.putArray("Pipes");
+ for (Pipe pipe : pipes) {
+ pipesArray.add(buildPipeListEntry(pipe));
+ }
+ return Response.ok(response).build();
+ } catch (AwsException e) {
+ return Response.status(e.getHttpStatus())
+ .entity(new AwsErrorResponse(e.getErrorCode(), e.getMessage()))
+ .build();
+ }
+ }
+
+ @POST
+ @Path("/v1/pipes/{name}/start")
+ public Response startPipe(@PathParam("name") String name,
+ @Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ try {
+ Pipe pipe = pipesService.startPipe(name, region);
+ return Response.ok(buildPipeResponse(pipe)).build();
+ } catch (AwsException e) {
+ return Response.status(e.getHttpStatus())
+ .entity(new AwsErrorResponse(e.getErrorCode(), e.getMessage()))
+ .build();
+ }
+ }
+
+ @POST
+ @Path("/v1/pipes/{name}/stop")
+ public Response stopPipe(@PathParam("name") String name,
+ @Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ try {
+ Pipe pipe = pipesService.stopPipe(name, region);
+ return Response.ok(buildPipeResponse(pipe)).build();
+ } catch (AwsException e) {
+ return Response.status(e.getHttpStatus())
+ .entity(new AwsErrorResponse(e.getErrorCode(), e.getMessage()))
+ .build();
+ }
+ }
+
+ // ──────────────────────────── Helpers ────────────────────────────
+
+ private ObjectNode buildPipeResponse(Pipe pipe) {
+ ObjectNode node = objectMapper.createObjectNode();
+ node.put("Arn", pipe.getArn());
+ node.put("Name", pipe.getName());
+ node.put("Source", pipe.getSource());
+ node.put("Target", pipe.getTarget());
+ node.put("RoleArn", pipe.getRoleArn());
+ node.put("DesiredState", pipe.getDesiredState().name());
+ node.put("CurrentState", pipe.getCurrentState().name());
+ if (pipe.getDescription() != null) node.put("Description", pipe.getDescription());
+ if (pipe.getEnrichment() != null) node.put("Enrichment", pipe.getEnrichment());
+ if (pipe.getCreationTime() != null) node.put("CreationTime", pipe.getCreationTime().getEpochSecond());
+ if (pipe.getLastModifiedTime() != null) node.put("LastModifiedTime", pipe.getLastModifiedTime().getEpochSecond());
+ if (pipe.getStateReason() != null) node.put("StateReason", pipe.getStateReason());
+ return node;
+ }
+
+ private ObjectNode buildPipeListEntry(Pipe pipe) {
+ ObjectNode node = objectMapper.createObjectNode();
+ node.put("Arn", pipe.getArn());
+ node.put("Name", pipe.getName());
+ node.put("Source", pipe.getSource());
+ node.put("Target", pipe.getTarget());
+ node.put("DesiredState", pipe.getDesiredState().name());
+ node.put("CurrentState", pipe.getCurrentState().name());
+ if (pipe.getCreationTime() != null) node.put("CreationTime", pipe.getCreationTime().getEpochSecond());
+ if (pipe.getLastModifiedTime() != null) node.put("LastModifiedTime", pipe.getLastModifiedTime().getEpochSecond());
+ return node;
+ }
+
+ private String textOrNull(JsonNode node, String field) {
+ JsonNode value = node.get(field);
+ if (value == null || value.isNull() || value.isMissingNode()) return null;
+ return value.asText();
+ }
+
+ private DesiredState parseDesiredState(String state) {
+ if (state == null || state.isBlank()) return null;
+ try {
+ return DesiredState.valueOf(state.toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
+
+ private PipeState parsePipeState(String state) {
+ if (state == null || state.isBlank()) return null;
+ try {
+ return PipeState.valueOf(state.toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
+
+ private Map parseTags(JsonNode tagsNode) {
+ Map tags = new HashMap<>();
+ if (tagsNode != null && tagsNode.isObject()) {
+ tagsNode.fields().forEachRemaining(e -> tags.put(e.getKey(), e.getValue().asText()));
+ }
+ return tags;
+ }
+}
diff --git a/src/main/java/io/github/hectorvent/floci/services/pipes/PipesService.java b/src/main/java/io/github/hectorvent/floci/services/pipes/PipesService.java
new file mode 100644
index 0000000000..4c803aeae4
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/services/pipes/PipesService.java
@@ -0,0 +1,213 @@
+package io.github.hectorvent.floci.services.pipes;
+
+import io.github.hectorvent.floci.config.EmulatorConfig;
+import io.github.hectorvent.floci.core.common.AwsException;
+import io.github.hectorvent.floci.core.common.TagHandler;
+import io.github.hectorvent.floci.core.storage.StorageBackend;
+import io.github.hectorvent.floci.core.storage.StorageFactory;
+import io.github.hectorvent.floci.services.pipes.model.DesiredState;
+import io.github.hectorvent.floci.services.pipes.model.Pipe;
+import io.github.hectorvent.floci.services.pipes.model.PipeState;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import org.jboss.logging.Logger;
+
+import java.time.Instant;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@ApplicationScoped
+public class PipesService implements TagHandler {
+
+ private static final Logger LOG = Logger.getLogger(PipesService.class);
+
+ private final StorageBackend storage;
+ private final EmulatorConfig config;
+
+ @Inject
+ public PipesService(StorageFactory storageFactory, EmulatorConfig config) {
+ this.storage = storageFactory.create("pipes", "pipes.json",
+ new TypeReference