Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit207a19d

Browse files
committed
add implementation of DeleteChangeSet for CFnV2
1 parent5ffabc0 commit207a19d

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

‎localstack-core/localstack/services/cloudformation/v2/provider.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
CreateChangeSetOutput,
1717
CreateStackInput,
1818
CreateStackOutput,
19+
DeleteChangeSetOutput,
1920
DeletionMode,
2021
DescribeChangeSetOutput,
2122
DescribeStackEventsOutput,
@@ -84,7 +85,7 @@ def is_changeset_arn(change_set_name_or_id: str) -> bool:
8485

8586
classStackNotFoundError(ValidationError):
8687
def__init__(self,stack_name:str):
87-
super().__init__(f"Stackwith id{stack_name} does not exist")
88+
super().__init__(f"Stack[{stack_name}] does not exist")
8889

8990

9091
deffind_stack_v2(state:CloudFormationStore,stack_name:str|None)->Stack|None:
@@ -448,6 +449,30 @@ def describe_change_set(
448449
)
449450
returnresult
450451

452+
@handler("DeleteChangeSet")
453+
defdelete_change_set(
454+
self,
455+
context:RequestContext,
456+
change_set_name:ChangeSetNameOrId,
457+
stack_name:StackNameOrId=None,
458+
**kwargs,
459+
)->DeleteChangeSetOutput:
460+
state=get_cloudformation_store(context.account_id,context.region)
461+
462+
ifis_changeset_arn(change_set_name):
463+
change_set=state.change_sets.get(change_set_name)
464+
elifnotis_changeset_arn(change_set_name)andstack_name:
465+
change_set=find_change_set_v2(state,change_set_name,stack_name)
466+
else:
467+
raiseValidationError(
468+
"StackName must be specified if ChangeSetName is not specified as an ARN."
469+
)
470+
471+
change_set.stack.change_set_ids.remove(change_set.change_set_id)
472+
state.change_sets.pop(change_set.change_set_id)
473+
474+
returnDeleteChangeSetOutput()
475+
451476
@handler("CreateStack",expand=False)
452477
defcreate_stack(self,context:RequestContext,request:CreateStackInput)->CreateStackOutput:
453478
try:

‎tests/aws/services/cloudformation/api/test_changesets.snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
}
173173
},
174174
"tests/aws/services/cloudformation/api/test_changesets.py::test_delete_change_set_exception": {
175-
"recorded-date":"12-03-2025,10:14:25",
175+
"recorded-date":"18-07-2025,20:15:37",
176176
"recorded-content": {
177177
"e1": {
178178
"Error": {

‎tests/aws/services/cloudformation/api/test_changesets.validation.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@
6060
"last_validated_date":"2023-11-22T07:49:15+00:00"
6161
},
6262
"tests/aws/services/cloudformation/api/test_changesets.py::test_delete_change_set_exception": {
63-
"last_validated_date":"2025-03-12T10:14:25+00:00"
63+
"last_validated_date":"2025-07-18T20:15:37+00:00",
64+
"durations_in_seconds": {
65+
"setup":0.32,
66+
"call":0.42,
67+
"teardown":0.0,
68+
"total":0.74
69+
}
6470
},
6571
"tests/aws/services/cloudformation/api/test_changesets.py::test_deleted_changeset": {
6672
"last_validated_date":"2022-08-11T09:11:47+00:00"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp