Skip to content

Commit 2e4d58b

Browse files
authored
refactor(ecs): migrate to aws sdk v3 (aws#8094)
## Problem AWS SDK V2 is at EOL. ## Solution Migrate ECS client to V3 --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 704ca6f commit 2e4d58b

File tree

5 files changed

+221
-47
lines changed

5 files changed

+221
-47
lines changed

package-lock.json

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

packages/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@
579579
"@aws-sdk/client-docdb": "<3.731.0",
580580
"@aws-sdk/client-docdb-elastic": "<3.731.0",
581581
"@aws-sdk/client-ec2": "<3.731.0",
582+
"@aws-sdk/client-ecs": "~3.693.0",
582583
"@aws-sdk/client-glue": "^3.852.0",
583584
"@aws-sdk/client-iam": "<3.731.0",
584585
"@aws-sdk/client-iot": "~3.693.0",

packages/core/src/awsService/ecs/model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import * as nls from 'vscode-nls'
77
const localize = nls.loadMessageBundle()
88

99
import * as vscode from 'vscode'
10-
import { ECS } from 'aws-sdk'
10+
import { Cluster as SdkCluster, ContainerDefinition, Service as SdkService, Task } from '@aws-sdk/client-ecs'
1111
import { DefaultEcsClient } from '../../shared/clients/ecsClient'
1212
import { ResourceTreeNode } from '../../shared/treeview/resource'
1313
import { getIcon } from '../../shared/icons'
1414
import { AsyncCollection } from '../../shared/utilities/asyncCollection'
1515
import { prepareCommand } from './util'
1616

1717
function createValidTaskFilter(containerName: string) {
18-
return function (t: ECS.Task): t is ECS.Task & { taskArn: string } {
18+
return function (t: Task): t is Task & { taskArn: string } {
1919
const managed = !!t.containers?.find(
2020
(c) => c?.name === containerName && c.managedAgents?.find((a) => a.name === 'ExecuteCommandAgent')
2121
)
@@ -24,7 +24,7 @@ function createValidTaskFilter(containerName: string) {
2424
}
2525
}
2626

27-
interface ContainerDescription extends ECS.ContainerDefinition {
27+
interface ContainerDescription extends ContainerDefinition {
2828
readonly clusterArn: string
2929
readonly taskRoleArn: string
3030
readonly enableExecuteCommand?: boolean
@@ -82,7 +82,7 @@ export class Service {
8282

8383
public constructor(
8484
private readonly client: DefaultEcsClient,
85-
public readonly description: ECS.Service
85+
public readonly description: SdkService
8686
) {}
8787

8888
public async listContainers(): Promise<Container[]> {
@@ -154,7 +154,7 @@ export class Cluster {
154154

155155
public constructor(
156156
private readonly client: DefaultEcsClient,
157-
private readonly cluster: ECS.Cluster
157+
private readonly cluster: SdkCluster
158158
) {}
159159

160160
public listServices(): AsyncCollection<Service[]> {

packages/core/src/awsService/ecs/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { IamClient } from '../../shared/clients/iam'
1313
import { ToolkitError } from '../../shared/errors'
1414
import { isCloud9 } from '../../shared/extensionUtilities'
1515
import { getOrInstallCli } from '../../shared/utilities/cliUtils'
16-
import { Session, TaskDefinition } from 'aws-sdk/clients/ecs'
16+
import { Session, TaskDefinition } from '@aws-sdk/client-ecs'
1717
import { getLogger } from '../../shared/logger/logger'
1818
import { SSMClient, TerminateSessionCommand } from '@aws-sdk/client-ssm'
1919
import { fromExtensionManifest } from '../../shared/settings'

0 commit comments

Comments
 (0)