fix(marketplace): serve Entitlement and Agreement in every region AWS publishes (#5028)

* fix(marketplace): serve Entitlement and Agreement in every region AWS publishes

GetEntitlements and the Marketplace Agreement API refused every region but
us-east-1, on the assumption that AWS Marketplace is commercial-only. AWS
publishes more endpoints than that: Entitlement also runs in cn-northwest-1
and eusc-de-east-1, and Agreement in us-iso-east-1, us-isob-east-1,
us-isof-south-1 and eusc-de-east-1 (botocore endpoints.json). Both now accept
exactly those regions and keep refusing the rest with AWS's message and error
code, so cn-north-1, which has neither endpoint, is still rejected.

* fix(marketplace): name the served regions in the Entitlement and Agreement refusals

Both refusals still said "available only in us-east-1" after the region sets
grew, so a caller in an unserved ISO, EUSC or China region was pointed at a
commercial region it cannot reach. Each message now lists the regions its
API serves, as Marketplace Discovery's already does. No reference source
carries AWS's text for these refusals, so the comment no longer calls it
AWS's.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-03 22:04:03 -04:00
1 parent f9a65581be
commit 546b5cef64
5 files changed
+49 -5

No files matched your search

@@ -146,4 +146,19 @@ class MarketplaceAgreementServiceTest {
() -> service.handle("SearchAgreements", mapper.readTree("{\"filters\":[{\"name\":\"AgreementType\",\"values\":[\"PurchaseAgreement\"]}]}"), "us-west-2"));
assertEquals("ValidationException", error.getErrorCode());
}
@Test
void searchAgreementsIsServedInEveryRegionAwsPublishesOutsideCommercial() throws Exception {
JsonNode request = mapper.readTree(
"{\"filters\":[{\"name\":\"AgreementType\",\"values\":[\"PurchaseAgreement\"]}]}");
for (String region : new String[] {"eusc-de-east-1", "us-iso-east-1", "us-isob-east-1", "us-isof-south-1"}) {
JsonNode response = service.handle("SearchAgreements", request, region);
assertEquals(0, response.path("agreementViewSummaries").size(), region);
}
AwsException error = assertThrows(AwsException.class,
() -> service.handle("SearchAgreements", request, "cn-north-1"));
assertEquals("ValidationException", error.getErrorCode());
assertEquals("AWS Marketplace Agreement API is available only in us-east-1, us-iso-east-1, us-isob-east-1, "
+ "us-isof-south-1, and eusc-de-east-1.", error.getMessage());
}
}
@@ -65,4 +65,19 @@ class MarketplaceEntitlementServiceTest {
assertThrows(AwsException.class,
() -> service.getEntitlements(mapper.readTree("{\"ProductCode\":\"product-local\"}"), "us-west-2"));
}
@Test
void getEntitlementsIsServedInEveryRegionAwsPublishesOutsideCommercial() throws Exception {
for (String region : new String[] {"cn-northwest-1", "eusc-de-east-1"}) {
JsonNode response = service.getEntitlements(
mapper.readTree("{\"ProductCode\":\"product-local\"}"), region);
assertEquals(0, response.path("Entitlements").size(), region);
}
AwsException error = assertThrows(AwsException.class,
() -> service.getEntitlements(
mapper.readTree("{\"ProductCode\":\"product-local\"}"), "cn-north-1"));
assertEquals("InvalidParameterException", error.getErrorCode());
assertEquals("AWS Marketplace Entitlement Service is available only in us-east-1, cn-northwest-1, "
+ "and eusc-de-east-1.", error.getMessage());
}
}