Skip to content

Commit 390d783

Browse files
laileni-awsaws-toolkit-automationroger-zhanggrhamiltchungjac
committed
feat(lambda): Merging Feature/lambda console2 ide to staging branch. (aws#7601)
- Releasing aws/aws-toolkit-vscode-staging#2144 --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. Co-authored-by: aws-toolkit-automation <[email protected]> Co-authored-by: Roger Zhang <[email protected]> Co-authored-by: Reed Hamilton <[email protected]> Co-authored-by: Jacob Chung <[email protected]>
1 parent be73485 commit 390d783

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+5400
-139
lines changed

package-lock.json

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/"
4242
},
4343
"devDependencies": {
44-
"@aws-toolkits/telemetry": "^1.0.324",
44+
"@aws-toolkits/telemetry": "^1.0.326",
4545
"@playwright/browser-chromium": "^1.43.1",
4646
"@stylistic/eslint-plugin": "^2.11.0",
4747
"@types/he": "^1.2.3",

packages/amazonq/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,84 +1227,84 @@
12271227
"fontCharacter": "\\f1d0"
12281228
}
12291229
},
1230-
"aws-lambda-function": {
1230+
"aws-lambda-create-stack": {
12311231
"description": "AWS Contributed Icon",
12321232
"default": {
12331233
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12341234
"fontCharacter": "\\f1d1"
12351235
}
12361236
},
1237-
"aws-mynah-MynahIconBlack": {
1237+
"aws-lambda-create-stack-light": {
12381238
"description": "AWS Contributed Icon",
12391239
"default": {
12401240
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12411241
"fontCharacter": "\\f1d2"
12421242
}
12431243
},
1244-
"aws-mynah-MynahIconWhite": {
1244+
"aws-lambda-function": {
12451245
"description": "AWS Contributed Icon",
12461246
"default": {
12471247
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12481248
"fontCharacter": "\\f1d3"
12491249
}
12501250
},
1251-
"aws-mynah-logo": {
1251+
"aws-mynah-MynahIconBlack": {
12521252
"description": "AWS Contributed Icon",
12531253
"default": {
12541254
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12551255
"fontCharacter": "\\f1d4"
12561256
}
12571257
},
1258-
"aws-redshift-cluster": {
1258+
"aws-mynah-MynahIconWhite": {
12591259
"description": "AWS Contributed Icon",
12601260
"default": {
12611261
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12621262
"fontCharacter": "\\f1d5"
12631263
}
12641264
},
1265-
"aws-redshift-cluster-connected": {
1265+
"aws-mynah-logo": {
12661266
"description": "AWS Contributed Icon",
12671267
"default": {
12681268
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12691269
"fontCharacter": "\\f1d6"
12701270
}
12711271
},
1272-
"aws-redshift-database": {
1272+
"aws-redshift-cluster": {
12731273
"description": "AWS Contributed Icon",
12741274
"default": {
12751275
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12761276
"fontCharacter": "\\f1d7"
12771277
}
12781278
},
1279-
"aws-redshift-redshift-cluster-connected": {
1279+
"aws-redshift-cluster-connected": {
12801280
"description": "AWS Contributed Icon",
12811281
"default": {
12821282
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12831283
"fontCharacter": "\\f1d8"
12841284
}
12851285
},
1286-
"aws-redshift-schema": {
1286+
"aws-redshift-database": {
12871287
"description": "AWS Contributed Icon",
12881288
"default": {
12891289
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12901290
"fontCharacter": "\\f1d9"
12911291
}
12921292
},
1293-
"aws-redshift-table": {
1293+
"aws-redshift-redshift-cluster-connected": {
12941294
"description": "AWS Contributed Icon",
12951295
"default": {
12961296
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12971297
"fontCharacter": "\\f1da"
12981298
}
12991299
},
1300-
"aws-s3-bucket": {
1300+
"aws-redshift-schema": {
13011301
"description": "AWS Contributed Icon",
13021302
"default": {
13031303
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
13041304
"fontCharacter": "\\f1db"
13051305
}
13061306
},
1307-
"aws-s3-create-bucket": {
1307+
"aws-redshift-table": {
13081308
"description": "AWS Contributed Icon",
13091309
"default": {
13101310
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",

packages/core/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -309,84 +309,84 @@
309309
"fontCharacter": "\\f1d0"
310310
}
311311
},
312-
"aws-lambda-function": {
312+
"aws-lambda-create-stack": {
313313
"description": "AWS Contributed Icon",
314314
"default": {
315315
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
316316
"fontCharacter": "\\f1d1"
317317
}
318318
},
319-
"aws-mynah-MynahIconBlack": {
319+
"aws-lambda-create-stack-light": {
320320
"description": "AWS Contributed Icon",
321321
"default": {
322322
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
323323
"fontCharacter": "\\f1d2"
324324
}
325325
},
326-
"aws-mynah-MynahIconWhite": {
326+
"aws-lambda-function": {
327327
"description": "AWS Contributed Icon",
328328
"default": {
329329
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
330330
"fontCharacter": "\\f1d3"
331331
}
332332
},
333-
"aws-mynah-logo": {
333+
"aws-mynah-MynahIconBlack": {
334334
"description": "AWS Contributed Icon",
335335
"default": {
336336
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
337337
"fontCharacter": "\\f1d4"
338338
}
339339
},
340-
"aws-redshift-cluster": {
340+
"aws-mynah-MynahIconWhite": {
341341
"description": "AWS Contributed Icon",
342342
"default": {
343343
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
344344
"fontCharacter": "\\f1d5"
345345
}
346346
},
347-
"aws-redshift-cluster-connected": {
347+
"aws-mynah-logo": {
348348
"description": "AWS Contributed Icon",
349349
"default": {
350350
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
351351
"fontCharacter": "\\f1d6"
352352
}
353353
},
354-
"aws-redshift-database": {
354+
"aws-redshift-cluster": {
355355
"description": "AWS Contributed Icon",
356356
"default": {
357357
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
358358
"fontCharacter": "\\f1d7"
359359
}
360360
},
361-
"aws-redshift-redshift-cluster-connected": {
361+
"aws-redshift-cluster-connected": {
362362
"description": "AWS Contributed Icon",
363363
"default": {
364364
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
365365
"fontCharacter": "\\f1d8"
366366
}
367367
},
368-
"aws-redshift-schema": {
368+
"aws-redshift-database": {
369369
"description": "AWS Contributed Icon",
370370
"default": {
371371
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
372372
"fontCharacter": "\\f1d9"
373373
}
374374
},
375-
"aws-redshift-table": {
375+
"aws-redshift-redshift-cluster-connected": {
376376
"description": "AWS Contributed Icon",
377377
"default": {
378378
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
379379
"fontCharacter": "\\f1da"
380380
}
381381
},
382-
"aws-s3-bucket": {
382+
"aws-redshift-schema": {
383383
"description": "AWS Contributed Icon",
384384
"default": {
385385
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
386386
"fontCharacter": "\\f1db"
387387
}
388388
},
389-
"aws-s3-create-bucket": {
389+
"aws-redshift-table": {
390390
"description": "AWS Contributed Icon",
391391
"default": {
392392
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",

packages/core/package.nls.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@
160160
"AWS.command.downloadLambda": "Download...",
161161
"AWS.command.uploadLambda": "Upload Lambda...",
162162
"AWS.command.invokeLambda": "Invoke in the cloud",
163+
"AWS.command.openLambdaFile": "Open your Lambda code",
164+
"AWS.command.quickDeployLambda": "Save and deploy your code",
165+
"AWS.command.openLambdaWorkspace": "Open in a workspace",
163166
"AWS.command.invokeLambda.cn": "Invoke on Amazon",
167+
"AWS.command.lambda.convertToSam": "Convert to SAM Application",
164168
"AWS.command.refreshAwsExplorer": "Refresh Explorer",
165169
"AWS.command.refreshCdkExplorer": "Refresh CDK Explorer",
166170
"AWS.command.cdk.help": "View CDK Documentation",
Lines changed: 12 additions & 0 deletions
Loading
Lines changed: 12 additions & 0 deletions
Loading
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Welcome to Lambda Development with AWS SAM
2+
3+
This project was generated from existing ${sourceType} to ${stackName} stack using the AWS Toolkit for VS Code. Your Lambda functions are now a project in AWS Serverless Application Model (SAM). Here, you can manage your functions as infrastructure as code using the AWS SAM template. This eliminates the need for manual changes in the AWS Console, provides better version control, and allows automated deployments of your serverless resources.
4+
5+
${warning}
6+
7+
## Prerequisites
8+
9+
Confirm you have installed the following tools:
10+
11+
- **The AWS CLI**: Needed to interact with AWS services from the command line.
12+
- **The AWS SAM CLI:** Needed to locally build, invoke, and deploy your functions. Version 1.98+ is required.
13+
- **Docker**: Optional, but required if you want to invoke locally, Docker is required.
14+
15+
**Note:** For help on installing these tools, choose the **Application Builder** panel in **EXPLORER** or the AWS Toolkit Extension, and select **Walkthrough of Application Builder**.
16+
17+
## What you can do with AWS SAM
18+
19+
Your functions are ready for local development. You can either use the **AWS Application Builder** or the **SAM CLI** to edit and manage your functions.
20+
21+
To get started using Application Builder, choose the **Application Builder** panel in **EXPLORER** or the AWS Toolkit Extension, and select **Walkthrough of Application Builder**.
22+
23+
Use the following SAM CLI commands to manage your functions:
24+
25+
- **Build Your Code:** Run [`sam build`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-build.html) in the terminal to compile your code and install dependencies.
26+
- **Test Locally:** Run the [`sam local invoke`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-invoke.html) and [`sam local start-api`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-start-api.html)commands in the terminal.
27+
- **Deploy Your Changes:** Run [`sam deploy --guided`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-deploy.html) in the terminal to deploy your updated function to AWS.
28+
- **Verify Deployment:** Run [`sam remote invoke`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-remote-invoke.html) or go to the Lambda Console
29+
30+
## Quick Reference
31+
32+
- **SAM Template**: [template.yaml](./template.yaml) - Contains your infrastructure as code
33+
- **SAM Configuration**: [samconfig.toml](./samconfig.toml) - Contains deployment configuration
34+
35+
## Advanced features
36+
37+
You can also debug your functions locally with breakpoints, manage environment variables, work with layers and dependencies, and configure function triggers and permissions through the AWS Toolkit interface. For more details, refer to the following resources
38+
39+
- [AWS toolkit for Visual Studio Code User Guide](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html)
40+
- [Working with Application Builder](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/appbuilder-overview-overview.html)
41+
- [AWS SAM Developer Guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html)
42+
- [AWS SAM command line reference](http://https//docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-command-reference.html)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Welcome to Lambda Local Development
2+
3+
Learn how to view your Lambda Function locally, iterate, and deploy changes to the AWS Cloud.
4+
5+
## Edit your Lambda function
6+
7+
- Make changes to your function code and save it. You will be prompted to deploy if you're done editing. You can come back later if you have more changes to make.
8+
- Using the terminal and your favorite package manager, add dependencies for your project.
9+
10+
## Manage your Lambda functions
11+
12+
- Select the AWS icon in the left sidebar and select **EXPLORER**
13+
- In your desired region, select the Lambda dropdown menu:
14+
- To save and deploy a previously edited Lambda function, select the cloud deploy icon next to your Lambda function.
15+
- To remotely invoke a function, select the play icon next to your Lambda function.
16+
17+
## Advanced Features
18+
19+
- To convert to a Lambda function to an AWS SAM application, select the ![createStack](./create-stack.svg) icon next to your Lambda function. For details on what AWS SAM is and how it can help you, see the [AWS Serverless Application Model Developer Guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html).

packages/core/src/auth/utils.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export async function promptForConnection(auth: Auth, type?: 'iam' | 'iam-only'
7171
if (resp === 'addNewConnection') {
7272
// We could call this command directly, but it either lives in packages/toolkit or will at some point.
7373
const source: AuthSource = 'addConnectionQuickPick' // enforcing type sanity check
74-
await vscode.commands.executeCommand('aws.toolkit.auth.manageConnections', placeholder, source)
74+
await vscode.commands.executeCommand('aws.toolkit.auth.manageConnections', placeholder, source, undefined, true)
7575
return undefined
7676
}
7777

@@ -89,8 +89,9 @@ export async function promptForConnection(auth: Auth, type?: 'iam' | 'iam-only'
8989
export async function promptAndUseConnection(...[auth, type]: Parameters<typeof promptForConnection>) {
9090
return telemetry.aws_setCredentials.run(async (span) => {
9191
let conn = await promptForConnection(auth, type)
92+
// Returning because either conn is a valid connection, or the customer selected 'addNewConnection' or 'editCredentials'
9293
if (!conn) {
93-
throw new CancellationError('user')
94+
return
9495
}
9596

9697
// HACK: We assume that if we are toolkit we want AWS account scopes.
@@ -113,38 +114,41 @@ export async function promptAndUseConnection(...[auth, type]: Parameters<typeof
113114
* @param opts.prompt: controls if prompt is shown when no valid connection is found
114115
* @returns active iam connection, or undefined if not found/no prompt
115116
*/
116-
export async function getIAMConnection(opts: { prompt: boolean } = { prompt: false }) {
117+
export async function getIAMConnection(
118+
opts: { prompt: boolean; messageText?: string } = {
119+
prompt: false,
120+
}
121+
) {
117122
const connection = Auth.instance.activeConnection
118123
if (connection?.type === 'iam' && connection.state === 'valid') {
119124
return connection
120125
}
121126
if (!opts.prompt) {
122127
return
123128
}
129+
const authRequiredMessage = 'The current command requires authentication with IAM credentials.'
124130
let errorMessage = localize(
125-
'aws.toolkit.auth.requireIAMmessage',
126-
'The current command requires authentication with IAM credentials.'
131+
'aws.toolkit.auth.requireAuthmessage',
132+
opts.messageText ? opts.messageText : authRequiredMessage
127133
)
128134
if (connection?.state === 'valid') {
129135
errorMessage =
130-
localize(
131-
'aws.toolkit.auth.requireIAMInvalidAuth',
132-
'Authentication through Builder ID or IAM Identity Center detected. '
133-
) + errorMessage
136+
localize('aws.toolkit.auth.requireIAMInvalidAuth', 'Authentication through Builder ID detected.') +
137+
errorMessage
134138
}
135-
const acceptMessage = localize('aws.toolkit.auth.accept', 'Authenticate with IAM credentials')
139+
const acceptMessage = localize('aws.toolkit.auth.accept', 'Select Connection')
136140
const modalResponse = await showMessageWithUrl(
137141
errorMessage,
138142
credentialHelpUrl,
139-
localizedText.viewDocs,
143+
localizedText.learnMore,
140144
'info',
141145
[acceptMessage],
142146
true
143147
)
144148
if (modalResponse !== acceptMessage) {
145149
return
146150
}
147-
await promptAndUseConnection(Auth.instance, 'iam-only')
151+
await promptAndUseConnection(Auth.instance, 'iam')
148152
return Auth.instance.activeConnection
149153
}
150154

0 commit comments

Comments
 (0)