fix(appconfig): use capital "Tags" body key matching AWS SDK wire format (#704)

AppConfigTagHandler inherited the default tagsBodyKey() = "tags"
(lowercase), so SharedTagsController parsed and serialised the tag
payload with the lowercase key. The AWS spec for AppConfig
TagResource and ListTagsForResource is capital "Tags" with a map
body, which is what AWS SDK clients send and expect — so SDK calls
to appConfig.tagResource(...) silently dropped tags and listing
came back empty.

Override tagsBodyKey() on AppConfigTagHandler to return "Tags".
The other axes (POST method, map body, lowercase tagKeys query)
already match the defaults so no further override is needed.

AppConfigIntegrationTest is updated to send capital "Tags" bodies
and assert capital "Tags" response keys, matching the AWS SDK
wire format. AppConfigTest (SDK compatibility) now exercises a
tagResource → listTagsForResource → untagResource round-trip via
AppConfigClient to lock in the wire format end-to-end.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-05-04 20:18:53 -05:00
1 parent 4fe93aa379
commit 7fa2a28c62
3 files changed
+53 -8

No files matched your search

@@ -266,4 +266,44 @@ class AppConfigTest {
// The RestAssured internal test sees "" (raw HTTP header value).
assertThat(response.versionLabel()).isNull();
}
@Test
@Order(50)
@DisplayName("TagResource / ListTagsForResource - SDK round-trip")
void tagAndListViaSdk() {
// Reproducer for the wire-format mismatch that previously made AWS SDK callers
// silently get an empty tag set: SDK serializes as {"Tags": {...}} (capital),
// floci must accept and echo back that exact shape.
String tagAppId = appConfig.createApplication(CreateApplicationRequest.builder()
.name("tag-roundtrip-app")
.build()).id();
String arn = "arn:aws:appconfig:us-east-1:000000000000:application/" + tagAppId;
try {
appConfig.tagResource(TagResourceRequest.builder()
.resourceArn(arn)
.tags(java.util.Map.of("env", "prod", "owner", "Alice"))
.build());
ListTagsForResourceResponse listed = appConfig.listTagsForResource(
ListTagsForResourceRequest.builder().resourceArn(arn).build());
assertThat(listed.tags())
.containsEntry("env", "prod")
.containsEntry("owner", "Alice");
appConfig.untagResource(UntagResourceRequest.builder()
.resourceArn(arn)
.tagKeys("env")
.build());
assertThat(appConfig.listTagsForResource(
ListTagsForResourceRequest.builder().resourceArn(arn).build()).tags())
.doesNotContainKey("env")
.containsEntry("owner", "Alice");
} finally {
try {
appConfig.deleteApplication(DeleteApplicationRequest.builder()
.applicationId(tagAppId).build());
} catch (Exception ignored) {}
}
}
}