Skip to content

Commit d806de9

Browse files
committed
rename to ec2Wrapper to avoid confusion
1 parent f94d505 commit d806de9

File tree

16 files changed

+41
-41
lines changed

16 files changed

+41
-41
lines changed

packages/core/src/awsService/ec2/commands.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
import { Ec2InstanceNode } from './explorer/ec2InstanceNode'
66
import { Ec2Node } from './explorer/ec2ParentNode'
7-
import { SafeEc2Instance, Ec2Client } from '../../shared/clients/ec2Client'
7+
import { SafeEc2Instance, Ec2Wrapper } from '../../shared/clients/ec2Wrapper'
88
import { copyToClipboard } from '../../shared/utilities/messages'
99
import { ec2LogSchema } from './ec2LogDocumentProvider'
1010
import { getAwsConsoleUrl } from '../../shared/awsConsole'
@@ -29,20 +29,20 @@ export async function openRemoteConnection(connectionManagers: Ec2ConnecterMap,
2929
export async function startInstance(node?: Ec2Node) {
3030
const prompterFilter = (instance: SafeEc2Instance) => instance.LastSeenStatus !== 'running'
3131
const selection = await getSelection(node, prompterFilter)
32-
const client = new Ec2Client(selection.region)
32+
const client = new Ec2Wrapper(selection.region)
3333
await client.startInstanceWithCancel(selection.instanceId)
3434
}
3535

3636
export async function stopInstance(node?: Ec2Node) {
3737
const prompterFilter = (instance: SafeEc2Instance) => instance.LastSeenStatus !== 'stopped'
3838
const selection = await getSelection(node, prompterFilter)
39-
const client = new Ec2Client(selection.region)
39+
const client = new Ec2Wrapper(selection.region)
4040
await client.stopInstanceWithCancel(selection.instanceId)
4141
}
4242

4343
export async function rebootInstance(node?: Ec2Node) {
4444
const selection = await getSelection(node)
45-
const client = new Ec2Client(selection.region)
45+
const client = new Ec2Wrapper(selection.region)
4646
await client.rebootInstanceWithCancel(selection.instanceId)
4747
}
4848

packages/core/src/awsService/ec2/ec2LogDocumentProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
import * as vscode from 'vscode'
66
import { Ec2Selection } from './prompter'
7-
import { Ec2Client } from '../../shared/clients/ec2Client'
7+
import { Ec2Wrapper } from '../../shared/clients/ec2Wrapper'
88
import { ec2LogsScheme } from '../../shared/constants'
99
import { UriSchema } from '../../shared/utilities/uriUtils'
1010

@@ -16,7 +16,7 @@ export class Ec2LogDocumentProvider implements vscode.TextDocumentContentProvide
1616
throw new Error(`Invalid EC2 Logs URI: ${uri.toString()}`)
1717
}
1818
const ec2Selection = ec2LogSchema.parse(uri)
19-
const ec2Client = new Ec2Client(ec2Selection.region)
19+
const ec2Client = new Ec2Wrapper(ec2Selection.region)
2020
const consoleOutput = await ec2Client.getConsoleOutput(ec2Selection.instanceId, false)
2121
return consoleOutput.Output
2222
}

packages/core/src/awsService/ec2/explorer/ec2InstanceNode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
import * as vscode from 'vscode'
6-
import { Ec2Client, getNameOfInstance } from '../../../shared/clients/ec2Client'
6+
import { Ec2Wrapper, getNameOfInstance } from '../../../shared/clients/ec2Wrapper'
77
import { AWSResourceNode } from '../../../shared/treeview/nodes/awsResourceNode'
88
import { AWSTreeNodeBase } from '../../../shared/treeview/nodes/awsTreeNodeBase'
9-
import { SafeEc2Instance } from '../../../shared/clients/ec2Client'
9+
import { SafeEc2Instance } from '../../../shared/clients/ec2Wrapper'
1010
import globals from '../../../shared/extensionGlobals'
1111
import { getIconCode } from '../utils'
1212
import { Ec2Selection } from '../prompter'
@@ -23,7 +23,7 @@ type Ec2InstanceNodeContext = 'awsEc2RunningNode' | 'awsEc2StoppedNode' | 'awsEc
2323
export class Ec2InstanceNode extends AWSTreeNodeBase implements AWSResourceNode {
2424
public constructor(
2525
public readonly parent: Ec2ParentNode,
26-
public readonly client: Ec2Client,
26+
public readonly client: Ec2Wrapper,
2727
public override readonly regionCode: string,
2828
private readonly partitionId: string,
2929
// XXX: this variable is marked as readonly, but the 'status' attribute is updated when polling the nodes.

packages/core/src/awsService/ec2/explorer/ec2ParentNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { AWSTreeNodeBase } from '../../../shared/treeview/nodes/awsTreeNodeBase'
77
import { makeChildrenNodes } from '../../../shared/treeview/utils'
88
import { PlaceholderNode } from '../../../shared/treeview/nodes/placeholderNode'
99
import { Ec2InstanceNode } from './ec2InstanceNode'
10-
import { Ec2Client } from '../../../shared/clients/ec2Client'
10+
import { Ec2Wrapper } from '../../../shared/clients/ec2Wrapper'
1111
import { updateInPlace } from '../../../shared/utilities/collectionUtils'
1212
import { PollingSet } from '../../../shared/utilities/pollingSet'
1313

@@ -23,7 +23,7 @@ export class Ec2ParentNode extends AWSTreeNodeBase {
2323
public constructor(
2424
public override readonly regionCode: string,
2525
public readonly partitionId: string,
26-
protected readonly ec2Client: Ec2Client
26+
protected readonly ec2Client: Ec2Wrapper
2727
) {
2828
super('EC2', vscode.TreeItemCollapsibleState.Collapsed)
2929
this.ec2InstanceNodes = new Map<string, Ec2InstanceNode>()

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getOrInstallCli } from '../../shared/utilities/cliUtils'
1010
import { isCloud9 } from '../../shared/extensionUtilities'
1111
import { ToolkitError } from '../../shared/errors'
1212
import { SsmClient } from '../../shared/clients/ssmClient'
13-
import { Ec2Client } from '../../shared/clients/ec2Client'
13+
import { Ec2Wrapper } from '../../shared/clients/ec2Wrapper'
1414
import {
1515
VscodeRemoteConnection,
1616
ensureDependencies,
@@ -40,7 +40,7 @@ export interface Ec2RemoteEnv extends VscodeRemoteConnection {
4040

4141
export class Ec2Connecter implements vscode.Disposable {
4242
protected ssmClient: SsmClient
43-
protected ec2Client: Ec2Client
43+
protected ec2Client: Ec2Wrapper
4444
protected iamClient: DefaultIamClient
4545
protected sessionManager: Ec2SessionTracker
4646

@@ -63,8 +63,8 @@ export class Ec2Connecter implements vscode.Disposable {
6363
return new SsmClient(this.regionCode)
6464
}
6565

66-
protected createEc2SdkClient(): Ec2Client {
67-
return new Ec2Client(this.regionCode)
66+
protected createEc2SdkClient(): Ec2Wrapper {
67+
return new Ec2Wrapper(this.regionCode)
6868
}
6969

7070
protected createIamSdkClient(): DefaultIamClient {

packages/core/src/awsService/ec2/prompter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { RegionSubmenu, RegionSubmenuResponse } from '../../shared/ui/common/regionSubmenu'
77
import { DataQuickPickItem } from '../../shared/ui/pickerPrompter'
8-
import { Ec2Client, SafeEc2Instance } from '../../shared/clients/ec2Client'
8+
import { Ec2Wrapper, SafeEc2Instance } from '../../shared/clients/ec2Wrapper'
99
import { isValidResponse } from '../../shared/wizards/wizard'
1010
import { CancellationError } from '../../shared/utilities/timeoutUtils'
1111
import { AsyncCollection } from '../../shared/utilities/asyncCollection'
@@ -54,7 +54,7 @@ export class Ec2Prompter {
5454
}
5555

5656
protected async getInstancesFromRegion(regionCode: string): Promise<AsyncCollection<SafeEc2Instance>> {
57-
const client = new Ec2Client(regionCode)
57+
const client = new Ec2Wrapper(regionCode)
5858
return await client.getInstances()
5959
}
6060

packages/core/src/awsService/ec2/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { SafeEc2Instance } from '../../shared/clients/ec2Client'
6+
import { SafeEc2Instance } from '../../shared/clients/ec2Wrapper'
77
import { copyToClipboard } from '../../shared/utilities/messages'
88
import { Ec2Selection } from './prompter'
99
import { sshLogFileLocation } from '../../shared/sshConfig'

packages/core/src/awsexplorer/regionNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { getEcsRootNode } from '../awsService/ecs/model'
3030
import { compareTreeItems, TreeShim } from '../shared/treeview/utils'
3131
import { Ec2ParentNode } from '../awsService/ec2/explorer/ec2ParentNode'
3232
import { DevSettings } from '../shared/settings'
33-
import { Ec2Client } from '../shared/clients/ec2Client'
33+
import { Ec2Wrapper } from '../shared/clients/ec2Wrapper'
3434
import { isCloud9 } from '../shared/extensionUtilities'
3535

3636
interface ServiceNode {
@@ -67,7 +67,7 @@ const serviceCandidates: ServiceNode[] = [
6767
serviceId: 'ec2',
6868
when: () => DevSettings.instance.isDevMode(),
6969
createFn: (regionCode: string, partitionId: string) =>
70-
new Ec2ParentNode(regionCode, partitionId, new Ec2Client(regionCode)),
70+
new Ec2ParentNode(regionCode, partitionId, new Ec2Wrapper(regionCode)),
7171
},
7272
{
7373
serviceId: 'ecr',

packages/core/src/shared/clients/ec2Client.ts renamed to packages/core/src/shared/clients/ec2Wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ interface SafeEc2GetConsoleOutputResult extends GetConsoleOutputRequest {
4949
InstanceId: string
5050
}
5151

52-
export class Ec2Client {
52+
export class Ec2Wrapper {
5353
public constructor(public readonly regionCode: string) {}
5454

5555
private async createSdkClient(): Promise<EC2Client> {

packages/core/src/test/awsService/ec2/ec2LogDocumentProvider.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as vscode from 'vscode'
88
import * as sinon from 'sinon'
99
import { Ec2LogDocumentProvider } from '../../../awsService/ec2/ec2LogDocumentProvider'
1010
import { ec2LogsScheme } from '../../../shared/constants'
11-
import { Ec2Client } from '../../../shared/clients/ec2Client'
11+
import { Ec2Wrapper } from '../../../shared/clients/ec2Wrapper'
1212

1313
describe('LogDataDocumentProvider', async function () {
1414
let provider: Ec2LogDocumentProvider
@@ -28,7 +28,7 @@ describe('LogDataDocumentProvider', async function () {
2828
it('fetches content for valid ec2 log URI', async function () {
2929
const validUri = vscode.Uri.parse(`${ec2LogsScheme}:us-west1:instance1`)
3030
const expectedContent = 'log content'
31-
sinon.stub(Ec2Client.prototype, 'getConsoleOutput').resolves({
31+
sinon.stub(Ec2Wrapper.prototype, 'getConsoleOutput').resolves({
3232
InstanceId: 'instance1',
3333
Output: expectedContent,
3434
})

0 commit comments

Comments
 (0)