File tree Expand file tree Collapse file tree 5 files changed +38
-4
lines changed Expand file tree Collapse file tree 5 files changed +38
-4
lines changed Original file line number Diff line number Diff line change 1120
1120
"command" : " aws.ec2.openTerminal" ,
1121
1121
"when" : " aws.isDevMode"
1122
1122
},
1123
+ {
1124
+ "command" : " aws.ec2.linkToLaunchInstance" ,
1125
+ "when" : " aws.isDevMode"
1126
+ },
1123
1127
{
1124
1128
"command" : " aws.ec2.startInstance" ,
1125
1129
"when" : " false"
2192
2196
}
2193
2197
}
2194
2198
},
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
+ },
2195
2210
{
2196
2211
"command" : " aws.ecr.copyTagUri" ,
2197
2212
"title" : " %AWS.command.ecr.copyTagUri%" ,
Original file line number Diff line number Diff line change 110
110
"AWS.command.cdk.help" : " View CDK Documentation" ,
111
111
"AWS.command.ec2.openTerminal" : " Open terminal to EC2 instance..." ,
112
112
"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" ,
116
113
"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" ,
117
118
"AWS.command.ecr.copyTagUri" : " Copy Tag URI" ,
118
119
"AWS.command.ecr.copyRepositoryUri" : " Copy Repository URI" ,
119
120
"AWS.command.ecr.createRepository" : " Create Repository..." ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { Ec2InstanceNode } from './explorer/ec2InstanceNode'
9
9
import { copyTextCommand } from '../awsexplorer/commands/copyText'
10
10
import { Ec2Node } from './explorer/ec2ParentNode'
11
11
import {
12
+ linkToLaunchInstance ,
12
13
openRemoteConnection ,
13
14
openTerminal ,
14
15
rebootInstance ,
@@ -47,6 +48,10 @@ export async function activate(ctx: ExtContext): Promise<void> {
47
48
Commands . register ( 'aws.ec2.rebootInstance' , async ( node ?: Ec2Node ) => {
48
49
await rebootInstance ( node )
49
50
refreshExplorer ( node )
51
+ } ) ,
52
+
53
+ Commands . register ( 'aws.ec2.linkToLaunchInstance' , async ( node ?: Ec2Node ) => {
54
+ await linkToLaunchInstance ( )
50
55
} )
51
56
)
52
57
}
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ import { Ec2ConnectionManager } from './model'
9
9
import { Ec2Prompter , instanceFilter , Ec2Selection } from './prompter'
10
10
import { Ec2Instance , Ec2Client } from '../shared/clients/ec2Client'
11
11
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'
12
15
13
16
export async function refreshExplorer ( node ?: Ec2Node ) {
14
17
await node ?. refreshNode ( )
@@ -47,6 +50,12 @@ export async function rebootInstance(node?: Ec2Node) {
47
50
await client . rebootInstanceWithCancel ( selection . instanceId )
48
51
}
49
52
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
+
50
59
async function getSelection ( node ?: Ec2Node , filter ?: instanceFilter ) : Promise < Ec2Selection > {
51
60
const prompter = new Ec2Prompter ( filter )
52
61
const selection = node && node instanceof Ec2InstanceNode ? node . toSelection ( ) : await prompter . promptUser ( )
Original file line number Diff line number Diff line change 5
5
6
6
import * as vscode from 'vscode'
7
7
8
- export function getAwsConsoleUrl ( service : 'ecr' | 'cloudformation' , region : string ) : vscode . Uri {
8
+ export function getAwsConsoleUrl ( service : 'ecr' | 'cloudformation' | 'ec2-launch' , region : string ) : vscode . Uri {
9
9
switch ( service ) {
10
10
case 'ecr' :
11
11
return vscode . Uri . parse ( `https://${ region } .console.aws.amazon.com/ecr/repositories?region=${ region } ` )
12
12
case 'cloudformation' :
13
13
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
+ )
14
18
default :
15
19
throw Error ( )
16
20
}
You can’t perform that action at this time.
0 commit comments