Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

feat(appintegrations): add data and event integrations (#3379)

lex00137a39add3db
diff --git a/README.md b/README.md
index 4f9f8f09d1..82f3d78e3c 100644
--- a/README.md
+++ b/README.md
@@ -237,7 +237,7 @@ Floci supports local emulation for application services, data services, eventing
| Containers and compute | ECS, EC2, Lightsail, EKS, MWAA, ECR, EFS, CodeBuild, CodeDeploy, CodePipeline, CodeGuru Reviewer, AWS Batch, Auto Scaling, Application Auto Scaling, Elastic Beanstalk, ELB v2, ELB Classic |
| Data, analytics, and AI | Athena, Glue, Lake Formation, EMR, EMR Serverless, Redshift, Redshift Data API, Firehose, Managed Service for Apache Flink, OpenSearch, S3 Tables, S3 Vectors, Textract, Transcribe, Comprehend, Rekognition, Translate, Bedrock Runtime, Bedrock AgentCore |
| Databases and caching | RDS, RDS Data API, Neptune, DocumentDB, MemoryDB, ElastiCache |
-| Messaging and transfer | SES, Kinesis, MSK, Amazon MQ, Transfer Family, IoT Core, Amazon Connect |
+| Messaging and transfer | SES, Kinesis, MSK, Amazon MQ, Transfer Family, IoT Core, Amazon Connect, Amazon AppIntegrations |
| Security and governance | AWS Network Firewall, AWS RAM, Service Quotas, WAF v2, GuardDuty, Amazon Inspector, CloudTrail, CloudFront, Resource Groups Tagging API, Resource Explorer 2, CloudHSM v2, Organizations, AWS Account Management, IAM Access Analyzer, IAM Identity Center (SSO Admin, OIDC, Access Portal, SCIM), Identity Store, Amazon Macie, Amazon Detective, Security Hub, Amazon Verified Permissions, Control Catalog, Control Tower, Service Catalog, AWS Marketplace |
| Cost and billing | AWS Budgets, Pricing, Cost Explorer, Cost and Usage Reports, BCM Data Exports |
| Resilience, backup, and config | AWS FIS, AWS Backup, AWS Config, AppConfig, AppConfigData, CloudFormation, Cloud Control API |
diff --git a/compatibility-tests/sdk-test-java/pom.xml b/compatibility-tests/sdk-test-java/pom.xml
index 4c8a697c86..d1329c8fae 100644
--- a/compatibility-tests/sdk-test-java/pom.xml
+++ b/compatibility-tests/sdk-test-java/pom.xml
@@ -545,6 +545,11 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>appconfigdata</artifactId>
</dependency>
+ <!-- Amazon AppIntegrations client -->
+ <dependency>
+ <groupId>software.amazon.awssdk</groupId>
+ <artifactId>appintegrations</artifactId>
+ </dependency>
<!-- JDBC drivers for RDS data-plane tests -->
<dependency>
<groupId>org.postgresql</groupId>
diff --git a/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java b/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java
index fb8af4115b..738c1f66e7 100644
--- a/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java
+++ b/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java
@@ -103,6 +103,7 @@ import software.amazon.awssdk.services.iotjobsdataplane.IotJobsDataPlaneClient;
import software.amazon.awssdk.services.scheduler.SchedulerClient;
import software.amazon.awssdk.services.appconfig.AppConfigClient;
import software.amazon.awssdk.services.appconfigdata.AppConfigDataClient;
+import software.amazon.awssdk.services.appintegrations.AppIntegrationsClient;
import software.amazon.awssdk.services.autoscaling.AutoScalingClient;
import software.amazon.awssdk.services.backup.BackupClient;
import software.amazon.awssdk.services.elasticloadbalancingv2.ElasticLoadBalancingV2Client;
@@ -1168,6 +1169,14 @@ public final class TestFixtures {
.build();
}
+ public static AppIntegrationsClient appIntegrationsClient() {
+ return AppIntegrationsClient.builder()
+ .endpointOverride(ENDPOINT)
+ .region(REGION)
+ .credentialsProvider(CREDENTIALS)
+ .build();
+ }
+
public static PipesClient pipesClient() {
return PipesClient.builder()
.endpointOverride(ENDPOINT)
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppIntegrationsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppIntegrationsTest.java
new file mode 100644
index 0000000000..8949f926f3
--- /dev/null
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppIntegrationsTest.java
@@ -0,0 +1,235 @@
+package com.floci.test;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+import software.amazon.awssdk.services.appintegrations.AppIntegrationsClient;
+import software.amazon.awssdk.services.appintegrations.model.CreateDataIntegrationResponse;
+import software.amazon.awssdk.services.appintegrations.model.CreateEventIntegrationResponse;
+import software.amazon.awssdk.services.appintegrations.model.GetDataIntegrationResponse;
+import software.amazon.awssdk.services.appintegrations.model.GetEventIntegrationResponse;
+import software.amazon.awssdk.services.appintegrations.model.ListDataIntegrationsResponse;
+import software.amazon.awssdk.services.appintegrations.model.ListEventIntegrationAssociationsResponse;
+import software.amazon.awssdk.services.appintegrations.model.ListEventIntegrationsResponse;
+import software.amazon.awssdk.services.appintegrations.model.ResourceNotFoundException;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+@DisplayName("Amazon AppIntegrations")
+@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
+class AppIntegrationsTest {
+
+ private static AppIntegrationsClient appIntegrations;
+ private static String eventIntegrationName;
+ private static String eventIntegrationArn;
+ private static String dataIntegrationName;
+ private static String dataIntegrationId;
+ private static String dataIntegrationArn;
+
+ @BeforeAll
+ static void setup() {
+ appIntegrations = TestFixtures.appIntegrationsClient();
+ long stamp = System.currentTimeMillis();
+ eventIntegrationName = "sdk-test-event-integration-" + stamp;
+ dataIntegrationName = "sdk-test-data-integration-" + stamp;
+ }
+
+ @AfterAll
+ static void cleanup() {
+ if (appIntegrations == null) {
+ return;
+ }
+ if (eventIntegrationArn != null) {
+ try {
+ appIntegrations.deleteEventIntegration(r -> r.name(eventIntegrationName));
+ } catch (RuntimeException e) {
+ System.out.println("AppIntegrations cleanup skipped the event integration: " + e);
+ }
+ }
+ if (dataIntegrationId != null) {
+ try {
+ appIntegrations.deleteDataIntegration(r -> r.dataIntegrationIdentifier(dataIntegrationId));
+ } catch (RuntimeException e) {
+ System.out.println("AppIntegrations cleanup skipped the data integration: " + e);
+ }
+ }
+ appIntegrations.close();
+ }
+
+ @Test
+ @Order(1)
+ void createEventIntegration() {
+ CreateEventIntegrationResponse response = appIntegrations.createEventIntegration(r -> r
+ .name(eventIntegrationName)
+ .description("partner events")
+ .eventBridgeBus("sdk-test-bus")
+ .eventFilter(f -> f.source("aws.partner/example.com/1234"))
+ .tags(Map.of("team", "data")));
+
+ eventIntegrationArn = response.eventIntegrationArn();
+
+ assertThat(eventIntegrationArn)
+ .contains(":app-integrations:")
+ .contains(":event-integration/" + eventIntegrationName);
+ }
+
+ @Test
+ @Order(2)
+ void getEventIntegration() {
+ GetEventIntegrationResponse response = appIntegrations.getEventIntegration(r -> r
+ .name(eventIntegrationName));
+
+ assertThat(response.name()).isEqualTo(eventIntegrationName);
+ assertThat(response.description()).isEqualTo("partner events");
+ assertThat(response.eventIntegrationArn()).isEqualTo(eventIntegrationArn);
+ assertThat(response.eventBridgeBus()).isEqualTo("sdk-test-bus");
+ assertThat(response.eventFilter().source()).isEqualTo("aws.partner/example.com/1234");
+ assertThat(response.tags()).containsEntry("team", "data");
+ }
+
+ @Test
+ @Order(3)
+ void listEventIntegrations() {
+ ListEventIntegrationsResponse response = appIntegrations.listEventIntegrations(r -> { });
+
+ assertThat(response.eventIntegrations()).anySatisfy(integration -> {
+ assertThat(integration.name()).isEqualTo(eventIntegrationName);
+ assertThat(integration.eventIntegrationArn()).isEqualTo(eventIntegrationArn);
+ assertThat(integration.eventBridgeBus()).isEqualTo("sdk-test-bus");
+ });
+ }
+
+ @Test
+ @Order(4)
+ void updateEventIntegrationDescription() {
+ appIntegrations.updateEventIntegration(r -> r
+ .name(eventIntegrationName)
+ .description("partner events, revised"));
+
+ assertThat(appIntegrations.getEventIntegration(r -> r.name(eventIntegrationName)).description())
+ .isEqualTo("partner events, revised");
+ }
+
+ /**
+ * Associations are written by the consuming service, so a fresh integration reports none.
+ * The call still has to deserialize, which is what pins the wire member name.
+ */
+ @Test
+ @Order(5)
+ void listEventIntegrationAssociationsIsEmpty() {
+ ListEventIntegrationAssociationsResponse response = appIntegrations
+ .listEventIntegrationAssociations(r -> r.eventIntegrationName(eventIntegrationName));
+
+ assertThat(response.eventIntegrationAssociations()).isEmpty();
+ }
+
+ @Test
+ @Order(6)
+ void createDataIntegration() {
+ CreateDataIntegrationResponse response = appIntegrations.createDataIntegration(r -> r
+ .name(dataIntegrationName)
+ .description("salesforce pull")
+ .kmsKey("arn:aws:kms:us-east-1:000000000000:key/abc")
+ .sourceURI("Salesforce://AppFlow/test")
+ .scheduleConfig(s -> s
+ .scheduleExpression("rate(1 hour)")
+ .firstExecutionFrom("1439788800000")
+ .object("Account"))
+ .fileConfiguration(f -> f.folders(List.of("/home/data")))
+ .tags(Map.of("team", "data")));
+
+ dataIntegrationId = response.id();
+ dataIntegrationArn = response.arn();
+
+ assertThat(dataIntegrationId).isNotBlank();
+ assertThat(dataIntegrationArn)
+ .contains(":app-integrations:")
+ .contains(":data-integration/" + dataIntegrationId);
+ assertThat(response.name()).isEqualTo(dataIntegrationName);
+ assertThat(response.kmsKey()).isEqualTo("arn:aws:kms:us-east-1:000000000000:key/abc");
+ assertThat(response.sourceURI()).isEqualTo("Salesforce://AppFlow/test");
+ assertThat(response.scheduleConfiguration().scheduleExpression()).isEqualTo("rate(1 hour)");
+ assertThat(response.fileConfiguration().folders()).containsExactly("/home/data");
+ assertThat(response.tags()).containsEntry("team", "data");
+ }
+
+ @Test
+ @Order(7)
+ void getDataIntegrationByIdAndByArn() {
+ GetDataIntegrationResponse byId = appIntegrations.getDataIntegration(r -> r
+ .identifier(dataIntegrationId));
+
+ assertThat(byId.id()).isEqualTo(dataIntegrationId);
+ assertThat(byId.arn()).isEqualTo(dataIntegrationArn);
+ assertThat(byId.description()).isEqualTo("salesforce pull");
+ assertThat(byId.scheduleConfiguration().firstExecutionFrom()).isEqualTo("1439788800000");
+ assertThat(byId.scheduleConfiguration().object()).isEqualTo("Account");
+
+ assertThat(appIntegrations.getDataIntegration(r -> r.identifier(dataIntegrationArn)).id())
+ .isEqualTo(dataIntegrationId);
+ }
+
+ @Test
+ @Order(8)
+ void listDataIntegrations() {
+ ListDataIntegrationsResponse response = appIntegrations.listDataIntegrations(r -> { });
+
+ assertThat(response.dataIntegrations()).anySatisfy(summary -> {
+ assertThat(summary.name()).isEqualTo(dataIntegrationName);
+ assertThat(summary.arn()).isEqualTo(dataIntegrationArn);
+ assertThat(summary.sourceURI()).isEqualTo("Salesforce://AppFlow/test");
+ });
+ }
+
+ @Test
+ @Order(9)
+ void updateDataIntegrationDescription() {
+ appIntegrations.updateDataIntegration(r -> r
+ .identifier(dataIntegrationId)
+ .description("salesforce pull, revised"));
+
+ assertThat(appIntegrations.getDataIntegration(r -> r.identifier(dataIntegrationId)).description())
+ .isEqualTo("salesforce pull, revised");
+ }
+
+ @Test
+ @Order(10)
+ void tagRoundTripOnBothIntegrationTypes() {
+ for (String arn : List.of(eventIntegrationArn, dataIntegrationArn)) {
+ appIntegrations.tagResource(r -> r.resourceArn(arn).tags(Map.of("env", "test")));
+
+ assertThat(appIntegrations.listTagsForResource(r -> r.resourceArn(arn)).tags())
+ .containsEntry("team", "data")
+ .containsEntry("env", "test");
+
+ appIntegrations.untagResource(r -> r.resourceArn(arn).tagKeys("env"));
+
+ assertThat(appIntegrations.listTagsForResource(r -> r.resourceArn(arn)).tags())
+ .containsEntry("team", "data")
+ .doesNotContainKey("env");
+ }
+ }
+
+ @Test
+ @Order(11)
+ void deleteBothIntegrationsThenGetThrowsResourceNotFound() {
+ appIntegrations.deleteEventIntegration(r -> r.name(eventIntegrationName));
+ appIntegrations.deleteDataIntegration(r -> r.dataIntegrationIdentifier(dataIntegrationId));
+
+ assertThatThrownBy(() -> appIntegrations.getEventIntegration(r -> r.name(eventIntegrationName)))
+ .isInstanceOf(ResourceNotFoundException.class);
+ assertThatThrownBy(() -> appIntegrations.getDataIntegration(r -> r.identifier(dataIntegrationId)))
+ .isInstanceOf(ResourceNotFoundException.class);
+
+ eventIntegrationArn = null;
+ dataIntegrationId = null;
+ }
+}
diff --git a/docs/services/appintegrations.md b/docs/services/appintegrations.md
new file mode 100644
index 0000000000..82e0b1dda7
--- /dev/null
+++ b/docs/services/appintegrations.md
@@ -0,0 +1,85 @@
+# Amazon AppIntegrations
+
+**Protocol:** REST-JSON
+**Endpoint:** `http://localhost:4566/eventIntegrations`, `/dataIntegrations`
+(SigV4 service `app-integrations`)
+
+## Supported Actions
+
+<!-- floci:actions:start -->
+| Action | Description |
+| --- | --- |
+| `CreateEventIntegration` | Create an event integration; returns its ARN |
+| `GetEventIntegration` | Get an event integration by name, including tags |
+| `UpdateEventIntegration` | Change an event integration's description |
+| `DeleteEventIntegration` | Delete an event integration |
+| `ListEventIntegrations` | List event integrations |
+| `ListEventIntegrationAssociations` | List an event integration's client associations |
+| `CreateDataIntegration` | Create a data integration; returns the full resource |
+| `GetDataIntegration` | Get a data integration by id or ARN |
+| `UpdateDataIntegration` | Change a data integration's name or description |
+| `DeleteDataIntegration` | Delete a data integration |
+| `ListDataIntegrations` | List data integration summaries |
+| `ListTagsForResource` | List tags on either integration type (`GET /tags/{resourceArn}`) |
+| `TagResource` | Tag either integration type (`POST /tags/{resourceArn}`) |
+| `UntagResource` | Remove tags (`DELETE /tags/{resourceArn}?tagKeys=`) |
+<!-- floci:actions:end -->
+
+Event integrations are addressed by name and get the ARN
+`arn:aws:app-integrations:<region>:<account>:event-integration/<name>`. Data
+integrations get a generated id and the ARN
+`arn:aws:app-integrations:<region>:<account>:data-integration/<id>`. `GetDataIntegration`,
+`UpdateDataIntegration` and `DeleteDataIntegration` accept either the id or that ARN.
+
+`EventBridgeBus`, `EventFilter.Source`, `Description` and `Tags` round-trip through
+`GetEventIntegration`, which is what `aws_appintegrations_event_integration` reads.
+Note that `CreateDataIntegration` takes the schedule under `ScheduleConfig` and reads
+it back as `ScheduleConfiguration`, matching the AWS model.
+
+`UpdateEventIntegration` and `UpdateDataIntegration` change only the members present in
+the request body. An omitted `Description` or `Name` keeps its stored value.
+
+`ListEventIntegrationAssociations` returns an empty list for an existing integration
+and `ResourceNotFoundException` for a missing one. Associations are created by the
+consuming service (Amazon Connect and friends) when it binds a client to the
+integration. Floci has no path that creates one, so an empty list is the true state
+rather than a placeholder.
+
+## Not implemented
+
+These return a clean `UnknownOperationException` rather than a stub success:
+
+- `CreateDataIntegrationAssociation`, `UpdateDataIntegrationAssociation` and
+ `ListDataIntegrationAssociations`. An association binds a data integration to a live
+ client execution, which the emulator has no way to model.
+- `CreateApplication`, `GetApplication`, `UpdateApplication`, `DeleteApplication`,
+ `ListApplications` and `ListApplicationAssociations`. The third-party application
+ surface is not yet modelled.
+
+## Configuration
+
+| Variable | Default | Description |
+|---|---|---|
+| `FLOCI_SERVICES_APPINTEGRATIONS_ENABLED` | `true` | Enable or disable the service |
+
+## Examples
+
+```bash
+export AWS_ENDPOINT_URL=http://localhost:4566
+
+aws appintegrations create-event-integration \
+ --name my-integration \
+ --event-bridge-bus my-bus \
+ --event-filter Source=aws.partner/example.com/1234
+
+aws appintegrations get-event-integration --name my-integration
+
+aws appintegrations create-data-integration \
+ --name my-data-integration \
+ --kms-key arn:aws:kms:us-east-1:000000000000:key/abc \
+ --source-uri "Salesforce://AppFlow/test"
+
+aws appintegrations list-data-integrations
+
+aws appintegrations delete-event-integration --name my-integration
+```
diff --git a/docs/services/index.md b/docs/services/index.md
index e84125c31c..62ed2aaa09 100644
--- a/docs/services/index.md
+++ b/docs/services/index.md
@@ -57,6 +57,7 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac
| [Security Hub](securityhub.md) | `/organization/*`, `/accounts`, `/findingAggregator/*`, `/configurationPolicy*`, `/tags/*` | REST JSON | 22 |
| [Amazon Detective](detective.md) | `/orgs/*`, `/graphs/list`, `/graph/*` | REST JSON | 8 |
| [Amazon Connect](connect.md) | `/instance`, `/instance/{instanceId}/*`, `/tags/*` | REST JSON | 15 |
+| [Amazon AppIntegrations](appintegrations.md) | `/eventIntegrations/*`, `/dataIntegrations/*`, `/tags/*` | REST JSON | 14 |
| [ElastiCache](elasticache.md) | `POST /` with `Action=` param + TCP proxy | Query + RESP | 8 |
| [MemoryDB](memorydb.md) | `POST /` + `X-Amz-Target: AmazonMemoryDB.*` + TCP proxy | JSON 1.1 + RESP | 7 |
| [RDS](rds.md) | `POST /` with `Action=` param + TCP proxy | Query + wire | 14 |
diff --git a/mkdocs.yml b/mkdocs.yml
index 18ae4bb89a..336bd312ef 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -158,6 +158,7 @@ nav:
- Managed Prometheus (AMP): services/managed-prometheus.md
- GuardDuty: services/guardduty.md
- Connect: services/connect.md
+ - AppIntegrations: services/appintegrations.md
- ACM: services/acm.md
- ECS: services/ecs.md
- ECR: services/ecr.md
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 57eb92d804..3b11cf1bcf 100644
--- a/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java
+++ b/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java
@@ -739,6 +739,7 @@ public interface EmulatorConfig {
ControlCatalogServiceConfig controlcatalog();
ControlTowerServiceConfig controltower();
ConnectServiceConfig connect();
+ AppIntegrationsServiceConfig appintegrations();
CognitoIdentityServiceConfig cognitoidentity();
GlobalAcceleratorServiceConfig globalaccelerator();
@@ -755,6 +756,11 @@ public interface EmulatorConfig {
boolean enabled();
}
+ interface AppIntegrationsServiceConfig {
+ @WithDefault("true")
+ boolean enabled();
+ }
+
interface CognitoIdentityServiceConfig {
@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 7e3d041498..666b14cb2b 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
@@ -607,6 +607,12 @@ public class ResolvedServiceCatalog {
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("connect"), Set.of(),
Set.of(io.github.hectorvent.floci.services.connect.ConnectController.class)),
+ descriptor("app-integrations", "appintegrations",
+ config.services().appintegrations().enabled(), true,
+ "appintegrations", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON,
+ protocols(ServiceProtocol.REST_JSON),
+ Set.of(), Set.of("app-integrations"), Set.of(),
+ Set.of(io.github.hectorvent.floci.services.appintegrations.AppIntegrationsController.class)),
descriptor("cognito-identity", "cognitoidentity",
config.services().cognitoidentity().enabled(), true,
"cognitoidentity", config.storage().mode(), 5000L, null, ServiceProtocol.JSON,
diff --git a/src/main/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsController.java b/src/main/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsController.java
new file mode 100644
index 0000000000..39c052be16
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsController.java
@@ -0,0 +1,265 @@
+package io.github.hectorvent.floci.services.appintegrations;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import io.github.hectorvent.floci.core.common.JsonErrorResponseUtils;
+import io.github.hectorvent.floci.core.common.RegionResolver;
+import io.github.hectorvent.floci.services.appintegrations.model.DataIntegration;
+import io.github.hectorvent.floci.services.appintegrations.model.EventIntegration;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.PATCH;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.WebApplicationException;
+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 java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Amazon AppIntegrations REST-JSON controller (API version 2020-07-29).
+ *
+ * <p>Tag operations live on the shared {@code /tags/{resourceArn}} path and are served by
+ * {@code SharedTagsController} through {@link AppIntegrationsService}'s {@code TagHandler}.
+ * Only the operations declared below are served; anything else falls through to the
+ * emulator's not-found handling rather than a stub success.
+ */
+@Path("/")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public class AppIntegrationsController {
+
+ private final AppIntegrationsService appIntegrationsService;
+ private final RegionResolver regionResolver;
+ private final ObjectMapper objectMapper;
+
+ @Inject
+ public AppIntegrationsController(AppIntegrationsService appIntegrationsService,
+ RegionResolver regionResolver, ObjectMapper objectMapper) {
+ this.appIntegrationsService = appIntegrationsService;
+ this.regionResolver = regionResolver;
+ this.objectMapper = objectMapper;
+ }
+
+ @POST
+ @Path("/eventIntegrations")
+ public Response createEventIntegration(@Context HttpHeaders headers, String body) {
+ String region = regionResolver.resolveRegion(headers);
+ JsonNode request = readTree(body);
+ EventIntegration integration = appIntegrationsService.createEventIntegration(
+ textOrNull(request, "Name"),
+ textOrNull(request, "Description"),
+ request.get("EventFilter"),
+ textOrNull(request, "EventBridgeBus"),
+ parseTags(request.get("Tags")),
+ region);
+
+ ObjectNode response = objectMapper.createObjectNode();
+ response.put("EventIntegrationArn", integration.getEventIntegrationArn());
+ return Response.ok(response).build();
+ }
+
+ @GET
+ @Path("/eventIntegrations/{name}")
+ public Response getEventIntegration(@PathParam("name") String name, @Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ EventIntegration integration = appIntegrationsService.getEventIntegration(name, region);
+ return Response.ok(eventIntegrationNode(integration)).build();
+ }
+
+ @PATCH
+ @Path("/eventIntegrations/{name}")
+ public Response updateEventIntegration(@PathParam("name") String name,
+ @Context HttpHeaders headers, String body) {
+ String region = regionResolver.resolveRegion(headers);
+ JsonNode request = readTree(body);
+ appIntegrationsService.updateEventIntegration(name, optionalText(request, "Description"), region);
+ return Response.ok(objectMapper.createObjectNode()).build();
+ }
+
+ @DELETE
+ @Path("/eventIntegrations/{name}")
+ public Response deleteEventIntegration(@PathParam("name") String name, @Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ appIntegrationsService.deleteEventIntegration(name, region);
+ return Response.ok(objectMapper.createObjectNode()).build();
+ }
+
+ @GET
+ @Path("/eventIntegrations")
+ public Response listEventIntegrations(@Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ ObjectNode response = objectMapper.createObjectNode();
+ ArrayNode integrations = response.putArray("EventIntegrations");
+ for (EventIntegration integration : appIntegrationsService.listEventIntegrations(region)) {
+ integrations.add(eventIntegrationNode(integration));
+ }
+ return Response.ok(response).build();
+ }
+
+ /**
+ * Associations are created by the consuming service (Amazon Connect and friends)
+ * when it binds a client to the integration. Floci has no path that creates one, so
+ * an existing integration always reports an empty list; a missing one still raises
+ * ResourceNotFoundException.
+ */
+ @GET
+ @Path("/eventIntegrations/{name}/associations")
+ public Response listEventIntegrationAssociations(@PathParam("name") String name,
+ @Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ appIntegrationsService.getEventIntegration(name, region);
+ ObjectNode response = objectMapper.createObjectNode();
+ response.putArray("EventIntegrationAssociations");
+ return Response.ok(response).build();
+ }
+
+ @POST
+ @Path("/dataIntegrations")
+ public Response createDataIntegration(@Context HttpHeaders headers, String body) {
+ String region = regionResolver.resolveRegion(headers);
+ JsonNode request = readTree(body);
+ DataIntegration integration = appIntegrationsService.createDataIntegration(
+ textOrNull(request, "Name"),
+ textOrNull(request, "Description"),
+ textOrNull(request, "KmsKey"),
+ textOrNull(request, "SourceURI"),
+ request.get("ScheduleConfig"),
+ request.get("FileConfiguration"),
+ request.get("ObjectConfiguration"),
+ parseTags(request.get("Tags")),
+ region);
+
+ ObjectNode response = dataIntegrationNode(integration);
+ String clientToken = textOrNull(request, "ClientToken");
+ if (clientToken != null) {
+ response.put("ClientToken", clientToken);
+ }
+ return Response.ok(response).build();
+ }
+
+ @GET
+ @Path("/dataIntegrations/{identifier}")
+ public Response getDataIntegration(@PathParam("identifier") String identifier,
+ @Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ DataIntegration integration = appIntegrationsService.getDataIntegration(identifier, region);
+ return Response.ok(dataIntegrationNode(integration)).build();
+ }
+
+ @PATCH
+ @Path("/dataIntegrations/{identifier}")
+ public Response updateDataIntegration(@PathParam("identifier") String identifier,
+ @Context HttpHeaders headers, String body) {
+ String region = regionResolver.resolveRegion(headers);
+ JsonNode request = readTree(body);
+ appIntegrationsService.updateDataIntegration(identifier, optionalText(request, "Name"),
+ optionalText(request, "Description"), region);
+ return Response.ok(objectMapper.createObjectNode()).build();
+ }
+
+ @DELETE
+ @Path("/dataIntegrations/{identifier}")
+ public Response deleteDataIntegration(@PathParam("identifier") String identifier,
+ @Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ appIntegrationsService.deleteDataIntegration(identifier, region);
+ return Response.ok(objectMapper.createObjectNode()).build();
+ }
+
+ @GET
+ @Path("/dataIntegrations")
+ public Response listDataIntegrations(@Context HttpHeaders headers) {
+ String region = regionResolver.resolveRegion(headers);
+ ObjectNode response = objectMapper.createObjectNode();
+ ArrayNode integrations = response.putArray("DataIntegrations");
+ for (DataIntegration integration : appIntegrationsService.listDataIntegrations(region)) {
+ ObjectNode summary = integrations.addObject();
+ summary.put("Arn", integration.getArn());
+ summary.put("Name", integration.getName());
+ if (integration.getSourceUri() != null) {
+ summary.put("SourceURI", integration.getSourceUri());
+ }
+ }
+ return Response.ok(response).build();
+ }
+
+ private ObjectNode eventIntegrationNode(EventIntegration integration) {
+ ObjectNode node = objectMapper.createObjectNode();
+ node.put("Name", integration.getName());
+ if (integration.getDescription() != null) {
+ node.put("Description", integration.getDescription());
+ }
+ node.put("EventIntegrationArn", integration.getEventIntegrationArn());
+ node.put("EventBridgeBus", integration.getEventBridgeBus());
+ node.putObject("EventFilter").put("Source", integration.getEventFilterSource());
+ node.set("Tags", objectMapper.valueToTree(
+ integration.getTags() != null ? integration.getTags() : Map.of()));
+ return node;
+ }
+
+ private ObjectNode dataIntegrationNode(DataIntegration integration) {
+ ObjectNode node = objectMapper.createObjectNode();
+ node.put("Arn", integration.getArn());
+ node.put("Id", integration.getId());
+ node.put("Name", integration.getName());
+ if (integration.getDescription() != null) {
+ node.put("Description", integration.getDescription());
+ }
+ node.put("KmsKey", integration.getKmsKey());
+ if (integration.getSourceUri() != null) {
+ node.put("SourceURI", integration.getSourceUri());
+ }
+ setIfPresent(node, "ScheduleConfiguration", integration.getScheduleConfiguration());
+ setIfPresent(node, "FileConfiguration", integration.getFileConfiguration());
+ setIfPresent(node, "ObjectConfiguration", integration.getObjectConfiguration());
+ node.set("Tags", objectMapper.valueToTree(
+ integration.getTags() != null ? integration.getTags() : Map.of()));
+ return node;
+ }
+
+ private void setIfPresent(ObjectNode node, String field, JsonNode value) {
+ if (value != null && !value.isNull()) {
+ node.set(field, value);
+ }
+ }
+
+ private JsonNode readTree(String body) {
+ try {
+ return objectMapper.readTree(body == null || body.isBlank() ? "{}" : body);
+ } catch (Exception e) {
+ throw new WebApplicationException(JsonErrorResponseUtils.createSerializationErrorResponse());
+ }
+ }
+
+ private String textOrNull(JsonNode node, String field) {
+ return optionalText(node, field).orElse(null);
+ }
+
+ private Optional<String> optionalText(JsonNode node, String field) {
+ JsonNode value = node.get(field);
+ if (value == null || value.isNull()) {
+ return Optional.empty();
+ }
+ return Optional.of(value.asText());
+ }
+
+ private Map<String, String> parseTags(JsonNode tagsNode) {
+ Map<String, String> 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/appintegrations/AppIntegrationsService.java b/src/main/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsService.java
new file mode 100644
index 0000000000..390b68dd33
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsService.java
@@ -0,0 +1,282 @@
+package io.github.hectorvent.floci.services.appintegrations;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import io.github.hectorvent.floci.core.common.AwsArnUtils;
+import io.github.hectorvent.floci.core.common.AwsException;
+import io.github.hectorvent.floci.core.common.RegionResolver;
+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.appintegrations.model.DataIntegration;
+import io.github.hectorvent.floci.services.appintegrations.model.EventIntegration;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import org.jboss.logging.Logger;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+
+/**
+ * Amazon AppIntegrations (signing name {@code app-integrations}, API version 2020-07-29).
+ * Event integrations are addressed by name, data integrations by generated id; both accept
+ * their own ARN wherever the API takes an identifier.
+ */
+@ApplicationScoped
+public class AppIntegrationsService implements TagHandler {
+
+ private static final Logger LOG = Logger.getLogger(AppIntegrationsService.class);
+
+ static final String SERVICE = "app-integrations";
+ private static final String EVENT_INTEGRATION_RESOURCE = "event-integration";
+ private static final String DATA_INTEGRATION_RESOURCE = "data-integration";
+
+ private final StorageBackend<String, EventIntegration> eventIntegrations;
+ private final StorageBackend<String, DataIntegration> dataIntegrations;
+ private final RegionResolver regionResolver;
+
+ @Inject
+ public AppIntegrationsService(StorageFactory storageFactory, RegionResolver regionResolver) {
+ this.eventIntegrations = storageFactory.create("appintegrations",
+ "appintegrations-event-integrations.json",
+ new TypeReference<Map<String, EventIntegration>>() {});
+ this.dataIntegrations = storageFactory.create("appintegrations",
+ "appintegrations-data-integrations.json",
+ new TypeReference<Map<String, DataIntegration>>() {});
+ this.regionResolver = regionResolver;
+ }
+
+ public EventIntegration createEventIntegration(String name, String description, JsonNode eventFilter,
+ String eventBridgeBus, Map<String, String> tags,
+ String region) {
+ requireMember(name, "Name");
+ requireMember(eventBridgeBus, "EventBridgeBus");
+ if (eventFilter == null || !eventFilter.isObject()
+ || eventFilter.get("Source") == null || eventFilter.get("Source").isNull()) {
+ throw new AwsException("InvalidRequestException", "EventFilter.Source is required", 400);
+ }
+ if (eventIntegrations.get(key(region, name)).isPresent()) {
+ throw new AwsException("DuplicateResourceException",
+ "An event integration named " + name + " already exists.", 409);
+ }
+
+ EventIntegration integration = new EventIntegration();
+ integration.setName(name);
+ integration.setDescription(description);
+ integration.setEventIntegrationArn(
+ regionResolver.buildArn(SERVICE, region, EVENT_INTEGRATION_RESOURCE + "/" + name));
+ integration.setEventBridgeBus(eventBridgeBus);
+ integration.setEventFilterSource(eventFilter.get("Source").asText());
+ integration.setTags(tags != null ? new LinkedHashMap<>(tags) : new LinkedHashMap<>());
+ integration.setAccountId(regionResolver.getAccountId());
+
+ eventIntegrations.put(key(region, name), integration);
+ LOG.infov("Created AppIntegrations event integration: {0}", name);
+ return integration;
+ }
+
+ public EventIntegration getEventIntegration(String name, String region) {
+ String resolved = resolveIdentifier(name, EVENT_INTEGRATION_RESOURCE);
+ return eventIntegrations.get(key(region, resolved))
+ .orElseThrow(() -> new AwsException("ResourceNotFoundException",
+ "Event integration " + name + " does not exist.", 404));
+ }
+
+ /**
+ * {@code Description} is the only updatable member. An absent member leaves the stored
+ * value alone, which is how AWS treats an optional member the caller did not send.
+ */
+ public EventIntegration updateEventIntegration(String name, Optional<String> description, String region) {
+ EventIntegration integration = getEventIntegration(name, region);
+ description.ifPresent(integration::setDescription);
+ eventIntegrations.put(key(region, integration.getName()), integration);
+ return integration;
+ }
+
+ public void deleteEventIntegration(String name, String region) {
+ EventIntegration integration = getEventIntegration(name, region);
+ eventIntegrations.delete(key(region, integration.getName()));
+ LOG.infov("Deleted AppIntegrations event integration: {0}", integration.getName());
+ }
+
+ public List<EventIntegration> listEventIntegrations(String region) {
+ String prefix = region + "::";
+ return eventIntegrations.scan(k -> k.startsWith(prefix));
+ }
+
+ public DataIntegration createDataIntegration(String name, String description, String kmsKey,
+ String sourceUri, JsonNode scheduleConfig,
+ JsonNode fileConfiguration, JsonNode objectConfiguration,
+ Map<String, String> tags, String region) {
+ requireMember(name, "Name");
+ requireMember(kmsKey, "KmsKey");
+ for (DataIntegration existing : listDataIntegrations(region)) {
+ if (name.equals(existing.getName())) {
+ throw new AwsException("DuplicateResourceException",
+ "A data integration named " + name + " already exists.", 409);
+ }
+ }
+
+ String id = UUID.randomUUID().toString();
+ DataIntegration integration = new DataIntegration();
+ integration.setId(id);
+ integration.setArn(regionResolver.buildArn(SERVICE, region, DATA_INTEGRATION_RESOURCE + "/" + id));
+ integration.setName(name);
+ integration.setDescription(description);
+ integration.setKmsKey(kmsKey);
+ integration.setSourceUri(sourceUri);
+ integration.setScheduleConfiguration(scheduleConfig);
+ integration.setFileConfiguration(fileConfiguration);
+ integration.setObjectConfiguration(objectConfiguration);
+ integration.setTags(tags != null ? new LinkedHashMap<>(tags) : new LinkedHashMap<>());
+ integration.setAccountId(regionResolver.getAccountId());
+
+ dataIntegrations.put(key(region, id), integration);
+ LOG.infov("Created AppIntegrations data integration: {0}", id);
+ return integration;
+ }
+
+ public DataIntegration getDataIntegration(String identifier, String region) {
+ String id = resolveIdentifier(identifier, DATA_INTEGRATION_RESOURCE);
+ return dataIntegrations.get(key(region, id))
+ .orElseThrow(() -> new AwsException("ResourceNotFoundException",
+ "Data integration " + identifier + " does not exist.", 404));
+ }
+
+ public DataIntegration updateDataIntegration(String identifier, Optional<String> name,
+ Optional<String> description, String region) {
+ DataIntegration integration = getDataIntegration(identifier, region);
+ name.ifPresent(integration::setName);
+ description.ifPresent(integration::setDescription);
+ dataIntegrations.put(key(region, integration.getId()), integration);
+ return integration;
+ }
+
+ public void deleteDataIntegration(String identifier, String region) {
+ DataIntegration integration = getDataIntegration(identifier, region);
+ dataIntegrations.delete(key(region, integration.getId()));
+ LOG.infov("Deleted AppIntegrations data integration: {0}", integration.getId());
+ }
+
+ public List<DataIntegration> listDataIntegrations(String region) {
+ String prefix = region + "::";
+ return dataIntegrations.scan(k -> k.startsWith(prefix));
+ }
+
+ @Override
+ public String serviceKey() {
+ return SERVICE;
+ }
+
+ /** AppIntegrations models no {@code responseCode} on either tag write, so both answer 200. */
+ @Override
+ public int tagResourceSuccessStatus() {
+ return 200;
+ }
+
+ @Override
+ public int untagResourceSuccessStatus() {
+ return 200;
+ }
+
+ @Override
+ public Map<String, String> listTags(String region, String arn) {
+ Map<String, String> tags = tagsOf(findByArn(arn, region));
+ return tags != null ? tags : Map.of();
+ }
+
+ @Override
+ public void tagResource(String region, String arn, Map<String, String> tags) {
+ Object resource = findByArn(arn, region);
+ if (tagsOf(resource) == null) {
+ setTags(resource, new LinkedHashMap<>());
+ }
+ tagsOf(resource).putAll(tags);
+ store(region, resource);
+ }
+
+ @Override
+ public void untagResource(String region, String arn, List<String> tagKeys) {
+ Object resource = findByArn(arn, region);
+ Map<String, String> tags = tagsOf(resource);
+ if (tags != null && tagKeys != null) {
+ tagKeys.forEach(tags::remove);
+ }
+ store(region, resource);
+ }
+
+ private Object findByArn(String arn, String region) {
+ String prefix = region + "::";
+ for (EventIntegration event : eventIntegrations.scan(k -> k.startsWith(prefix))) {
+ if (arn.equals(event.getEventIntegrationArn())) {
+ return event;
+ }
+ }
+ for (DataIntegration data : dataIntegrations.scan(k -> k.startsWith(prefix))) {
+ if (arn.equals(data.getArn())) {
+ return data;
+ }
+ }
+ throw new AwsException("ResourceNotFoundException", "Resource " + arn + " does not exist.", 404);
+ }
+
+ private Map<String, String> tagsOf(Object resource) {
+ return resource instanceof EventIntegration event ? event.getTags() : ((DataIntegration) resource).getTags();
+ }
+
+ private void setTags(Object resource, Map<String, String> tags) {
+ if (resource instanceof EventIntegration event) {
+ event.setTags(tags);
+ } else {
+ ((DataIntegration) resource).setTags(tags);
+ }
+ }
+
+ private void store(String region, Object resource) {
+ if (resource instanceof EventIntegration event) {
+ eventIntegrations.put(key(region, event.getName()), event);
+ } else {
+ DataIntegration data = (DataIntegration) resource;
+ dataIntegrations.put(key(region, data.getId()), data);
+ }
+ }
+
+ /**
+ * Both the bare identifier and the resource's own ARN are accepted, as AWS does.
+ * An ARN naming a different AppIntegrations resource type is rejected rather than
+ * silently resolving against the wrong store.
+ */
+ private String resolveIdentifier(String identifier, String expectedResourceType) {
+ if (identifier == null || identifier.isBlank()) {
+ throw new AwsException("InvalidRequestException", "Identifier is required", 400);
+ }
+ if (!identifier.startsWith("arn:")) {
+ return identifier;
+ }
+ String resource;
+ try {
+ resource = AwsArnUtils.parse(identifier).resource();
+ } catch (IllegalArgumentException e) {
+ throw new AwsException("InvalidRequestException", "Invalid ARN: " + identifier, 400);
+ }
+ int slash = resource.indexOf('/');
+ if (slash < 0 || slash == resource.length() - 1
+ || !expectedResourceType.equals(resource.substring(0, slash))) {
+ throw new AwsException("InvalidRequestException", "Invalid ARN: " + identifier, 400);
+ }
+ return resource.substring(slash + 1);
+ }
+
+ private void requireMember(String value, String member) {
+ if (value == null || value.isBlank()) {
+ throw new AwsException("InvalidRequestException", member + " is required", 400);
+ }
+ }
+
+ private String key(String region, String identifier) {
+ return region + "::" + identifier;
+ }
+}
diff --git a/src/main/java/io/github/hectorvent/floci/services/appintegrations/model/DataIntegration.java b/src/main/java/io/github/hectorvent/floci/services/appintegrations/model/DataIntegration.java
new file mode 100644
index 0000000000..0b852c74d4
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/services/appintegrations/model/DataIntegration.java
@@ -0,0 +1,111 @@
+package io.github.hectorvent.floci.services.appintegrations.model;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+@RegisterForReflection
+public class DataIntegration {
+
+ private String id;
+ private String arn;
+ private String name;
+ private String description;
+ private String kmsKey;
+ private String sourceUri;
+ private JsonNode scheduleConfiguration;
+ private JsonNode fileConfiguration;
+ private JsonNode objectConfiguration;
+ private Map<String, String> tags = new LinkedHashMap<>();
+ private String accountId;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getArn() {
+ return arn;
+ }
+
+ public void setArn(String arn) {
+ this.arn = arn;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getKmsKey() {
+ return kmsKey;
+ }
+
+ public void setKmsKey(String kmsKey) {
+ this.kmsKey = kmsKey;
+ }
+
+ public String getSourceUri() {
+ return sourceUri;
+ }
+
+ public void setSourceUri(String sourceUri) {
+ this.sourceUri = sourceUri;
+ }
+
+ public JsonNode getScheduleConfiguration() {
+ return scheduleConfiguration;
+ }
+
+ public void setScheduleConfiguration(JsonNode scheduleConfiguration) {
+ this.scheduleConfiguration = scheduleConfiguration;
+ }
+
+ public JsonNode getFileConfiguration() {
+ return fileConfiguration;
+ }
+
+ public void setFileConfiguration(JsonNode fileConfiguration) {
+ this.fileConfiguration = fileConfiguration;
+ }
+
+ public JsonNode getObjectConfiguration() {
+ return objectConfiguration;
+ }
+
+ public void setObjectConfiguration(JsonNode objectConfiguration) {
+ this.objectConfiguration = objectConfiguration;
+ }
+
+ public Map<String, String> getTags() {
+ return tags;
+ }
+
+ public void setTags(Map<String, String> tags) {
+ this.tags = tags;
+ }
+
+ public String getAccountId() {
+ return accountId;
+ }
+
+ public void setAccountId(String accountId) {
+ this.accountId = accountId;
+ }
+}
diff --git a/src/main/java/io/github/hectorvent/floci/services/appintegrations/model/EventIntegration.java b/src/main/java/io/github/hectorvent/floci/services/appintegrations/model/EventIntegration.java
new file mode 100644
index 0000000000..34a9a01df0
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/services/appintegrations/model/EventIntegration.java
@@ -0,0 +1,74 @@
+package io.github.hectorvent.floci.services.appintegrations.model;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+@RegisterForReflection
+public class EventIntegration {
+
+ private String name;
+ private String description;
+ private String eventIntegrationArn;
+ private String eventBridgeBus;
+ private String eventFilterSource;
+ private Map<String, String> tags = new LinkedHashMap<>();
+ private String accountId;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getEventIntegrationArn() {
+ return eventIntegrationArn;
+ }
+
+ public void setEventIntegrationArn(String eventIntegrationArn) {
+ this.eventIntegrationArn = eventIntegrationArn;
+ }
+
+ public String getEventBridgeBus() {
+ return eventBridgeBus;
+ }
+
+ public void setEventBridgeBus(String eventBridgeBus) {
+ this.eventBridgeBus = eventBridgeBus;
+ }
+
+ public String getEventFilterSource() {
+ return eventFilterSource;
+ }
+
+ public void setEventFilterSource(String eventFilterSource) {
+ this.eventFilterSource = eventFilterSource;
+ }
+
+ public Map<String, String> getTags() {
+ return tags;
+ }
+
+ public void setTags(Map<String, String> tags) {
+ this.tags = tags;
+ }
+
+ public String getAccountId() {
+ return accountId;
+ }
+
+ public void setAccountId(String accountId) {
+ this.accountId = accountId;
+ }
+}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 493d45f5ba..e651191391 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -681,6 +681,8 @@ floci:
enabled: true
connect:
enabled: true
+ appintegrations:
+ enabled: true
cognitoidentity:
enabled: true
globalaccelerator:
diff --git a/src/test/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsIntegrationTest.java
new file mode 100644
index 0000000000..ac869b25bb
--- /dev/null
+++ b/src/test/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsIntegrationTest.java
@@ -0,0 +1,396 @@
+package io.github.hectorvent.floci.services.appintegrations;
+
+import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
+
+@QuarkusTest
+@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
+class AppIntegrationsIntegrationTest {
+
+ private static final String EVENT_INTEGRATION_NAME = "floci-event-integration";
+
+ private static String eventIntegrationArn;
+ private static String dataIntegrationId;
+ private static String dataIntegrationArn;
+
+ @Test
+ @Order(1)
+ void createEventIntegration() {
+ eventIntegrationArn = given()
+ .contentType("application/json")
+ .body("""
+ {
+ "Name": "%s",
+ "Description": "partner events",
+ "EventBridgeBus": "floci-bus",
+ "EventFilter": {"Source": "aws.partner/example.com/1234"},
+ "Tags": {"team": "data"}
+ }
+ """.formatted(EVENT_INTEGRATION_NAME))
+ .when()
+ .post("/eventIntegrations")
+ .then()
+ .statusCode(200)
+ .body("EventIntegrationArn", containsString(":app-integrations:"))
+ .body("EventIntegrationArn", containsString(":event-integration/" + EVENT_INTEGRATION_NAME))
+ .extract().path("EventIntegrationArn");
+ }
+
+ @Test
+ @Order(2)
+ void getEventIntegrationEchoesTheRequest() {
+ given()
+ .when()
+ .get("/eventIntegrations/" + EVENT_INTEGRATION_NAME)
+ .then()
+ .statusCode(200)
+ .body("Name", equalTo(EVENT_INTEGRATION_NAME))
+ .body("Description", equalTo("partner events"))
+ .body("EventIntegrationArn", equalTo(eventIntegrationArn))
+ .body("EventBridgeBus", equalTo("floci-bus"))
+ .body("EventFilter.Source", equalTo("aws.partner/example.com/1234"))
+ .body("Tags.team", equalTo("data"));
+ }
+
+ @Test
+ @Order(3)
+ void listEventIntegrations() {
+ given()
+ .when()
+ .get("/eventIntegrations")
+ .then()
+ .statusCode(200)
+ .body("EventIntegrations.Name", hasItem(EVENT_INTEGRATION_NAME))
+ .body("EventIntegrations.find { it.Name == '" + EVENT_INTEGRATION_NAME + "' }.EventBridgeBus",
+ equalTo("floci-bus"));
+ }
+
+ @Test
+ @Order(4)
+ void listEventIntegrationAssociationsIsEmptyForANewIntegration() {
+ given()
+ .when()
+ .get("/eventIntegrations/" + EVENT_INTEGRATION_NAME + "/associations")
+ .then()
+ .statusCode(200)
+ .body("EventIntegrationAssociations.size()", equalTo(0));
+ }
+
+ @Test
+ @Order(5)
+ void listAssociationsForAMissingIntegrationReturnsResourceNotFound() {
+ given()
+ .when()
+ .get("/eventIntegrations/no-such-integration/associations")
+ .then()
+ .statusCode(404)
+ .body("__type", equalTo("ResourceNotFoundException"));
+ }
+
+ @Test
+ @Order(6)
+ void tagRoundTripOnTheEventIntegration() {
+ given()
+ .when()
+ .get("/tags/" + eventIntegrationArn)
+ .then()
+ .statusCode(200)
+ .body("tags.team", equalTo("data"));
+
+ given()
+ .contentType("application/json")
+ .body("{\"tags\": {\"env\": \"test\"}}")
+ .when()
+ .post("/tags/" + eventIntegrationArn)
+ .then()
+ .statusCode(200);
+
+ given()
+ .when()
+ .get("/tags/" + eventIntegrationArn)
+ .then()
+ .statusCode(200)
+ .body("tags.env", equalTo("test"));
+
+ given()
+ .queryParam("tagKeys", "env")
+ .when()
+ .delete("/tags/" + eventIntegrationArn)
+ .then()
+ .statusCode(200);
+
+ given()
+ .when()
+ .get("/tags/" + eventIntegrationArn)
+ .then()
+ .statusCode(200)
+ .body("tags.env", nullValue())
+ .body("tags.team", equalTo("data"));
+ }
+
+ @Test
+ @Order(7)
+ void updateEventIntegration() {
+ given()
+ .contentType("application/json")
+ .body("{\"Description\": \"partner events, revised\"}")
+ .when()
+ .patch("/eventIntegrations/" + EVENT_INTEGRATION_NAME)
+ .then()
+ .statusCode(200);
+
+ given()
+ .when()
+ .get("/eventIntegrations/" + EVENT_INTEGRATION_NAME)
+ .then()
+ .statusCode(200)
+ .body("Description", equalTo("partner events, revised"))
+ .body("EventBridgeBus", equalTo("floci-bus"))
+ .body("EventFilter.Source", equalTo("aws.partner/example.com/1234"));
+
+ given()
+ .contentType("application/json")
+ .body("{}")
+ .when()
+ .patch("/eventIntegrations/" + EVENT_INTEGRATION_NAME)
+ .then()
+ .statusCode(200);
+
+ given()
+ .when()
+ .get("/eventIntegrations/" + EVENT_INTEGRATION_NAME)
+ .then()
+ .statusCode(200)
+ .body("Description", equalTo("partner events, revised"));
+ }
+
+ @Test
+ @Order(8)
+ void duplicateEventIntegrationNameReturnsDuplicateResource() {
+ given()
+ .contentType("application/json")
+ .body("""
+ {
+ "Name": "%s",
+ "EventBridgeBus": "floci-bus",
+ "EventFilter": {"Source": "aws.partner/example.com/1234"}
+ }
+ """.formatted(EVENT_INTEGRATION_NAME))
+ .when()
+ .post("/eventIntegrations")
+ .then()
+ .statusCode(409)
+ .body("__type", equalTo("DuplicateResourceException"));
+ }
+
+ @Test
+ @Order(9)
+ void createEventIntegrationWithoutEventFilterReturnsInvalidRequest() {
+ given()
+ .contentType("application/json")
+ .body("{\"Name\": \"no-filter\", \"EventBridgeBus\": \"floci-bus\"}")
+ .when()
+ .post("/eventIntegrations")
+ .then()
+ .statusCode(400)
+ .body("__type", equalTo("InvalidRequestException"));
+ }
+
+ @Test
+ @Order(10)
+ void getMissingEventIntegrationReturnsResourceNotFound() {
+ given()
+ .when()
+ .get("/eventIntegrations/no-such-integration")
+ .then()
+ .statusCode(404)
+ .body("__type", equalTo("ResourceNotFoundException"));
+ }
+
+ @Test
+ @Order(11)
+ void createDataIntegration() {
+ var response = given()
+ .contentType("application/json")
+ .body("""
+ {
+ "Name": "floci-data-integration",
+ "Description": "salesforce pull",
+ "KmsKey": "arn:aws:kms:us-east-1:000000000000:key/abc",
+ "SourceURI": "Salesforce://AppFlow/test",
+ "ScheduleConfig": {"ScheduleExpression": "rate(1 hour)", "FirstExecutionFrom": "1439788800000"},
+ "FileConfiguration": {"Folders": ["/home/data"]},
+ "Tags": {"team": "data"}
+ }
+ """)
+ .when()
+ .post("/dataIntegrations")
+ .then()
+ .statusCode(200)
+ .body("Id", notNullValue())
+ .body("Arn", containsString(":data-integration/"))
+ .body("Name", equalTo("floci-data-integration"))
+ .body("KmsKey", equalTo("arn:aws:kms:us-east-1:000000000000:key/abc"))
+ .body("SourceURI", equalTo("Salesforce://AppFlow/test"))
+ .body("ScheduleConfiguration.ScheduleExpression", equalTo("rate(1 hour)"))
+ .body("FileConfiguration.Folders[0]", equalTo("/home/data"))
+ .body("Tags.team", equalTo("data"))
+ .extract();
+ dataIntegrationId = response.path("Id");
+ dataIntegrationArn = response.path("Arn");
+ }
+
+ @Test
+ @Order(12)
+ void getDataIntegrationByIdAndByArn() {
+ given()
+ .when()
+ .get("/dataIntegrations/" + dataIntegrationId)
+ .then()
+ .statusCode(200)
+ .body("Id", equalTo(dataIntegrationId))
+ .body("Arn", equalTo(dataIntegrationArn))
+ .body("Description", equalTo("salesforce pull"))
+ .body("ScheduleConfiguration.FirstExecutionFrom", equalTo("1439788800000"));
+
+ String encodedArn = java.net.URLEncoder.encode(dataIntegrationArn,
+ java.nio.charset.StandardCharsets.UTF_8);
+ given()
+ .urlEncodingEnabled(false)
+ .when()
+ .get("/dataIntegrations/" + encodedArn)
+ .then()
+ .statusCode(200)
+ .body("Id", equalTo(dataIntegrationId));
+ }
+
+ @Test
+ @Order(13)
+ void listDataIntegrations() {
+ given()
+ .when()
+ .get("/dataIntegrations")
+ .then()
+ .statusCode(200)
+ .body("DataIntegrations.Name", hasItem("floci-data-integration"))
+ .body("DataIntegrations.find { it.Name == 'floci-data-integration' }.Arn",
+ equalTo(dataIntegrationArn))
+ .body("DataIntegrations.find { it.Name == 'floci-data-integration' }.SourceURI",
+ equalTo("Salesforce://AppFlow/test"));
+ }
+
+ @Test
+ @Order(14)
+ void tagRoundTripOnTheDataIntegration() {
+ given()
+ .contentType("application/json")
+ .body("{\"tags\": {\"tier\": \"gold\"}}")
+ .when()
+ .post("/tags/" + dataIntegrationArn)
+ .then()
+ .statusCode(200);
+
+ given()
+ .when()
+ .get("/tags/" + dataIntegrationArn)
+ .then()
+ .statusCode(200)
+ .body("tags.tier", equalTo("gold"))
+ .body("tags.team", equalTo("data"));
+ }
+
+ @Test
+ @Order(15)
+ void updateDataIntegration() {
+ given()
+ .contentType("application/json")
+ .body("{\"Description\": \"salesforce pull, revised\"}")
+ .when()
+ .patch("/dataIntegrations/" + dataIntegrationId)
+ .then()
+ .statusCode(200);
+
+ given()
+ .when()
+ .get("/dataIntegrations/" + dataIntegrationId)
+ .then()
+ .statusCode(200)
+ .body("Description", equalTo("salesforce pull, revised"))
+ .body("Name", equalTo("floci-data-integration"));
+ }
+
+ @Test
+ @Order(16)
+ void createDataIntegrationWithoutKmsKeyReturnsInvalidRequest() {
+ given()
+ .contentType("application/json")
+ .body("{\"Name\": \"no-key\"}")
+ .when()
+ .post("/dataIntegrations")
+ .then()
+ .statusCode(400)
+ .body("__type", equalTo("InvalidRequestException"));
+ }
+
+ @Test
+ @Order(17)
+ void getMissingDataIntegrationReturnsResourceNotFound() {
+ given()
+ .when()
+ .get("/dataIntegrations/00000000-0000-0000-0000-00000000dead")
+ .then()
+ .statusCode(404)
+ .body("__type", equalTo("ResourceNotFoundException"));
+ }
+
+ @Test
+ @Order(18)
+ void deleteDataIntegration() {
+ given()
+ .when()
+ .delete("/dataIntegrations/" + dataIntegrationId)
+ .then()
+ .statusCode(200);
+
+ given()
+ .when()
+ .get("/dataIntegrations/" + dataIntegrationId)
+ .then()
+ .statusCode(404)
+ .body("__type", equalTo("ResourceNotFoundException"));
+ }
+
+ @Test
+ @Order(19)
+ void deleteEventIntegration() {
+ given()
+ .when()
+ .delete("/eventIntegrations/" + EVENT_INTEGRATION_NAME)
+ .then()
+ .statusCode(200);
+
+ given()
+ .when()
+ .get("/eventIntegrations/" + EVENT_INTEGRATION_NAME)
+ .then()
+ .statusCode(404)
+ .body("__type", equalTo("ResourceNotFoundException"));
+
+ given()
+ .when()
+ .delete("/eventIntegrations/" + EVENT_INTEGRATION_NAME)
+ .then()
+ .statusCode(404)
+ .body("__type", equalTo("ResourceNotFoundException"));
+ }
+}
diff --git a/src/test/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsServiceTest.java
new file mode 100644
index 0000000000..2ffa78cb19
--- /dev/null
+++ b/src/test/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsServiceTest.java
@@ -0,0 +1,196 @@
+package io.github.hectorvent.floci.services.appintegrations;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import io.github.hectorvent.floci.core.common.AwsException;
+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.appintegrations.model.DataIntegration;
+import io.github.hectorvent.floci.services.appintegrations.model.EventIntegration;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * AppIntegrations domain rules that the REST layer only passes through: required members,
+ * duplicate names, ARN-or-id resolution, and the partial-update semantics of the two
+ * PATCH operations.
+ */
+class AppIntegrationsServiceTest {
+
+ private static final String REGION = "us-east-1";
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ private AppIntegrationsService service;
+
+ @BeforeEach
+ void setUp() {
+ service = new AppIntegrationsService(new SharedStorageFactory(),
+ new RegionResolver(REGION, "000000000000"));
+ }
+
+ @Test
+ void createEventIntegrationBuildsTheAwsArnAndStoresTheFilterSource() {
+ EventIntegration integration = service.createEventIntegration("orders", "partner events",
+ eventFilter("aws.partner/example.com/1234"), "floci-bus", Map.of("team", "data"), REGION);
+
+ assertEquals("arn:aws:app-integrations:us-east-1:000000000000:event-integration/orders",
+ integration.getEventIntegrationArn());
+ assertEquals("aws.partner/example.com/1234", integration.getEventFilterSource());
+ assertEquals("floci-bus", integration.getEventBridgeBus());
+ assertEquals("data", integration.getTags().get("team"));
+ }
+
+ @Test
+ void createEventIntegrationRejectsAMissingRequiredMember() {
+ AwsException noName = assertThrows(AwsException.class, () -> service.createEventIntegration(
+ null, null, eventFilter("aws.partner/x"), "floci-bus", Map.of(), REGION));
+ assertEquals("InvalidRequestException", noName.getErrorCode());
+
+ AwsException noBus = assertThrows(AwsException.class, () -> service.createEventIntegration(
+ "orders", null, eventFilter("aws.partner/x"), null, Map.of(), REGION));
+ assertEquals("InvalidRequestException", noBus.getErrorCode());
+
+ AwsException noFilter = assertThrows(AwsException.class, () -> service.createEventIntegration(
+ "orders", null, null, "floci-bus", Map.of(), REGION));
+ assertEquals("InvalidRequestException", noFilter.getErrorCode());
+ }
+
+ @Test
+ void duplicateEventIntegrationNameRaisesDuplicateResource() {
+ service.createEventIntegration("orders", null, eventFilter("aws.partner/x"), "bus", Map.of(), REGION);
+
+ AwsException duplicate = assertThrows(AwsException.class, () -> service.createEventIntegration(
+ "orders", null, eventFilter("aws.partner/x"), "bus", Map.of(), REGION));
+ assertEquals("DuplicateResourceException", duplicate.getErrorCode());
+ assertEquals(409, duplicate.getHttpStatus());
+ }
+
+ @Test
+ void updateEventIntegrationLeavesAnAbsentDescriptionAlone() {
+ service.createEventIntegration("orders", "first", eventFilter("aws.partner/x"), "bus", Map.of(), REGION);
+
+ service.updateEventIntegration("orders", Optional.of("second"), REGION);
+ assertEquals("second", service.getEventIntegration("orders", REGION).getDescription());
+
+ service.updateEventIntegration("orders", Optional.empty(), REGION);
+ assertEquals("second", service.getEventIntegration("orders", REGION).getDescription());
+ }
+
+ @Test
+ void getMissingEventIntegrationRaisesResourceNotFound() {
+ AwsException missing = assertThrows(AwsException.class,
+ () -> service.getEventIntegration("nope", REGION));
+ assertEquals("ResourceNotFoundException", missing.getErrorCode());
+ assertEquals(404, missing.getHttpStatus());
+ }
+
+ @Test
+ void createDataIntegrationRequiresNameAndKmsKey() {
+ AwsException noName = assertThrows(AwsException.class, () -> service.createDataIntegration(
+ null, null, "arn:aws:kms:us-east-1:000000000000:key/abc", null, null, null, null,
+ Map.of(), REGION));
+ assertEquals("InvalidRequestException", noName.getErrorCode());
+
+ AwsException noKey = assertThrows(AwsException.class, () -> service.createDataIntegration(
+ "orders", null, null, null, null, null, null, Map.of(), REGION));
+ assertEquals("InvalidRequestException", noKey.getErrorCode());
+ }
+
+ @Test
+ void dataIntegrationResolvesByIdAndByItsOwnArn() {
+ DataIntegration created = service.createDataIntegration("orders", "pull", "key/abc",
+ "Salesforce://AppFlow/test", null, null, null, Map.of(), REGION);
+
+ assertEquals(created.getId(), service.getDataIntegration(created.getId(), REGION).getId());
+ assertEquals(created.getId(), service.getDataIntegration(created.getArn(), REGION).getId());
+
+ AwsException wrongType = assertThrows(AwsException.class, () -> service.getDataIntegration(
+ "arn:aws:app-integrations:us-east-1:000000000000:event-integration/orders", REGION));
+ assertEquals("InvalidRequestException", wrongType.getErrorCode());
+ }
+
+ @Test
+ void updateDataIntegrationAppliesOnlyThePresentMembers() {
+ DataIntegration created = service.createDataIntegration("orders", "pull", "key/abc",
+ null, null, null, null, Map.of(), REGION);
+
+ service.updateDataIntegration(created.getId(), Optional.empty(), Optional.of("revised"), REGION);
+
+ DataIntegration updated = service.getDataIntegration(created.getId(), REGION);
+ assertEquals("orders", updated.getName());
+ assertEquals("revised", updated.getDescription());
+ }
+
+ @Test
+ void tagsAreSharedAcrossBothResourceTypesByArn() {
+ EventIntegration event = service.createEventIntegration("orders", null,
+ eventFilter("aws.partner/x"), "bus", Map.of("team", "data"), REGION);
+ DataIntegration data = service.createDataIntegration("orders-data", null, "key/abc",
+ null, null, null, null, Map.of(), REGION);
+
+ service.tagResource(REGION, data.getArn(), Map.of("tier", "gold"));
+ assertEquals("gold", service.listTags(REGION, data.getArn()).get("tier"));
+ assertEquals("data", service.listTags(REGION, event.getEventIntegrationArn()).get("team"));
+
+ service.untagResource(REGION, event.getEventIntegrationArn(), List.of("team"));
+ assertTrue(service.listTags(REGION, event.getEventIntegrationArn()).isEmpty());
+
+ AwsException unknown = assertThrows(AwsException.class, () -> service.listTags(REGION,
+ "arn:aws:app-integrations:us-east-1:000000000000:data-integration/missing"));
+ assertEquals("ResourceNotFoundException", unknown.getErrorCode());
+ }
+
+ @Test
+ void tagWritesAnswerTwoHundredAsTheAwsModelDoes() {
+ assertEquals(200, service.tagResourceSuccessStatus());
+ assertEquals(200, service.untagResourceSuccessStatus());
+ assertEquals("app-integrations", service.serviceKey());
+ }
+
+ @Test
+ void deleteRemovesTheIntegrationFromItsListing() {
+ service.createEventIntegration("orders", null, eventFilter("aws.partner/x"), "bus", Map.of(), REGION);
+ DataIntegration data = service.createDataIntegration("orders-data", null, "key/abc",
+ null, null, null, null, Map.of(), REGION);
+
+ service.deleteEventIntegration("orders", REGION);
+ service.deleteDataIntegration(data.getArn(), REGION);
+
+ assertTrue(service.listEventIntegrations(REGION).isEmpty());
+ assertTrue(service.listDataIntegrations(REGION).isEmpty());
+ }
+
+ private ObjectNode eventFilter(String source) {
+ ObjectNode filter = MAPPER.createObjectNode();
+ filter.put("Source", source);
+ return filter;
+ }
+
+ private static final class SharedStorageFactory extends StorageFactory {
+ private final Map<String, StorageBackend<String, ?>> stores = new HashMap<>();
+
+ private SharedStorageFactory() {
+ super(null, null);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <V> AccountAwareStorageBackend<V> create(String serviceName, String fileName,
+ TypeReference<Map<String, V>> typeReference) {
+ return (AccountAwareStorageBackend<V>) stores.computeIfAbsent(
+ fileName, ignored -> AccountAwareStorageBackend.inMemory("000000000000"));
+ }
+ }
+}
diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml
index fcf16bb8c7..2d5052683b 100644
--- a/src/test/resources/application.yml
+++ b/src/test/resources/application.yml
@@ -418,6 +418,8 @@ floci:
enabled: true
connect:
enabled: true
+ appintegrations:
+ enabled: true
cognitoidentity:
enabled: true
globalaccelerator:
diff --git a/tools/docs/service_matrix.yaml b/tools/docs/service_matrix.yaml
index e410406c35..5601ee5fbf 100644
--- a/tools/docs/service_matrix.yaml
+++ b/tools/docs/service_matrix.yaml
@@ -35,6 +35,7 @@ aliases:
secretsmanager: secrets-manager
codeguru-reviewer: codegurureviewer # SigV4 signing name is hyphenated; the doc slug is not
cognito-identity: cognitoidentity # SigV4 signing name is hyphenated; the doc slug is not
+ app-integrations: appintegrations # SigV4 signing name is hyphenated; the doc slug is not
servicecatalog: service-catalog
cognito-idp: cognito # Cognito's SigV4 signing name
states: step-functions # Step Functions' SigV4 signing name
diff --git a/tools/docs/services.yaml b/tools/docs/services.yaml
index 24d6bad11f..32905de591 100644
--- a/tools/docs/services.yaml
+++ b/tools/docs/services.yaml
@@ -125,6 +125,19 @@ services:
rename_actions:
GetControl: GetControl
ListControls: ListControls
+ - service: appintegrations
+ doc: docs/services/appintegrations.md
+ sources:
+ - { path: src/main/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsController.java, mode: rest }
+ - { path: src/main/java/io/github/hectorvent/floci/core/common/SharedTagsController.java, mode: rest }
+ rename_actions:
+ ListTags: ListTagsForResource
+ TagResourcePost: TagResource
+ exclude_actions:
+ - ListTagsByQuery
+ - TagResourceByBody
+ - TagResourcePut
+ - UntagResourceByQuery
- service: connect
doc: docs/services/connect.md
sources: