software.amazon.awssdk
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 68389f7289..eae8bac528 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
@@ -30,6 +30,7 @@ import software.amazon.awssdk.services.guardduty.GuardDutyClient;
import software.amazon.awssdk.services.fis.FisClient;
import software.amazon.awssdk.services.organizations.OrganizationsClient;
import software.amazon.awssdk.services.rum.RumClient;
+import software.amazon.awssdk.services.resourceexplorer2.ResourceExplorer2Client;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.endpoints.Endpoint;
import software.amazon.awssdk.services.s3control.S3ControlClient;
@@ -955,6 +956,23 @@ public final class TestFixtures {
.build();
}
+ public static ResourceExplorer2Client resourceExplorer2Client() {
+ return resourceExplorer2Client(REGION);
+ }
+
+ /**
+ * Resource Explorer 2 client bound to an explicit region. The emulator auto-provisions an
+ * index only in the default region, so CreateIndex/DeleteIndex tests use a different region
+ * to exercise a real create against a region that starts with no index.
+ */
+ public static ResourceExplorer2Client resourceExplorer2Client(Region region) {
+ var builder = ResourceExplorer2Client.builder().region(region);
+ if (!isRealAws()) {
+ builder.endpointOverride(ENDPOINT).credentialsProvider(CREDENTIALS);
+ }
+ return builder.build();
+ }
+
public static AppSyncClient appSyncClient() {
return AppSyncClient.builder()
.endpointOverride(ENDPOINT)
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ResourceExplorer2Test.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ResourceExplorer2Test.java
new file mode 100644
index 0000000000..8c412abd8d
--- /dev/null
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ResourceExplorer2Test.java
@@ -0,0 +1,593 @@
+package com.floci.test;
+
+import org.junit.jupiter.api.*;
+import org.junit.jupiter.api.condition.EnabledIf;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.resourceexplorer2.ResourceExplorer2Client;
+import software.amazon.awssdk.services.resourceexplorer2.model.*;
+import software.amazon.awssdk.services.s3.S3Client;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+/**
+ * SDK compatibility tests for Resource Explorer 2.
+ *
+ * Every test deserializes the response through the real AWS SDK and asserts
+ * on EVERY field. If the wire format is wrong (wrong casing, wrong structure,
+ * missing fields), the SDK will return null for that field and the test fails.
+ *
+ *
This is the safety net that prevents wire format regressions.
+ */
+@DisplayName("Resource Explorer 2")
+@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
+class ResourceExplorer2Test {
+
+ private static ResourceExplorer2Client client;
+ // The emulator auto-provisions an index only in the default region (us-east-1). CreateIndex
+ // there is a no-op/conflict, so index create+delete is exercised against a second region
+ // that starts with no index, matching AWS's one-index-per-region rule.
+ private static ResourceExplorer2Client altRegionClient;
+ private static S3Client s3;
+
+ private static String defaultViewArn;
+ private static String autoProvisionedIndexArn;
+ private static String createdViewArn;
+ private static String createdIndexArn;
+
+ @BeforeAll
+ static void setup() {
+ client = TestFixtures.resourceExplorer2Client();
+ altRegionClient = TestFixtures.resourceExplorer2Client(Region.US_WEST_2);
+ s3 = TestFixtures.s3Client();
+ }
+
+ @AfterAll
+ static void cleanup() {
+ if (client != null) {
+ client.close();
+ }
+ if (altRegionClient != null) {
+ altRegionClient.close();
+ }
+ if (s3 != null) {
+ s3.close();
+ }
+ }
+
+ // -----------------------------------------------------------------------
+ // GetIndex — every field must deserialize
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(1)
+ void getIndexDeserializesAllFields() {
+ GetIndexResponse response = client.getIndex(GetIndexRequest.builder().build());
+
+ // Every field the SDK model exposes must be non-null and correctly typed
+ assertThat(response.arn()).as("GetIndex.Arn").isNotBlank();
+ assertThat(response.type()).as("GetIndex.Type").isNotNull();
+ assertThat(response.type()).isIn(IndexType.LOCAL, IndexType.AGGREGATOR);
+ assertThat(response.state()).as("GetIndex.State").isNotNull();
+ assertThat(response.state()).isEqualTo(IndexState.ACTIVE);
+ assertThat(response.createdAt()).as("GetIndex.CreatedAt").isNotNull();
+ assertThat(response.lastUpdatedAt()).as("GetIndex.LastUpdatedAt").isNotNull();
+ assertThat(response.tags()).as("GetIndex.Tags").isNotNull();
+ assertThat(response.replicatingFrom()).as("GetIndex.ReplicatingFrom").isNotNull();
+ assertThat(response.replicatingTo()).as("GetIndex.ReplicatingTo").isNotNull();
+
+ autoProvisionedIndexArn = response.arn();
+ }
+
+ // -----------------------------------------------------------------------
+ // GetDefaultView
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(2)
+ void getDefaultViewReturnsViewArn() {
+ GetDefaultViewResponse response = client.getDefaultView(GetDefaultViewRequest.builder().build());
+ assertThat(response.viewArn()).as("GetDefaultView.ViewArn").isNotBlank();
+ defaultViewArn = response.viewArn();
+ }
+
+ // -----------------------------------------------------------------------
+ // GetView — every field of the View object
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(3)
+ void getViewDeserializesAllFields() {
+ GetViewResponse response = client.getView(GetViewRequest.builder()
+ .viewArn(defaultViewArn).build());
+ View view = response.view();
+
+ assertThat(view).as("GetView.View").isNotNull();
+ assertThat(view.viewArn()).as("View.ViewArn").isEqualTo(defaultViewArn);
+ assertThat(view.viewName()).as("View.ViewName").isNotBlank();
+ assertThat(view.owner()).as("View.Owner").isNotBlank();
+ assertThat(view.scope()).as("View.Scope").isNotBlank();
+ assertThat(view.lastUpdatedAt()).as("View.LastUpdatedAt").isNotNull();
+ assertThat(view.includedProperties()).as("View.IncludedProperties").isNotNull();
+ assertThat(view.filters()).as("View.Filters").isNotNull();
+ assertThat(view.filters().filterString()).as("View.Filters.FilterString").isNotNull();
+
+ // GetViewResponse has root-level Tags (separate from View)
+ assertThat(response.tags()).as("GetViewResponse.Tags").isNotNull();
+ }
+
+ // -----------------------------------------------------------------------
+ // ListSupportedResourceTypes — field-level assertions
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(4)
+ void listSupportedResourceTypesDeserializesAllFields() {
+ ListSupportedResourceTypesResponse response = client.listSupportedResourceTypes(
+ ListSupportedResourceTypesRequest.builder().maxResults(50).build());
+
+ assertThat(response.resourceTypes()).as("ResourceTypes").isNotEmpty();
+ for (var rt : response.resourceTypes()) {
+ assertThat(rt.resourceType()).as("SupportedResourceType.ResourceType").isNotBlank();
+ assertThat(rt.service()).as("SupportedResourceType.Service").isNotBlank();
+ // Verify format: "service:type"
+ assertThat(rt.resourceType()).contains(":");
+ }
+ }
+
+ // -----------------------------------------------------------------------
+ // Cross-service setup
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(5)
+ void createS3BucketForDiscovery() {
+ assumeFalse(TestFixtures.isRealAws(), "Skip resource creation against real AWS");
+ String bucketName = TestFixtures.uniqueName("re2");
+ s3.createBucket(b -> b.bucket(bucketName));
+ }
+
+ // -----------------------------------------------------------------------
+ // ListResources — every field of Resource objects
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(10)
+ void listResourcesDeserializesAllResourceFields() {
+ ListResourcesResponse response = client.listResources(ListResourcesRequest.builder().build());
+
+ assertThat(response.viewArn()).as("ListResources.ViewArn").isNotBlank();
+ assertThat(response.resources()).as("ListResources.Resources").isNotNull();
+
+ // Must have at least one resource (the S3 bucket we created)
+ assertThat(response.resources()).isNotEmpty();
+
+ for (Resource resource : response.resources()) {
+ assertThat(resource.arn()).as("Resource.Arn").isNotBlank();
+ assertThat(resource.resourceType()).as("Resource.ResourceType").isNotBlank();
+ assertThat(resource.service()).as("Resource.Service").isNotBlank();
+ assertThat(resource.region()).as("Resource.Region").isNotBlank();
+ assertThat(resource.owningAccountId()).as("Resource.OwningAccountId").isNotBlank();
+ assertThat(resource.lastReportedAt()).as("Resource.LastReportedAt").isNotNull();
+ assertThat(resource.properties()).as("Resource.Properties").isNotNull();
+ }
+ }
+
+ @Test
+ @Order(11)
+ void listResourcesWithFilterReturnsCorrectTypes() {
+ ListResourcesResponse response = client.listResources(ListResourcesRequest.builder()
+ .filters(SearchFilter.builder().filterString("service:s3").build())
+ .build());
+
+ assertThat(response.resources()).isNotEmpty();
+ for (Resource resource : response.resources()) {
+ assertThat(resource.service()).as("Filtered resource service").isEqualTo("s3");
+ assertThat(resource.resourceType()).startsWith("s3:");
+ }
+ }
+
+ // -----------------------------------------------------------------------
+ // Search — Count object structure is critical
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(12)
+ void searchCountIsObjectWithTotalResourcesAndComplete() {
+ SearchResponse response = client.search(SearchRequest.builder()
+ .queryString("service:s3")
+ .build());
+
+ // Count must be an object, not an integer
+ assertThat(response.count()).as("Search.Count").isNotNull();
+ assertThat(response.count().totalResources()).as("Count.TotalResources").isNotNull();
+ assertThat(response.count().totalResources()).isGreaterThanOrEqualTo(0L);
+ assertThat(response.count().complete()).as("Count.Complete").isNotNull();
+
+ assertThat(response.resources()).as("Search.Resources").isNotNull();
+ assertThat(response.viewArn()).as("Search.ViewArn").isNotBlank();
+ }
+
+ @Test
+ @Order(13)
+ void searchCountTotalMatchesActualResourceCount() {
+ SearchResponse response = client.search(SearchRequest.builder()
+ .queryString("service:s3")
+ .build());
+
+ // TotalResources should match the number of matching resources
+ assertThat(response.count().totalResources())
+ .as("Count.TotalResources matches filtered count")
+ .isEqualTo((long) response.resources().size());
+ }
+
+ // -----------------------------------------------------------------------
+ // CreateView — response shape
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(20)
+ void createViewResponseContainsViewObject() {
+ assumeFalse(TestFixtures.isRealAws(), "Skip view mutation against real AWS");
+ CreateViewResponse response = client.createView(CreateViewRequest.builder()
+ .viewName("sdk-compat-view")
+ .filters(SearchFilter.builder().filterString("service:s3").build())
+ .includedProperties(IncludedProperty.builder().name("tags").build())
+ .tags(Map.of("testKey", "testValue"))
+ .build());
+
+ View view = response.view();
+ assertThat(view).as("CreateView.View").isNotNull();
+ assertThat(view.viewArn()).as("View.ViewArn").isNotBlank();
+ assertThat(view.owner()).as("View.Owner").isNotBlank();
+ assertThat(view.lastUpdatedAt()).as("View.LastUpdatedAt").isNotNull();
+ assertThat(view.includedProperties()).as("View.IncludedProperties").isNotEmpty();
+
+ createdViewArn = view.viewArn();
+ }
+
+ // -----------------------------------------------------------------------
+ // ListViews
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(21)
+ void listViewsReturnsArns() {
+ ListViewsResponse response = client.listViews(ListViewsRequest.builder().build());
+ assertThat(response.views()).as("ListViews.Views").isNotEmpty();
+ if (!TestFixtures.isRealAws()) {
+ assertThat(response.views()).contains(createdViewArn);
+ }
+ }
+
+ // -----------------------------------------------------------------------
+ // BatchGetView — must have both Views and Errors
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(22)
+ void batchGetViewReturnsViewsAndErrorsForMissing() {
+ assumeFalse(TestFixtures.isRealAws(), "Depends on created view");
+ String bogusArn = "arn:aws:resource-explorer-2:us-east-1:000000000000:view/does-not-exist/00000000-0000-0000-0000-000000000000";
+
+ BatchGetViewResponse response = client.batchGetView(BatchGetViewRequest.builder()
+ .viewArns(createdViewArn, bogusArn)
+ .build());
+
+ // Found views
+ assertThat(response.views()).as("BatchGetView.Views").isNotEmpty();
+ assertThat(response.views().get(0).viewArn())
+ .as("BatchGetView found view")
+ .isEqualTo(createdViewArn);
+
+ // Errors for missing
+ assertThat(response.errors()).as("BatchGetView.Errors").isNotEmpty();
+ assertThat(response.errors().get(0).viewArn())
+ .as("BatchGetView error ViewArn")
+ .isEqualTo(bogusArn);
+ assertThat(response.errors().get(0).errorMessage())
+ .as("BatchGetView error message")
+ .isNotBlank();
+ }
+
+ // -----------------------------------------------------------------------
+ // UpdateView
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(23)
+ void updateViewReturnsUpdatedView() {
+ assumeFalse(TestFixtures.isRealAws(), "Depends on created view");
+ UpdateViewResponse response = client.updateView(UpdateViewRequest.builder()
+ .viewArn(createdViewArn)
+ .includedProperties(IncludedProperty.builder().name("tags").build())
+ .build());
+
+ assertThat(response.view()).as("UpdateView.View").isNotNull();
+ assertThat(response.view().viewArn()).isEqualTo(createdViewArn);
+ assertThat(response.view().lastUpdatedAt()).as("Updated.LastUpdatedAt").isNotNull();
+ }
+
+ // -----------------------------------------------------------------------
+ // DeleteView
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(24)
+ void deleteViewReturnsViewArn() {
+ assumeFalse(TestFixtures.isRealAws(), "Depends on created view");
+ DeleteViewResponse response = client.deleteView(DeleteViewRequest.builder()
+ .viewArn(createdViewArn).build());
+ assertThat(response.viewArn()).as("DeleteView.ViewArn").isEqualTo(createdViewArn);
+ }
+
+ // -----------------------------------------------------------------------
+ // CreateIndex — response must be trimmed to {Arn, State, CreatedAt}
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(30)
+ void createIndexReturnsArnStateCreatedAt() {
+ assumeFalse(TestFixtures.isRealAws(), "Skip index mutation against real AWS");
+ CreateIndexResponse response = altRegionClient.createIndex(CreateIndexRequest.builder()
+ .tags(Map.of("env", "test"))
+ .build());
+
+ assertThat(response.arn()).as("CreateIndex.Arn").isNotBlank();
+ assertThat(response.state()).as("CreateIndex.State").isNotNull();
+ assertThat(response.createdAt()).as("CreateIndex.CreatedAt").isNotNull();
+
+ createdIndexArn = response.arn();
+ }
+
+ // -----------------------------------------------------------------------
+ // ListIndexes — each item has Arn, Region, Type
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(31)
+ void listIndexesDeserializesItemFields() {
+ ListIndexesResponse response = client.listIndexes(ListIndexesRequest.builder().build());
+
+ assertThat(response.indexes()).as("ListIndexes.Indexes").isNotEmpty();
+ for (var idx : response.indexes()) {
+ assertThat(idx.arn()).as("Index.Arn").isNotBlank();
+ assertThat(idx.region()).as("Index.Region").isNotBlank();
+ assertThat(idx.type()).as("Index.Type").isNotNull();
+ }
+ }
+
+ // -----------------------------------------------------------------------
+ // UpdateIndexType — PascalCase response fields
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(32)
+ void updateIndexTypeDeserializesAllFields() {
+ assumeFalse(TestFixtures.isRealAws(), "Skip index mutation against real AWS");
+ UpdateIndexTypeResponse response = client.updateIndexType(UpdateIndexTypeRequest.builder()
+ .arn(autoProvisionedIndexArn)
+ .type(IndexType.AGGREGATOR)
+ .build());
+
+ assertThat(response.arn()).as("UpdateIndexType.Arn").isNotBlank();
+ assertThat(response.state()).as("UpdateIndexType.State").isNotNull();
+ assertThat(response.type()).as("UpdateIndexType.Type").isNotNull();
+ assertThat(response.lastUpdatedAt()).as("UpdateIndexType.LastUpdatedAt").isNotNull();
+ }
+
+ // -----------------------------------------------------------------------
+ // DeleteIndex — must include LastUpdatedAt
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(33)
+ void deleteIndexReturnsArnLastUpdatedAtState() {
+ assumeFalse(TestFixtures.isRealAws(), "Depends on created index");
+ DeleteIndexResponse response = altRegionClient.deleteIndex(DeleteIndexRequest.builder()
+ .arn(createdIndexArn)
+ .build());
+
+ assertThat(response.arn()).as("DeleteIndex.Arn").isEqualTo(createdIndexArn);
+ assertThat(response.state()).as("DeleteIndex.State").isNotNull();
+ assertThat(response.lastUpdatedAt()).as("DeleteIndex.LastUpdatedAt").isNotNull();
+ }
+
+ // -----------------------------------------------------------------------
+ // Error handling — invalid input must return proper error, not 500
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(40)
+ void getMissingViewReturnsError() {
+ // Real AWS: 401 UnauthorizedException (auth checked before existence for wrong-account ARN)
+ // Floci: 404 ResourceNotFoundException
+ assertThatThrownBy(() -> client.getView(GetViewRequest.builder()
+ .viewArn("arn:aws:resource-explorer-2:us-east-1:000000000000:view/nope/00000000-0000-0000-0000-000000000000")
+ .build()))
+ .isInstanceOf(ResourceExplorer2Exception.class);
+ }
+
+ @Test
+ @Order(41)
+ void deleteMissingIndexReturnsError() {
+ // Real AWS: 403 AccessDeniedException (auth checked before existence for wrong-account ARN)
+ // Floci: 404 ResourceNotFoundException
+ assertThatThrownBy(() -> client.deleteIndex(DeleteIndexRequest.builder()
+ .arn("arn:aws:resource-explorer-2:us-east-1:000000000000:index/nonexistent")
+ .build()))
+ .isInstanceOf(ResourceExplorer2Exception.class);
+ }
+
+ // -----------------------------------------------------------------------
+ // CLASS 3: Wire Format — Nested Structure Deserialization
+ // Drills into nested objects to verify the SDK can parse every level.
+ // If any nested field uses wrong casing or wrong structure, the SDK
+ // returns null and these tests fail.
+ // -----------------------------------------------------------------------
+
+ @Test
+ @Order(50)
+ void viewFiltersFilterStringDeserializes() {
+ assumeFalse(TestFixtures.isRealAws(), "Creates/deletes views");
+ // Create view with filter, then get it and drill into nested Filters object
+ CreateViewResponse createResp = client.createView(CreateViewRequest.builder()
+ .viewName("nested-test-view")
+ .filters(SearchFilter.builder().filterString("service:s3").build())
+ .includedProperties(IncludedProperty.builder().name("tags").build())
+ .build());
+ String arn = createResp.view().viewArn();
+
+ GetViewResponse getResp = client.getView(GetViewRequest.builder().viewArn(arn).build());
+ View view = getResp.view();
+
+ // Drill into nested Filters.FilterString
+ assertThat(view.filters()).as("View.Filters").isNotNull();
+ assertThat(view.filters().filterString()).as("Filters.FilterString").isEqualTo("service:s3");
+
+ // Drill into nested IncludedProperties[].Name
+ assertThat(view.includedProperties()).as("View.IncludedProperties").hasSize(1);
+ assertThat(view.includedProperties().get(0).name())
+ .as("IncludedProperty.Name").isEqualTo("tags");
+
+ // Drill into scope
+ assertThat(view.scope()).as("View.Scope").contains("arn:aws:iam:");
+
+ // Cleanup
+ client.deleteView(DeleteViewRequest.builder().viewArn(arn).build());
+ }
+
+ @Test
+ @Order(51)
+ void resourcePropertiesTagDataDeserializes() {
+ // List resources — S3 bucket should have tag Properties
+ ListResourcesResponse response = client.listResources(ListResourcesRequest.builder()
+ .filters(SearchFilter.builder().filterString("service:s3").build())
+ .build());
+
+ assertThat(response.resources()).isNotEmpty();
+ Resource s3Resource = response.resources().get(0);
+
+ // Properties is a list of ResourceProperty
+ assertThat(s3Resource.properties()).as("Resource.Properties").isNotNull();
+ // Note: Properties may be empty if no tags — we just verify the list itself deserializes.
+ // The integration test handles tag-specific assertions.
+ }
+
+ @Test
+ @Order(52)
+ void searchCountNestedFieldsDeserialize() {
+ SearchResponse response = client.search(SearchRequest.builder()
+ .queryString("")
+ .maxResults(1)
+ .build());
+
+ ResourceCount count = response.count();
+ assertThat(count).as("Search.Count object").isNotNull();
+
+ // These would be null if Count was an integer instead of an object
+ assertThat(count.totalResources()).as("Count.TotalResources").isNotNull();
+ assertThat(count.totalResources()).isGreaterThanOrEqualTo(0L);
+
+ // Complete is a boolean — just verify it deserializes (not null)
+ // Value depends on whether there are >1 matching resources
+ assertThat(count.complete()).as("Count.Complete").isNotNull();
+ }
+
+ @Test
+ @Order(53)
+ void searchCountCompleteIsTrueWhenAllResultsFit() {
+ SearchResponse response = client.search(SearchRequest.builder()
+ .queryString("")
+ .maxResults(1000)
+ .build());
+
+ assertThat(response.count().complete())
+ .as("Count.Complete when not paginating").isTrue();
+ assertThat(response.nextToken()).as("NextToken absent on last page").isNull();
+ }
+
+ @Test
+ @Order(54)
+ void indexReplicatingFieldsAreEmptyLists() {
+ GetIndexResponse response = client.getIndex(GetIndexRequest.builder().build());
+
+ // ReplicatingFrom and ReplicatingTo should deserialize as lists, not null
+ assertThat(response.replicatingFrom())
+ .as("GetIndex.ReplicatingFrom").isNotNull().isEmpty();
+ assertThat(response.replicatingTo())
+ .as("GetIndex.ReplicatingTo").isNotNull().isEmpty();
+ }
+
+ @Test
+ @Order(55)
+ void batchGetViewErrorFieldsDeserialize() {
+ assumeFalse(TestFixtures.isRealAws(), "Uses floci-specific bogus ARN format");
+ String bogus = "arn:aws:resource-explorer-2:us-east-1:000000000000:view/x/00000000-0000-0000-0000-000000000000";
+
+ BatchGetViewResponse response = client.batchGetView(BatchGetViewRequest.builder()
+ .viewArns(bogus)
+ .build());
+
+ assertThat(response.errors()).as("Errors list").hasSize(1);
+ BatchGetViewError error = response.errors().get(0);
+ assertThat(error.viewArn()).as("Error.ViewArn").isEqualTo(bogus);
+ assertThat(error.errorMessage()).as("Error.ErrorMessage").isNotBlank();
+ }
+
+ @Test
+ @Order(56)
+ void listResourcesPaginationTokenRoundTrips() {
+ assumeFalse(TestFixtures.isRealAws(), "Floci-specific pagination behavior");
+ // Page 1
+ ListResourcesResponse page1 = client.listResources(ListResourcesRequest.builder()
+ .maxResults(1)
+ .build());
+ assertThat(page1.resources()).hasSize(1);
+ assertThat(page1.nextToken()).as("Page1 NextToken").isNotNull();
+
+ // Page 2 using token from page 1
+ ListResourcesResponse page2 = client.listResources(ListResourcesRequest.builder()
+ .maxResults(1)
+ .nextToken(page1.nextToken())
+ .build());
+ assertThat(page2.resources()).hasSize(1);
+
+ // Page 1 and Page 2 should return different resources
+ assertThat(page2.resources().get(0).arn())
+ .as("Page 2 returns different resource")
+ .isNotEqualTo(page1.resources().get(0).arn());
+ }
+
+ @Test
+ @Order(57)
+ void updateViewNestedFieldsDeserialize() {
+ assumeFalse(TestFixtures.isRealAws(), "Creates/deletes views");
+ // Create, update, verify nested fields roundtrip
+ CreateViewResponse created = client.createView(CreateViewRequest.builder()
+ .viewName("update-nested-test")
+ .build());
+ String arn = created.view().viewArn();
+
+ UpdateViewResponse updated = client.updateView(UpdateViewRequest.builder()
+ .viewArn(arn)
+ .filters(SearchFilter.builder().filterString("region:us-east-1").build())
+ .includedProperties(IncludedProperty.builder().name("tags").build())
+ .build());
+
+ View view = updated.view();
+ assertThat(view.viewArn()).isEqualTo(arn);
+ assertThat(view.filters()).as("Updated Filters").isNotNull();
+ assertThat(view.filters().filterString())
+ .as("Updated FilterString").isEqualTo("region:us-east-1");
+ assertThat(view.includedProperties()).hasSize(1);
+ assertThat(view.includedProperties().get(0).name()).isEqualTo("tags");
+
+ client.deleteView(DeleteViewRequest.builder().viewArn(arn).build());
+ }
+}
diff --git a/docs/configuration/environment-variables.md b/docs/configuration/environment-variables.md
index 2e484fa2e9..2ff3c6e231 100644
--- a/docs/configuration/environment-variables.md
+++ b/docs/configuration/environment-variables.md
@@ -460,5 +460,6 @@ These services spawn Docker containers. They require access to the Docker socket
| `FLOCI_SERVICES_BACKUP_ENABLED` | `true` | Enable the AWS Backup service |
| `FLOCI_SERVICES_BACKUP_JOB_COMPLETION_DELAY_SECONDS` | `3` | Simulated delay before backup jobs transition to `COMPLETED` |
| `FLOCI_SERVICES_FIS_ENABLED` | `true` | Enable the AWS Fault Injection Service management API |
+| `FLOCI_SERVICES_RESOURCEEXPLORER2_ENABLED` | `true` | Enable the Resource Explorer 2 service |
| `FLOCI_SERVICES_APPCONFIG_ENABLED` | `true` | Enable the AppConfig service |
| `FLOCI_SERVICES_APPCONFIGDATA_ENABLED` | `true` | Enable the AppConfig Data service |
diff --git a/docs/services/docdb.md b/docs/services/docdb.md
index 7baf2a7964..1fafe82c0d 100644
--- a/docs/services/docdb.md
+++ b/docs/services/docdb.md
@@ -21,7 +21,7 @@ The management API shares the RDS Query endpoint (`POST /` with an `Action=` par
| --- | --- |
| `CreateDBCluster` | Create a DocumentDB cluster and start a MongoDB container |
| `DescribeDBClusters` | List clusters and their connection details |
-| `DescribeDBClusterSnapshots` | - |
+| `DescribeDBClusterSnapshots` | Return an empty cluster-snapshot list (snapshots are not modeled) |
| `DescribeGlobalClusters` | List global clusters — always empty, as none are modeled |
| `DeleteDBCluster` | Stop and remove a cluster (must have no instances) |
| `ModifyDBCluster` | Update engine version or IAM auth setting |
@@ -143,6 +143,6 @@ print(cluster["DBCluster"]["Endpoint"])
- IAM database authentication for MongoDB connections (the flag is stored and echoed back, but connections are not SigV4-proxied).
- TLS / `--tls` enforced connections.
-- Snapshot creation and restore (`DescribeDBClusterSnapshots` returns an empty stub result; snapshots are not modeled).
+- Snapshot and restore operations.
- Global clusters, replicas, and read-scaling beyond a single MongoDB container per cluster.
- Parameter groups, subnet groups, and maintenance windows.
diff --git a/docs/services/index.md b/docs/services/index.md
index 168c30c34d..d77bf8b149 100644
--- a/docs/services/index.md
+++ b/docs/services/index.md
@@ -64,6 +64,7 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac
| [ACM](acm.md) | `POST /` + `X-Amz-Target: CertificateManager.*` | JSON 1.1 | 12 |
| [ECR](ecr.md) | `POST /` + `X-Amz-Target: AmazonEC2ContainerRegistry_V20150921.*` (control plane) and `/v2/...` (data plane via `registry:2`) | JSON 1.1 + OCI Distribution | 17 |
| [Resource Groups Tagging API](resource-groups-tagging.md) | `POST /` + `X-Amz-Target: ResourceGroupsTaggingAPI_20170126.*` | JSON 1.1 | 5 |
+| [Resource Explorer](resource-explorer.md) | `POST /{OperationName}`, rewritten to `/re2/*` for the four paths S3 Vectors also claims | REST JSON | 32 |
| [SES](ses.md) | `POST /` with `Action=` param | Query | 16 |
| [SES v2](ses.md#v2) | `/v2/email/*` | REST JSON | 10 |
| [OpenSearch](opensearch.md) | `/2021-01-01/opensearch/...` | REST JSON | 24 |
diff --git a/docs/services/rds.md b/docs/services/rds.md
index 1fa2f831a9..8d44e9cf65 100644
--- a/docs/services/rds.md
+++ b/docs/services/rds.md
@@ -41,7 +41,7 @@ RDS Data API (`rds-data`) is documented separately because it uses REST JSON rou
| `DescribeOptionGroups` | List option groups, including the implicit `default:` groups |
| `ModifyOptionGroup` | Add, update, or remove options in an option group |
| `DeleteOptionGroup` | Delete an option group |
-| `DescribeDBSnapshots` | - |
+| `DescribeDBSnapshots` | Return an empty snapshot list (snapshots are not modeled) |
| `DescribeDBProxies` | List DB proxies |
| `CreateDBProxy` | Create a DB proxy |
| `ModifyDBProxy` | Update mutable DB proxy authentication, logging, timeout, TLS, role, and security-group settings |
@@ -51,7 +51,7 @@ RDS Data API (`rds-data`) is documented separately because it uses REST JSON rou
| `DescribeDBProxyTargetGroups` | List a proxy's target groups |
| `ModifyDBProxyTargetGroup` | Update target-group connection-pool configuration |
| `DescribeDBProxyTargets` | List a proxy target group's registered targets |
-| `DescribeDBClusterSnapshots` | - |
+| `DescribeDBClusterSnapshots` | Return an empty cluster-snapshot list (snapshots are not modeled) |
| `DescribeGlobalClusters` | List global clusters — always empty, as none are modeled |
| `AddTagsToResource` | Add tags to a DB resource |
| `ListTagsForResource` | List tags for a DB resource |
diff --git a/docs/services/resource-explorer.md b/docs/services/resource-explorer.md
new file mode 100644
index 0000000000..2e091fc0b1
--- /dev/null
+++ b/docs/services/resource-explorer.md
@@ -0,0 +1,182 @@
+# Resource Explorer 2
+
+AWS Resource Explorer 2 (`resource-explorer-2`) makes the resources other floci services hold
+searchable from one place: `Search` and `ListResources` answer the Resource Explorer query
+language across every enabled service, and index and view management works as it does in AWS.
+
+The API is REST JSON — operation names are URI paths (`POST /Search`) — and floci serves it on
+the shared port 4566.
+
+## Supported actions
+
+
+| Action | Description |
+| --- | --- |
+| `ListResources` | Search with filters only; pages through every match |
+| `Search` | Search with filters and free-form keywords; returns at most the first 1000 matches |
+| `ListSupportedResourceTypes` | List the resource types the enabled services expose |
+| `CreateIndex` | Turn Resource Explorer on in a Region |
+| `GetIndex` | Details of the Region's index |
+| `DeleteIndex` | Turn Resource Explorer off in a Region |
+| `ListIndexes` | List indexes, optionally by type or Region |
+| `UpdateIndexType` | Promote a local index to aggregator, or demote it |
+| `CreateView` | Create a view, optionally with a filter and tag data |
+| `GetView` | A view's definition and tags |
+| `DeleteView` | Delete a view, clearing it as a default if it was one |
+| `UpdateView` | Replace a view's filter or included properties |
+| `ListViews` | ARNs of the calling Region's views |
+| `BatchGetView` | Several views at once, reporting the ones that are missing |
+| `AssociateDefaultView` | Make a view the Region's default |
+| `DisassociateDefaultView` | Leave the Region without a default view |
+| `GetDefaultView` | The Region's default view ARN, if it has one |
+| `GetAccountLevelServiceConfiguration` | Organization status — always `DISABLED`, as no organization is modeled |
+| `ListIndexesForMembers` | Member accounts' indexes — this account's own, or empty |
+| `ListManagedViews` | AWS-managed views — always empty, as none are modeled |
+| `GetManagedView` | Always reports the managed view as not found |
+| `ListServiceViews` | Service-owned views — always empty, as none are modeled |
+| `GetServiceView` | Always reports the service view as not found |
+| `ListServiceIndexes` | Indexes across Regions, in the service-index shape |
+| `GetServiceIndex` | The Region's index ARN and type |
+| `ListStreamingAccessForServices` | Services granted streaming access — always empty, as none are modeled |
+| `CreateResourceExplorerSetup` | Create indexes and views across several Regions in one task |
+| `DeleteResourceExplorerSetup` | Remove indexes and views from named Regions, or from all of them |
+| `GetResourceExplorerSetup` | A setup task's per-Region index and view status |
+| `ListTagsForResource` | An index's or view's tags |
+| `TagResource` | Add or overwrite tags on an index or view |
+| `UntagResource` | Remove tags by key from an index or view |
+
+
+## Indexes and views
+
+An index turns Resource Explorer on in a Region; a view decides which resources a search can
+return and whether tag data comes back with them. floci auto-provisions an `AGGREGATOR` index
+and a `default-view` in the default Region at startup, so `Search` works with no setup. Other
+Regions need `CreateIndex` (or `CreateResourceExplorerSetup`) first.
+
+`CreateResourceExplorerSetup` configures several Regions in one call — an index and a view per
+Region, optionally promoting one Region to aggregator — and returns a `TaskId` that
+`GetResourceExplorerSetup` reads back. Each Region's index and view step is recorded
+independently, so a Region that fails reports its AWS error code through that Region's
+`ErrorDetails` instead of abandoning the rest of the task.
+
+## Making a service discoverable
+
+A service exposes its resources by implementing `core/resource/ResourceProvider`:
+
+```java
+public interface ResourceProvider {
+ List getResources();
+ Set getSupportedResourceTypes();
+}
+```
+
+`ResourceExplorer2Service` collects every implementation through CDI. `LambdaService` is the
+shortest example; `Ec2Service` is the largest, mapping eight resource types.
+
+There is no index behind this: every `Search` and `ListResources` calls each provider's
+`getResources()`, so results always match live service state. A provider must therefore be
+cheap and must tolerate a resource that is mid-creation — skip a null ARN, and treat a null tag
+map as empty.
+
+### Discoverable services
+
+| Service | Resource types |
+|---|---|
+| ACM | `acm:certificate` |
+| Amazon MQ | `mq:broker` |
+| CloudFormation | `cloudformation:stack` |
+| CloudWatch Logs | `logs:log-group` |
+| Cognito | `cognito-idp:userpool` |
+| DynamoDB | `dynamodb:table` |
+| EC2 | `ec2:instance`, `ec2:vpc`, `ec2:subnet`, `ec2:security-group`, `ec2:volume`, `ec2:internet-gateway`, `ec2:natgateway`, `ec2:route-table` |
+| ECR | `ecr:repository` |
+| ECS | `ecs:cluster`, `ecs:service` |
+| EKS | `eks:cluster` |
+| ElastiCache | `elasticache:cluster` |
+| ELB v2 | `elasticloadbalancing:loadbalancer`, `elasticloadbalancing:targetgroup` |
+| EventBridge | `events:event-bus`, `events:rule` |
+| Firehose | `firehose:deliverystream` |
+| IAM | `iam:user`, `iam:role` |
+| Kinesis | `kinesis:stream` |
+| KMS | `kms:key` |
+| Lambda | `lambda:function` |
+| Lightsail | `lightsail:instance`, `lightsail:database`, `lightsail:bucket` |
+| MSK | `kafka:cluster` |
+| OpenSearch | `es:domain` |
+| Pipes | `pipes:pipe` |
+| RDS | `rds:db` |
+| RUM | `rum:appmonitor` |
+| S3 | `s3:bucket` |
+| Secrets Manager | `secretsmanager:secret` |
+| SNS | `sns:topic` |
+| SQS | `sqs:queue` |
+| SSM | `ssm:parameter` |
+| Step Functions | `states:statemachine` |
+
+API Gateway and Route 53 are not discoverable yet, each for its own reason: `RestApi` carries no
+Region, and `Route53Service` resolves no account id — a hosted zone's ARN has neither. Both are
+waiting on a field, not on new query support.
+
+## Query syntax
+
+The filter grammar is implemented in full: the `accountid:`, `application:`, `id:`, `region:`,
+`resourcetype:`, `resourcetype.supports:`, `service:`, `tag:`, `tag.key:` and `tag.value:`
+filters, the `tag:all` and `tag:none` special cases, comma-OR within a filter, `-` negation,
+trailing `*` prefix matching, quoted phrases, and `\` escaping.
+
+`ListResources` accepts only filters — free-form text is rejected with a `ValidationException`,
+as AWS rejects it. `Search` accepts both.
+
+Tag filters (`tag:`, `tag.key:`, `tag.value:` and `application:`, which reads the
+`awsApplication` tag) require a view whose `IncludedProperties` name `tags`. Against a view
+without it the query is rejected rather than evaluated on data the view may not expose, and
+results carry no tag data.
+
+## Configuration
+
+| Variable | Default | Description |
+|---|---|---|
+| `FLOCI_SERVICES_RESOURCEEXPLORER2_ENABLED` | `true` | Enable or disable Resource Explorer 2 |
+| `FLOCI_STORAGE_SERVICES_RESOURCEEXPLORER2_MODE` | _(global storage mode)_ | Override the storage mode for indexes, views, and setup tasks |
+
+## Where floci differs from AWS
+
+- **Free-form keywords select rather than rank.** AWS reads `ec2 billing` as `ec2 OR billing`
+ and never excludes a resource for missing a keyword — it ranks it lower and still returns it,
+ so a keyword-only search in a live account returns everything. floci keeps the `OR` reading
+ but returns only matches, since it has no relevance model and an unfiltered result set is not
+ a useful answer locally. Filters, which AWS documents as deterministic, match exactly.
+- **An index is `ACTIVE` immediately.** `CreateIndex` reports `CREATING` on its own response, as
+ the API contract requires, but floci is synchronous and there is no provisioning window to
+ fake, so the very next `GetIndex` reports `ACTIVE`.
+- **Setup tasks finish before the call returns.** `CreateResourceExplorerSetup` and
+ `DeleteResourceExplorerSetup` run synchronously, so a task's per-Region status is already
+ terminal — `SUCCEEDED` or `FAILED` — the first time `GetResourceExplorerSetup` reads it.
+- **A stale `NextToken` returns an empty page.** A token pointing past a result set that shrank
+ between calls is answered with an empty page rather than an error, which is how AWS handles a
+ replayed token.
+- **Paginated results are ordered by ARN.** AWS treats `NextToken` as opaque and documents no
+ result order — `Search` is relevance-ranked. floci's token is an offset into a list rebuilt on
+ every call from provider and storage iteration, neither of which is ordered, so the results are
+ sorted by ARN before the page is cut. Without that total order the second page would index into
+ a differently arranged list and silently drop or repeat resources. The same ordering applies to
+ `ListIndexes`, `ListViews` and `ListSupportedResourceTypes`.
+- **The default view is stored, not inferred.** The per-Region default is persisted on its own
+ rather than derived from a view's name, so `DisassociateDefaultView` survives a restart.
+- **IAM tags are indexed.** AWS does not index tags attached to IAM users and roles; floci does,
+ because hiding them would make locally tagged roles unfindable for no benefit.
+- **Organization and trusted-service surfaces are empty.** floci models neither AWS
+ Organizations nor trusted-service integrations, so `ListManagedViews`, `ListServiceViews` and
+ `ListStreamingAccessForServices` answer with empty lists, `GetManagedView` and `GetServiceView`
+ report `ResourceNotFoundException`, `GetAccountLevelServiceConfiguration` reports
+ `AWSServiceAccessStatus: DISABLED`, and `ListIndexesForMembers` returns this account's indexes
+ when its id is among those asked for and nothing otherwise.
+
+## Routing note
+
+Resource Explorer 2 and S3 Vectors are both REST-JSON services rooted at `/`, and both declare
+`/CreateIndex`, `/GetIndex`, `/ListIndexes` and `/DeleteIndex`. JAX-RS cannot route those by
+path, so `ResourceExplorer2PathRewriteFilter` disambiguates on the SigV4 credential scope — the
+same signal `AwsQueryController` routes Query services by — and rewrites the path for Resource
+Explorer 2 callers. Requests that carry no `Authorization` header reach S3 Vectors; every AWS
+SDK and the CLI sign their requests, so this only affects hand-rolled `curl` calls.
diff --git a/mkdocs.yml b/mkdocs.yml
index 441fba53ee..2198742f13 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -120,6 +120,7 @@ nav:
- ECS: services/ecs.md
- ECR: services/ecr.md
- Resource Groups Tagging API: services/resource-groups-tagging.md
+ - Resource Explorer 2: services/resource-explorer.md
- EKS: services/eks.md
- MWAA: services/mwaa.md
- OpenSearch: services/opensearch.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 eb75dc2ac0..89720aeeb2 100644
--- a/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java
+++ b/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java
@@ -268,6 +268,7 @@ public interface EmulatorConfig {
BackupStorageConfig backup();
FisStorageConfig fis();
CloudFrontStorageConfig cloudfront();
+ ResourceExplorer2StorageConfig resourceexplorer2();
AppSyncStorageConfig appsync();
BatchStorageConfig batch();
LightsailStorageConfig lightsail();
@@ -417,6 +418,13 @@ public interface EmulatorConfig {
Optional mode();
}
+ interface ResourceExplorer2StorageConfig {
+ Optional mode();
+
+ @WithDefault("5000")
+ long flushIntervalMs();
+ }
+
interface AppSyncStorageConfig {
Optional mode();
@@ -632,6 +640,7 @@ public interface EmulatorConfig {
ConfigServiceConfig configservice();
CloudTrailServiceConfig cloudtrail();
CloudControlServiceConfig cloudcontrol();
+ ResourceExplorer2ServiceConfig resourceexplorer2();
CloudFrontServiceConfig cloudfront();
AppSyncServiceConfig appsync();
BatchServiceConfig batch();
@@ -765,6 +774,11 @@ public interface EmulatorConfig {
int flushIntervalSeconds();
}
+ interface ResourceExplorer2ServiceConfig {
+ @WithDefault("true")
+ boolean enabled();
+ }
+
interface AutoScalingServiceConfig {
@WithDefault("true")
boolean enabled();
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java b/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java
index a24e4fd527..b5615f990e 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java
@@ -289,8 +289,8 @@ public class AwsQueryController {
case "sns" -> snsQueryHandler.handle(action, formParams, region);
case "iam" -> iamQueryHandler.handle(action, formParams, authorization);
case "sts" -> stsQueryHandler.handle(action, formParams);
- case "elasticache" -> elastiCacheQueryHandler.handle(action, formParams);
- case "rds" -> {
+ case "elasticache" -> elastiCacheQueryHandler.handle(action, formParams, region);
+ case "rds" -> {
// Neptune signs requests with "rds" credential scope (same wire protocol).
// Route to Neptune when Engine=neptune (create ops) or when the cluster/instance
// already exists in Neptune storage (describe/modify/delete ops).
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/RegionResolver.java b/src/main/java/io/github/hectorvent/floci/core/common/RegionResolver.java
index dbfaf0abdd..6e43af617e 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/RegionResolver.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/RegionResolver.java
@@ -118,6 +118,10 @@ public class RegionResolver {
return defaultRegion;
}
+ public String getDefaultAccountId() {
+ return defaultAccountId;
+ }
+
/**
* Returns the region for the current request when called from a request context,
* or the configured default region otherwise (async workers, startup, tests).
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 a39063d457..684f253d29 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
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.core.common;
import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.services.appconfig.AppConfigController;
import io.github.hectorvent.floci.services.backup.BackupController;
+import io.github.hectorvent.floci.services.resourceexplorer2.ResourceExplorer2Controller;
import io.github.hectorvent.floci.services.appconfig.AppConfigDataController;
import io.github.hectorvent.floci.services.batch.BatchController;
import io.github.hectorvent.floci.services.bedrockruntime.BedrockRuntimeController;
@@ -397,6 +398,15 @@ public class ResolvedServiceCatalog {
config.storage().services().backup().flushIntervalMs(), null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("backup"), Set.of(), Set.of(BackupController.class)),
+ descriptor("resource-explorer-2", "resourceexplorer2",
+ config.services().resourceexplorer2().enabled(), true,
+ "resourceexplorer2",
+ storageMode(config.storage().services().resourceexplorer2().mode(), config.storage().mode()),
+ config.storage().services().resourceexplorer2().flushIntervalMs(),
+ null, ServiceProtocol.REST_JSON,
+ protocols(ServiceProtocol.REST_JSON),
+ Set.of(), Set.of("resource-explorer-2"), Set.of(),
+ Set.of(ResourceExplorer2Controller.class)),
descriptor("fis", "fis", config.services().fis().enabled(), true,
"fis", storageMode(config.storage().services().fis().mode(), config.storage().mode()),
config.storage().services().fis().flushIntervalMs(), null, ServiceProtocol.REST_JSON,
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/SigV4CredentialScope.java b/src/main/java/io/github/hectorvent/floci/core/common/SigV4CredentialScope.java
index f01c1d6ca0..1dce84d5dc 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/SigV4CredentialScope.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/SigV4CredentialScope.java
@@ -9,14 +9,14 @@ import java.util.regex.Pattern;
* Extracts the SigV4 signing service name from an Authorization header's
* credential scope ({@code Credential=////aws4_request}).
*/
-final class SigV4CredentialScope {
+public final class SigV4CredentialScope {
private static final Pattern SERVICE_PATTERN = Pattern.compile("Credential=\\S+/\\d{8}/[^/]+/([^/]+)/");
private SigV4CredentialScope() {
}
- static Optional serviceName(String authorization) {
+ public static Optional serviceName(String authorization) {
if (authorization == null) {
return Optional.empty();
}
diff --git a/src/main/java/io/github/hectorvent/floci/core/resource/ExplorerResource.java b/src/main/java/io/github/hectorvent/floci/core/resource/ExplorerResource.java
new file mode 100644
index 0000000000..ccd80f89ed
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/core/resource/ExplorerResource.java
@@ -0,0 +1,54 @@
+package io.github.hectorvent.floci.core.resource;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+import java.time.Instant;
+import java.util.Map;
+
+/**
+ * A single resource made visible to Resource Explorer 2.
+ *
+ * One instance describes one AWS resource (a certificate, a queue, a cluster, etc.)
+ *
+ *
The fields are what the query language filters and keywords match against, so they
+ * must be populated with real, consistent values for search to work. Filterable attributes:
+ * {@code resourcetype:}, {@code service:}, {@code region:}, {@code accountid:}, {@code id:} (the
+ * ARN), and the tag attributes ({@code tag:}, {@code tag.key:}, {@code tag.value:},
+ * {@code application:} — the last reads the {@code awsApplication} tag). A bare keyword matches a
+ * case-insensitive substring of {@link #arn}, {@link #resourceType}, {@link #service}, or
+ * {@link #region}. See {@code ResourceFilter} for the exact matching rules.
+ *
+ * @param arn full ARN of the resource, e.g.
+ * {@code arn:aws:acm:us-east-1:123456789012:certificate/abc}. Doubles as the
+ * resource's unique id ({@code id:} filter) and is matched by keyword search.
+ * @param resourceType Resource Explorer's type identifier in {@code service:subtype} form, e.g.
+ * {@code acm:certificate}, {@code kafka:cluster}, {@code iam:user}. Must be
+ * identical to the {@link SupportedResourceType#resourceType()} the provider
+ * advertises for this resource, and unique across all providers.
+ * @param service AWS service namespace — the service segment of the ARN, e.g. {@code acm},
+ * {@code kafka}, {@code cognito-idp}. This is the prefix of
+ * {@link #resourceType}, not necessarily the floci module name.
+ * @param region AWS region the resource lives in, e.g. {@code us-east-1}; usually
+ * {@code AwsArnUtils.parse(arn).region()}.
+ * @param owningAccountId 12-digit account id that owns the resource; usually
+ * {@code AwsArnUtils.parse(arn).accountId()}.
+ * @param lastReportedAt when Resource Explorer last observed the resource. floci has no scan
+ * pipeline, so providers pass the resource's creation timestamp (falling back
+ * to {@code Instant.now()} when unknown).
+ * @param tags resource tags as key→value; drives the tag filters and is emitted as the
+ * {@code tags} property. Never {@code null} — pass {@code Map.of()} when the
+ * resource has no tags.
+ * @see SupportedResourceType
+ * @see AWS API: Resource
+ * @see Resource Explorer search query syntax
+ */
+@RegisterForReflection
+public record ExplorerResource(
+ String arn,
+ String resourceType,
+ String service,
+ String region,
+ String owningAccountId,
+ Instant lastReportedAt,
+ Map tags
+) {}
diff --git a/src/main/java/io/github/hectorvent/floci/core/resource/ResourceProvider.java b/src/main/java/io/github/hectorvent/floci/core/resource/ResourceProvider.java
new file mode 100644
index 0000000000..543c53b4ec
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/core/resource/ResourceProvider.java
@@ -0,0 +1,63 @@
+package io.github.hectorvent.floci.core.resource;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Extension point that lets an individual AWS service emulator expose its resources to the Resource
+ * Explorer 2 emulator. Implement this on a service that owns resources you want to be discoverable
+ * via {@code Search}, {@code ListResources}, and {@code ListSupportedResourceTypes}.
+ *
+ * Implementations must be CDI beans (usually {@code @ApplicationScoped} service classes).
+ * {@code ResourceExplorer2Service} iterates {@code ResourceProvider}s:
+ *
+ * - {@code Search} / {@code ListResources} concatenate {@link #getResources()} from all
+ * providers, apply the query filter, then paginate. {@code Search} returns at most the first
+ * 1000 matches; {@code ListResources} has no such cap and pages through every match, but omits
+ * its {@code NextToken} when {@code MaxResults} is 1000. floci mirrors both behaviors.
+ * - {@code ListSupportedResourceTypes} concatenates {@link #getSupportedResourceTypes()} from
+ * all providers and deduplicates by {@link SupportedResourceType#resourceType()}.
+ *
+ *
+ * Implementing
+ *
+ * - {@link #getResources()}: scan your storage backend and map each stored entity to an
+ * {@link ExplorerResource}.
+ * - {@link #getSupportedResourceTypes()}: return one {@link SupportedResourceType} per distinct
+ * {@code resourceType} string you emit.
+ * - Keep the {@code resourceType} string identical between the two methods — a resource whose
+ * type is not advertised will still be searchable, but callers listing supported types would
+ * not see it, which is inconsistent with AWS.
+ *
+ *
+ * See {@code AcmService}, {@code MskService}, or {@code IamService} (which exposes two types)
+ * for reference implementations.
+ *
+ * @see ExplorerResource
+ * @see SupportedResourceType
+ * @see Resource Explorer terms and concepts
+ * @see AWS API: Search
+ */
+public interface ResourceProvider {
+
+ /**
+ * All resources this service currently own.
+ *
+ * Build the list from live storage rather
+ * than caching. Return an empty list when the service holds nothing; never return {@code null}.
+ * Ordering is not significant — Resource Explorer sorts by ARN before paginating, so an
+ * unordered store scan is safe to return as-is.
+ */
+ List getResources();
+
+ /**
+ * The resource types this provider can produce.
+ *
+ * One entry per distinct
+ * {@link ExplorerResource#resourceType()} value returned by {@link #getResources()}.
+ * The set is fixed for a given service, so returning a
+ * literal {@code Set.of(...)} is the norm. Each {@code resourceType} must be globally unique
+ * across providers.
+ */
+ Set getSupportedResourceTypes();
+}
diff --git a/src/main/java/io/github/hectorvent/floci/core/resource/SupportedResourceType.java b/src/main/java/io/github/hectorvent/floci/core/resource/SupportedResourceType.java
new file mode 100644
index 0000000000..b4e85bfaa7
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/core/resource/SupportedResourceType.java
@@ -0,0 +1,33 @@
+package io.github.hectorvent.floci.core.resource;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+/**
+ * One resource type a {@link ResourceProvider} can produce.
+ *
+ * This is the type-level counterpart to {@link ExplorerResource}
+ * (which is an instance): a provider returns one of these per distinct
+ * {@link ExplorerResource#resourceType()} value it emits.
+ *
+ *
The Resource Explorer 2 service collects these from every provider, deduplicates by {@link #resourceType}.
+ *
+ * @param resourceType type identifier in {@code service:subtype} form, e.g. {@code acm:certificate},
+ * {@code kafka:cluster}, {@code iam:user}. Must exactly match the
+ * {@link ExplorerResource#resourceType()} used for the corresponding resources,
+ * and be unique across all providers — the service uses this string as the
+ * deduplication key.
+ * @param service AWS service namespace, i.e. the segment before the colon in
+ * {@link #resourceType} (e.g. {@code acm}, {@code kafka}, {@code cognito-idp}).
+ * @param supportsTags whether this type carries tags. Advisory metadata describing the type; the
+ * Resource Explorer emulator currently treats every exposed type as taggable
+ * regardless (the {@code resourcetype:supports=tags} filter is a pass-through),
+ * so set it truthfully but do not expect it to gate behavior today.
+ * @see ExplorerResource
+ * @see AWS API: ListSupportedResourceTypes
+ */
+@RegisterForReflection
+public record SupportedResourceType(
+ String resourceType,
+ String service,
+ boolean supportsTags
+) {}
diff --git a/src/main/java/io/github/hectorvent/floci/services/acm/AcmService.java b/src/main/java/io/github/hectorvent/floci/services/acm/AcmService.java
index d6a373e842..7f911e04a9 100644
--- a/src/main/java/io/github/hectorvent/floci/services/acm/AcmService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/acm/AcmService.java
@@ -4,6 +4,9 @@ import io.github.hectorvent.floci.config.EmulatorConfig;
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.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.acm.model.*;
@@ -35,7 +38,7 @@ import java.util.stream.Collectors;
* @see AWS ACM API Reference
*/
@ApplicationScoped
-public class AcmService {
+public class AcmService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(AcmService.class);
private static final int MAX_TAGS = 50;
@@ -481,6 +484,29 @@ public class AcmService {
this.accountDaysBeforeExpiry.set(daysBeforeExpiry);
}
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (Certificate cert : store.scan(k -> true)) {
+ String arn = cert.getArn();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "acm:certificate", "acm",
+ parsed.region(), parsed.accountId(),
+ cert.getCreatedAt() != null ? cert.getCreatedAt() : Instant.now(),
+ cert.getTags() != null ? cert.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("acm:certificate", "acm", true));
+ }
+
// ============ Helper Methods ============
private Certificate getCertificateByArn(String arn, String region) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqService.java b/src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqService.java
index 3308dc3d43..8b51ddd87b 100644
--- a/src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqService.java
@@ -5,6 +5,9 @@ import io.github.hectorvent.floci.config.EmulatorConfig;
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.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
@@ -20,17 +23,19 @@ import jakarta.inject.Inject;
import org.jboss.logging.Logger;
import java.security.SecureRandom;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ApplicationScoped
-public class AmazonMqService {
+public class AmazonMqService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(AmazonMqService.class);
private static final String ENGINE_RABBITMQ = "RABBITMQ";
@@ -154,6 +159,29 @@ public class AmazonMqService {
return storage.scan(k -> true);
}
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (Broker broker : storage.scan(k -> true)) {
+ String arn = broker.getBrokerArn();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "mq:broker", "mq",
+ parsed.region(), parsed.accountId(),
+ broker.getCreated() != null ? broker.getCreated() : Instant.now(),
+ broker.getTags() != null ? broker.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("mq:broker", "mq", true));
+ }
+
public void deleteBroker(String brokerId) {
Broker broker = describeBroker(brokerId);
broker.setBrokerState(BrokerState.DELETION_IN_PROGRESS);
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationService.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationService.java
index 8396fc2dc1..46eecc101f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationService.java
@@ -38,12 +38,19 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* CloudFormation stack lifecycle management — Create, Update, Delete stacks via ChangeSets.
*/
@ApplicationScoped
-public class CloudFormationService {
+public class CloudFormationService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(CloudFormationService.class);
@@ -2063,4 +2070,29 @@ public class CloudFormationService {
private static String key(String stackName, String region) {
return region + ":" + stackName;
}
+
+ // ─── Resource Explorer 2 ───────────────────────────────────────────────────
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (Stack stack : stacks.values()) {
+ String arn = stack.getStackId();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "cloudformation:stack", "cloudformation",
+ parsed.region(), parsed.accountId(),
+ stack.getCreationTime() != null ? stack.getCreationTime() : Instant.now(),
+ stack.getTags() != null ? stack.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("cloudformation:stack", "cloudformation", true));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsService.java b/src/main/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsService.java
index faa70c4e9c..e18e8d215e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsService.java
@@ -29,9 +29,14 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.LongSupplier;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
+import java.time.Instant;
+import java.util.Set;
@ApplicationScoped
-public class CloudWatchLogsService {
+public class CloudWatchLogsService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(CloudWatchLogsService.class);
@@ -967,4 +972,39 @@ public class CloudWatchLogsService {
return defaultValue;
}
}
+
+ // ─── Resource Explorer 2 ───────────────────────────────────────────────────
+
+ /**
+ * Log groups carry no Region of their own — the store keys them {@code region::name} — so the
+ * key is the only place the Region can come from.
+ */
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (String key : groupStore.keys()) {
+ int separator = key.indexOf("::");
+ if (separator < 0) {
+ continue;
+ }
+ LogGroup group = groupStore.get(key).orElse(null);
+ if (group == null || group.getLogGroupName() == null) {
+ continue;
+ }
+ String region = key.substring(0, separator);
+ resources.add(new ExplorerResource(
+ "arn:aws:logs:" + region + ":" + regionResolver.getAccountId()
+ + ":log-group:" + group.getLogGroupName() + ":*",
+ "logs:log-group", "logs",
+ region, regionResolver.getAccountId(),
+ group.getCreatedTime() > 0 ? Instant.ofEpochMilli(group.getCreatedTime()) : Instant.now(),
+ group.getTags() != null ? group.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("logs:log-group", "logs", true));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java
index 93e80e2ac9..7d40eed1c4 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java
@@ -10,6 +10,9 @@ 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.ReservedTags;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.cognito.model.CognitoGroup;
@@ -48,6 +51,7 @@ import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.time.Clock;
import java.time.Duration;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
@@ -66,7 +70,7 @@ import java.util.UUID;
import static io.github.hectorvent.floci.core.common.ReservedTags.rejectUnknownReservedTags;
@ApplicationScoped
-public class CognitoService {
+public class CognitoService implements ResourceProvider {
private static final int DEFAULT_REFRESH_TOKEN_VALIDITY_DAYS = 30;
private static final Logger LOG = Logger.getLogger(CognitoService.class);
@@ -313,6 +317,29 @@ public class CognitoService {
return poolStore.scan(k -> true);
}
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (UserPool pool : poolStore.scan(k -> true)) {
+ String arn = pool.getArn();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "cognito-idp:userpool", "cognito-idp",
+ parsed.region(), parsed.accountId(),
+ pool.getCreationDate() > 0 ? Instant.ofEpochSecond(pool.getCreationDate()) : Instant.now(),
+ pool.getUserPoolTags() != null ? pool.getUserPoolTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("cognito-idp:userpool", "cognito-idp", true));
+ }
+
private UserPool describeUserPoolByArn(String resourceArn) {
String poolId = extractUserPoolIdFromArn(resourceArn);
return describeUserPool(poolId);
diff --git a/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java b/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java
index 59e1dfd740..92f0ff3f5e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java
@@ -49,9 +49,12 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Supplier;
import java.util.zip.GZIPOutputStream;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
@ApplicationScoped
-public class DynamoDbService {
+public class DynamoDbService implements ResourceProvider {
private static final String LOCAL_REPLICA_UPDATE_ERROR =
"Cannot add, delete, or update the local region through ReplicaUpdates. "
@@ -3014,4 +3017,26 @@ public class DynamoDbService {
return new ListExportsResult(summaries, newNextToken);
}
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (TableDefinition table : tableStore.scan(k -> true)) {
+ if (table.getTableArn() == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(table.getTableArn());
+ resources.add(new ExplorerResource(
+ table.getTableArn(), "dynamodb:table", "dynamodb",
+ parsed.region(), parsed.accountId(),
+ table.getCreationDateTime() != null ? table.getCreationDateTime() : Instant.now(),
+ table.getTags() != null ? table.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("dynamodb:table", "dynamodb", true));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2Service.java b/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2Service.java
index 8a2d4cc67b..f0a4301f4c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2Service.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2Service.java
@@ -20,6 +20,7 @@ import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -31,6 +32,9 @@ import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.AwsRegions;
import io.github.hectorvent.floci.core.common.ContainerTeardown;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.InMemoryStorage;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
@@ -95,7 +99,7 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
@ApplicationScoped
-public class Ec2Service implements ContainerTeardown {
+public class Ec2Service implements ContainerTeardown, ResourceProvider {
private static final Logger LOG = Logger.getLogger(Ec2Service.class);
private static final DateTimeFormatter ISO_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@@ -5527,4 +5531,80 @@ public class Ec2Service implements ContainerTeardown {
return result;
}
+
+ // ─── Resource Explorer 2 ───────────────────────────────────────────────────
+
+ /**
+ * The EC2 resources Resource Explorer indexes. Each store is scanned across every Region,
+ * because a provider answers for the whole emulator rather than for the request's Region.
+ *
+ * Types not listed here — images, snapshots, key pairs, transit gateways — are omitted
+ * deliberately: they are either AWS-owned catalogue entries rather than account resources, or
+ * carry no tags and no identity worth searching on.
+ */
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ collectExplorerResources(resources, instances.scan(k -> true), "instance",
+ Instance::getInstanceId, Instance::getRegion, Instance::getLaunchTime, Instance::getTags);
+ collectExplorerResources(resources, vpcs.scan(k -> true), "vpc",
+ Vpc::getVpcId, Vpc::getRegion, v -> null, Vpc::getTags);
+ collectExplorerResources(resources, subnets.scan(k -> true), "subnet",
+ Subnet::getSubnetId, Subnet::getRegion, s -> null, Subnet::getTags);
+ collectExplorerResources(resources, securityGroups.scan(k -> true), "security-group",
+ SecurityGroup::getGroupId, SecurityGroup::getRegion, g -> null, SecurityGroup::getTags);
+ collectExplorerResources(resources, volumes.scan(k -> true), "volume",
+ Volume::getVolumeId, Volume::getRegion, Volume::getCreateTime, Volume::getTags);
+ collectExplorerResources(resources, internetGateways.scan(k -> true), "internet-gateway",
+ InternetGateway::getInternetGatewayId, InternetGateway::getRegion, g -> null, InternetGateway::getTags);
+ collectExplorerResources(resources, natGateways.scan(k -> true), "natgateway",
+ NatGateway::getNatGatewayId, NatGateway::getRegion, NatGateway::getCreateTime, NatGateway::getTags);
+ collectExplorerResources(resources, routeTables.scan(k -> true), "route-table",
+ RouteTable::getRouteTableId, RouteTable::getRegion, t -> null, RouteTable::getTags);
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(
+ new SupportedResourceType("ec2:instance", "ec2", true),
+ new SupportedResourceType("ec2:vpc", "ec2", true),
+ new SupportedResourceType("ec2:subnet", "ec2", true),
+ new SupportedResourceType("ec2:security-group", "ec2", true),
+ new SupportedResourceType("ec2:volume", "ec2", true),
+ new SupportedResourceType("ec2:internet-gateway", "ec2", true),
+ new SupportedResourceType("ec2:natgateway", "ec2", true),
+ new SupportedResourceType("ec2:route-table", "ec2", true));
+ }
+
+ private void collectExplorerResources(List out, List stored, String resourceType,
+ Function id, Function region,
+ Function createdAt, Function> tags) {
+ for (T resource : stored) {
+ String resourceId = id.apply(resource);
+ String resourceRegion = region.apply(resource);
+ if (resourceId == null || resourceRegion == null) {
+ continue;
+ }
+ Instant created = createdAt.apply(resource);
+ out.add(new ExplorerResource(
+ "arn:aws:ec2:" + resourceRegion + ":" + accountId + ":" + resourceType + "/" + resourceId,
+ "ec2:" + resourceType, "ec2", resourceRegion, accountId,
+ created != null ? created : Instant.now(),
+ explorerTags(tags.apply(resource))));
+ }
+ }
+
+ private static Map explorerTags(List tags) {
+ if (tags == null) {
+ return Map.of();
+ }
+ Map converted = new LinkedHashMap<>();
+ for (Tag tag : tags) {
+ if (tag.getKey() != null) {
+ converted.put(tag.getKey(), tag.getValue() != null ? tag.getValue() : "");
+ }
+ }
+ return converted;
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/ecr/EcrService.java b/src/main/java/io/github/hectorvent/floci/services/ecr/EcrService.java
index 9eaa765c52..476362f4b1 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ecr/EcrService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ecr/EcrService.java
@@ -4,6 +4,9 @@ import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.ecr.model.AuthorizationData;
@@ -26,10 +29,11 @@ import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.regex.Pattern;
@ApplicationScoped
-public class EcrService {
+public class EcrService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(EcrService.class);
private static final Pattern REPO_NAME = Pattern.compile(
@@ -485,6 +489,29 @@ public class EcrService {
return repo;
}
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (Repository repo : repoStore.scan(k -> true)) {
+ String arn = repo.getRepositoryArn();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "ecr:repository", "ecr",
+ parsed.region(), parsed.accountId(),
+ repo.getCreatedAt() != null ? repo.getCreatedAt() : Instant.now(),
+ repo.getTags() != null ? repo.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("ecr:repository", "ecr", true));
+ }
+
// ============================================================
// Result records
// ============================================================
diff --git a/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java b/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java
index 385b0bd5c0..ef3e3d5cd7 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java
@@ -50,9 +50,14 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
+import io.github.hectorvent.floci.core.common.AwsArnUtils;
+import java.util.Set;
@ApplicationScoped
-public class EcsService implements ContainerTeardown {
+public class EcsService implements ContainerTeardown, ResourceProvider {
private static final Logger LOG = Logger.getLogger(EcsService.class);
private static final String DEFAULT_CLUSTER = "default";
@@ -1776,4 +1781,38 @@ public class EcsService implements ContainerTeardown {
int slash = after.indexOf('/');
return slash >= 0 ? after.substring(0, slash) : after;
}
+
+ // ─── Resource Explorer 2 ───────────────────────────────────────────────────
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (EcsCluster cluster : clusters.values()) {
+ addExplorerResource(resources, cluster.getClusterArn(), "ecs:cluster", null, cluster.getTags());
+ }
+ for (EcsServiceModel service : services.values()) {
+ addExplorerResource(resources, service.getServiceArn(), "ecs:service",
+ service.getCreatedAt(), service.getTags());
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(
+ new SupportedResourceType("ecs:cluster", "ecs", true),
+ new SupportedResourceType("ecs:service", "ecs", true));
+ }
+
+ private static void addExplorerResource(List out, String arn, String resourceType,
+ Instant createdAt, Map tags) {
+ if (arn == null) {
+ return;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ out.add(new ExplorerResource(arn, resourceType, "ecs",
+ parsed.region(), parsed.accountId(),
+ createdAt != null ? createdAt : Instant.now(),
+ tags != null ? tags : Map.of()));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/eks/EksService.java b/src/main/java/io/github/hectorvent/floci/services/eks/EksService.java
index 98ac02c95e..35d7b109c1 100644
--- a/src/main/java/io/github/hectorvent/floci/services/eks/EksService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/eks/EksService.java
@@ -42,9 +42,13 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
+import java.util.Set;
@ApplicationScoped
-public class EksService implements TagHandler {
+public class EksService implements TagHandler, ResourceProvider {
private static final Logger LOG = Logger.getLogger(EksService.class);
@@ -571,4 +575,29 @@ public class EksService implements TagHandler {
storage.put(cluster.getName(), cluster);
}
}
+
+ // ─── Resource Explorer 2 ───────────────────────────────────────────────────
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (Cluster cluster : storage.scan(k -> true)) {
+ String arn = cluster.getArn();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "eks:cluster", "eks",
+ parsed.region(), parsed.accountId(),
+ cluster.getCreatedAt() != null ? cluster.getCreatedAt() : Instant.now(),
+ cluster.getTags() != null ? cluster.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("eks:cluster", "eks", true));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheQueryHandler.java
index 3b1edf357e..a20ae29c3d 100644
--- a/src/main/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheQueryHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheQueryHandler.java
@@ -51,11 +51,11 @@ public class ElastiCacheQueryHandler {
this.regionResolver = regionResolver;
}
- public Response handle(String action, MultivaluedMap params) {
+ public Response handle(String action, MultivaluedMap params, String region) {
LOG.debugv("ElastiCache action: {0}", action);
return switch (action) {
case "ValidateIamAuthToken" -> handleValidateIamAuthToken(params);
- case "CreateReplicationGroup" -> handleCreateReplicationGroup(params);
+ case "CreateReplicationGroup" -> handleCreateReplicationGroup(params, region);
case "DescribeReplicationGroups" -> handleDescribeReplicationGroups(params);
case "ModifyReplicationGroup" -> handleModifyReplicationGroup(params);
case "DeleteReplicationGroup" -> handleDeleteReplicationGroup(params);
@@ -83,7 +83,7 @@ public class ElastiCacheQueryHandler {
// ── Replication Groups ────────────────────────────────────────────────────
- private Response handleCreateReplicationGroup(MultivaluedMap params) {
+ private Response handleCreateReplicationGroup(MultivaluedMap params, String region) {
String groupId = params.getFirst("ReplicationGroupId");
String description = params.getFirst("ReplicationGroupDescription");
String authToken = params.getFirst("AuthToken");
@@ -105,7 +105,7 @@ public class ElastiCacheQueryHandler {
try {
ReplicationGroup group = service.createReplicationGroup(
- groupId, description != null ? description : "", authMode, authToken);
+ groupId, description != null ? description : "", authMode, authToken, region);
String result = replicationGroupXml(group);
return Response.ok(AwsQueryResponse.envelope("CreateReplicationGroup", AwsNamespaces.EC, result)).build();
} catch (AwsException e) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheService.java b/src/main/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheService.java
index fa9c9631aa..2bb19d0dab 100644
--- a/src/main/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheService.java
@@ -2,8 +2,12 @@ package io.github.hectorvent.floci.services.elasticache;
import com.fasterxml.jackson.core.type.TypeReference;
import io.github.hectorvent.floci.config.EmulatorConfig;
+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.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.elasticache.container.ElastiCacheContainerHandle;
@@ -38,7 +42,7 @@ import java.util.regex.Pattern;
* Creates Valkey containers and auth proxies on group creation.
*/
@ApplicationScoped
-public class ElastiCacheService {
+public class ElastiCacheService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(ElastiCacheService.class);
@@ -78,7 +82,7 @@ public class ElastiCacheService {
}
public ReplicationGroup createReplicationGroup(String groupId, String description,
- AuthMode authMode, String authToken) {
+ AuthMode authMode, String authToken, String region) {
if (groups.get(groupId).isPresent()) {
throw new AwsException("ReplicationGroupAlreadyExistsFault",
"Replication group " + groupId + " already exists.", 400);
@@ -110,6 +114,8 @@ public class ElastiCacheService {
group.setContainerHost(handle.getHost());
group.setContainerPort(handle.getPort());
group.setAuthToken(authToken);
+ group.setArn(regionResolver.buildArn("elasticache", region, "replicationgroup:" + groupId));
+ group.setRegion(region);
proxyManager.startProxy(groupId, authMode, proxyPort,
handle.getHost(), handle.getPort(),
@@ -610,4 +616,26 @@ public class ElastiCacheService {
}
LOG.infov("Deleted cache parameter group {0}", name);
}
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (ReplicationGroup group : groups.scan(k -> true)) {
+ if (group.getArn() == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(group.getArn());
+ resources.add(new ExplorerResource(
+ group.getArn(), "elasticache:cluster", "elasticache",
+ parsed.region(), parsed.accountId(),
+ group.getCreatedAt() != null ? group.getCreatedAt() : Instant.now(),
+ Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("elasticache:cluster", "elasticache", true));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/elasticache/model/ReplicationGroup.java b/src/main/java/io/github/hectorvent/floci/services/elasticache/model/ReplicationGroup.java
index 3effd18ec9..ca2197913f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/elasticache/model/ReplicationGroup.java
+++ b/src/main/java/io/github/hectorvent/floci/services/elasticache/model/ReplicationGroup.java
@@ -18,6 +18,8 @@ public class ReplicationGroup {
private int proxyPort;
private String authToken; // stored plain-text for PASSWORD auth validation in the proxy
private Set associatedUserIds = new HashSet<>();
+ private String arn;
+ private String region;
// Transient fields — not persisted, restored on container restart
private transient String containerId;
@@ -75,4 +77,10 @@ public class ReplicationGroup {
public int getContainerPort() { return containerPort; }
public void setContainerPort(int containerPort) { this.containerPort = containerPort; }
+
+ public String getArn() { return arn; }
+ public void setArn(String arn) { this.arn = arn; }
+
+ public String getRegion() { return region; }
+ public void setRegion(String region) { this.region = region; }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2Service.java b/src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2Service.java
index 6936ccd34b..99e9532c17 100644
--- a/src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2Service.java
+++ b/src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2Service.java
@@ -19,9 +19,16 @@ import java.time.Instant;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
@ApplicationScoped
-public class ElbV2Service {
+public class ElbV2Service implements ResourceProvider {
@Inject
ElbV2DataPlane dataPlane;
@@ -1145,4 +1152,43 @@ public class ElbV2Service {
}
}
}
+
+ // ─── Resource Explorer 2 ───────────────────────────────────────────────────
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (Map regionLoadBalancers : loadBalancers.values()) {
+ for (LoadBalancer loadBalancer : regionLoadBalancers.values()) {
+ addExplorerResource(resources, loadBalancer.getLoadBalancerArn(),
+ "elasticloadbalancing:loadbalancer", loadBalancer.getCreatedTime());
+ }
+ }
+ for (Map regionTargetGroups : targetGroups.values()) {
+ for (TargetGroup targetGroup : regionTargetGroups.values()) {
+ addExplorerResource(resources, targetGroup.getTargetGroupArn(),
+ "elasticloadbalancing:targetgroup", null);
+ }
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(
+ new SupportedResourceType("elasticloadbalancing:loadbalancer", "elasticloadbalancing", true),
+ new SupportedResourceType("elasticloadbalancing:targetgroup", "elasticloadbalancing", true));
+ }
+
+ private void addExplorerResource(List out, String arn, String resourceType,
+ Instant createdAt) {
+ if (arn == null) {
+ return;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ out.add(new ExplorerResource(arn, resourceType, "elasticloadbalancing",
+ parsed.region(), parsed.accountId(),
+ createdAt != null ? createdAt : Instant.now(),
+ tags.getOrDefault(arn, Map.of())));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java b/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
index 89b2da08be..0bbe0a5390 100644
--- a/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
@@ -39,9 +39,13 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Pattern;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
+import java.util.Set;
@ApplicationScoped
-public class EventBridgeService {
+public class EventBridgeService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(EventBridgeService.class);
@@ -1579,4 +1583,38 @@ public class EventBridgeService {
}
}
+ // ─── Resource Explorer 2 ───────────────────────────────────────────────────
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (EventBus bus : busStore.scan(k -> true)) {
+ addExplorerResource(resources, bus.getArn(), "events:event-bus",
+ bus.getCreatedTime(), bus.getTags());
+ }
+ for (Rule rule : ruleStore.scan(k -> true)) {
+ addExplorerResource(resources, rule.getArn(), "events:rule",
+ rule.getCreatedAt(), rule.getTags());
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(
+ new SupportedResourceType("events:event-bus", "events", true),
+ new SupportedResourceType("events:rule", "events", true));
+ }
+
+ private static void addExplorerResource(List out, String arn, String resourceType,
+ Instant createdAt, Map tags) {
+ if (arn == null) {
+ return;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ out.add(new ExplorerResource(arn, resourceType, "events",
+ parsed.region(), parsed.accountId(),
+ createdAt != null ? createdAt : Instant.now(),
+ tags != null ? tags : Map.of()));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/firehose/FirehoseService.java b/src/main/java/io/github/hectorvent/floci/services/firehose/FirehoseService.java
index 788f1acd1f..62812ce544 100644
--- a/src/main/java/io/github/hectorvent/floci/services/firehose/FirehoseService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/firehose/FirehoseService.java
@@ -28,9 +28,17 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
+import java.util.LinkedHashMap;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
@ApplicationScoped
-public class FirehoseService {
+public class FirehoseService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(FirehoseService.class);
private static final String DEFAULT_BUCKET = "floci-firehose-results";
@@ -416,4 +424,35 @@ public class FirehoseService {
s3Service.createBucket(bucket, regionResolver.getDefaultRegion());
} catch (Exception ignored) {}
}
+
+ // ─── Resource Explorer 2 ───────────────────────────────────────────────────
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (DeliveryStreamDescription stream : streamStore.scan(k -> true)) {
+ String arn = stream.getDeliveryStreamARN();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ Map tags = new LinkedHashMap<>();
+ if (stream.getTags() != null) {
+ for (DeliveryStreamDescription.Tag tag : stream.getTags()) {
+ tags.put(tag.getKey(), tag.getValue() != null ? tag.getValue() : "");
+ }
+ }
+ resources.add(new ExplorerResource(
+ arn, "firehose:deliverystream", "firehose",
+ parsed.region(), parsed.accountId(),
+ stream.getCreateTimestamp() != null ? stream.getCreateTimestamp() : Instant.now(),
+ tags));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("firehose:deliverystream", "firehose", true));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java b/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java
index 5728d30fbb..d88bbe3378 100644
--- a/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java
@@ -5,6 +5,9 @@ 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.SessionAccountLookup;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
import io.github.hectorvent.floci.core.storage.InMemoryStorage;
import io.github.hectorvent.floci.core.storage.StorageBackend;
@@ -28,6 +31,7 @@ import org.jboss.logging.Logger;
import java.time.Instant;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -48,7 +52,7 @@ import java.util.regex.Pattern;
*/
@Startup
@ApplicationScoped
-public class IamService implements SessionAccountLookup {
+public class IamService implements SessionAccountLookup, ResourceProvider {
private static final Logger LOG = Logger.getLogger(IamService.class);
private static final String CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
@@ -1269,6 +1273,43 @@ public class IamService implements SessionAccountLookup {
.toList();
}
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (IamUser user : users.scan(k -> true)) {
+ addIamResource(resources, user.getArn(), "iam:user", user.getCreateDate(), user.getTags());
+ }
+ for (IamRole role : roles.scan(k -> true)) {
+ addIamResource(resources, role.getArn(), "iam:role", role.getCreateDate(), role.getTags());
+ }
+ return resources;
+ }
+
+ private void addIamResource(List out, String arn, String type,
+ Instant createDate, Map tags) {
+ if (arn == null) {
+ return;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ // IAM is a global service: its ARNs carry no region. Resource Explorer reports
+ // global resources with the region "global" (not an empty string).
+ String region = parsed.region() == null || parsed.region().isEmpty()
+ ? "global"
+ : parsed.region();
+ out.add(new ExplorerResource(
+ arn, type, "iam",
+ region, parsed.accountId(),
+ createDate != null ? createDate : Instant.now(),
+ tags != null ? tags : Map.of()));
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(
+ new SupportedResourceType("iam:user", "iam", true),
+ new SupportedResourceType("iam:role", "iam", true));
+ }
+
// =========================================================================
// Account Aliases
// ==================================================================
diff --git a/src/main/java/io/github/hectorvent/floci/services/kinesis/KinesisService.java b/src/main/java/io/github/hectorvent/floci/services/kinesis/KinesisService.java
index 78ee4cd864..72b4ba42d3 100644
--- a/src/main/java/io/github/hectorvent/floci/services/kinesis/KinesisService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/kinesis/KinesisService.java
@@ -18,9 +18,15 @@ import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
+import io.github.hectorvent.floci.core.common.AwsArnUtils;
+import java.util.ArrayList;
+import java.util.Set;
@ApplicationScoped
-public class KinesisService {
+public class KinesisService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(KinesisService.class);
private static final Set VALID_SHARD_LEVEL_METRICS = Set.of(
"IncomingBytes", "IncomingRecords", "OutgoingBytes", "OutgoingRecords",
@@ -779,4 +785,30 @@ public class KinesisService {
private String regionKey(String region, String name) {
return region + "::" + name;
}
+
+ // ─── Resource Explorer 2 ───────────────────────────────────────────────────
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (KinesisStream stream : store.scan(k -> true)) {
+ String arn = stream.getStreamArn();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "kinesis:stream", "kinesis",
+ parsed.region(), parsed.accountId(),
+ stream.getStreamCreationTimestamp() != null
+ ? stream.getStreamCreationTimestamp() : Instant.now(),
+ stream.getTags() != null ? stream.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("kinesis:stream", "kinesis", true));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java b/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java
index 225f688b1c..7d113332ff 100644
--- a/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java
@@ -1,9 +1,13 @@
package io.github.hectorvent.floci.services.kms;
import com.fasterxml.jackson.core.type.TypeReference;
+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.ReservedTags;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.kms.model.KmsAlias;
@@ -58,7 +62,7 @@ import static io.github.hectorvent.floci.services.kms.model.KmsMessageType.DIGES
import static io.github.hectorvent.floci.services.kms.model.KmsMessageType.RAW;
@ApplicationScoped
-public class KmsService {
+public class KmsService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(KmsService.class);
@@ -1165,4 +1169,26 @@ public class KmsService {
}
}
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (KmsKey key : keyStore.scan(k -> true)) {
+ String arn = key.getArn();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "kms:key", "kms",
+ parsed.region(), parsed.accountId(),
+ key.getCreationDate() > 0 ? Instant.ofEpochSecond(key.getCreationDate()) : Instant.now(),
+ key.getTags() != null ? key.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("kms:key", "kms", true));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java
index c4cd479e42..2a5de66562 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java
@@ -7,6 +7,9 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.storage.StorageBackedMap;
import io.github.hectorvent.floci.core.storage.StorageFactory;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.services.lambda.model.EventSourceMapping;
import io.github.hectorvent.floci.services.lambda.model.FunctionEventInvokeConfig;
import io.github.hectorvent.floci.services.lambda.model.InvocationType;
@@ -39,6 +42,7 @@ import java.util.Base64;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
@@ -47,7 +51,7 @@ import java.util.regex.Pattern;
* Business logic for Lambda function management and invocation.
*/
@ApplicationScoped
-public class LambdaService {
+public class LambdaService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(LambdaService.class);
private static final Pattern EFS_ACCESS_POINT_ARN = Pattern.compile(
@@ -252,6 +256,32 @@ public class LambdaService {
}
}
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (LambdaFunction fn : functionStore.listAll()) {
+ if (!"$LATEST".equals(fn.getVersion())) {
+ continue;
+ }
+ String arn = fn.getFunctionArn();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "lambda:function", "lambda",
+ parsed.region(), parsed.accountId(),
+ fn.getLastModified() > 0 ? Instant.ofEpochMilli(fn.getLastModified()) : Instant.now(),
+ fn.getTags() != null ? fn.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("lambda:function", "lambda", true));
+ }
+
public LambdaFunction createFunction(String region, Map request) {
String functionName = (String) request.get("FunctionName");
String role = (String) request.get("Role");
diff --git a/src/main/java/io/github/hectorvent/floci/services/lightsail/LightsailService.java b/src/main/java/io/github/hectorvent/floci/services/lightsail/LightsailService.java
index 235a052655..73508a3489 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lightsail/LightsailService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lightsail/LightsailService.java
@@ -5,8 +5,12 @@ 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.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import jakarta.enterprise.context.ApplicationScoped;
@@ -17,12 +21,14 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Comparator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.UUID;
@ApplicationScoped
-public class LightsailService {
+public class LightsailService implements ResourceProvider {
private static final String SERVICE = "lightsail";
private static final String RESOURCE_INSTANCE = "Instance";
@@ -497,6 +503,53 @@ public class LightsailService {
return mapper.createObjectNode().put("isPeered", false);
}
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (ObjectNode node : resourceStore.scan(key -> true)) {
+ String arn = node.path("arn").asText(null);
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn,
+ SERVICE + ":" + node.path("resourceType").asText(),
+ SERVICE,
+ parsed.region(),
+ parsed.accountId(),
+ reportedAt(node),
+ tagsOf(node)));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(
+ new SupportedResourceType(SERVICE + ":" + RESOURCE_INSTANCE, SERVICE, true),
+ new SupportedResourceType(SERVICE + ":" + RESOURCE_DISK, SERVICE, true),
+ new SupportedResourceType(SERVICE + ":" + RESOURCE_KEY_PAIR, SERVICE, true),
+ // Lightsail static IPs are not taggable in AWS.
+ new SupportedResourceType(SERVICE + ":" + RESOURCE_STATIC_IP, SERVICE, false));
+ }
+
+ private static Instant reportedAt(ObjectNode node) {
+ double createdAt = node.path("createdAt").asDouble(0);
+ return createdAt > 0 ? Instant.ofEpochMilli(Math.round(createdAt * 1000)) : Instant.now();
+ }
+
+ private static Map tagsOf(ObjectNode node) {
+ Map tags = new LinkedHashMap<>();
+ for (JsonNode tag : node.path("tags")) {
+ String key = tag.path("key").asText(null);
+ if (key != null) {
+ tags.put(key, tag.path("value").asText(""));
+ }
+ }
+ return tags;
+ }
+
private ObjectNode baseResource(String region, String availabilityZone, String resourceType, String name) {
Instant now = Instant.now();
ObjectNode resource = mapper.createObjectNode();
diff --git a/src/main/java/io/github/hectorvent/floci/services/msk/MskService.java b/src/main/java/io/github/hectorvent/floci/services/msk/MskService.java
index e26e41bbbf..f27bd831a7 100644
--- a/src/main/java/io/github/hectorvent/floci/services/msk/MskService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/msk/MskService.java
@@ -6,6 +6,9 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.Pagination;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.RegionResolver;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
@@ -24,15 +27,17 @@ import org.jboss.logging.Logger;
import java.security.SecureRandom;
import java.time.Instant;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ApplicationScoped
-public class MskService {
+public class MskService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(MskService.class);
private static final String DEFAULT_KAFKA_VERSION = "3.6.0";
@@ -279,4 +284,27 @@ public class MskService {
storage.put(cluster.getClusterArn(), cluster);
}
}
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (MskCluster cluster : storage.scan(k -> true)) {
+ String arn = cluster.getClusterArn();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "kafka:cluster", "kafka",
+ parsed.region(), parsed.accountId(),
+ cluster.getCreationTime() != null ? cluster.getCreationTime() : Instant.now(),
+ cluster.getTags() != null ? cluster.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("kafka:cluster", "kafka", true));
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/opensearch/OpenSearchService.java b/src/main/java/io/github/hectorvent/floci/services/opensearch/OpenSearchService.java
index a9efa87fed..d99840672c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/opensearch/OpenSearchService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/opensearch/OpenSearchService.java
@@ -24,14 +24,19 @@ import org.jboss.logging.Logger;
import java.security.SecureRandom;
import java.time.Instant;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
@ApplicationScoped
-public class OpenSearchService {
+public class OpenSearchService implements ResourceProvider {
private static final Logger LOG = Logger.getLogger(OpenSearchService.class);
@@ -366,4 +371,26 @@ public class OpenSearchService {
domainStore.put(domain.getDomainName(), domain);
}
}
+
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (Domain domain : listDomainNames(null)) {
+ if (domain.getArn() == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(domain.getArn());
+ resources.add(new ExplorerResource(
+ domain.getArn(), "es:domain", "es",
+ parsed.region(), parsed.accountId(),
+ domain.getCreatedAt() != null ? domain.getCreatedAt() : Instant.now(),
+ domain.getTags() != null ? domain.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("es:domain", "es", true));
+ }
}
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
index ea212b32b6..a846757300 100644
--- a/src/main/java/io/github/hectorvent/floci/services/pipes/PipesService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/pipes/PipesService.java
@@ -4,6 +4,9 @@ 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.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
@@ -17,13 +20,15 @@ import jakarta.inject.Inject;
import org.jboss.logging.Logger;
import java.time.Instant;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
@ApplicationScoped
-public class PipesService implements TagHandler {
+public class PipesService implements TagHandler, ResourceProvider {
private static final Logger LOG = Logger.getLogger(PipesService.class);
@@ -204,6 +209,29 @@ public class PipesService implements TagHandler {
return pipe;
}
+ @Override
+ public List getResources() {
+ List resources = new ArrayList<>();
+ for (Pipe pipe : storage.scan(k -> true)) {
+ String arn = pipe.getArn();
+ if (arn == null) {
+ continue;
+ }
+ AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
+ resources.add(new ExplorerResource(
+ arn, "pipes:pipe", "pipes",
+ parsed.region(), parsed.accountId(),
+ pipe.getCreationTime() != null ? pipe.getCreationTime() : Instant.now(),
+ pipe.getTags() != null ? pipe.getTags() : Map.of()));
+ }
+ return resources;
+ }
+
+ @Override
+ public Set getSupportedResourceTypes() {
+ return Set.of(new SupportedResourceType("pipes:pipe", "pipes", true));
+ }
+
@Override
public String serviceKey() {
return "pipes";
diff --git a/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java b/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java
index 47e6a20f30..c6fc2a4173 100644
--- a/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java
@@ -10,6 +10,9 @@ import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.docker.ContainerStorageHelper;
import io.github.hectorvent.floci.core.common.docker.CurrentContainerNetworkResolver;
import io.github.hectorvent.floci.core.common.docker.DockerHostResolver;
+import io.github.hectorvent.floci.core.resource.ExplorerResource;
+import io.github.hectorvent.floci.core.resource.ResourceProvider;
+import io.github.hectorvent.floci.core.resource.SupportedResourceType;
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
import io.github.hectorvent.floci.core.storage.InMemoryStorage;
import io.github.hectorvent.floci.core.storage.StorageBackend;
@@ -33,6 +36,7 @@ import io.github.hectorvent.floci.services.rds.model.DbSubnetGroup;
import io.github.hectorvent.floci.services.rds.model.OptionGroup;
import io.github.hectorvent.floci.services.rds.model.OptionGroupOption;
import io.github.hectorvent.floci.services.rds.proxy.RdsProxyManager;
+import io.github.hectorvent.floci.services.resourcegroupstagging.ResourceGroupsTaggingService;
import io.github.hectorvent.floci.services.secretsmanager.SecretsManagerService;
import io.github.hectorvent.floci.services.secretsmanager.model.Secret;
import io.github.hectorvent.floci.core.common.Resettable;
@@ -61,7 +65,7 @@ import java.util.regex.Pattern;
* Starts DB containers and auth proxies on creation.
*/
@ApplicationScoped
-public class RdsService implements Resettable {
+public class RdsService implements Resettable, ResourceProvider {
private static final Logger LOG = Logger.getLogger(RdsService.class);
private static final ObjectMapper JSON = new ObjectMapper();
@@ -132,6 +136,7 @@ public class RdsService implements Resettable {
private final SecretsManagerService secretsManagerService;
private final DockerHostResolver dockerHostResolver;
private final CurrentContainerNetworkResolver currentContainerNetworkResolver;
+ private final ResourceGroupsTaggingService taggingService;
private final Set usedPorts = ConcurrentHashMap.newKeySet();
private static final Pattern IMAGE_TAG_VERSION_PATTERN = Pattern.compile("^(\\d+(?:\\.\\d+)*)(.*)$");
private static final Pattern SAFE_IMAGE_TAG_PATTERN = Pattern.compile("[A-Za-z0-9._-]+");
@@ -163,7 +168,8 @@ public class RdsService implements Resettable {
StorageFactory storageFactory,
SecretsManagerService secretsManagerService,
DockerHostResolver dockerHostResolver,
- CurrentContainerNetworkResolver currentContainerNetworkResolver) {
+ CurrentContainerNetworkResolver currentContainerNetworkResolver,
+ ResourceGroupsTaggingService taggingService) {
this.containerManager = containerManager;
this.proxyManager = proxyManager;
this.ec2Service = ec2Service;
@@ -172,6 +178,7 @@ public class RdsService implements Resettable {
this.secretsManagerService = secretsManagerService;
this.dockerHostResolver = dockerHostResolver;
this.currentContainerNetworkResolver = currentContainerNetworkResolver;
+ this.taggingService = taggingService;
this.instances = storageFactory.create("rds", "rds-instances.json",
new TypeReference