fix(elb): return TargetGroupNotFound for missing target groups (#1161)

This commit is contained in:
JonghyeokNam authored and GitHub committed 2026-06-03 20:40:52 -05:00
1 parent 30a598f080
commit 289e1e9630
2 files changed
+33 -1

No files matched your search

@@ -238,13 +238,16 @@ public class ElbV2Service {
if (tgArns != null && !tgArns.isEmpty()) {
Set<String> arnSet = new HashSet<>(tgArns);
result = result.stream().filter(tg -> arnSet.contains(tg.getTargetGroupArn())).collect(Collectors.toList());
if (result.isEmpty()) {
if (result.size() != arnSet.size()) {
throw new AwsException("TargetGroupNotFound", "One or more target groups not found.", 400);
}
}
if (names != null && !names.isEmpty()) {
Set<String> nameSet = new HashSet<>(names);
result = result.stream().filter(tg -> nameSet.contains(tg.getTargetGroupName())).collect(Collectors.toList());
if (result.size() != nameSet.size()) {
throw new AwsException("TargetGroupNotFound", "One or more target groups not found.", 400);
}
}
return result;
}