Skip to content

Commit 4821ae7

Browse files
authored
Merge #2588 feat(lambda): "Upload Lambda" from anywhere
2 parents 7789849 + 3c7f54b commit 4821ae7

File tree

13 files changed

+444
-64
lines changed

13 files changed

+444
-64
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Lambda: Use Upload Lambda from a folder, template file, or the command palette."
4+
}

package.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383
"onCommand:aws.cloudFormation.newTemplate",
8484
"onCommand:aws.sam.newTemplate",
8585
"onFileSystem:s3",
86-
"onFileSystem:s3-readonly"
86+
"onFileSystem:s3-readonly",
87+
"onCommand:aws.uploadLambda"
8788
],
8889
"main": "./dist/src/main",
8990
"contributes": {
@@ -252,6 +253,11 @@
252253
"items": {
253254
"type": "string"
254255
}
256+
},
257+
"aws.lambda.recentlyUploaded": {
258+
"type": "object",
259+
"description": "%AWS.configuration.description.lambda.recentlyUploaded%",
260+
"default": []
255261
}
256262
}
257263
},
@@ -734,10 +740,6 @@
734740
"command": "aws.downloadLambda",
735741
"when": "false"
736742
},
737-
{
738-
"command": "aws.uploadLambda",
739-
"when": "false"
740-
},
741743
{
742744
"command": "aws.invokeLambda",
743745
"when": "false"
@@ -1155,6 +1157,11 @@
11551157
"command": "aws.deploySamApplication",
11561158
"when": "isFileSystemResource == true && resourceFilename =~ /^template\\.(json|yml|yaml)$/",
11571159
"group": "z_aws@1"
1160+
},
1161+
{
1162+
"command": "aws.uploadLambda",
1163+
"when": "isFileSystemResource == true && resourceFilename =~ /^template\\.(json|yml|yaml)$/ || (explorerResourceIsFolder && isCloud9)",
1164+
"group": "z_aws@2"
11581165
}
11591166
],
11601167
"view/item/context": [
@@ -2127,7 +2134,6 @@
21272134
"command": "aws.uploadLambda",
21282135
"title": "%AWS.command.uploadLambda%",
21292136
"category": "%AWS.title%",
2130-
"enablement": "viewItem =~ /^(awsRegionFunctionNode|awsRegionFunctionNodeDownloadable)$/",
21312137
"cloud9": {
21322138
"cn": {
21332139
"category": "%AWS.title.cn%"

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"AWS.productName.cn": "Amazon Toolkit",
66
"AWS.cdk.explorerTitle": "CDK (Preview)",
77
"AWS.configuration.profileDescription": "The name of the credential profile to obtain credentials from.",
8+
"AWS.configuration.description.lambda.recentlyUploaded": "Recently selected Lambda upload targets.",
89
"AWS.configuration.description.logLevel": "The AWS Toolkit's log level (changes reflected on restart)",
910
"AWS.configuration.description.logLevel.cn": "The Amazon Toolkit's log level (changes reflected on restart)",
1011
"AWS.configuration.description.iot.maxItemsPerPage": "Controls how many IoT Things, Certificates, or Policies are listed before showing a node to `Load More...`.",

src/lambda/activation.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,18 @@ export async function activate(context: ExtContext): Promise<void> {
4848
'aws.downloadLambda',
4949
async (node: LambdaFunctionNode) => await downloadLambdaCommand(node)
5050
),
51-
vscode.commands.registerCommand('aws.uploadLambda', async (node: LambdaFunctionNode) => {
52-
await uploadLambdaCommand(node)
51+
vscode.commands.registerCommand('aws.uploadLambda', async arg => {
52+
if (arg instanceof LambdaFunctionNode) {
53+
await uploadLambdaCommand({
54+
name: arg.functionName,
55+
region: arg.regionCode,
56+
configuration: arg.configuration,
57+
})
58+
} else if (arg instanceof vscode.Uri) {
59+
await uploadLambdaCommand(undefined, arg)
60+
} else {
61+
await uploadLambdaCommand()
62+
}
5363
}),
5464
registerSamInvokeVueCommand(context)
5565
)

0 commit comments

Comments
 (0)