Merge pull request #41 from breezy-bytes/feature/cloudformation-add-delete-change-set

feat: add support for DeleteChangeSet in CloudFormation
This commit is contained in:
Juan Diego López authored and GitHub committed 2026-03-24 13:39:36 -04:00
commit e05b7ec7be
4 files changed
+176

No files matched your search

@@ -46,6 +46,7 @@ public class CloudFormationQueryHandler {
case "CreateChangeSet" -> createChangeSet(params, region);
case "DescribeChangeSet" -> describeChangeSet(params, region);
case "ExecuteChangeSet" -> executeChangeSet(params, region);
case "DeleteChangeSet" -> deleteChangeSet(params, region);
case "ListChangeSets" -> listChangeSets(params, region);
case "DescribeStackEvents" -> describeStackEvents(params, region);
case "DescribeStackResources" -> describeStackResources(params, region);
@@ -222,6 +223,25 @@ public class CloudFormationQueryHandler {
return Response.ok(xml).type("text/xml").build();
}
// ── DeleteChangeSet ───────────────────────────────────────────────────────
private Response deleteChangeSet(MultivaluedMap<String, String> params, String region) {
String stackName = params.getFirst("StackName");
String changeSetName = params.getFirst("ChangeSetName");
try {
cfnService.deleteChangeSet(stackName, changeSetName, region);
} catch (AwsException e) {
return xmlError(e.getErrorCode(), e.getMessage(), e.getHttpStatus());
}
String xml = new XmlBuilder()
.start("DeleteChangeSetResponse", CF_NS)
.raw("<DeleteChangeSetResult/>")
.raw(AwsQueryResponse.responseMetadata())
.end("DeleteChangeSetResponse")
.build();
return Response.ok(xml).type("text/xml").build();
}
// ── ListChangeSets ────────────────────────────────────────────────────────
private Response listChangeSets(MultivaluedMap<String, String> params, String region) {
@@ -128,6 +128,18 @@ public class CloudFormationService {
executor.submit(() -> executeTemplate(stack, templateBody, params, isCreate, region));
}
// ── DeleteChangeSet ───────────────────────────────────────────────────────
public void deleteChangeSet(String stackName, String changeSetName, String region) {
Stack stack = getStackOrThrow(stackName, region);
ChangeSet cs = stack.getChangeSets().get(changeSetName);
if (cs == null) {
throw new AwsException("ChangeSetNotFoundException",
"ChangeSet [" + changeSetName + "] does not exist", 400);
}
stack.getChangeSets().remove(changeSetName);
}
// ── DeleteStack ───────────────────────────────────────────────────────────
public void deleteStack(String stackName, String region) {