mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 23:29:28 -05:00
fix(autoscaling): validate tag propagation per action (#7537)
This commit is contained in:
1 parent
ab2d19a4ac
commit
ee038af772
5 files changed
+396
-5
No files matched your search
+13
-5
@@ -516,7 +516,14 @@ public class AutoScalingQueryHandler {
|
||||
}
|
||||
|
||||
private Response handleCreateOrUpdateTags(MultivaluedMap<String, String> p, String region) {
|
||||
for (TagRequest tag : parseTagRequests(p)) {
|
||||
List<TagRequest> tags = parseTagRequests(p);
|
||||
for (int i = 0; i < tags.size(); i++) {
|
||||
if (tags.get(i).propagateAtLaunch() == null) {
|
||||
throw new AwsException("ValidationError",
|
||||
"Tags.member." + (i + 1) + ".PropagateAtLaunch is required", 400);
|
||||
}
|
||||
}
|
||||
for (TagRequest tag : tags) {
|
||||
service.createOrUpdateTags(
|
||||
region,
|
||||
tag.resourceId(),
|
||||
@@ -1745,8 +1752,8 @@ public class AutoScalingQueryHandler {
|
||||
if (key == null) { break; }
|
||||
String value = p.getFirst("Tags.member." + i + ".Value");
|
||||
tags.put(key, value != null ? value : "");
|
||||
propagateAtLaunch.put(key,
|
||||
Boolean.parseBoolean(p.getFirst("Tags.member." + i + ".PropagateAtLaunch")));
|
||||
String flag = p.getFirst("Tags.member." + i + ".PropagateAtLaunch");
|
||||
propagateAtLaunch.put(key, flag == null || Boolean.parseBoolean(flag));
|
||||
}
|
||||
return new ParsedTags(tags, propagateAtLaunch);
|
||||
}
|
||||
@@ -1759,13 +1766,14 @@ public class AutoScalingQueryHandler {
|
||||
String resourceId = p.getFirst("Tags.member." + i + ".ResourceId");
|
||||
String resourceType = p.getFirst("Tags.member." + i + ".ResourceType");
|
||||
String value = p.getFirst("Tags.member." + i + ".Value");
|
||||
boolean propagateAtLaunch = Boolean.parseBoolean(p.getFirst("Tags.member." + i + ".PropagateAtLaunch"));
|
||||
String flag = p.getFirst("Tags.member." + i + ".PropagateAtLaunch");
|
||||
Boolean propagateAtLaunch = flag == null ? null : Boolean.parseBoolean(flag);
|
||||
result.add(new TagRequest(resourceId, resourceType, key, value != null ? value : "", propagateAtLaunch));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private record TagRequest(String resourceId, String resourceType, String key, String value, boolean propagateAtLaunch) {}
|
||||
private record TagRequest(String resourceId, String resourceType, String key, String value, Boolean propagateAtLaunch) {}
|
||||
|
||||
private record ParsedTags(Map<String, String> tags, Map<String, Boolean> propagateAtLaunch) {}
|
||||
|
||||
|
||||
Reference in new issue
Block a user