Skip to content

Commit 49ce3f6

Browse files
Merge master into feature/model-selection
2 parents 5418584 + 23a25d1 commit 49ce3f6

File tree

22 files changed

+923
-111
lines changed

22 files changed

+923
-111
lines changed

packages/core/package.json

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -323,159 +323,173 @@
323323
"fontCharacter": "\\f1d2"
324324
}
325325
},
326-
"aws-lambda-function": {
326+
"aws-lambda-deployed-function": {
327327
"description": "AWS Contributed Icon",
328328
"default": {
329329
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
330330
"fontCharacter": "\\f1d3"
331331
}
332332
},
333-
"aws-mynah-MynahIconBlack": {
333+
"aws-lambda-function": {
334334
"description": "AWS Contributed Icon",
335335
"default": {
336336
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
337337
"fontCharacter": "\\f1d4"
338338
}
339339
},
340-
"aws-mynah-MynahIconWhite": {
340+
"aws-lambda-invoke-remotely": {
341341
"description": "AWS Contributed Icon",
342342
"default": {
343343
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
344344
"fontCharacter": "\\f1d5"
345345
}
346346
},
347-
"aws-mynah-logo": {
347+
"aws-mynah-MynahIconBlack": {
348348
"description": "AWS Contributed Icon",
349349
"default": {
350350
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
351351
"fontCharacter": "\\f1d6"
352352
}
353353
},
354-
"aws-redshift-cluster": {
354+
"aws-mynah-MynahIconWhite": {
355355
"description": "AWS Contributed Icon",
356356
"default": {
357357
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
358358
"fontCharacter": "\\f1d7"
359359
}
360360
},
361-
"aws-redshift-cluster-connected": {
361+
"aws-mynah-logo": {
362362
"description": "AWS Contributed Icon",
363363
"default": {
364364
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
365365
"fontCharacter": "\\f1d8"
366366
}
367367
},
368-
"aws-redshift-database": {
368+
"aws-redshift-cluster": {
369369
"description": "AWS Contributed Icon",
370370
"default": {
371371
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
372372
"fontCharacter": "\\f1d9"
373373
}
374374
},
375-
"aws-redshift-redshift-cluster-connected": {
375+
"aws-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-redshift-schema": {
382+
"aws-redshift-database": {
383383
"description": "AWS Contributed Icon",
384384
"default": {
385385
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
386386
"fontCharacter": "\\f1db"
387387
}
388388
},
389-
"aws-redshift-table": {
389+
"aws-redshift-redshift-cluster-connected": {
390390
"description": "AWS Contributed Icon",
391391
"default": {
392392
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
393393
"fontCharacter": "\\f1dc"
394394
}
395395
},
396-
"aws-s3-bucket": {
396+
"aws-redshift-schema": {
397397
"description": "AWS Contributed Icon",
398398
"default": {
399399
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
400400
"fontCharacter": "\\f1dd"
401401
}
402402
},
403-
"aws-s3-create-bucket": {
403+
"aws-redshift-table": {
404404
"description": "AWS Contributed Icon",
405405
"default": {
406406
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
407407
"fontCharacter": "\\f1de"
408408
}
409409
},
410-
"aws-sagemaker-code-editor": {
410+
"aws-s3-bucket": {
411411
"description": "AWS Contributed Icon",
412412
"default": {
413413
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
414414
"fontCharacter": "\\f1df"
415415
}
416416
},
417-
"aws-sagemaker-jupyter-lab": {
417+
"aws-s3-create-bucket": {
418418
"description": "AWS Contributed Icon",
419419
"default": {
420420
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
421421
"fontCharacter": "\\f1e0"
422422
}
423423
},
424-
"aws-sagemakerunifiedstudio-catalog": {
424+
"aws-sagemaker-code-editor": {
425425
"description": "AWS Contributed Icon",
426426
"default": {
427427
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
428428
"fontCharacter": "\\f1e1"
429429
}
430430
},
431-
"aws-sagemakerunifiedstudio-spaces": {
431+
"aws-sagemaker-jupyter-lab": {
432432
"description": "AWS Contributed Icon",
433433
"default": {
434434
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
435435
"fontCharacter": "\\f1e2"
436436
}
437437
},
438-
"aws-sagemakerunifiedstudio-spaces-dark": {
438+
"aws-sagemakerunifiedstudio-catalog": {
439439
"description": "AWS Contributed Icon",
440440
"default": {
441441
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
442442
"fontCharacter": "\\f1e3"
443443
}
444444
},
445-
"aws-sagemakerunifiedstudio-symbol-int": {
445+
"aws-sagemakerunifiedstudio-spaces": {
446446
"description": "AWS Contributed Icon",
447447
"default": {
448448
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
449449
"fontCharacter": "\\f1e4"
450450
}
451451
},
452-
"aws-sagemakerunifiedstudio-table": {
452+
"aws-sagemakerunifiedstudio-spaces-dark": {
453453
"description": "AWS Contributed Icon",
454454
"default": {
455455
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
456456
"fontCharacter": "\\f1e5"
457457
}
458458
},
459-
"aws-schemas-registry": {
459+
"aws-sagemakerunifiedstudio-symbol-int": {
460460
"description": "AWS Contributed Icon",
461461
"default": {
462462
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
463463
"fontCharacter": "\\f1e6"
464464
}
465465
},
466-
"aws-schemas-schema": {
466+
"aws-sagemakerunifiedstudio-table": {
467467
"description": "AWS Contributed Icon",
468468
"default": {
469469
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
470470
"fontCharacter": "\\f1e7"
471471
}
472472
},
473-
"aws-stepfunctions-preview": {
473+
"aws-schemas-registry": {
474474
"description": "AWS Contributed Icon",
475475
"default": {
476476
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
477477
"fontCharacter": "\\f1e8"
478478
}
479+
},
480+
"aws-schemas-schema": {
481+
"description": "AWS Contributed Icon",
482+
"default": {
483+
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
484+
"fontCharacter": "\\f1e9"
485+
}
486+
},
487+
"aws-stepfunctions-preview": {
488+
"description": "AWS Contributed Icon",
489+
"default": {
490+
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
491+
"fontCharacter": "\\f1ea"
492+
}
479493
}
480494
}
481495
},

packages/core/package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@
249249
"AWS.command.ssmDocument.openLocalDocumentJson": "Download as JSON",
250250
"AWS.command.ssmDocument.openLocalDocumentYaml": "Download as YAML",
251251
"AWS.command.ssmDocument.publishDocument": "Publish a Systems Manager Document",
252-
"AWS.command.launchConfigForm.title": "Local Invoke and Debug Configuration",
252+
"AWS.command.launchConfigForm.title": "Invoke Locally",
253253
"AWS.command.addSamDebugConfig": "Add Local Invoke and Debug Configuration",
254254
"AWS.command.toggleSamCodeLenses": "Toggle SAM hints in source files",
255255
"AWS.command.apprunner.createService": "Create Service",
Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

packages/core/resources/markdown/samReadme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ${LISTOFCONFIGURATIONS}
1313

1414
You can debug the Lambda handlers locally by adding a breakpoint to the source file, then running the launch configuration. This works by using Docker on your local machine.
1515

16-
Invocation parameters, including payloads and request parameters, can be edited either by the `Local Invoke and Debug Configuration` command (through the ${COMMANDPALETTE} or ${CODELENS}) or by editing the `launch.json` file.
16+
Invocation parameters, including payloads and request parameters, can be edited either by the `Invoke Locally` command (through the ${COMMANDPALETTE} or ${CODELENS}) or by editing the `launch.json` file.
1717

1818
${COMPANYNAME} Lambda functions not defined in the [`template.yaml`](./template.yaml) file can be invoked and debugged by creating a launch configuration through the ${CODELENS} over the function declaration, or with the `Add Local Invoke and Debug Configuration` command.
1919

packages/core/src/awsService/appBuilder/explorer/nodes/deployedNode.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export async function generateDeployedNode(
8080
stackName: string,
8181
resourceTreeEntity: ResourceTreeEntity,
8282
location?: vscode.Uri
83-
): Promise<any[]> {
83+
): Promise<DeployedResourceNode[] | TreeNode[]> {
8484
let newDeployedResource: any
8585
const partitionId = globals.regionProvider.getPartitionId(regionCode) ?? defaultPartition
8686
try {
@@ -97,7 +97,9 @@ export async function generateDeployedNode(
9797
regionCode,
9898
configuration,
9999
undefined,
100-
location ? vscode.Uri.joinPath(location, resourceTreeEntity.CodeUri ?? '').fsPath : undefined
100+
location ? vscode.Uri.joinPath(location, resourceTreeEntity.CodeUri ?? '').fsPath : undefined,
101+
location,
102+
deployedResource.LogicalResourceId
101103
)
102104
} catch (error: any) {
103105
getLogger().error('Error getting Lambda configuration: %O', error)

packages/core/src/awsService/appBuilder/explorer/nodes/resourceNode.ts

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,36 @@ import { generatePropertyNodes } from './propertyNode'
1717
import { generateDeployedNode } from './deployedNode'
1818
import { StackResource } from '../../../../lambda/commands/listSamResources'
1919
import { DeployedResourceNode } from './deployedNode'
20+
import { LambdaFunctionNode } from '../../../../lambda/explorer/lambdaFunctionNode'
21+
import { ToolkitError } from '../../../../shared/errors'
2022

2123
enum ResourceTypeId {
2224
Function = 'function',
25+
DeployedFunction = 'deployed-function',
2326
Api = 'api',
2427
Other = '',
2528
}
2629

30+
export async function generateLambdaNodeFromResource(resource: ResourceNode['resource']): Promise<LambdaFunctionNode> {
31+
if (!resource.deployedResource || !resource.region || !resource.stackName || !resource.resource) {
32+
throw new ToolkitError('Error getting Lambda info from Appbuilder Node, please check your connection')
33+
}
34+
const nodes = (await generateDeployedNode(
35+
resource.deployedResource,
36+
resource.region,
37+
resource.stackName,
38+
resource.resource,
39+
resource.projectRoot
40+
)) as DeployedResourceNode[]
41+
if (nodes.length !== 1) {
42+
throw new ToolkitError('Error getting Lambda info from Appbuilder Node, please check your connection')
43+
}
44+
// lambda function node or undefined
45+
return nodes[0].resource?.explorerNode
46+
}
47+
48+
// from here, we should have a helper function to detect if lambda is deployed
49+
// then return deployed node/normal node on each condition.
2750
export class ResourceNode implements TreeNode {
2851
public readonly id = this.resourceTreeEntity.Id
2952
private readonly type = this.resourceTreeEntity.Type
@@ -43,6 +66,7 @@ export class ResourceNode implements TreeNode {
4366
return {
4467
resource: this.resourceTreeEntity,
4568
location: this.location.samTemplateUri,
69+
projectRoot: this.location.projectRoot,
4670
workspaceFolder: this.location.workspaceFolder,
4771
region: this.region,
4872
stackName: this.stackName,
@@ -56,13 +80,13 @@ export class ResourceNode implements TreeNode {
5680
let propertyNodes: TreeNode[] = []
5781

5882
if (this.deployedResource && this.region && this.stackName) {
59-
deployedNodes = await generateDeployedNode(
83+
deployedNodes = (await generateDeployedNode(
6084
this.deployedResource,
6185
this.region,
6286
this.stackName,
6387
this.resourceTreeEntity,
6488
this.location.projectRoot
65-
)
89+
)) as DeployedResourceNode[]
6690
}
6791
if (this.resourceTreeEntity.Type === SERVERLESS_FUNCTION_TYPE) {
6892
propertyNodes = generatePropertyNodes(this.resourceTreeEntity)
@@ -72,10 +96,7 @@ export class ResourceNode implements TreeNode {
7296
}
7397

7498
public getTreeItem(): vscode.TreeItem {
75-
// Determine the initial TreeItem collapsible state based on the type
76-
const collapsibleState = this.deployedResource
77-
? vscode.TreeItemCollapsibleState.Collapsed
78-
: vscode.TreeItemCollapsibleState.None
99+
const collapsibleState = vscode.TreeItemCollapsibleState.Collapsed
79100

80101
// Create the TreeItem with the determined collapsible state
81102
const item = new vscode.TreeItem(this.resourceTreeEntity.Id, collapsibleState)
@@ -100,7 +121,11 @@ export class ResourceNode implements TreeNode {
100121
private getIconPath(): IconPath | undefined {
101122
switch (this.type) {
102123
case SERVERLESS_FUNCTION_TYPE:
124+
if (this.deployedResource) {
125+
return getIcon('aws-lambda-deployed-function')
126+
}
103127
return getIcon('aws-lambda-function')
128+
// add deployed lambda function type
104129
case s3BucketType:
105130
return getIcon('aws-s3-bucket')
106131
case appRunnerType:
@@ -115,6 +140,9 @@ export class ResourceNode implements TreeNode {
115140
private getResourceId(): ResourceTypeId {
116141
switch (this.type) {
117142
case SERVERLESS_FUNCTION_TYPE:
143+
if (this.deployedResource) {
144+
return ResourceTypeId.DeployedFunction
145+
}
118146
return ResourceTypeId.Function
119147
case 'Api':
120148
return ResourceTypeId.Api

0 commit comments

Comments
 (0)