feat(dynamodb): serve DescribeLimits and DescribeEndpoints (#8099)

* feat(dynamodb): serve DescribeLimits and DescribeEndpoints

DynamoDB reports the default quotas of 80,000 read and write capacity
units per account and 40,000 per table. It names its Regional endpoint
with a cache period of 1,440 minutes.

* fix(dynamodb): name Floci's own address in DescribeEndpoints

With endpoint discovery on, the AWS SDK for Java 2.x sends later
requests to the address DescribeEndpoints names, even when the client
sets an endpoint. The Regional AWS host sent them to real DynamoDB.
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-11-12 09:10:59 -04:00
1 parent 59c2b46e1c
commit 60252c9b7f
4 files changed
+64 -3

No files matched your search

@@ -878,6 +878,36 @@ class DynamoDbIntegrationTest {
.body("TableNames", hasItem("TestTable"));
}
@Test
void describeLimitsReportsTheDefaultQuotas() {
given()
.header("X-Amz-Target", "DynamoDB_20120810.DescribeLimits")
.contentType(DYNAMODB_CONTENT_TYPE)
.body("{}")
.when()
.post("/")
.then()
.statusCode(200)
.body("AccountMaxReadCapacityUnits", equalTo(80000))
.body("AccountMaxWriteCapacityUnits", equalTo(80000))
.body("TableMaxReadCapacityUnits", equalTo(40000))
.body("TableMaxWriteCapacityUnits", equalTo(40000));
}
@Test
void describeEndpointsNamesFloci() {
given()
.header("X-Amz-Target", "DynamoDB_20120810.DescribeEndpoints")
.contentType(DYNAMODB_CONTENT_TYPE)
.body("{}")
.when()
.post("/")
.then()
.statusCode(200)
.body("Endpoints.Address", contains("localhost:4566"))
.body("Endpoints.CachePeriodInMinutes", contains(1440));
}
@Test
@Order(5)
void putItem() {
@@ -74,7 +74,7 @@ class DynamoDbNativeBackendTest {
DynamoDbService service = new DynamoDbService(storageFactory, new RegionResolver(REGION, ACCOUNT), streams,
forwarder, null, mapper, mock(EmulatorConfig.class, RETURNS_DEEP_STUBS));
NativeDynamoDbTableService tables = new NativeDynamoDbTableService(service, streams, mock(KinesisService.class));
backend = new NativeDynamoDbBackend(new NativeDynamoDbJsonHandler(service, tables, mapper),
backend = new NativeDynamoDbBackend(new NativeDynamoDbJsonHandler(service, tables, mapper, mock(EmulatorConfig.class)),
new NativeDynamoDbStreamsJsonHandler(streams, service, new RegionResolver(REGION, ACCOUNT), mapper),
tables, service, streams, ttl, mapper);
}