Skip to content

Commit a8e4860

Browse files
committed
copy paste method to another file
1 parent 1b5c45c commit a8e4860

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

packages/core/src/shared/remoteSession.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ import { pushIf } from './utilities/collectionUtils'
2020
import { ChildProcess } from './utilities/processUtils'
2121
import { findSshPath, getVscodeCliPath } from './utilities/pathFind'
2222
import { IamClient } from './clients/iamClient'
23-
import { IAM } from 'aws-sdk'
23+
import { IAM, SSM } from 'aws-sdk'
2424
import { getIdeProperties } from './extensionUtilities'
25+
import { Ec2Selection } from '../awsService/ec2/prompter'
26+
import { sshLogFileLocation } from './sshConfig'
2527

2628
const policyAttachDelay = 5000
2729

@@ -251,3 +253,21 @@ export async function getDeniedSsmActions(client: IamClient, roleArn: string): P
251253

252254
return deniedActions
253255
}
256+
257+
export function getEc2SsmEnv(
258+
selection: Ec2Selection,
259+
ssmPath: string,
260+
session: SSM.StartSessionResponse
261+
): NodeJS.ProcessEnv {
262+
return Object.assign(
263+
{
264+
AWS_REGION: selection.region,
265+
AWS_SSM_CLI: ssmPath,
266+
LOG_FILE_LOCATION: sshLogFileLocation('ec2', selection.instanceId),
267+
STREAM_URL: session.StreamUrl,
268+
SESSION_ID: session.SessionId,
269+
TOKEN: session.TokenValue,
270+
},
271+
process.env
272+
)
273+
}

0 commit comments

Comments
 (0)