feat(appsync): Phase 2 — Schema Registry, Model Fixes, CRUDL completion & AWS Scalars (#1185)

* build: add graphql-java dependency

* feat(appsync): add and extend data models for Phase 2

- Add AdditionalAuthenticationProvider, DomainName, ChannelNamespace, ApiAssociation models
- Add 14 fields to GraphqlApi (apiType, visibility, owner, etc.)
- Change additionalAuthenticationProviders from raw maps to typed list
- Add 6 fields to Resolver (resolverArn, cachingConfig, maxBatchSize, etc.)
- Add dataSourceArn to DataSource
- Rename FunctionConfiguration.arn to functionArn

* feat(appsync): add service and controller changes for Phase 2

* feat(appsync): add service and controller changes for Phase 2

* test(appsync): add Phase 2 integration tests

Add ~60 new tests for:
- Model completeness (new fields, ARNs, functionArn rename)
- Domain names CRUDL + associate/disassociate
- Channel namespaces CRUDL + update
- Merged API associations CRUDL
- Enhanced metrics
- Schema registry parsing with AWS scalars and extensions
- Directive registration (aws_api_key, aws_subscribe, deprecated, unknown)
- Edge cases (null auth providers, maxBatchSize 0, cleanup on delete)

* test(appsync): add AWS scalar unit tests

Test all 17 AWS scalars:
- All registered in AppSyncScalarRegistry
- AWSDateTime, AWSJSON, AWSEmail parse valid/invalid values
- AWSTimestamp and AWSShort range validation
- AWSURL and AWSPhone format validation

* test(appsync): add SDK compatibility tests for Phase 2

Validate that the AWS SDK Java v2 can read:
- dataSourceArn() on CreateDataSource response
- resolverArn() on CreateResolver response
- functionArn() on CreateFunction response
- BadRequestException on invalid schema creation

* docs(appsync): add Phase 2 operations, schema registry, and AWS scalars documentation

- Add Domain Names, Channel Namespaces, Merged API Associations, Enhanced Metrics
- Document AWS scalar types (17 scalars with validation rules)
- Document AppSync directives (8 directives with locations)
- Update Not Implemented section with future phase references
- Add CLI examples for domain names and channel namespaces
- Update cascade delete to include channel namespaces and domain associations

* docs: add AppSync to service tables, env vars, storage config, and SDK README

- README.md: add AppSync to category table, detailed notes, and architecture diagram
- docs/index.md: add AppSync to supported services table, fix count to 52
- docs/configuration/environment-variables.md: add FLOCI_SERVICES_APPSYNC_ENABLED
- docs/configuration/advanced/application-yml.md: add appsync config block
- docs/configuration/storage.md: add AppSync per-service storage override
- compatibility-tests/sdk-test-java/README.md: add AppSyncTest to services table

* fix(appsync): reuse ObjectMapper and fix AWSJSON serialize for non-string values

AWSJSON scalar was creating a new ObjectMapper on every parseValue() call. serialize() used toString() which produces invalid JSON for Map/JsonNode results.

* fix(appsync): strip string literals and comments before unknown directive validation

The regex @(\w+) incorrectly flagged @ mentions inside GraphQL string literals and comments as unknown directives.

* fix(appsync): prevent silent overwrite on creates, validate required fields and input values

- Add existence checks on createDataSource, createResolver, createType,
  createChannelNamespace, createMergedApiAssociation (→ ConflictException 409)
- Validate authenticationType is required on createGraphqlApi
- Validate typeName is required on createResolver
- Validate dataSourceName exists on createResolver and createFunction
- Prevent associateApi from silently overwriting existing association
- Enforce API key limit (max 2 per API)
- Fix expires parsing to accept ISO 8601 strings, throw on invalid values
- Fix castInt overflow detection
- Fix updateApiKey expires validation (was silently swallowing errors)
- Change InvalidNextTokenException to BadRequestException (AWS standard)
- Fix maxResults=0 to return empty page
- Fix getIntrospectionSchema to throw 404 instead of returning null
- Fix tags with null values (was producing literal string "null")

* test(appsync): fix cascade delete test to create data source before function, align with new validation

* refactor(appsync): remove dead code and unused hasSchema()

- Delete AppSyncDirectiveRegistry.java (100 lines, never used)
- Delete DirectiveValidator.java (45 lines, never called)
- Remove hasSchema() from SchemaRegistry (never called)

* fix(appsync): scalar null-safety, type validation, and DNS resolution

- Add null checks to 5 serialize() methods (AWS_TIMESTAMP, AWS_LONG,
  AWS_INTEGER, AWS_BOOLEAN, AWS_FLOAT) to prevent NPE
- Fix AWS_TIMESTAMP parseValue() ClassCastException on String input
- Replace InetAddress.getByName() with regex in AWS IPAddress to
  prevent DNS resolution (SSRF concern)
- AWSBoolean now rejects non-boolean values (matches AppSync behavior)

* refactor(appsync): centralize directive definitions in AppSyncDirective enum

- Add AppSyncDirective enum as single source of truth for directive
  names and SDL definitions
- Update AppSyncSchemaParser to use enum instead of duplicated strings
- Eliminates 3 sources of truth (validateNoUnknownDirectives Set,
  injectDirectiveDefinitions SDL, and formerly AppSyncDirectiveRegistry)

* perf(appsync): cache scalarMap in AppSyncScalarRegistry

- Initialize scalarMap once in constructor as unmodifiableMap
- Avoids recreating HashMap on every call (was called twice per
  schema parse)

* test(appsync): add tests for scalar fixes and behavior changes

- Add tests for null-safety in serialize() (5 scalars)
- Add test for AWSTimestamp parseValue with String input
- Add tests for AWSIPAddress regex validation (IPv4, IPv6, invalid)
- Add tests for AWSBoolean rejecting non-boolean values
- Add test for scalarMap caching

* test(sdk): add AWS scalars schema creation test

Verifies that schemas with AWS scalar types (AWSDateTime, AWSJSON,
AWSIPAddress, AWSBoolean) parse correctly via the SDK.

* fix(appsync): correct API paths to match AWS documentation

- Channel namespaces: /v1/ → /v2/, channelnamespaces → channelNamespaces
- Domain association: /apis → /apiassociation
- Remove ListApiAssociations (not a real AppSync operation)
- Remove GetEnhancedMetricsConfig (not a real AppSync operation)
- Rename Merged API Association to Source API Association with correct paths:
  - AssociateSourceGraphqlApi: POST /v1/mergedApis/{id}/sourceApiAssociations
  - GetSourceApiAssociation: GET /v1/mergedApis/{id}/sourceApiAssociations/{id}
  - ListSourceApiAssociations: GET /v1/apis/{apiId}/sourceApiAssociations
  - DisassociateSourceGraphqlApi: DELETE /v1/mergedApis/{id}/sourceApiAssociations/{id}

* feat(appsync): add SourceApiAssociation models

Add SourceApiAssociation, SourceApiAssociationConfig, and
SourceApiAssociationSummary models to support merged/source API
association operations per AWS AppSync API Reference.

* feat(appsync): add ChannelNamespace support models

Add AuthMode, HandlerConfig, HandlerConfigs, Integration, and
LambdaConfig models for ChannelNamespace handler configuration
per AWS AppSync API Reference.

* fix(appsync): fix ApiAssociation and ChannelNamespace models

ApiAssociation: remove source/merged API fields, keep only domain
association fields (apiId, associationStatus, deploymentDetail,
domainName) per AWS AppSync API Reference.

ChannelNamespace: add missing fields (channelNamespaceArn,
codeHandlers, created, handlerConfigs, lastModified,
publishAuthModes, subscribeAuthModes, tags) per AWS docs.

* feat(appsync): add missing service methods and fix response models

- associateApi now returns full ApiAssociation object
- createMergedApiAssociation returns SourceApiAssociation
- createSourceApiAssociation returns SourceApiAssociation
- getSourceApiAssociation validates mergedApiId
- listSourceApiAssociations returns SourceApiAssociationSummary
- Add updateSourceApiAssociation method
- Add deleteMergedApiAssociation method
- ChannelNamespace: populate arn, timestamps on create/update

* feat(appsync): fix response formats and add missing endpoints

- associateMergedGraphqlApi: response key apiAssociation → sourceApiAssociation
- disassociateSourceGraphqlApi: returns 200 + body (not 204)
- associateApi: returns full ApiAssociation from service
- Add POST /v1/mergedApis/{id}/sourceApiAssociations/{assocId} (UpdateSourceApiAssociation)
- Add DELETE /v1/sourceApis/{id}/mergedApiAssociations/{assocId} (DisassociateMergedGraphqlApi)

* test(appsync): fix and add integration tests for new endpoints

- Fix associateSourceGraphqlApi: use mergedApiId and sourceApiAssociationStatus
- Fix deleteSourceApiAssociation: expect 200 with body (not 204)
- Add updateDomainName test
- Add associateMergedGraphqlApi test
- Add updateSourceApiAssociation test
- Add disassociateMergedGraphqlApi test

* test(appsync): add SDK tests for missing operations

- Add updateDomainName test
- Add associateMergedGraphqlApi test
- Add updateSourceApiAssociation test
- Add disassociateMergedGraphqlApi test
- Fix test ordering for new domain tests
This commit is contained in:
AgustinBertagna authored and GitHub committed 2026-06-07 00:05:51 -05:00
1 parent 9a7070992e
commit 4446404288
34 files changed
+3718 -110

No files matched your search

@@ -62,8 +62,8 @@ public class AppSyncController {
@POST
@Path("/v1/apis/{apiId}")
public Response updateGraphqlApi(@Context HttpHeaders headers,
@PathParam("apiId") String apiId,
String body) throws IOException {
@PathParam("apiId") String apiId,
String body) throws IOException {
String region = regionResolver.resolveRegion(headers);
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
@@ -128,7 +128,9 @@ public class AppSyncController {
public Response getIntrospectionSchema(@PathParam("apiId") String apiId) {
String schema = service.getIntrospectionSchema(apiId);
ObjectNode root = objectMapper.createObjectNode();
root.put("schema", schema);
ObjectNode schemaNode = objectMapper.createObjectNode();
schemaNode.put("definition", schema);
root.set("schema", schemaNode);
return Response.ok(root).build();
}
@@ -136,10 +138,13 @@ public class AppSyncController {
@POST
@Path("/v1/apis/{apiId}/datasources")
public Response createDataSource(@PathParam("apiId") String apiId, String body) throws IOException {
public Response createDataSource(@Context HttpHeaders headers,
@PathParam("apiId") String apiId,
String body) throws IOException {
String region = regionResolver.resolveRegion(headers);
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
DataSource ds = service.createDataSource(apiId, request);
DataSource ds = service.createDataSource(apiId, request, region);
ObjectNode root = objectMapper.createObjectNode();
root.set("dataSource", objectMapper.valueToTree(ds));
return Response.status(200).entity(root).build();
@@ -157,8 +162,8 @@ public class AppSyncController {
@POST
@Path("/v1/apis/{apiId}/datasources/{name}")
public Response updateDataSource(@PathParam("apiId") String apiId,
@PathParam("name") String name,
String body) throws IOException {
@PathParam("name") String name,
String body) throws IOException {
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
DataSource ds = service.updateDataSource(apiId, name, request);
@@ -170,7 +175,7 @@ public class AppSyncController {
@DELETE
@Path("/v1/apis/{apiId}/datasources/{name}")
public Response deleteDataSource(@PathParam("apiId") String apiId,
@PathParam("name") String name) {
@PathParam("name") String name) {
service.deleteDataSource(apiId, name);
return Response.noContent().build();
}
@@ -196,13 +201,15 @@ public class AppSyncController {
@POST
@Path("/v1/apis/{apiId}/types/{typeName}/resolvers")
public Response createResolver(@PathParam("apiId") String apiId,
@PathParam("typeName") String typeName,
String body) throws IOException {
public Response createResolver(@Context HttpHeaders headers,
@PathParam("apiId") String apiId,
@PathParam("typeName") String typeName,
String body) throws IOException {
String region = regionResolver.resolveRegion(headers);
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
request.put("typeName", typeName);
Resolver resolver = service.createResolver(apiId, request);
Resolver resolver = service.createResolver(apiId, request, region);
ObjectNode root = objectMapper.createObjectNode();
root.set("resolver", objectMapper.valueToTree(resolver));
return Response.status(200).entity(root).build();
@@ -257,9 +264,9 @@ public class AppSyncController {
@POST
@Path("/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}")
public Response updateResolver(@PathParam("apiId") String apiId,
@PathParam("typeName") String typeName,
@PathParam("fieldName") String fieldName,
String body) throws IOException {
@PathParam("typeName") String typeName,
@PathParam("fieldName") String fieldName,
String body) throws IOException {
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
Resolver resolver = service.updateResolver(apiId, typeName, fieldName, request);
@@ -271,8 +278,8 @@ public class AppSyncController {
@DELETE
@Path("/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}")
public Response deleteResolver(@PathParam("apiId") String apiId,
@PathParam("typeName") String typeName,
@PathParam("fieldName") String fieldName) {
@PathParam("typeName") String typeName,
@PathParam("fieldName") String fieldName) {
service.deleteResolver(apiId, typeName, fieldName);
return Response.noContent().build();
}
@@ -537,4 +544,237 @@ public class AppSyncController {
return Response.ok(root).build();
}
// ──────────────────────────── Domain Names ────────────────────────────
@POST
@Path("/v1/domainnames")
public Response createDomainName(String body) throws IOException {
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
DomainName dn = service.createDomainName(request);
ObjectNode root = objectMapper.createObjectNode();
root.set("domainNameConfig", objectMapper.valueToTree(dn));
return Response.status(200).entity(root).build();
}
@GET
@Path("/v1/domainnames/{domainName}")
public Response getDomainName(@PathParam("domainName") String domainName) {
DomainName dn = service.getDomainName(domainName);
ObjectNode root = objectMapper.createObjectNode();
root.set("domainNameConfig", objectMapper.valueToTree(dn));
return Response.ok(root).build();
}
@GET
@Path("/v1/domainnames")
public Response listDomainNames(@QueryParam("maxResults") Integer maxResults,
@QueryParam("nextToken") String nextToken) {
var page = service.listDomainNames(maxResults, nextToken);
ObjectNode root = objectMapper.createObjectNode();
ArrayNode items = root.putArray("domainNames");
page.items().forEach(items::addPOJO);
if (page.nextToken() != null) {
root.put("nextToken", page.nextToken());
} else {
root.putNull("nextToken");
}
return Response.ok(root).build();
}
@POST
@Path("/v1/domainnames/{domainName}")
public Response updateDomainName(@PathParam("domainName") String domainName,
String body) throws IOException {
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
DomainName dn = service.updateDomainName(domainName, request);
ObjectNode root = objectMapper.createObjectNode();
root.set("domainNameConfig", objectMapper.valueToTree(dn));
return Response.ok(root).build();
}
@DELETE
@Path("/v1/domainnames/{domainName}")
public Response deleteDomainName(@PathParam("domainName") String domainName) {
service.deleteDomainName(domainName);
return Response.noContent().build();
}
@POST
@Path("/v1/domainnames/{domainName}/apiassociation")
public Response associateApi(@PathParam("domainName") String domainName, String body) throws IOException {
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
String apiId = (String) request.get("apiId");
var assoc = service.associateApi(domainName, apiId);
ObjectNode root = objectMapper.createObjectNode();
root.set("apiAssociation", objectMapper.valueToTree(assoc));
return Response.status(200).entity(root).build();
}
@GET
@Path("/v1/domainnames/{domainName}/apiassociation")
public Response getApiAssociation(@PathParam("domainName") String domainName) {
var assoc = service.getApiAssociation(domainName);
ObjectNode root = objectMapper.createObjectNode();
root.set("apiAssociation", objectMapper.valueToTree(assoc));
return Response.ok(root).build();
}
@DELETE
@Path("/v1/domainnames/{domainName}/apiassociation")
public Response disassociateApi(@PathParam("domainName") String domainName) {
service.disassociateApi(domainName);
return Response.noContent().build();
}
// ──────────────────────────── Channel Namespaces ────────────────────────────
@POST
@Path("/v2/apis/{apiId}/channelNamespaces")
public Response createChannelNamespace(@PathParam("apiId") String apiId, String body) throws IOException {
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
ChannelNamespace ns = service.createChannelNamespace(apiId, request);
ObjectNode root = objectMapper.createObjectNode();
root.set("channelNamespace", objectMapper.valueToTree(ns));
return Response.status(200).entity(root).build();
}
@GET
@Path("/v2/apis/{apiId}/channelNamespaces/{name}")
public Response getChannelNamespace(@PathParam("apiId") String apiId, @PathParam("name") String name) {
ChannelNamespace ns = service.getChannelNamespace(apiId, name);
ObjectNode root = objectMapper.createObjectNode();
root.set("channelNamespace", objectMapper.valueToTree(ns));
return Response.ok(root).build();
}
@POST
@Path("/v2/apis/{apiId}/channelNamespaces/{name}")
public Response updateChannelNamespace(@PathParam("apiId") String apiId,
@PathParam("name") String name,
String body) throws IOException {
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
ChannelNamespace ns = service.updateChannelNamespace(apiId, name, request);
ObjectNode root = objectMapper.createObjectNode();
root.set("channelNamespace", objectMapper.valueToTree(ns));
return Response.ok(root).build();
}
@DELETE
@Path("/v2/apis/{apiId}/channelNamespaces/{name}")
public Response deleteChannelNamespace(@PathParam("apiId") String apiId, @PathParam("name") String name) {
service.deleteChannelNamespace(apiId, name);
return Response.noContent().build();
}
@GET
@Path("/v2/apis/{apiId}/channelNamespaces")
public Response listChannelNamespaces(@PathParam("apiId") String apiId,
@QueryParam("maxResults") Integer maxResults,
@QueryParam("nextToken") String nextToken) {
var page = service.listChannelNamespaces(apiId, maxResults, nextToken);
ObjectNode root = objectMapper.createObjectNode();
ArrayNode items = root.putArray("channelNamespaces");
page.items().forEach(items::addPOJO);
if (page.nextToken() != null) {
root.put("nextToken", page.nextToken());
} else {
root.putNull("nextToken");
}
return Response.ok(root).build();
}
// ──────────────────────────── Merged API Associations ─────────────────
@POST
@Path("/v1/sourceApis/{sourceApiIdentifier}/mergedApiAssociations")
public Response associateMergedGraphqlApi(@Context HttpHeaders headers,
@PathParam("sourceApiIdentifier") String sourceApiIdentifier,
String body) throws IOException {
String region = regionResolver.resolveRegion(headers);
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
var assoc = service.createMergedApiAssociation(sourceApiIdentifier, request, region);
ObjectNode root = objectMapper.createObjectNode();
root.set("sourceApiAssociation", objectMapper.valueToTree(assoc));
return Response.status(200).entity(root).build();
}
@POST
@Path("/v1/mergedApis/{mergedApiIdentifier}/sourceApiAssociations")
public Response associateSourceGraphqlApi(@Context HttpHeaders headers,
@PathParam("mergedApiIdentifier") String mergedApiIdentifier,
String body) throws IOException {
String region = regionResolver.resolveRegion(headers);
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
var assoc = service.createSourceApiAssociation(mergedApiIdentifier, request, region);
ObjectNode root = objectMapper.createObjectNode();
root.set("sourceApiAssociation", objectMapper.valueToTree(assoc));
return Response.status(200).entity(root).build();
}
@GET
@Path("/v1/mergedApis/{mergedApiIdentifier}/sourceApiAssociations/{associationId}")
public Response getSourceApiAssociation(@PathParam("mergedApiIdentifier") String mergedApiIdentifier,
@PathParam("associationId") String associationId) {
var assoc = service.getSourceApiAssociation(mergedApiIdentifier, associationId);
ObjectNode root = objectMapper.createObjectNode();
root.set("sourceApiAssociation", objectMapper.valueToTree(assoc));
return Response.ok(root).build();
}
@POST
@Path("/v1/mergedApis/{mergedApiIdentifier}/sourceApiAssociations/{associationId}")
public Response updateSourceApiAssociation(@PathParam("mergedApiIdentifier") String mergedApiIdentifier,
@PathParam("associationId") String associationId,
String body) throws IOException {
@SuppressWarnings("unchecked")
Map<String, Object> request = objectMapper.readValue(body, Map.class);
var assoc = service.updateSourceApiAssociation(mergedApiIdentifier, associationId, request);
ObjectNode root = objectMapper.createObjectNode();
root.set("sourceApiAssociation", objectMapper.valueToTree(assoc));
return Response.ok(root).build();
}
@GET
@Path("/v1/apis/{apiId}/sourceApiAssociations")
public Response listSourceApiAssociations(@PathParam("apiId") String apiId,
@QueryParam("maxResults") Integer maxResults,
@QueryParam("nextToken") String nextToken) {
var page = service.listSourceApiAssociations(apiId, maxResults, nextToken);
ObjectNode root = objectMapper.createObjectNode();
ArrayNode items = root.putArray("sourceApiAssociationSummaries");
page.items().forEach(items::addPOJO);
if (page.nextToken() != null) {
root.put("nextToken", page.nextToken());
} else {
root.putNull("nextToken");
}
return Response.ok(root).build();
}
@DELETE
@Path("/v1/mergedApis/{mergedApiIdentifier}/sourceApiAssociations/{associationId}")
public Response disassociateSourceGraphqlApi(@PathParam("mergedApiIdentifier") String mergedApiIdentifier,
@PathParam("associationId") String associationId) {
service.deleteSourceApiAssociation(mergedApiIdentifier, associationId);
ObjectNode root = objectMapper.createObjectNode();
root.put("sourceApiAssociationStatus", "DELETION_SCHEDULED");
return Response.ok(root).build();
}
@DELETE
@Path("/v1/sourceApis/{sourceApiIdentifier}/mergedApiAssociations/{associationId}")
public Response disassociateMergedGraphqlApi(@PathParam("sourceApiIdentifier") String sourceApiIdentifier,
@PathParam("associationId") String associationId) {
var assoc = service.deleteMergedApiAssociation(sourceApiIdentifier, associationId);
ObjectNode root = objectMapper.createObjectNode();
root.put("sourceApiAssociationStatus", assoc.getSourceApiAssociationStatus());
return Response.ok(root).build();
}
}
@@ -1,18 +1,19 @@
package io.github.hectorvent.floci.services.appsync;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.appsync.graphql.SchemaRegistry;
import io.github.hectorvent.floci.services.appsync.model.*;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Base64;
@ApplicationScoped
@@ -20,17 +21,24 @@ public class AppSyncService {
private static final Logger LOG = Logger.getLogger(AppSyncService.class);
private final StorageBackend<String, GraphqlApi> apiStore;
private final StorageBackend<String, String> schemaStore; // apiId -> schema SDL
private final StorageBackend<String, String> schemaStore;
private final StorageBackend<String, SchemaCreationStatus> schemaStatusStore;
private final StorageBackend<String, DataSource> dataSourceStore;
private final StorageBackend<String, Resolver> resolverStore;
private final StorageBackend<String, FunctionConfiguration> functionStore;
private final StorageBackend<String, ApiKey> apiKeyStore;
private final StorageBackend<String, AppSyncType> typeStore;
private final StorageBackend<String, DomainName> domainStore;
private final StorageBackend<String, String> associationStore;
private final StorageBackend<String, ChannelNamespace> channelNamespaceStore;
private final StorageBackend<String, SourceApiAssociation> mergedApiAssociationStore;
private final RegionResolver regionResolver;
private final SchemaRegistry schemaRegistry;
private final ObjectMapper objectMapper;
@Inject
public AppSyncService(StorageFactory storageFactory, EmulatorConfig config, RegionResolver regionResolver) {
public AppSyncService(StorageFactory storageFactory, EmulatorConfig config, RegionResolver regionResolver,
SchemaRegistry schemaRegistry, ObjectMapper objectMapper) {
this.apiStore = storageFactory.create("appsync", "appsync-apis.json", new TypeReference<>() {});
this.schemaStore = storageFactory.create("appsync", "appsync-schemas.json", new TypeReference<>() {});
this.schemaStatusStore = storageFactory.create("appsync", "appsync-schema-status.json", new TypeReference<>() {});
@@ -39,7 +47,13 @@ public class AppSyncService {
this.functionStore = storageFactory.create("appsync", "appsync-functions.json", new TypeReference<>() {});
this.apiKeyStore = storageFactory.create("appsync", "appsync-apikeys.json", new TypeReference<>() {});
this.typeStore = storageFactory.create("appsync", "appsync-types.json", new TypeReference<>() {});
this.domainStore = storageFactory.create("appsync", "appsync-domainnames.json", new TypeReference<>() {});
this.associationStore = storageFactory.create("appsync", "appsync-associations.json", new TypeReference<>() {});
this.channelNamespaceStore = storageFactory.create("appsync", "appsync-channelnamespaces.json", new TypeReference<>() {});
this.mergedApiAssociationStore = storageFactory.create("appsync", "appsync-merged-api-associations.json", new TypeReference<>() {});
this.regionResolver = regionResolver;
this.schemaRegistry = schemaRegistry;
this.objectMapper = objectMapper;
}
// ──────────────────────────── GraphQL API ────────────────────────────
@@ -49,11 +63,15 @@ public class AppSyncService {
if (name == null || name.isBlank()) {
throw new AwsException("BadRequestException", "A GraphQL API name is required", 400);
}
String authType = (String) request.get("authenticationType");
if (authType == null || authType.isBlank()) {
throw new AwsException("BadRequestException", "The authenticationType is required", 400);
}
String apiId = generateApiId();
GraphqlApi api = new GraphqlApi();
api.setApiId(apiId);
api.setName(name);
api.setAuthenticationType(parseEnum(AuthenticationType.class, request.get("authenticationType")));
api.setAuthenticationType(parseEnum(AuthenticationType.class, authType));
Object xrayValue = request.get("xrayEnabled");
if (xrayValue instanceof Boolean b) {
api.setXrayEnabled(b);
@@ -62,18 +80,27 @@ public class AppSyncService {
} else {
api.setXrayEnabled(false);
}
api.setLogConfig((Map<String, Object>) request.get("logConfig"));
api.setLogConfig(castMap(request.get("logConfig")));
api.setApiType(coerceString(request.get("apiType"), "GRAPHQL"));
api.setOwner(coerceString(request.get("owner")));
api.setOwnerContact(coerceString(request.get("ownerContact")));
api.setVisibility(coerceString(request.get("visibility"), "GLOBAL"));
api.setIntrospectionConfig(coerceString(request.get("introspectionConfig")));
api.setQueryDepthLimit(castInt(request.get("queryDepthLimit")));
api.setResolverCountLimit(castInt(request.get("resolverCountLimit")));
api.setEnhancedMetricsConfig(castMap(request.get("enhancedMetricsConfig")));
api.setLambdaAuthorizerConfig(castMap(request.get("lambdaAuthorizerConfig")));
api.setOpenIDConnectConfig(castMap(request.get("openIDConnectConfig")));
api.setUserPoolConfig(castMap(request.get("userPoolConfig")));
api.setDns(castStringMap(request.get("dns")));
api.setWafWebAclArn(coerceString(request.get("wafWebAclArn")));
api.setMergedApiExecutionRoleArn(coerceString(request.get("mergedApiExecutionRoleArn")));
Object additionalObj = request.get("additionalAuthenticationProviders");
if (additionalObj instanceof List<?> additionalList) {
List<Map<String, Object>> providers = new ArrayList<>();
for (Object item : additionalList) {
if (item instanceof Map<?, ?> map) {
@SuppressWarnings("unchecked")
Map<String, Object> casted = (Map<String, Object>) map;
providers.add(casted);
}
}
List<AdditionalAuthenticationProvider> providers = objectMapper.convertValue(
additionalList, new TypeReference<List<AdditionalAuthenticationProvider>>() {});
api.setAdditionalAuthenticationProviders(providers);
}
@@ -85,10 +112,10 @@ public class AppSyncService {
uris.put("REALTIME", "ws://localhost:4566/v1/apis/" + apiId + "/graphql/realtime");
api.setUris(uris);
Map<String, Object> tags = (Map<String, Object>) request.get("tags");
Map<String, Object> tags = castMap(request.get("tags"));
if (tags != null) {
Map<String, String> tagMap = new HashMap<>();
tags.forEach((k, v) -> tagMap.put(k, String.valueOf(v)));
tags.forEach((k, v) -> tagMap.put(k, v != null ? String.valueOf(v) : ""));
api.setTags(tagMap);
}
@@ -106,6 +133,7 @@ public class AppSyncService {
return paginate(apiStore.scan(k -> true), nextToken, maxResults);
}
@SuppressWarnings("unchecked")
public GraphqlApi updateGraphqlApi(String apiId, Map<String, Object> request, String region) {
GraphqlApi existing = getGraphqlApi(apiId);
if (request.containsKey("name")) existing.setName((String) request.get("name"));
@@ -122,9 +150,34 @@ public class AppSyncService {
if (request.containsKey("tags")) {
Map<String, Object> tags = (Map<String, Object>) request.get("tags");
Map<String, String> tagMap = new HashMap<>();
tags.forEach((k, v) -> tagMap.put(k, String.valueOf(v)));
tags.forEach((k, v) -> tagMap.put(k, v != null ? String.valueOf(v) : ""));
existing.setTags(tagMap);
}
if (request.containsKey("apiType")) existing.setApiType((String) request.get("apiType"));
if (request.containsKey("owner")) existing.setOwner((String) request.get("owner"));
if (request.containsKey("ownerContact")) existing.setOwnerContact((String) request.get("ownerContact"));
if (request.containsKey("visibility")) existing.setVisibility((String) request.get("visibility"));
if (request.containsKey("introspectionConfig")) existing.setIntrospectionConfig((String) request.get("introspectionConfig"));
if (request.containsKey("queryDepthLimit")) existing.setQueryDepthLimit(castInt(request.get("queryDepthLimit")));
if (request.containsKey("resolverCountLimit")) existing.setResolverCountLimit(castInt(request.get("resolverCountLimit")));
if (request.containsKey("enhancedMetricsConfig")) existing.setEnhancedMetricsConfig((Map<String, Object>) request.get("enhancedMetricsConfig"));
if (request.containsKey("lambdaAuthorizerConfig")) existing.setLambdaAuthorizerConfig((Map<String, Object>) request.get("lambdaAuthorizerConfig"));
if (request.containsKey("openIDConnectConfig")) existing.setOpenIDConnectConfig((Map<String, Object>) request.get("openIDConnectConfig"));
if (request.containsKey("userPoolConfig")) existing.setUserPoolConfig((Map<String, Object>) request.get("userPoolConfig"));
if (request.containsKey("dns")) {
@SuppressWarnings("unchecked")
Map<String, String> dns = (Map<String, String>) request.get("dns");
existing.setDns(dns);
}
if (request.containsKey("wafWebAclArn")) existing.setWafWebAclArn((String) request.get("wafWebAclArn"));
if (request.containsKey("mergedApiExecutionRoleArn")) existing.setMergedApiExecutionRoleArn((String) request.get("mergedApiExecutionRoleArn"));
if (request.containsKey("additionalAuthenticationProviders")) {
Object additionalObj = request.get("additionalAuthenticationProviders");
if (additionalObj instanceof List<?> additionalList) {
existing.setAdditionalAuthenticationProviders(
objectMapper.convertValue(additionalList, new TypeReference<List<AdditionalAuthenticationProvider>>() {}));
}
}
apiStore.put(apiId, existing);
return existing;
}
@@ -134,11 +187,14 @@ public class AppSyncService {
apiStore.delete(apiId);
schemaStore.delete(apiId);
schemaStatusStore.delete(apiId);
schemaRegistry.remove(apiId);
deleteDataSourcesForApi(apiId);
deleteResolversForApi(apiId);
deleteFunctionsForApi(apiId);
deleteTypesForApi(apiId);
deleteApiKeysForApi(apiId);
deleteChannelNamespacesForApi(apiId);
deleteDomainAssociationsForApi(apiId);
LOG.infov("Deleted GraphQL API {0}", apiId);
}
@@ -146,6 +202,7 @@ public class AppSyncService {
public void startSchemaCreation(String apiId, String definition) {
getGraphqlApi(apiId);
schemaRegistry.register(apiId, definition);
schemaStore.put(apiId, definition);
SchemaCreationStatus status = new SchemaCreationStatus();
status.setStatus(SchemaCreationStatusType.ACTIVE);
@@ -161,12 +218,14 @@ public class AppSyncService {
public String getIntrospectionSchema(String apiId) {
getGraphqlApi(apiId);
return schemaStore.get(apiId).orElse(null);
return schemaStore.get(apiId)
.orElseThrow(() -> new AwsException("NotFoundException",
"Schema not found for API: " + apiId, 404));
}
// ──────────────────────────── Data Sources ────────────────────────────
public DataSource createDataSource(String apiId, Map<String, Object> request) {
public DataSource createDataSource(String apiId, Map<String, Object> request, String region) {
getGraphqlApi(apiId);
String name = (String) request.get("name");
if (name == null || name.isBlank()) {
@@ -180,15 +239,20 @@ public class AppSyncService {
ds.setDescription((String) request.get("description"));
ds.setType(parseEnum(DataSourceType.class, request.get("type")));
ds.setServiceRoleArn((String) request.get("serviceRoleArn"));
ds.setDynamodbConfig((Map<String, Object>) request.get("dynamodbConfig"));
ds.setLambdaConfig((Map<String, Object>) request.get("lambdaConfig"));
ds.setHttpConfig((Map<String, Object>) request.get("httpConfig"));
ds.setEventBridgeConfig((Map<String, Object>) request.get("eventBridgeConfig"));
ds.setRelationalDatabaseConfig((Map<String, Object>) request.get("relationalDatabaseConfig"));
ds.setOpenSearchServiceConfig((Map<String, Object>) request.get("openSearchServiceConfig"));
ds.setAmazonBedrockRuntimeConfig((Map<String, Object>) request.get("amazonBedrockRuntimeConfig"));
ds.setDynamodbConfig(castMap(request.get("dynamodbConfig")));
ds.setLambdaConfig(castMap(request.get("lambdaConfig")));
ds.setHttpConfig(castMap(request.get("httpConfig")));
ds.setEventBridgeConfig(castMap(request.get("eventBridgeConfig")));
ds.setRelationalDatabaseConfig(castMap(request.get("relationalDatabaseConfig")));
ds.setOpenSearchServiceConfig(castMap(request.get("openSearchServiceConfig")));
ds.setAmazonBedrockRuntimeConfig(castMap(request.get("amazonBedrockRuntimeConfig")));
ds.setDataSourceArn(regionResolver.buildArn("appsync", region, "apis/" + apiId + "/datasources/" + name));
dataSourceStore.put(apiKey(apiId, ds.getName()), ds);
String dsKey = apiKey(apiId, ds.getName());
if (dataSourceStore.get(dsKey).isPresent()) {
throw new AwsException("ConflictException", "Data source already exists: " + name, 409);
}
dataSourceStore.put(dsKey, ds);
return ds;
}
@@ -201,6 +265,7 @@ public class AppSyncService {
return paginate(dataSourceStore.scan(k -> k.startsWith(apiId + "::")), nextToken, maxResults);
}
@SuppressWarnings("unchecked")
public DataSource updateDataSource(String apiId, String dataSourceName, Map<String, Object> request) {
DataSource existing = getDataSource(apiId, dataSourceName);
if (request.containsKey("description")) existing.setDescription((String) request.get("description"));
@@ -222,20 +287,9 @@ public class AppSyncService {
dataSourceStore.delete(apiKey(apiId, dataSourceName));
}
private void deleteDataSourcesForApi(String apiId) {
dataSourceStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(ds -> {
try {
dataSourceStore.delete(apiKey(apiId, ds.getName()));
} catch (Exception e) {
// ignore - already deleted
}
});
}
// ──────────────────────────── Resolvers ────────────────────────────
public Resolver createResolver(String apiId, Map<String, Object> request) {
public Resolver createResolver(String apiId, Map<String, Object> request, String region) {
getGraphqlApi(apiId);
String fieldName = (String) request.get("fieldName");
if (fieldName == null || fieldName.isBlank()) {
@@ -245,9 +299,15 @@ public class AppSyncService {
if (dataSourceName == null || dataSourceName.isBlank()) {
throw new AwsException("BadRequestException", "A data source name is required for the resolver", 400);
}
String typeName = (String) request.get("typeName");
if (typeName == null || typeName.isBlank()) {
throw new AwsException("BadRequestException", "A type name is required for the resolver", 400);
}
// Validate data source exists
getDataSource(apiId, dataSourceName);
Resolver resolver = new Resolver();
resolver.setApiId(apiId);
resolver.setTypeName((String) request.get("typeName"));
resolver.setTypeName(typeName);
resolver.setFieldName((String) request.get("fieldName"));
resolver.setDataSourceName((String) request.get("dataSourceName"));
resolver.setFunctionId((String) request.get("functionId"));
@@ -255,8 +315,15 @@ public class AppSyncService {
resolver.setResponseMappingTemplate((String) request.get("responseMappingTemplate"));
resolver.setKind(parseEnum(ResolverKind.class, request.getOrDefault("kind", "UNIT")));
resolver.setCode((String) request.get("code"));
resolver.setCachingConfig(castMap(request.get("cachingConfig")));
resolver.setMaxBatchSize(castInt(request.get("maxBatchSize")));
resolver.setMetricsConfig((String) request.get("metricsConfig"));
resolver.setPipelineConfig(castMap(request.get("pipelineConfig")));
resolver.setSyncConfig(castMap(request.get("syncConfig")));
resolver.setResolverArn(regionResolver.buildArn("appsync", region,
"apis/" + apiId + "/types/" + typeName + "/resolvers/" + fieldName));
Map<String, Object> runtime = (Map<String, Object>) request.get("runtime");
Map<String, Object> runtime = castMap(request.get("runtime"));
if (runtime != null) {
Resolver.ResolverRuntime rt = new Resolver.ResolverRuntime();
rt.setName(parseEnum(ResolverRuntimeName.class, runtime.get("name")));
@@ -265,6 +332,10 @@ public class AppSyncService {
}
String key = resolverKey(apiId, resolver.getTypeName(), resolver.getFieldName());
if (resolverStore.get(key).isPresent()) {
throw new AwsException("ConflictException",
"Resolver already exists for " + typeName + "." + fieldName, 409);
}
resolverStore.put(key, resolver);
return resolver;
}
@@ -294,6 +365,7 @@ public class AppSyncService {
return paginate(all, nextToken, maxResults);
}
@SuppressWarnings("unchecked")
public Resolver updateResolver(String apiId, String typeName, String fieldName, Map<String, Object> request) {
Resolver existing = getResolver(apiId, typeName, fieldName);
if (request.containsKey("dataSourceName")) existing.setDataSourceName((String) request.get("dataSourceName"));
@@ -302,6 +374,11 @@ public class AppSyncService {
if (request.containsKey("responseMappingTemplate")) existing.setResponseMappingTemplate((String) request.get("responseMappingTemplate"));
if (request.containsKey("kind")) existing.setKind(parseEnum(ResolverKind.class, request.get("kind")));
if (request.containsKey("code")) existing.setCode((String) request.get("code"));
if (request.containsKey("cachingConfig")) existing.setCachingConfig((Map<String, Object>) request.get("cachingConfig"));
if (request.containsKey("maxBatchSize")) existing.setMaxBatchSize(castInt(request.get("maxBatchSize")));
if (request.containsKey("metricsConfig")) existing.setMetricsConfig((String) request.get("metricsConfig"));
if (request.containsKey("pipelineConfig")) existing.setPipelineConfig((Map<String, Object>) request.get("pipelineConfig"));
if (request.containsKey("syncConfig")) existing.setSyncConfig((Map<String, Object>) request.get("syncConfig"));
if (request.containsKey("runtime")) {
Map<String, Object> runtime = (Map<String, Object>) request.get("runtime");
Resolver.ResolverRuntime rt = new Resolver.ResolverRuntime();
@@ -318,11 +395,6 @@ public class AppSyncService {
resolverStore.delete(resolverKey(apiId, typeName, fieldName));
}
private void deleteResolversForApi(String apiId) {
resolverStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(r -> resolverStore.delete(resolverKey(apiId, r.getTypeName(), r.getFieldName())));
}
// ──────────────────────────── Functions ────────────────────────────
public FunctionConfiguration createFunction(String apiId, Map<String, Object> request, String region) {
@@ -331,15 +403,19 @@ public class AppSyncService {
if (name == null || name.isBlank()) {
throw new AwsException("BadRequestException", "A function name is required", 400);
}
String dsName = (String) request.get("dataSourceName");
if (dsName != null && !dsName.isBlank()) {
getDataSource(apiId, dsName);
}
FunctionConfiguration fn = new FunctionConfiguration();
fn.setFunctionId(generateShortId());
fn.setName((String) request.get("name"));
fn.setDescription((String) request.get("description"));
fn.setDataSourceName((String) request.get("dataSourceName"));
fn.setDataSourceName(dsName);
fn.setRequestMappingTemplate((String) request.get("requestMappingTemplate"));
fn.setResponseMappingTemplate((String) request.get("responseMappingTemplate"));
fn.setFunctionVersion((String) request.getOrDefault("functionVersion", "2018-05-29"));
fn.setArn(buildFunctionArn(apiId, fn.getFunctionId(), region));
fn.setFunctionArn(buildFunctionArn(apiId, fn.getFunctionId(), region));
fn.setCode((String) request.get("code"));
functionStore.put(apiKey(apiId, fn.getFunctionId()), fn);
@@ -355,6 +431,7 @@ public class AppSyncService {
return paginate(functionStore.scan(k -> k.startsWith(apiId + "::")), nextToken, maxResults);
}
@SuppressWarnings("unchecked")
public FunctionConfiguration updateFunction(String apiId, String functionId, Map<String, Object> request) {
FunctionConfiguration existing = getFunction(apiId, functionId);
if (request.containsKey("description")) existing.setDescription((String) request.get("description"));
@@ -372,11 +449,6 @@ public class AppSyncService {
functionStore.delete(apiKey(apiId, functionId));
}
private void deleteFunctionsForApi(String apiId) {
functionStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(fn -> functionStore.delete(apiKey(apiId, fn.getFunctionId())));
}
// ──────────────────────────── Types ────────────────────────────
public AppSyncType createType(String apiId, Map<String, Object> request) {
@@ -389,6 +461,10 @@ public class AppSyncService {
if (name == null || name.isBlank()) {
throw new AwsException("BadRequestException", "A type name is required", 400);
}
String typeKey = apiKey(apiId, name);
if (typeStore.get(typeKey).isPresent()) {
throw new AwsException("ConflictException", "Type already exists: " + name, 409);
}
AppSyncType type = new AppSyncType();
type.setApiId(apiId);
type.setName(name);
@@ -396,7 +472,7 @@ public class AppSyncService {
type.setDescription((String) request.get("description"));
type.setFormat(parseEnum(TypeFormat.class, request.getOrDefault("format", "SDL")));
typeStore.put(apiKey(apiId, type.getName()), type);
typeStore.put(typeKey, type);
return type;
}
@@ -423,15 +499,15 @@ public class AppSyncService {
typeStore.delete(apiKey(apiId, typeName));
}
private void deleteTypesForApi(String apiId) {
typeStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(t -> typeStore.delete(apiKey(apiId, t.getName())));
}
// ──────────────────────────── API Keys ────────────────────────────
public ApiKey createApiKey(String apiId, Map<String, Object> request) {
getGraphqlApi(apiId);
long existingCount = apiKeyStore.scan(k -> k.startsWith(apiId + "::")).size();
if (existingCount >= 2) {
throw new AwsException("LimitExceededException",
"Maximum of 2 API keys per API reached", 429);
}
ApiKey key = new ApiKey();
key.setId(generateShortId());
key.setApiId(apiId);
@@ -445,12 +521,15 @@ public class AppSyncService {
try {
key.setExpires(Long.parseLong(s));
} catch (NumberFormatException e) {
// try parsing as ISO date and convert to epoch seconds
key.setExpires(null);
try {
key.setExpires(java.time.Instant.parse(s).getEpochSecond());
} catch (java.time.format.DateTimeParseException ex) {
throw new AwsException("BadRequestException",
"Invalid expires value: " + s + ". Expected epoch seconds or ISO 8601.", 400);
}
}
}
// Generate a simple API key string
key.setApiKey("da2-" + generateShortId());
apiKeyStore.put(apiKey(apiId, key.getId()), key);
@@ -479,7 +558,12 @@ public class AppSyncService {
try {
existing.setExpires(Long.parseLong(s));
} catch (NumberFormatException e) {
// keep existing
try {
existing.setExpires(java.time.Instant.parse(s).getEpochSecond());
} catch (java.time.format.DateTimeParseException ex) {
throw new AwsException("BadRequestException",
"Invalid expires value: " + s + ". Expected epoch seconds or ISO 8601.", 400);
}
}
}
}
@@ -492,11 +576,6 @@ public class AppSyncService {
apiKeyStore.delete(apiKey(apiId, keyId));
}
private void deleteApiKeysForApi(String apiId) {
apiKeyStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(k -> apiKeyStore.delete(apiKey(apiId, k.getId())));
}
// ──────────────────────────── Tags ────────────────────────────
public Map<String, String> getTags(String resourceArn) {
@@ -533,6 +612,265 @@ public class AppSyncService {
return api.getEnvironmentVariables();
}
// ──────────────────────────── Domain Names ────────────────────────────
public DomainName createDomainName(Map<String, Object> request) {
String domainName = (String) request.get("domainName");
if (domainName == null || domainName.isBlank()) {
throw new AwsException("BadRequestException", "A domain name is required", 400);
}
if (domainStore.get(domainName).isPresent()) {
throw new AwsException("ConflictException", "Domain name already exists: " + domainName, 409);
}
DomainName dn = new DomainName();
dn.setDomainName(domainName);
dn.setDescription((String) request.get("description"));
dn.setCertificateArn((String) request.get("certificateArn"));
String shortId = generateShortId();
dn.setAppsyncDomainName(shortId + ".appsync-api.us-east-1.amazonaws.com");
dn.setHostedZoneId("Z" + generateShortId());
dn.setDomainNameArn(regionResolver.buildArn("appsync", regionResolver.getDefaultRegion(),
"domainnames/" + domainName));
Object tagsObj = request.get("tags");
if (tagsObj instanceof Map<?, ?> tagMap) {
Map<String, String> tagStrings = new HashMap<>();
tagMap.forEach((k, v) -> tagStrings.put(String.valueOf(k), String.valueOf(v)));
dn.setTags(tagStrings);
}
domainStore.put(domainName, dn);
return dn;
}
public DomainName getDomainName(String domainName) {
return domainStore.get(domainName)
.orElseThrow(() -> new AwsException("NotFoundException", "Domain name not found: " + domainName, 404));
}
public Page<DomainName> listDomainNames(Integer maxResults, String nextToken) {
return paginate(domainStore.scan(k -> true), nextToken, maxResults);
}
public DomainName updateDomainName(String domainName, Map<String, Object> request) {
DomainName existing = getDomainName(domainName);
if (request.containsKey("description")) existing.setDescription((String) request.get("description"));
domainStore.put(domainName, existing);
return existing;
}
public void deleteDomainName(String domainName) {
getDomainName(domainName);
associationStore.delete(domainName);
domainStore.delete(domainName);
}
public ApiAssociation associateApi(String domainName, String apiId) {
getDomainName(domainName);
getGraphqlApi(apiId);
if (associationStore.get(domainName).isPresent()) {
throw new AwsException("ConflictException",
"Domain name already associated with an API", 409);
}
associationStore.put(domainName, apiId);
ApiAssociation assoc = new ApiAssociation();
assoc.setApiId(apiId);
assoc.setDomainName(domainName);
assoc.setAssociationStatus("SUCCESS");
assoc.setDeploymentDetail("Successfully associated");
return assoc;
}
public ApiAssociation getApiAssociation(String domainName) {
getDomainName(domainName);
String apiId = associationStore.get(domainName)
.orElseThrow(() -> new AwsException("NotFoundException",
"No API associated with domain: " + domainName, 404));
ApiAssociation assoc = new ApiAssociation();
assoc.setDomainName(domainName);
assoc.setApiId(apiId);
assoc.setAssociationStatus("SUCCESS");
return assoc;
}
public void disassociateApi(String domainName) {
getDomainName(domainName);
associationStore.delete(domainName);
}
// ──────────────────────────── Channel Namespaces ────────────────────────────
public ChannelNamespace createChannelNamespace(String apiId, Map<String, Object> request) {
getGraphqlApi(apiId);
String name = (String) request.get("name");
if (name == null || name.isBlank()) {
throw new AwsException("BadRequestException", "A channel namespace name is required", 400);
}
String nsKey = apiKey(apiId, name);
if (channelNamespaceStore.get(nsKey).isPresent()) {
throw new AwsException("ConflictException",
"Channel namespace already exists: " + name, 409);
}
ChannelNamespace ns = new ChannelNamespace();
ns.setName(name);
ns.setApiId(apiId);
ns.setDescription((String) request.get("description"));
ns.setChannelNamespaceArn(regionResolver.buildArn("appsync", regionResolver.getDefaultRegion(),
"apis/" + apiId + "/channelNamespaces/" + name));
ns.setCodeHandlers((String) request.get("codeHandlers"));
ns.setCreated(System.currentTimeMillis());
ns.setLastModified(System.currentTimeMillis());
channelNamespaceStore.put(nsKey, ns);
return ns;
}
public ChannelNamespace getChannelNamespace(String apiId, String name) {
return channelNamespaceStore.get(apiKey(apiId, name))
.orElseThrow(() -> new AwsException("NotFoundException",
"Channel namespace not found: " + name, 404));
}
public ChannelNamespace updateChannelNamespace(String apiId, String name, Map<String, Object> request) {
ChannelNamespace existing = getChannelNamespace(apiId, name);
if (request.containsKey("description")) existing.setDescription((String) request.get("description"));
if (request.containsKey("codeHandlers")) existing.setCodeHandlers((String) request.get("codeHandlers"));
existing.setLastModified(System.currentTimeMillis());
channelNamespaceStore.put(apiKey(apiId, name), existing);
return existing;
}
public void deleteChannelNamespace(String apiId, String name) {
getChannelNamespace(apiId, name);
channelNamespaceStore.delete(apiKey(apiId, name));
}
public Page<ChannelNamespace> listChannelNamespaces(String apiId, Integer maxResults, String nextToken) {
return paginate(channelNamespaceStore.scan(k -> k.startsWith(apiId + "::")), nextToken, maxResults);
}
// ──────────────────────────── Merged API Associations ─────────────────
public SourceApiAssociation createMergedApiAssociation(String sourceApiIdentifier, Map<String, Object> request, String region) {
getGraphqlApi(sourceApiIdentifier);
String mergedApiIdentifier = (String) request.getOrDefault("mergedApiIdentifier", request.get("mergedApiId"));
if (mergedApiIdentifier == null || mergedApiIdentifier.isBlank()) {
throw new AwsException("BadRequestException", "A merged API identifier is required", 400);
}
getGraphqlApi(mergedApiIdentifier);
SourceApiAssociation assoc = new SourceApiAssociation();
assoc.setAssociationId(generateShortId());
assoc.setAssociationArn(regionResolver.buildArn("appsync", region,
"sourceApis/" + sourceApiIdentifier + "/mergedApiAssociations/" + generateShortId()));
assoc.setMergedApiId(mergedApiIdentifier);
assoc.setMergedApiArn(regionResolver.buildArn("appsync", region, "apis/" + mergedApiIdentifier));
assoc.setSourceApiId(sourceApiIdentifier);
assoc.setSourceApiArn(regionResolver.buildArn("appsync", region, "apis/" + sourceApiIdentifier));
assoc.setDescription((String) request.get("description"));
assoc.setSourceApiAssociationStatus("MERGED");
SourceApiAssociationConfig config = new SourceApiAssociationConfig();
String mergeType = (String) request.getOrDefault("mergeType", "MERGE");
config.setMergeType(mergeType);
assoc.setSourceApiAssociationConfig(config);
mergedApiAssociationStore.put(assoc.getAssociationId(), assoc);
return assoc;
}
public SourceApiAssociation createSourceApiAssociation(String mergedApiIdentifier, Map<String, Object> request, String region) {
getGraphqlApi(mergedApiIdentifier);
String sourceApiId = (String) request.getOrDefault("sourceApiId", request.get("sourceApiIdentifier"));
if (sourceApiId == null || sourceApiId.isBlank()) {
throw new AwsException("BadRequestException", "A source API ID is required", 400);
}
getGraphqlApi(sourceApiId);
SourceApiAssociation assoc = new SourceApiAssociation();
assoc.setAssociationId(generateShortId());
assoc.setAssociationArn(regionResolver.buildArn("appsync", region,
"mergedApis/" + mergedApiIdentifier + "/sourceApiAssociations/" + generateShortId()));
assoc.setMergedApiId(mergedApiIdentifier);
assoc.setMergedApiArn(regionResolver.buildArn("appsync", region, "apis/" + mergedApiIdentifier));
assoc.setSourceApiId(sourceApiId);
assoc.setSourceApiArn(regionResolver.buildArn("appsync", region, "apis/" + sourceApiId));
assoc.setDescription((String) request.get("description"));
assoc.setSourceApiAssociationStatus("MERGED");
SourceApiAssociationConfig config = new SourceApiAssociationConfig();
String mergeType = (String) request.getOrDefault("mergeType", "MERGE");
config.setMergeType(mergeType);
assoc.setSourceApiAssociationConfig(config);
mergedApiAssociationStore.put(assoc.getAssociationId(), assoc);
return assoc;
}
public SourceApiAssociation getSourceApiAssociation(String mergedApiIdentifier, String associationId) {
SourceApiAssociation assoc = mergedApiAssociationStore.get(associationId)
.orElseThrow(() -> new AwsException("NotFoundException",
"Source API association not found: " + associationId, 404));
if (!mergedApiIdentifier.equals(assoc.getMergedApiId())) {
throw new AwsException("NotFoundException",
"Source API association not found: " + associationId, 404);
}
return assoc;
}
public SourceApiAssociation updateSourceApiAssociation(String mergedApiIdentifier, String associationId,
Map<String, Object> request) {
SourceApiAssociation assoc = getSourceApiAssociation(mergedApiIdentifier, associationId);
if (request.containsKey("description")) {
assoc.setDescription((String) request.get("description"));
}
Object configObj = request.get("sourceApiAssociationConfig");
if (configObj instanceof Map<?, ?> configMap) {
SourceApiAssociationConfig config = assoc.getSourceApiAssociationConfig();
if (config == null) {
config = new SourceApiAssociationConfig();
}
Object mergeType = configMap.get("mergeType");
if (mergeType != null) {
config.setMergeType((String) mergeType);
}
assoc.setSourceApiAssociationConfig(config);
}
mergedApiAssociationStore.put(associationId, assoc);
return assoc;
}
public Page<SourceApiAssociationSummary> listSourceApiAssociations(String apiId, Integer maxResults, String nextToken) {
List<SourceApiAssociationSummary> summaries = mergedApiAssociationStore.scan(k -> true).stream()
.filter(a -> apiId.equals(a.getMergedApiId()) || apiId.equals(a.getSourceApiId()))
.map(this::toSummary)
.toList();
return paginate(summaries, nextToken, maxResults);
}
public void deleteSourceApiAssociation(String mergedApiIdentifier, String associationId) {
getSourceApiAssociation(mergedApiIdentifier, associationId);
mergedApiAssociationStore.delete(associationId);
}
public SourceApiAssociation deleteMergedApiAssociation(String sourceApiIdentifier, String associationId) {
SourceApiAssociation assoc = mergedApiAssociationStore.get(associationId)
.orElseThrow(() -> new AwsException("NotFoundException",
"Source API association not found: " + associationId, 404));
if (!sourceApiIdentifier.equals(assoc.getSourceApiId())) {
throw new AwsException("NotFoundException",
"Source API association not found: " + associationId, 404);
}
mergedApiAssociationStore.delete(associationId);
assoc.setSourceApiAssociationStatus("DELETION_SCHEDULED");
return assoc;
}
private SourceApiAssociationSummary toSummary(SourceApiAssociation assoc) {
SourceApiAssociationSummary summary = new SourceApiAssociationSummary();
summary.setAssociationArn(assoc.getAssociationArn());
summary.setAssociationId(assoc.getAssociationId());
summary.setDescription(assoc.getDescription());
summary.setMergedApiArn(assoc.getMergedApiArn());
summary.setMergedApiId(assoc.getMergedApiId());
summary.setSourceApiArn(assoc.getSourceApiArn());
summary.setSourceApiId(assoc.getSourceApiId());
return summary;
}
// ──────────────────────────── Helpers ────────────────────────────
private String generateApiId() {
@@ -572,6 +910,55 @@ public class AppSyncService {
return String.valueOf(value);
}
private String coerceString(Object value, String defaultValue) {
String result = coerceString(value);
return result != null ? result : defaultValue;
}
private Integer castInt(Object value) {
if (value == null) return null;
if (value instanceof Integer i) return i;
if (value instanceof Number n) {
long longVal = n.longValue();
if (longVal < Integer.MIN_VALUE || longVal > Integer.MAX_VALUE) {
throw new AwsException("BadRequestException",
"Integer value out of range: " + longVal, 400);
}
return n.intValue();
}
try {
long longVal = Long.parseLong(value.toString());
if (longVal < Integer.MIN_VALUE || longVal > Integer.MAX_VALUE) {
throw new AwsException("BadRequestException",
"Integer value out of range: " + longVal, 400);
}
return (int) longVal;
} catch (NumberFormatException e) {
throw new AwsException("BadRequestException",
"Invalid integer value: " + value, 400);
}
}
@SuppressWarnings("unchecked")
private Map<String, Object> castMap(Object value) {
if (value instanceof Map) {
return (Map<String, Object>) value;
}
return null;
}
@SuppressWarnings("unchecked")
private Map<String, String> castStringMap(Object value) {
if (value instanceof Map) {
Map<String, String> result = new HashMap<>();
for (var entry : ((Map<Object, Object>) value).entrySet()) {
result.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
}
return result;
}
return null;
}
private <E extends Enum<E>> E parseEnum(Class<E> enumClass, Object value) {
if (value == null) return null;
String str = value instanceof String s ? s : String.valueOf(value);
@@ -583,6 +970,45 @@ public class AppSyncService {
}
}
private void deleteDataSourcesForApi(String apiId) {
dataSourceStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(ds -> dataSourceStore.delete(apiKey(apiId, ds.getName())));
}
private void deleteResolversForApi(String apiId) {
resolverStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(r -> resolverStore.delete(resolverKey(apiId, r.getTypeName(), r.getFieldName())));
}
private void deleteFunctionsForApi(String apiId) {
functionStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(fn -> functionStore.delete(apiKey(apiId, fn.getFunctionId())));
}
private void deleteTypesForApi(String apiId) {
typeStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(t -> typeStore.delete(apiKey(apiId, t.getName())));
}
private void deleteApiKeysForApi(String apiId) {
apiKeyStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(k -> apiKeyStore.delete(apiKey(apiId, k.getId())));
}
private void deleteChannelNamespacesForApi(String apiId) {
channelNamespaceStore.scan(k -> k.startsWith(apiId + "::"))
.forEach(ns -> channelNamespaceStore.delete(apiKey(apiId, ns.getName())));
}
private void deleteDomainAssociationsForApi(String apiId) {
for (String key : associationStore.keys()) {
String assocApiId = associationStore.get(key).orElse(null);
if (apiId.equals(assocApiId)) {
associationStore.delete(key);
}
}
}
// ──────────────────────────── Pagination ────────────────────────────
record Page<T>(List<T> items, String nextToken) {}
@@ -590,7 +1016,14 @@ public class AppSyncService {
static <T> Page<T> paginate(List<T> items, String nextToken, Integer maxResults) {
int start = decodeToken(nextToken);
if (start < 0 || start > items.size()) {
throw new AwsException("InvalidNextTokenException", "Invalid NextToken.", 400);
throw new AwsException("BadRequestException", "Invalid NextToken.", 400);
}
if (maxResults != null && maxResults < 0) {
throw new AwsException("BadRequestException", "maxResults must be non-negative", 400);
}
if (maxResults != null && maxResults == 0) {
String next = (start < items.size()) ? encodeToken(start) : null;
return new Page<>(List.of(), next);
}
int limit = (maxResults == null || maxResults <= 0)
? items.size()
@@ -620,11 +1053,19 @@ public class AppSyncService {
static String extractTypeNameFromDefinition(String definition) {
if (definition == null || definition.isBlank()) return null;
String trimmed = definition.strip();
// Match: type TypeName { ... } or input TypeName { ... } or enum TypeName { ... }
// Remove comments
String cleaned = definition.replaceAll("#[^\n]*", "");
String trimmed = cleaned.strip();
String[] parts = trimmed.split("\\s+");
if (parts.length >= 2) {
return parts[1].replaceAll("[{(].*", "");
String name = parts[1].replaceAll("[{(].*", "");
if (!name.isEmpty() && !name.startsWith("#")) return name;
}
// Try next word if first was a comment artifact
for (String part : parts) {
if (!part.isEmpty() && !part.startsWith("#") && !part.equals("type") && !part.equals("input") && !part.equals("enum")) {
return part.replaceAll("[{(].*", "");
}
}
return null;
}
@@ -0,0 +1,49 @@
package io.github.hectorvent.floci.services.appsync.graphql;
import java.util.Set;
import java.util.stream.Collectors;
public enum AppSyncDirective {
AWS_API_KEY("aws_api_key", "directive @aws_api_key on OBJECT | FIELD_DEFINITION"),
AWS_IAM("aws_iam", "directive @aws_iam on OBJECT | FIELD_DEFINITION"),
AWS_COGNITO_USER_POOLS("aws_cognito_user_pools",
"directive @aws_cognito_user_pools(cognito_groups: [String!]!) on OBJECT | FIELD_DEFINITION"),
AWS_OIDC("aws_oidc", "directive @aws_oidc on OBJECT | FIELD_DEFINITION"),
AWS_LAMBDA("aws_lambda", "directive @aws_lambda on OBJECT | FIELD_DEFINITION"),
AWS_SUBSCRIBE("aws_subscribe", "directive @aws_subscribe(mutations: [String!]!) on FIELD_DEFINITION"),
AWS_AUTH("aws_auth", "directive @aws_auth(cognito_groups: [String!]!) on OBJECT"),
AWS_DELTA_SYNC("aws_delta_sync",
"directive @aws_delta_sync(tableName: String!, deltaSyncTableTTL: Int!, baseTableTTL: Int!) on OBJECT");
private static final Set<String> KNOWN_NAMES;
static {
java.util.Set<String> names = new java.util.HashSet<>();
names.add("skip");
names.add("include");
names.add("deprecated");
for (AppSyncDirective d : values()) {
names.add(d.directiveName());
}
KNOWN_NAMES = java.util.Set.copyOf(names);
}
private final String name;
private final String sdl;
AppSyncDirective(String name, String sdl) {
this.name = name;
this.sdl = sdl;
}
public String directiveName() {
return name;
}
public String sdl() {
return sdl;
}
public static boolean isKnown(String directiveName) {
return KNOWN_NAMES.contains(directiveName);
}
}
@@ -0,0 +1,81 @@
package io.github.hectorvent.floci.services.appsync.graphql;
import graphql.schema.GraphQLSchema;
import graphql.schema.idl.RuntimeWiring;
import graphql.schema.idl.SchemaGenerator;
import graphql.schema.idl.SchemaParser;
import graphql.schema.idl.TypeDefinitionRegistry;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.services.appsync.graphql.scalars.AppSyncScalarRegistry;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ApplicationScoped
public class AppSyncSchemaParser {
private final AppSyncScalarRegistry scalarRegistry;
@Inject
public AppSyncSchemaParser(AppSyncScalarRegistry scalarRegistry) {
this.scalarRegistry = scalarRegistry;
}
public GraphQLSchema parse(String sdl) {
String sdlWithDirectives = injectDirectiveDefinitions(sdl);
validateNoUnknownDirectives(sdl);
SchemaParser parser = new SchemaParser();
TypeDefinitionRegistry typeRegistry;
try {
typeRegistry = parser.parse(sdlWithDirectives);
} catch (Exception e) {
throw new AwsException("BadRequestException", "Invalid schema: " + e.getMessage(), 400);
}
RuntimeWiring.Builder wiringBuilder = RuntimeWiring.newRuntimeWiring();
for (var entry : scalarRegistry.scalarMap().entrySet()) {
wiringBuilder = wiringBuilder.scalar(entry.getValue());
}
try {
return new SchemaGenerator().makeExecutableSchema(typeRegistry, wiringBuilder.build());
} catch (RuntimeException e) {
throw new AwsException("BadRequestException", "Invalid schema: " + e.getMessage(), 400);
}
}
private void validateNoUnknownDirectives(String sdl) {
String clean = sdl
.replaceAll("\"\"\"[\\s\\S]*?\"\"\"", "")
.replaceAll("\"(?:[^\"\\\\]|\\\\.)*\"", "")
.replaceAll("#[^\n]*", "");
Pattern directivePattern = Pattern.compile("@(\\w+)");
Matcher matcher = directivePattern.matcher(clean);
while (matcher.find()) {
String name = matcher.group(1);
if (!AppSyncDirective.isKnown(name)) {
throw new AwsException("BadRequestException",
"Unknown directive: @" + name, 400);
}
}
}
private String injectDirectiveDefinitions(String sdl) {
StringBuilder sb = new StringBuilder();
for (AppSyncDirective directive : AppSyncDirective.values()) {
sb.append(directive.sdl()).append("\n");
}
sb.append("\n");
for (String scalarName : scalarRegistry.allScalars().stream()
.map(s -> s.getName()).collect(Collectors.toList())) {
sb.append("scalar ").append(scalarName).append("\n");
}
sb.append("\n");
sb.append(sdl);
return sb.toString();
}
}
@@ -0,0 +1,33 @@
package io.github.hectorvent.floci.services.appsync.graphql;
import graphql.schema.GraphQLSchema;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
@ApplicationScoped
public class SchemaRegistry {
private final Map<String, GraphQLSchema> schemas = new ConcurrentHashMap<>();
private final AppSyncSchemaParser appSyncSchemaParser;
@Inject
public SchemaRegistry(AppSyncSchemaParser appSyncSchemaParser) {
this.appSyncSchemaParser = appSyncSchemaParser;
}
public void register(String apiId, String sdl) {
GraphQLSchema schema = appSyncSchemaParser.parse(sdl);
schemas.put(apiId, schema);
}
public Optional<GraphQLSchema> getSchema(String apiId) {
return Optional.ofNullable(schemas.get(apiId));
}
public void remove(String apiId) {
schemas.remove(apiId);
}
}
@@ -0,0 +1,53 @@
package io.github.hectorvent.floci.services.appsync.graphql.scalars;
import graphql.schema.GraphQLScalarType;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
@ApplicationScoped
public class AppSyncScalarRegistry {
private final List<GraphQLScalarType> scalars;
private final Map<String, GraphQLScalarType> scalarMap;
@Inject
public AppSyncScalarRegistry() {
this.scalars = List.of(
AppSyncScalars.AWSJSON,
AppSyncScalars.AWS_DATE_TIME,
AppSyncScalars.AWS_DATE,
AppSyncScalars.AWS_TIME,
AppSyncScalars.AWS_TIMESTAMP,
AppSyncScalars.AWS_EMAIL,
AppSyncScalars.AWS_URL,
AppSyncScalars.AWS_PHONE,
AppSyncScalars.AWS_IP_ADDRESS,
AppSyncScalars.AWS_BOOLEAN,
AppSyncScalars.AWS_LONG,
AppSyncScalars.AWS_INTEGER,
AppSyncScalars.AWS_SHORT,
AppSyncScalars.AWS_FLOAT,
AppSyncScalars.AWS_BIG_DECIMAL,
AppSyncScalars.AWS_BIG_INT,
AppSyncScalars.AWS_BYTE
);
this.scalarMap = scalars.stream()
.collect(Collectors.toUnmodifiableMap(GraphQLScalarType::getName, s -> s));
}
public List<GraphQLScalarType> allScalars() {
return scalars;
}
public Optional<GraphQLScalarType> getScalar(String name) {
return Optional.ofNullable(scalarMap.get(name));
}
public Map<String, GraphQLScalarType> scalarMap() {
return scalarMap;
}
}
@@ -0,0 +1,470 @@
package io.github.hectorvent.floci.services.appsync.graphql.scalars;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import graphql.language.StringValue;
import graphql.schema.Coercing;
import graphql.schema.CoercingParseLiteralException;
import graphql.schema.CoercingParseValueException;
import graphql.schema.CoercingSerializeException;
import graphql.schema.GraphQLScalarType;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URI;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Base64;
import java.util.regex.Pattern;
public final class AppSyncScalars {
private static final ObjectMapper SHARED_MAPPER = new ObjectMapper();
public static final GraphQLScalarType AWSJSON = GraphQLScalarType.newScalar()
.name("AWSJSON")
.description("A JSON string")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
if (dataFetcherResult == null) return null;
if (dataFetcherResult instanceof String s) return s;
try {
return SHARED_MAPPER.writeValueAsString(dataFetcherResult);
} catch (JsonProcessingException e) {
throw new CoercingSerializeException("Cannot serialize to JSON: " + e.getMessage());
}
}
@Override
public String parseValue(Object input) {
String str = input.toString();
try {
SHARED_MAPPER.readTree(str);
} catch (Exception e) {
throw new CoercingParseValueException("Invalid JSON: " + str);
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (!(input instanceof StringValue sv)) return null;
return parseValue(sv.getValue());
}
})
.build();
public static final GraphQLScalarType AWS_DATE_TIME = GraphQLScalarType.newScalar()
.name("AWSDateTime")
.description("An ISO-8601 datetime string")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
try {
Instant.parse(str);
} catch (DateTimeParseException e) {
throw new CoercingParseValueException("Invalid AWSDateTime: " + str);
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (!(input instanceof StringValue sv)) return null;
return parseValue(sv.getValue());
}
})
.build();
public static final GraphQLScalarType AWS_DATE = GraphQLScalarType.newScalar()
.name("AWSDate")
.description("An ISO-8601 date string (yyyy-MM-dd)")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
try {
LocalDate.parse(str, DateTimeFormatter.ISO_LOCAL_DATE);
} catch (DateTimeParseException e) {
throw new CoercingParseValueException("Invalid AWSDate: " + str);
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (!(input instanceof StringValue sv)) return null;
return parseValue(sv.getValue());
}
})
.build();
public static final GraphQLScalarType AWS_TIME = GraphQLScalarType.newScalar()
.name("AWSTime")
.description("An ISO-8601 time string (HH:mm:ss)")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
try {
LocalTime.parse(str, DateTimeFormatter.ISO_LOCAL_TIME);
} catch (DateTimeParseException e) {
throw new CoercingParseValueException("Invalid AWSTime: " + str);
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (!(input instanceof StringValue sv)) return null;
return parseValue(sv.getValue());
}
})
.build();
public static final GraphQLScalarType AWS_TIMESTAMP = GraphQLScalarType.newScalar()
.name("AWSTimestamp")
.description("Unix epoch seconds (0 to 32503680000)")
.coercing(new Coercing<Long, Long>() {
@Override
public Long serialize(Object dataFetcherResult) {
if (dataFetcherResult == null) return null;
if (dataFetcherResult instanceof Number n) return n.longValue();
return Long.parseLong(dataFetcherResult.toString());
}
@Override
public Long parseValue(Object input) {
long val;
if (input instanceof Number n) val = n.longValue();
else val = Long.parseLong(input.toString());
if (val < 0 || val > 32503680000L)
throw new CoercingParseValueException("AWSTimestamp out of range: " + val);
return val;
}
@Override
public Long parseLiteral(Object input) {
if (input instanceof graphql.language.IntValue iv) return parseValue(iv.getValue().longValue());
throw new CoercingParseLiteralException("AWSTimestamp must be an integer");
}
})
.build();
private static final Pattern EMAIL_PATTERN = Pattern.compile("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$");
public static final GraphQLScalarType AWS_EMAIL = GraphQLScalarType.newScalar()
.name("AWSEmail")
.description("An RFC 5322 email address")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
if (!EMAIL_PATTERN.matcher(str).matches())
throw new CoercingParseValueException("Invalid AWSEmail: " + str);
return str;
}
@Override
public String parseLiteral(Object input) {
if (!(input instanceof StringValue sv)) return null;
return parseValue(sv.getValue());
}
})
.build();
public static final GraphQLScalarType AWS_URL = GraphQLScalarType.newScalar()
.name("AWSURL")
.description("A valid URL")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
try {
URI.create(str).toURL();
} catch (Exception e) {
throw new CoercingParseValueException("Invalid AWSURL: " + str);
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (!(input instanceof StringValue sv)) return null;
return parseValue(sv.getValue());
}
})
.build();
private static final Pattern PHONE_PATTERN = Pattern.compile("^\\+[1-9]\\d{1,14}$");
public static final GraphQLScalarType AWS_PHONE = GraphQLScalarType.newScalar()
.name("AWSPhone")
.description("An E.164 phone number")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
if (!PHONE_PATTERN.matcher(str).matches())
throw new CoercingParseValueException("Invalid AWSPhone: " + str);
return str;
}
@Override
public String parseLiteral(Object input) {
if (!(input instanceof StringValue sv)) return null;
return parseValue(sv.getValue());
}
})
.build();
private static final Pattern IPV4_PATTERN = Pattern.compile(
"^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$");
private static final Pattern IPV6_PATTERN = Pattern.compile(
"^[0-9a-fA-F:]+$");
public static final GraphQLScalarType AWS_IP_ADDRESS = GraphQLScalarType.newScalar()
.name("AWSIPAddress")
.description("An IPv4 or IPv6 address")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
if (!IPV4_PATTERN.matcher(str).matches() && !IPV6_PATTERN.matcher(str).matches()) {
throw new CoercingParseValueException("Invalid AWSIPAddress: " + str);
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (!(input instanceof StringValue sv)) return null;
return parseValue(sv.getValue());
}
})
.build();
public static final GraphQLScalarType AWS_BOOLEAN = GraphQLScalarType.newScalar()
.name("AWSBoolean")
.description("A boolean value")
.coercing(new Coercing<Boolean, Boolean>() {
@Override
public Boolean serialize(Object dataFetcherResult) {
if (dataFetcherResult == null) return null;
if (dataFetcherResult instanceof Boolean b) return b;
throw new CoercingSerializeException("AWSBoolean cannot serialize non-boolean value: " + dataFetcherResult.getClass().getSimpleName());
}
@Override
public Boolean parseValue(Object input) {
if (input instanceof Boolean b) return b;
throw new CoercingParseValueException("AWSBoolean cannot parse non-boolean value: " + input);
}
@Override
public Boolean parseLiteral(Object input) {
if (input instanceof graphql.language.BooleanValue bv) return bv.isValue();
throw new CoercingParseLiteralException("AWSBoolean must be a boolean literal");
}
})
.build();
public static final GraphQLScalarType AWS_LONG = GraphQLScalarType.newScalar()
.name("AWSLong")
.description("A 64-bit signed integer")
.coercing(new Coercing<Long, Long>() {
@Override
public Long serialize(Object dataFetcherResult) {
if (dataFetcherResult == null) return null;
if (dataFetcherResult instanceof Number n) return n.longValue();
return Long.parseLong(dataFetcherResult.toString());
}
@Override
public Long parseValue(Object input) {
if (input instanceof Number n) return n.longValue();
return Long.parseLong(input.toString());
}
@Override
public Long parseLiteral(Object input) {
if (input instanceof graphql.language.IntValue iv) return iv.getValue().longValue();
throw new CoercingParseLiteralException("AWSLong must be an integer");
}
})
.build();
public static final GraphQLScalarType AWS_INTEGER = GraphQLScalarType.newScalar()
.name("AWSInteger")
.description("A 32-bit signed integer")
.coercing(new Coercing<Integer, Integer>() {
@Override
public Integer serialize(Object dataFetcherResult) {
if (dataFetcherResult == null) return null;
if (dataFetcherResult instanceof Number n) return n.intValue();
return Integer.parseInt(dataFetcherResult.toString());
}
@Override
public Integer parseValue(Object input) {
if (input instanceof Number n) return n.intValue();
return Integer.parseInt(input.toString());
}
@Override
public Integer parseLiteral(Object input) {
if (input instanceof graphql.language.IntValue iv) return iv.getValue().intValue();
throw new CoercingParseLiteralException("AWSInteger must be an integer");
}
})
.build();
public static final GraphQLScalarType AWS_SHORT = GraphQLScalarType.newScalar()
.name("AWSShort")
.description("A 16-bit signed integer (-32768 to 32767)")
.coercing(new Coercing<Integer, Integer>() {
@Override
public Integer serialize(Object dataFetcherResult) {
if (dataFetcherResult instanceof Number n) return n.intValue();
return Integer.parseInt(dataFetcherResult.toString());
}
@Override
public Integer parseValue(Object input) {
int val;
if (input instanceof Number n) val = n.intValue();
else val = Integer.parseInt(input.toString());
if (val < -32768 || val > 32767)
throw new CoercingParseValueException("AWSShort out of range: " + val);
return val;
}
@Override
public Integer parseLiteral(Object input) {
if (input instanceof graphql.language.IntValue iv) return parseValue(iv.getValue().intValue());
throw new CoercingParseLiteralException("AWSShort must be an integer");
}
})
.build();
public static final GraphQLScalarType AWS_FLOAT = GraphQLScalarType.newScalar()
.name("AWSFloat")
.description("An IEEE 754 double-precision float")
.coercing(new Coercing<Double, Double>() {
@Override
public Double serialize(Object dataFetcherResult) {
if (dataFetcherResult == null) return null;
if (dataFetcherResult instanceof Number n) return n.doubleValue();
return Double.parseDouble(dataFetcherResult.toString());
}
@Override
public Double parseValue(Object input) {
if (input instanceof Number n) return n.doubleValue();
return Double.parseDouble(input.toString());
}
@Override
public Double parseLiteral(Object input) {
if (input instanceof graphql.language.FloatValue fv) return fv.getValue().doubleValue();
if (input instanceof graphql.language.IntValue iv) return iv.getValue().doubleValue();
throw new CoercingParseLiteralException("AWSFloat must be a number");
}
})
.build();
public static final GraphQLScalarType AWS_BIG_DECIMAL = GraphQLScalarType.newScalar()
.name("AWSBigDecimal")
.description("An arbitrary-precision decimal number")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
try {
new BigDecimal(str);
} catch (NumberFormatException e) {
throw new CoercingParseValueException("Invalid AWSBigDecimal: " + str);
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (input instanceof StringValue sv) return parseValue(sv.getValue());
if (input instanceof graphql.language.FloatValue fv) return fv.getValue().toString();
if (input instanceof graphql.language.IntValue iv) return iv.getValue().toString();
return null;
}
})
.build();
public static final GraphQLScalarType AWS_BIG_INT = GraphQLScalarType.newScalar()
.name("AWSBigInt")
.description("An arbitrary-precision integer")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
try {
new BigInteger(str);
} catch (NumberFormatException e) {
throw new CoercingParseValueException("Invalid AWSBigInt: " + str);
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (input instanceof graphql.language.IntValue iv) return iv.getValue().toString();
if (input instanceof StringValue sv) return parseValue(sv.getValue());
return null;
}
})
.build();
public static final GraphQLScalarType AWS_BYTE = GraphQLScalarType.newScalar()
.name("AWSByte")
.description("A base64-encoded byte array")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
try {
Base64.getDecoder().decode(str);
} catch (IllegalArgumentException e) {
throw new CoercingParseValueException("Invalid AWSByte: not valid base64");
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (!(input instanceof StringValue sv)) return null;
return parseValue(sv.getValue());
}
})
.build();
private AppSyncScalars() {}
}
@@ -0,0 +1,29 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.Map;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AdditionalAuthenticationProvider {
private AuthenticationType authenticationType;
private Map<String, Object> lambdaAuthorizerConfig;
private Map<String, Object> openIDConnectConfig;
private Map<String, Object> userPoolConfig;
public AuthenticationType getAuthenticationType() { return authenticationType; }
public void setAuthenticationType(AuthenticationType authenticationType) { this.authenticationType = authenticationType; }
public Map<String, Object> getLambdaAuthorizerConfig() { return lambdaAuthorizerConfig; }
public void setLambdaAuthorizerConfig(Map<String, Object> lambdaAuthorizerConfig) { this.lambdaAuthorizerConfig = lambdaAuthorizerConfig; }
public Map<String, Object> getOpenIDConnectConfig() { return openIDConnectConfig; }
public void setOpenIDConnectConfig(Map<String, Object> openIDConnectConfig) { this.openIDConnectConfig = openIDConnectConfig; }
public Map<String, Object> getUserPoolConfig() { return userPoolConfig; }
public void setUserPoolConfig(Map<String, Object> userPoolConfig) { this.userPoolConfig = userPoolConfig; }
}
@@ -0,0 +1,27 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ApiAssociation {
private String apiId;
private String associationStatus;
private String deploymentDetail;
private String domainName;
public String getApiId() { return apiId; }
public void setApiId(String apiId) { this.apiId = apiId; }
public String getAssociationStatus() { return associationStatus; }
public void setAssociationStatus(String associationStatus) { this.associationStatus = associationStatus; }
public String getDeploymentDetail() { return deploymentDetail; }
public void setDeploymentDetail(String deploymentDetail) { this.deploymentDetail = deploymentDetail; }
public String getDomainName() { return domainName; }
public void setDomainName(String domainName) { this.domainName = domainName; }
}
@@ -0,0 +1,15 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AuthMode {
private String authType;
public String getAuthType() { return authType; }
public void setAuthType(String authType) { this.authType = authType; }
}
@@ -0,0 +1,57 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import java.util.Map;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ChannelNamespace {
private String name;
private String apiId;
private String description;
private String channelNamespaceArn;
private String codeHandlers;
private Long created;
private HandlerConfigs handlerConfigs;
private Long lastModified;
private List<AuthMode> publishAuthModes;
private List<AuthMode> subscribeAuthModes;
private Map<String, String> tags;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getApiId() { return apiId; }
public void setApiId(String apiId) { this.apiId = apiId; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public String getChannelNamespaceArn() { return channelNamespaceArn; }
public void setChannelNamespaceArn(String channelNamespaceArn) { this.channelNamespaceArn = channelNamespaceArn; }
public String getCodeHandlers() { return codeHandlers; }
public void setCodeHandlers(String codeHandlers) { this.codeHandlers = codeHandlers; }
public Long getCreated() { return created; }
public void setCreated(Long created) { this.created = created; }
public HandlerConfigs getHandlerConfigs() { return handlerConfigs; }
public void setHandlerConfigs(HandlerConfigs handlerConfigs) { this.handlerConfigs = handlerConfigs; }
public Long getLastModified() { return lastModified; }
public void setLastModified(Long lastModified) { this.lastModified = lastModified; }
public List<AuthMode> getPublishAuthModes() { return publishAuthModes; }
public void setPublishAuthModes(List<AuthMode> publishAuthModes) { this.publishAuthModes = publishAuthModes; }
public List<AuthMode> getSubscribeAuthModes() { return subscribeAuthModes; }
public void setSubscribeAuthModes(List<AuthMode> subscribeAuthModes) { this.subscribeAuthModes = subscribeAuthModes; }
public Map<String, String> getTags() { return tags; }
public void setTags(Map<String, String> tags) { this.tags = tags; }
}
@@ -21,6 +21,7 @@ public class DataSource {
private Map<String, Object> relationalDatabaseConfig;
private Map<String, Object> openSearchServiceConfig;
private Map<String, Object> amazonBedrockRuntimeConfig;
private String dataSourceArn;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
@@ -54,4 +55,7 @@ public class DataSource {
public Map<String, Object> getAmazonBedrockRuntimeConfig() { return amazonBedrockRuntimeConfig; }
public void setAmazonBedrockRuntimeConfig(Map<String, Object> config) { this.amazonBedrockRuntimeConfig = config; }
public String getDataSourceArn() { return dataSourceArn; }
public void setDataSourceArn(String dataSourceArn) { this.dataSourceArn = dataSourceArn; }
}
@@ -0,0 +1,42 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.HashMap;
import java.util.Map;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DomainName {
private String domainName;
private String description;
private String certificateArn;
private String appsyncDomainName;
private String hostedZoneId;
private String domainNameArn;
private Map<String, String> tags = new HashMap<>();
public String getDomainName() { return domainName; }
public void setDomainName(String domainName) { this.domainName = domainName; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public String getCertificateArn() { return certificateArn; }
public void setCertificateArn(String certificateArn) { this.certificateArn = certificateArn; }
public String getAppsyncDomainName() { return appsyncDomainName; }
public void setAppsyncDomainName(String appsyncDomainName) { this.appsyncDomainName = appsyncDomainName; }
public String getHostedZoneId() { return hostedZoneId; }
public void setHostedZoneId(String hostedZoneId) { this.hostedZoneId = hostedZoneId; }
public String getDomainNameArn() { return domainNameArn; }
public void setDomainNameArn(String domainNameArn) { this.domainNameArn = domainNameArn; }
public Map<String, String> getTags() { return tags; }
public void setTags(Map<String, String> tags) { this.tags = tags; }
}
@@ -15,7 +15,7 @@ public class FunctionConfiguration {
private String requestMappingTemplate;
private String responseMappingTemplate;
private String functionVersion;
private String arn;
private String functionArn;
private String code;
public String getFunctionId() { return functionId; }
@@ -39,8 +39,8 @@ public class FunctionConfiguration {
public String getFunctionVersion() { return functionVersion; }
public void setFunctionVersion(String functionVersion) { this.functionVersion = functionVersion; }
public String getArn() { return arn; }
public void setArn(String arn) { this.arn = arn; }
public String getFunctionArn() { return functionArn; }
public void setFunctionArn(String functionArn) { this.functionArn = functionArn; }
public String getCode() { return code; }
public void setCode(String code) { this.code = code; }
@@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -19,10 +18,24 @@ public class GraphqlApi {
private AuthenticationType authenticationType;
private Map<String, String> uris = new HashMap<>();
private Map<String, Object> logConfig;
private List<Map<String, Object>> additionalAuthenticationProviders;
private List<AdditionalAuthenticationProvider> additionalAuthenticationProviders;
private Boolean xrayEnabled;
private Map<String, String> tags = new HashMap<>();
private Map<String, String> environmentVariables = new HashMap<>();
private String apiType = "GRAPHQL";
private String owner;
private String ownerContact;
private String visibility = "GLOBAL";
private String introspectionConfig;
private Integer queryDepthLimit;
private Integer resolverCountLimit;
private Map<String, Object> enhancedMetricsConfig;
private Map<String, Object> lambdaAuthorizerConfig;
private Map<String, Object> openIDConnectConfig;
private Map<String, Object> userPoolConfig;
private Map<String, String> dns;
private String wafWebAclArn;
private String mergedApiExecutionRoleArn;
public String getApiId() { return apiId; }
public void setApiId(String apiId) { this.apiId = apiId; }
@@ -42,8 +55,8 @@ public class GraphqlApi {
public Map<String, Object> getLogConfig() { return logConfig; }
public void setLogConfig(Map<String, Object> logConfig) { this.logConfig = logConfig; }
public List<Map<String, Object>> getAdditionalAuthenticationProviders() { return additionalAuthenticationProviders; }
public void setAdditionalAuthenticationProviders(List<Map<String, Object>> providers) { this.additionalAuthenticationProviders = providers; }
public List<AdditionalAuthenticationProvider> getAdditionalAuthenticationProviders() { return additionalAuthenticationProviders; }
public void setAdditionalAuthenticationProviders(List<AdditionalAuthenticationProvider> additionalAuthenticationProviders) { this.additionalAuthenticationProviders = additionalAuthenticationProviders; }
public Boolean getXrayEnabled() { return xrayEnabled; }
public void setXrayEnabled(Boolean xrayEnabled) { this.xrayEnabled = xrayEnabled; }
@@ -53,4 +66,46 @@ public class GraphqlApi {
public Map<String, String> getEnvironmentVariables() { return environmentVariables; }
public void setEnvironmentVariables(Map<String, String> environmentVariables) { this.environmentVariables = environmentVariables; }
public String getApiType() { return apiType; }
public void setApiType(String apiType) { this.apiType = apiType; }
public String getOwner() { return owner; }
public void setOwner(String owner) { this.owner = owner; }
public String getOwnerContact() { return ownerContact; }
public void setOwnerContact(String ownerContact) { this.ownerContact = ownerContact; }
public String getVisibility() { return visibility; }
public void setVisibility(String visibility) { this.visibility = visibility; }
public String getIntrospectionConfig() { return introspectionConfig; }
public void setIntrospectionConfig(String introspectionConfig) { this.introspectionConfig = introspectionConfig; }
public Integer getQueryDepthLimit() { return queryDepthLimit; }
public void setQueryDepthLimit(Integer queryDepthLimit) { this.queryDepthLimit = queryDepthLimit; }
public Integer getResolverCountLimit() { return resolverCountLimit; }
public void setResolverCountLimit(Integer resolverCountLimit) { this.resolverCountLimit = resolverCountLimit; }
public Map<String, Object> getEnhancedMetricsConfig() { return enhancedMetricsConfig; }
public void setEnhancedMetricsConfig(Map<String, Object> enhancedMetricsConfig) { this.enhancedMetricsConfig = enhancedMetricsConfig; }
public Map<String, Object> getLambdaAuthorizerConfig() { return lambdaAuthorizerConfig; }
public void setLambdaAuthorizerConfig(Map<String, Object> lambdaAuthorizerConfig) { this.lambdaAuthorizerConfig = lambdaAuthorizerConfig; }
public Map<String, Object> getOpenIDConnectConfig() { return openIDConnectConfig; }
public void setOpenIDConnectConfig(Map<String, Object> openIDConnectConfig) { this.openIDConnectConfig = openIDConnectConfig; }
public Map<String, Object> getUserPoolConfig() { return userPoolConfig; }
public void setUserPoolConfig(Map<String, Object> userPoolConfig) { this.userPoolConfig = userPoolConfig; }
public Map<String, String> getDns() { return dns; }
public void setDns(Map<String, String> dns) { this.dns = dns; }
public String getWafWebAclArn() { return wafWebAclArn; }
public void setWafWebAclArn(String wafWebAclArn) { this.wafWebAclArn = wafWebAclArn; }
public String getMergedApiExecutionRoleArn() { return mergedApiExecutionRoleArn; }
public void setMergedApiExecutionRoleArn(String mergedApiExecutionRoleArn) { this.mergedApiExecutionRoleArn = mergedApiExecutionRoleArn; }
}
@@ -0,0 +1,19 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class HandlerConfig {
private String behavior;
private Integration integration;
public String getBehavior() { return behavior; }
public void setBehavior(String behavior) { this.behavior = behavior; }
public Integration getIntegration() { return integration; }
public void setIntegration(Integration integration) { this.integration = integration; }
}
@@ -0,0 +1,19 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class HandlerConfigs {
private HandlerConfig onPublish;
private HandlerConfig onSubscribe;
public HandlerConfig getOnPublish() { return onPublish; }
public void setOnPublish(HandlerConfig onPublish) { this.onPublish = onPublish; }
public HandlerConfig getOnSubscribe() { return onSubscribe; }
public void setOnSubscribe(HandlerConfig onSubscribe) { this.onSubscribe = onSubscribe; }
}
@@ -0,0 +1,19 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Integration {
private String dataSourceName;
private LambdaConfig lambdaConfig;
public String getDataSourceName() { return dataSourceName; }
public void setDataSourceName(String dataSourceName) { this.dataSourceName = dataSourceName; }
public LambdaConfig getLambdaConfig() { return lambdaConfig; }
public void setLambdaConfig(LambdaConfig lambdaConfig) { this.lambdaConfig = lambdaConfig; }
}
@@ -0,0 +1,15 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class LambdaConfig {
private String invokeType;
public String getInvokeType() { return invokeType; }
public void setInvokeType(String invokeType) { this.invokeType = invokeType; }
}
@@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.Map;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@@ -18,6 +20,12 @@ public class Resolver {
private ResolverKind kind;
private String code;
private ResolverRuntime runtime;
private String resolverArn;
private Map<String, Object> cachingConfig;
private Integer maxBatchSize;
private String metricsConfig;
private Map<String, Object> pipelineConfig;
private Map<String, Object> syncConfig;
public String getApiId() { return apiId; }
public void setApiId(String apiId) { this.apiId = apiId; }
@@ -49,6 +57,24 @@ public class Resolver {
public ResolverRuntime getRuntime() { return runtime; }
public void setRuntime(ResolverRuntime runtime) { this.runtime = runtime; }
public String getResolverArn() { return resolverArn; }
public void setResolverArn(String resolverArn) { this.resolverArn = resolverArn; }
public Map<String, Object> getCachingConfig() { return cachingConfig; }
public void setCachingConfig(Map<String, Object> cachingConfig) { this.cachingConfig = cachingConfig; }
public Integer getMaxBatchSize() { return maxBatchSize; }
public void setMaxBatchSize(Integer maxBatchSize) { this.maxBatchSize = maxBatchSize; }
public String getMetricsConfig() { return metricsConfig; }
public void setMetricsConfig(String metricsConfig) { this.metricsConfig = metricsConfig; }
public Map<String, Object> getPipelineConfig() { return pipelineConfig; }
public void setPipelineConfig(Map<String, Object> pipelineConfig) { this.pipelineConfig = pipelineConfig; }
public Map<String, Object> getSyncConfig() { return syncConfig; }
public void setSyncConfig(Map<String, Object> syncConfig) { this.syncConfig = syncConfig; }
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@@ -0,0 +1,55 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SourceApiAssociation {
private String associationArn;
private String associationId;
private String description;
private Long lastSuccessfulMergeDate;
private String mergedApiArn;
private String mergedApiId;
private String sourceApiArn;
private SourceApiAssociationConfig sourceApiAssociationConfig;
private String sourceApiAssociationStatus;
private String sourceApiAssociationStatusDetail;
private String sourceApiId;
public String getAssociationArn() { return associationArn; }
public void setAssociationArn(String associationArn) { this.associationArn = associationArn; }
public String getAssociationId() { return associationId; }
public void setAssociationId(String associationId) { this.associationId = associationId; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public Long getLastSuccessfulMergeDate() { return lastSuccessfulMergeDate; }
public void setLastSuccessfulMergeDate(Long lastSuccessfulMergeDate) { this.lastSuccessfulMergeDate = lastSuccessfulMergeDate; }
public String getMergedApiArn() { return mergedApiArn; }
public void setMergedApiArn(String mergedApiArn) { this.mergedApiArn = mergedApiArn; }
public String getMergedApiId() { return mergedApiId; }
public void setMergedApiId(String mergedApiId) { this.mergedApiId = mergedApiId; }
public String getSourceApiArn() { return sourceApiArn; }
public void setSourceApiArn(String sourceApiArn) { this.sourceApiArn = sourceApiArn; }
public SourceApiAssociationConfig getSourceApiAssociationConfig() { return sourceApiAssociationConfig; }
public void setSourceApiAssociationConfig(SourceApiAssociationConfig config) { this.sourceApiAssociationConfig = config; }
public String getSourceApiAssociationStatus() { return sourceApiAssociationStatus; }
public void setSourceApiAssociationStatus(String sourceApiAssociationStatus) { this.sourceApiAssociationStatus = sourceApiAssociationStatus; }
public String getSourceApiAssociationStatusDetail() { return sourceApiAssociationStatusDetail; }
public void setSourceApiAssociationStatusDetail(String sourceApiAssociationStatusDetail) { this.sourceApiAssociationStatusDetail = sourceApiAssociationStatusDetail; }
public String getSourceApiId() { return sourceApiId; }
public void setSourceApiId(String sourceApiId) { this.sourceApiId = sourceApiId; }
}
@@ -0,0 +1,15 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SourceApiAssociationConfig {
private String mergeType;
public String getMergeType() { return mergeType; }
public void setMergeType(String mergeType) { this.mergeType = mergeType; }
}
@@ -0,0 +1,39 @@
package io.github.hectorvent.floci.services.appsync.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SourceApiAssociationSummary {
private String associationArn;
private String associationId;
private String description;
private String mergedApiArn;
private String mergedApiId;
private String sourceApiArn;
private String sourceApiId;
public String getAssociationArn() { return associationArn; }
public void setAssociationArn(String associationArn) { this.associationArn = associationArn; }
public String getAssociationId() { return associationId; }
public void setAssociationId(String associationId) { this.associationId = associationId; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public String getMergedApiArn() { return mergedApiArn; }
public void setMergedApiArn(String mergedApiArn) { this.mergedApiArn = mergedApiArn; }
public String getMergedApiId() { return mergedApiId; }
public void setMergedApiId(String mergedApiId) { this.mergedApiId = mergedApiId; }
public String getSourceApiArn() { return sourceApiArn; }
public void setSourceApiArn(String sourceApiArn) { this.sourceApiArn = sourceApiArn; }
public String getSourceApiId() { return sourceApiId; }
public void setSourceApiId(String sourceApiId) { this.sourceApiId = sourceApiId; }
}