fix(config): validate recorder selector list cardinality (#8269)

* fix(config): validate recorder selector list cardinality
* test(config): reuse shared SDK client setup
This commit is contained in:
Jackson Price authored and GitHub committed 2026-11-14 01:35:09 -04:00
1 parent f9eb910b62
commit c6b41a4627
4 files changed
+166

No files matched your search

@@ -712,6 +712,7 @@ public class AwsConfigService {
}
public List<ConfigurationRecorder> describeConfigurationRecorders(String region, List<String> names, String arn) {
validateConfigurationRecorderNames(names);
ConfigurationRecorder recorder = configurationRecorders.get(region);
requireRecorderArn(arn, recorder);
if (recorder == null) {
@@ -732,6 +733,13 @@ public class AwsConfigService {
return List.of(recorder);
}
private static void validateConfigurationRecorderNames(List<String> names) {
if (names != null && names.size() > 1) {
throw new AwsException("ValidationException",
"You have specified more than one configuration recorder.", 400);
}
}
private static void requireRecorderArn(String arn, ConfigurationRecorder recorder) {
if (arn != null && (recorder == null || !arn.equals(recorder.arn()))) {
throw new AwsException("NoSuchConfigurationRecorderException",
@@ -780,6 +788,7 @@ public class AwsConfigService {
public List<ConfigurationRecorderStatus> describeConfigurationRecorderStatus(String region, List<String> names,
String arn) {
validateConfigurationRecorderNames(names);
ConfigurationRecorder recorder = configurationRecorders.get(region);
requireRecorderArn(arn, recorder);
if (recorder == null) {