Skip to content

Commit a20df98

Browse files
committed
resolve merge conflicts
2 parents 1140eff + 6d332a3 commit a20df98

File tree

5 files changed

+38
-4
lines changed

5 files changed

+38
-4
lines changed

package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,10 @@
11201120
"command": "aws.ec2.openTerminal",
11211121
"when": "aws.isDevMode"
11221122
},
1123+
{
1124+
"command": "aws.ec2.linkToLaunchInstance",
1125+
"when": "aws.isDevMode"
1126+
},
11231127
{
11241128
"command": "aws.ec2.startInstance",
11251129
"when": "false"
@@ -2192,6 +2196,17 @@
21922196
}
21932197
}
21942198
},
2199+
{
2200+
"command": "aws.ec2.linkToLaunchInstance",
2201+
"title": "%AWS.command.ec2.linkToLaunchInstance%",
2202+
"icon": "$(add)",
2203+
"category": "%AWS.title%",
2204+
"cloud9": {
2205+
"cn": {
2206+
"category": "%AWS.title.cn%"
2207+
}
2208+
}
2209+
},
21952210
{
21962211
"command": "aws.ecr.copyTagUri",
21972212
"title": "%AWS.command.ecr.copyTagUri%",

package.nls.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@
110110
"AWS.command.cdk.help": "View CDK Documentation",
111111
"AWS.command.ec2.openTerminal": "Open terminal to EC2 instance...",
112112
"AWS.command.ec2.openRemoteConnection": "Connect to EC2 instance in New Window...",
113-
"AWS.command.ec2.startInstance": "Start EC2 Instance",
114-
"AWS.command.ec2.stopInstance": "Stop EC2 Instance",
115-
"AWS.command.ec2.rebootInstance": "Reboot EC2 Instance",
116113
"AWS.command.ec2.copyInstanceId": "Copy Instance Id",
114+
"AWS.command.ec2.startInstance": "Start EC2 Instance...",
115+
"AWS.command.ec2.stopInstance": "Stop EC2 Instance...",
116+
"AWS.command.ec2.rebootInstance": "Reboot EC2 Instance...",
117+
"AWS.command.ec2.linkToLaunchInstance": "Launch EC2 Instance",
117118
"AWS.command.ecr.copyTagUri": "Copy Tag URI",
118119
"AWS.command.ecr.copyRepositoryUri": "Copy Repository URI",
119120
"AWS.command.ecr.createRepository": "Create Repository...",

src/ec2/activation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Ec2InstanceNode } from './explorer/ec2InstanceNode'
99
import { copyTextCommand } from '../awsexplorer/commands/copyText'
1010
import { Ec2Node } from './explorer/ec2ParentNode'
1111
import {
12+
linkToLaunchInstance,
1213
openRemoteConnection,
1314
openTerminal,
1415
rebootInstance,
@@ -47,6 +48,10 @@ export async function activate(ctx: ExtContext): Promise<void> {
4748
Commands.register('aws.ec2.rebootInstance', async (node?: Ec2Node) => {
4849
await rebootInstance(node)
4950
refreshExplorer(node)
51+
}),
52+
53+
Commands.register('aws.ec2.linkToLaunchInstance', async (node?: Ec2Node) => {
54+
await linkToLaunchInstance()
5055
})
5156
)
5257
}

src/ec2/commands.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { Ec2ConnectionManager } from './model'
99
import { Ec2Prompter, instanceFilter, Ec2Selection } from './prompter'
1010
import { Ec2Instance, Ec2Client } from '../shared/clients/ec2Client'
1111
import { copyToClipboard } from '../shared/utilities/messages'
12+
import { getAwsConsoleUrl } from '../shared/awsConsole'
13+
import globals from '../shared/extensionGlobals'
14+
import { openUrl } from '../shared/utilities/vsCodeUtils'
1215

1316
export async function refreshExplorer(node?: Ec2Node) {
1417
await node?.refreshNode()
@@ -47,6 +50,12 @@ export async function rebootInstance(node?: Ec2Node) {
4750
await client.rebootInstanceWithCancel(selection.instanceId)
4851
}
4952

53+
export async function linkToLaunchInstance(node?: Ec2Node) {
54+
const region = node ? node.regionCode : globals.regionProvider.guessDefaultRegion()
55+
const url = getAwsConsoleUrl('ec2-launch', region)
56+
await openUrl(url)
57+
}
58+
5059
async function getSelection(node?: Ec2Node, filter?: instanceFilter): Promise<Ec2Selection> {
5160
const prompter = new Ec2Prompter(filter)
5261
const selection = node && node instanceof Ec2InstanceNode ? node.toSelection() : await prompter.promptUser()

src/shared/awsConsole.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55

66
import * as vscode from 'vscode'
77

8-
export function getAwsConsoleUrl(service: 'ecr' | 'cloudformation', region: string): vscode.Uri {
8+
export function getAwsConsoleUrl(service: 'ecr' | 'cloudformation' | 'ec2-launch', region: string): vscode.Uri {
99
switch (service) {
1010
case 'ecr':
1111
return vscode.Uri.parse(`https://${region}.console.aws.amazon.com/ecr/repositories?region=${region}`)
1212
case 'cloudformation':
1313
return vscode.Uri.parse(`https://${region}.console.aws.amazon.com/cloudformation/home?region=${region}`)
14+
case 'ec2-launch':
15+
return vscode.Uri.parse(
16+
`https://${region}.console.aws.amazon.com/ec2/home?region=${region}#LaunchInstances:`
17+
)
1418
default:
1519
throw Error()
1620
}

0 commit comments

Comments
 (0)