Skip to content

Commit f05b361

Browse files
authored
Remove override/V2 SDK (#286)
1 parent 9eeca00 commit f05b361

17 files changed

+2876
-1736
lines changed

assets/featureFlag/prod.json

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,39 @@
66
"enabled": false
77
},
88
"EnhancedDryRun": {
9-
"enabled": false,
9+
"enabled": true,
1010
"fleetPercentage": 100,
11-
"allowlistedRegions": []
11+
"allowlistedRegions": [
12+
"us-east-1",
13+
"us-east-2",
14+
"us-west-1",
15+
"us-west-2",
16+
"ca-central-1",
17+
"ca-west-1",
18+
"sa-east-1",
19+
"eu-north-1",
20+
"eu-west-1",
21+
"eu-west-2",
22+
"eu-west-3",
23+
"eu-central-1",
24+
"eu-central-2",
25+
"eu-south-1",
26+
"eu-south-2",
27+
"ap-east-1",
28+
"ap-south-1",
29+
"ap-south-2",
30+
"ap-northeast-1",
31+
"ap-northeast-2",
32+
"ap-northeast-3",
33+
"ap-southeast-1",
34+
"ap-southeast-2",
35+
"ap-southeast-3",
36+
"ap-southeast-4",
37+
"me-south-1",
38+
"me-central-1",
39+
"af-south-1",
40+
"il-central-1"
41+
]
1242
}
1343
}
1444
}

package-lock.json

Lines changed: 2411 additions & 797 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545
"prepare": "husky"
4646
},
4747
"dependencies": {
48-
"@aws-sdk/client-cloudcontrol": "3.873.0",
49-
"@aws-sdk/client-cloudformation": "3.873.0",
50-
"@aws-sdk/client-iam": "3.873.0",
51-
"@aws-sdk/client-s3": "3.873.0",
52-
"@aws-sdk/client-sts": "3.873.0",
53-
"@aws-sdk/credential-provider-node": "3.873.0",
48+
"@aws-sdk/client-cloudcontrol": "3.934.0",
49+
"@aws-sdk/client-cloudformation": "3.934.0",
50+
"@aws-sdk/client-iam": "3.934.0",
51+
"@aws-sdk/client-s3": "3.934.0",
52+
"@aws-sdk/client-sts": "3.934.0",
53+
"@aws-sdk/credential-provider-node": "3.934.0",
5454
"@base2/pretty-print-object": "1.0.2",
5555
"@langchain/anthropic": "0.3.26",
5656
"@langchain/aws": "0.1.14",

src/server/CfnLspProviders.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ import {
2323
} from '../stacks/actions/StackActionRequestType';
2424
import { StackActionWorkflow } from '../stacks/actions/StackActionWorkflowType';
2525
import { ValidationWorkflow } from '../stacks/actions/ValidationWorkflow';
26-
import { ValidationWorkflowV2 } from '../stacks/actions/ValidationWorkflowV2';
2726
import { StackEventManager } from '../stacks/StackEventManager';
2827
import { StackManager } from '../stacks/StackManager';
29-
import { localCfnClientExists } from '../utils/ClientUtil';
3028
import { Closeable, closeSafely } from '../utils/Closeable';
3129
import { Configurable, Configurables } from '../utils/Configurable';
3230
import { CfnExternal } from './CfnExternal';
@@ -63,10 +61,7 @@ export class CfnLspProviders implements Configurables, Closeable {
6361
this.stackManager = overrides.stackManager ?? new StackManager(external.cfnService);
6462
this.stackEventManager = overrides.stackEventManager ?? new StackEventManager(external.cfnService);
6563
this.validationWorkflowService =
66-
overrides.validationWorkflowService ??
67-
(localCfnClientExists()
68-
? ValidationWorkflowV2.create(core, external, core.validationManager)
69-
: ValidationWorkflow.create(core, external, core.validationManager));
64+
overrides.validationWorkflowService ?? ValidationWorkflow.create(core, external, core.validationManager);
7065
this.deploymentWorkflowService =
7166
overrides.deploymentWorkflowService ?? DeploymentWorkflow.create(core, external);
7267
this.changeSetDeletionWorkflowService =

src/services/CfnService.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import {
1818
DeleteStackCommandOutput,
1919
DetectStackDriftCommand,
2020
DetectStackDriftCommandOutput,
21+
DescribeEventsCommand,
22+
DescribeEventsCommandOutput,
2123
DescribeStackEventsCommand,
2224
DescribeStackEventsCommandOutput,
2325
DescribeStackResourcesCommand,
@@ -193,6 +195,40 @@ export class CfnService {
193195
});
194196
}
195197

198+
@Count({ name: 'describeEvents' })
199+
public async describeEvents(params: {
200+
ChangeSetName: string;
201+
StackName: string;
202+
}): Promise<DescribeEventsCommandOutput> {
203+
return await this.withClient(async (client) => {
204+
let nextToken: string | undefined;
205+
let result: DescribeEventsCommandOutput | undefined;
206+
const operationEvents: DescribeEventsCommandOutput['OperationEvents'] = [];
207+
208+
do {
209+
const response = (await client.send(
210+
new DescribeEventsCommand({
211+
...params,
212+
NextToken: nextToken,
213+
}),
214+
)) as unknown as DescribeEventsCommandOutput;
215+
216+
if (result) {
217+
operationEvents.push(...(response.OperationEvents ?? []));
218+
} else {
219+
result = response;
220+
operationEvents.push(...(result.OperationEvents ?? []));
221+
}
222+
223+
nextToken = response.NextToken;
224+
} while (nextToken);
225+
226+
result.OperationEvents = operationEvents;
227+
result.NextToken = undefined;
228+
return result;
229+
});
230+
}
231+
196232
@Count({ name: 'describeStackResources' })
197233
public async describeStackResources(params: {
198234
StackName?: string;

src/services/CfnServiceV2.ts

Lines changed: 0 additions & 177 deletions
This file was deleted.

src/stacks/actions/StackActionOperations.ts

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { Change, ChangeSetType, StackStatus, OnStackFailure } from '@aws-sdk/client-cloudformation';
1+
import {
2+
Change,
3+
ChangeSetType,
4+
DescribeEventsCommandOutput,
5+
StackStatus,
6+
OnStackFailure,
7+
EventType,
8+
HookFailureMode,
9+
} from '@aws-sdk/client-cloudformation';
210
import { WaiterState } from '@smithy/util-waiter';
311
import { dump } from 'js-yaml';
412
import { DateTime } from 'luxon';
@@ -11,7 +19,6 @@ import { SyntaxTreeManager } from '../../context/syntaxtree/SyntaxTreeManager';
1119
import { DocumentType } from '../../document/Document';
1220
import { DocumentManager } from '../../document/DocumentManager';
1321
import { CfnService } from '../../services/CfnService';
14-
import { DescribeEventsOutput, ChangeV2 } from '../../services/CfnServiceV2';
1522
import { DiagnosticCoordinator } from '../../services/DiagnosticCoordinator';
1623
import { S3Service } from '../../services/S3Service';
1724
import { LoggerFactory } from '../../telemetry/LoggerFactory';
@@ -299,12 +306,9 @@ export async function deleteChangeSet(
299306
}
300307
}
301308

302-
export function mapChangesToStackChanges(changes?: Change[]): StackChange[] | undefined;
303-
export function mapChangesToStackChanges(changes?: ChangeV2[]): StackChange[] | undefined;
304-
export function mapChangesToStackChanges(changes?: Change[] | ChangeV2[]): StackChange[] | undefined {
305-
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
306-
return changes?.map((change: Change | ChangeV2) => {
307-
const resourceChange = change.ResourceChange as any;
309+
export function mapChangesToStackChanges(changes?: Change[]): StackChange[] | undefined {
310+
return changes?.map((change: Change) => {
311+
const resourceChange = change.ResourceChange;
308312
return {
309313
type: change.Type,
310314
resourceChange: resourceChange
@@ -339,20 +343,21 @@ export function processWorkflowUpdates(
339343
return existingWorkflow;
340344
}
341345

342-
export function parseValidationEvents(events: DescribeEventsOutput, validationName: string): ValidationDetail[] {
343-
const validEvents = events.OperationEvents.filter((event) => event.EventType === 'VALIDATION_ERROR');
346+
export function parseValidationEvents(events: DescribeEventsCommandOutput, validationName: string): ValidationDetail[] {
347+
const validEvents = events.OperationEvents?.filter((event) => event.EventType === EventType.VALIDATION_ERROR);
344348

345-
return validEvents.map((event) => {
346-
const timestamp = event.Timestamp instanceof Date ? event.Timestamp.toISOString() : event.Timestamp;
347-
return {
348-
Timestamp: DateTime.fromISO(timestamp),
349-
ValidationName: validationName,
350-
LogicalId: event.LogicalResourceId,
351-
Message: [event.ValidationName, event.ValidationStatusReason].filter(Boolean).join(': '),
352-
Severity: event.ValidationFailureMode === 'FAIL' ? 'ERROR' : 'INFO',
353-
ResourcePropertyPath: event.ValidationPath,
354-
};
355-
});
349+
return (
350+
validEvents?.map((event) => {
351+
return {
352+
Timestamp: event.Timestamp ? DateTime.fromISO(event.Timestamp.toISOString()) : undefined,
353+
ValidationName: validationName,
354+
LogicalId: event.LogicalResourceId,
355+
Message: [event.ValidationName, event.ValidationStatusReason].filter(Boolean).join(': '),
356+
Severity: event.ValidationFailureMode === HookFailureMode.FAIL ? 'ERROR' : 'INFO',
357+
ResourcePropertyPath: event.ValidationPath,
358+
};
359+
}) ?? []
360+
);
356361
}
357362

358363
export async function publishValidationDiagnostics(

0 commit comments

Comments
 (0)