5
5
6
6
import * as vscode from 'vscode'
7
7
import * as nls from 'vscode-nls'
8
- const localize = nls . loadMessageBundle ( )
9
8
10
9
import { Settings } from '../shared/settings'
11
10
import { showConfirmationMessage , showMessageWithCancel } from './utilities/messages'
@@ -23,6 +22,8 @@ import { IamClient } from './clients/iamClient'
23
22
import { IAM } from 'aws-sdk'
24
23
import { getIdeProperties } from './extensionUtilities'
25
24
25
+ const localize = nls . loadMessageBundle ( )
26
+
26
27
export interface MissingTool {
27
28
readonly name : 'code' | 'ssm' | 'ssh'
28
29
readonly reason ?: string
@@ -204,14 +205,19 @@ export async function promptToAddInlinePolicy(client: IamClient, roleArn: string
204
205
205
206
async function addInlinePolicyWithDelay ( client : IamClient , roleArn : string ) {
206
207
const timeout = new Timeout ( policyAttachDelay )
207
- await showMessageWithCancel ( `Adding Inline Policy to ${ roleArn } ` , timeout )
208
+ const message = `Adding Inline Policy to ${ roleArn } `
209
+ await showMessageWithCancel ( message , timeout )
208
210
await addSsmActionsToInlinePolicy ( client , roleArn )
209
211
210
212
function delay ( ms : number ) {
211
213
return new Promise ( resolve => setTimeout ( resolve , ms ) )
212
214
}
213
215
214
- await delay ( policyAttachDelay ) . finally ( ( ) => timeout . cancel ( ) )
216
+ await delay ( policyAttachDelay - 100 )
217
+ if ( timeout . completed ) {
218
+ throw new CancellationError ( 'user' )
219
+ }
220
+ timeout . cancel ( )
215
221
}
216
222
217
223
function getFormattedSsmActions ( ) {
0 commit comments