feat(servicequotas): add quota request history lookup (#3054)

* feat(servicequotas): add quota request history lookup

* fix(servicequotas): validate history tokens and quota scope
This commit is contained in:
Franklin G. Mendoza authored and GitHub committed 2026-09-05 13:52:22 -04:00
1 parent a31a9599fd
commit 532e27986e
4 files changed
+116 -8

No files matched your search

@@ -158,6 +158,81 @@ class ServiceQuotasIntegrationTest {
.body("Quota.GlobalQuota", equalTo(false));
}
@Test
void organizationsQuotaUsesAwsQuotaCode() {
given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "ServiceQuotasV20190624.GetServiceQuota")
.header("Authorization", AUTH_HEADER)
.body("{\"ServiceCode\":\"organizations\",\"QuotaCode\":\"L-E619E033\"}")
.when()
.post("/")
.then()
.statusCode(200)
.body("Quota.QuotaCode", equalTo("L-E619E033"))
.body("Quota.QuotaName", equalTo("Maximum number of accounts"))
.body("Quota.Value", equalTo(50.0f))
.body("Quota.GlobalQuota", equalTo(true));
}
@Test
void listRequestedQuotaHistoryByQuotaReturnsEmptyHistoryForKnownQuota() {
given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "ServiceQuotasV20190624.ListRequestedServiceQuotaChangeHistoryByQuota")
.header("Authorization", AUTH_HEADER)
.body("{\"ServiceCode\":\"organizations\",\"QuotaCode\":\"L-E619E033\"}")
.when()
.post("/")
.then()
.statusCode(200)
.body("RequestedQuotas.size()", equalTo(0));
}
@Test
void listRequestedQuotaHistoryByQuotaRejectsImpossibleNextToken() {
given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "ServiceQuotasV20190624.ListRequestedServiceQuotaChangeHistoryByQuota")
.header("Authorization", AUTH_HEADER)
.body("{\"ServiceCode\":\"organizations\",\"QuotaCode\":\"L-E619E033\",\"NextToken\":\"MQ\"}")
.when()
.post("/")
.then()
.statusCode(400)
.body("__type", equalTo("InvalidPaginationTokenException"));
}
@Test
void listRequestedQuotaHistoryByQuotaRejectsUnknownQuota() {
given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "ServiceQuotasV20190624.ListRequestedServiceQuotaChangeHistoryByQuota")
.header("Authorization", AUTH_HEADER)
.body("{\"ServiceCode\":\"organizations\",\"QuotaCode\":\"L-DOESNOTEX\"}")
.when()
.post("/")
.then()
.statusCode(400)
.body("__type", equalTo("NoSuchResourceException"));
}
@Test
void requestOrganizationsQuotaIncreasePreservesGlobalQuota() {
given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "ServiceQuotasV20190624.RequestServiceQuotaIncrease")
.header("Authorization", AUTH_HEADER)
.body("{\"ServiceCode\":\"organizations\",\"QuotaCode\":\"L-E619E033\",\"DesiredValue\":100}")
.when()
.post("/")
.then()
.statusCode(200)
.body("RequestedQuota.ServiceCode", equalTo("organizations"))
.body("RequestedQuota.QuotaCode", equalTo("L-E619E033"))
.body("RequestedQuota.GlobalQuota", equalTo(true));
}
@Test
void getServiceQuota_unknownQuotaCode_returnsNoSuchResource() {
given()