Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,159 +323,173 @@
"fontCharacter": "\\f1d2"
}
},
"aws-lambda-function": {
"aws-lambda-deployed-function": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d3"
}
},
"aws-mynah-MynahIconBlack": {
"aws-lambda-function": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d4"
}
},
"aws-mynah-MynahIconWhite": {
"aws-lambda-invoke-remotely": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d5"
}
},
"aws-mynah-logo": {
"aws-mynah-MynahIconBlack": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d6"
}
},
"aws-redshift-cluster": {
"aws-mynah-MynahIconWhite": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d7"
}
},
"aws-redshift-cluster-connected": {
"aws-mynah-logo": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d8"
}
},
"aws-redshift-database": {
"aws-redshift-cluster": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1d9"
}
},
"aws-redshift-redshift-cluster-connected": {
"aws-redshift-cluster-connected": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1da"
}
},
"aws-redshift-schema": {
"aws-redshift-database": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1db"
}
},
"aws-redshift-table": {
"aws-redshift-redshift-cluster-connected": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1dc"
}
},
"aws-s3-bucket": {
"aws-redshift-schema": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1dd"
}
},
"aws-s3-create-bucket": {
"aws-redshift-table": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1de"
}
},
"aws-sagemaker-code-editor": {
"aws-s3-bucket": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1df"
}
},
"aws-sagemaker-jupyter-lab": {
"aws-s3-create-bucket": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e0"
}
},
"aws-sagemakerunifiedstudio-catalog": {
"aws-sagemaker-code-editor": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e1"
}
},
"aws-sagemakerunifiedstudio-spaces": {
"aws-sagemaker-jupyter-lab": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e2"
}
},
"aws-sagemakerunifiedstudio-spaces-dark": {
"aws-sagemakerunifiedstudio-catalog": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e3"
}
},
"aws-sagemakerunifiedstudio-symbol-int": {
"aws-sagemakerunifiedstudio-spaces": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e4"
}
},
"aws-sagemakerunifiedstudio-table": {
"aws-sagemakerunifiedstudio-spaces-dark": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e5"
}
},
"aws-schemas-registry": {
"aws-sagemakerunifiedstudio-symbol-int": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e6"
}
},
"aws-schemas-schema": {
"aws-sagemakerunifiedstudio-table": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e7"
}
},
"aws-stepfunctions-preview": {
"aws-schemas-registry": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e8"
}
},
"aws-schemas-schema": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1e9"
}
},
"aws-stepfunctions-preview": {
"description": "AWS Contributed Icon",
"default": {
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
"fontCharacter": "\\f1ea"
}
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
"AWS.command.ssmDocument.openLocalDocumentJson": "Download as JSON",
"AWS.command.ssmDocument.openLocalDocumentYaml": "Download as YAML",
"AWS.command.ssmDocument.publishDocument": "Publish a Systems Manager Document",
"AWS.command.launchConfigForm.title": "Local Invoke and Debug Configuration",
"AWS.command.launchConfigForm.title": "Invoke Locally",
"AWS.command.addSamDebugConfig": "Add Local Invoke and Debug Configuration",
"AWS.command.toggleSamCodeLenses": "Toggle SAM hints in source files",
"AWS.command.apprunner.createService": "Create Service",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/core/resources/markdown/samReadme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ${LISTOFCONFIGURATIONS}

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.

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.
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.

${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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export async function generateDeployedNode(
stackName: string,
resourceTreeEntity: ResourceTreeEntity,
location?: vscode.Uri
): Promise<any[]> {
): Promise<DeployedResourceNode[] | TreeNode[]> {
let newDeployedResource: any
const partitionId = globals.regionProvider.getPartitionId(regionCode) ?? defaultPartition
try {
Expand All @@ -97,7 +97,9 @@ export async function generateDeployedNode(
regionCode,
configuration,
undefined,
location ? vscode.Uri.joinPath(location, resourceTreeEntity.CodeUri ?? '').fsPath : undefined
location ? vscode.Uri.joinPath(location, resourceTreeEntity.CodeUri ?? '').fsPath : undefined,
location,
deployedResource.LogicalResourceId
)
} catch (error: any) {
getLogger().error('Error getting Lambda configuration: %O', error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,36 @@ import { generatePropertyNodes } from './propertyNode'
import { generateDeployedNode } from './deployedNode'
import { StackResource } from '../../../../lambda/commands/listSamResources'
import { DeployedResourceNode } from './deployedNode'
import { LambdaFunctionNode } from '../../../../lambda/explorer/lambdaFunctionNode'
import { ToolkitError } from '../../../../shared/errors'

enum ResourceTypeId {
Function = 'function',
DeployedFunction = 'deployed-function',
Api = 'api',
Other = '',
}

export async function generateLambdaNodeFromResource(resource: ResourceNode['resource']): Promise<LambdaFunctionNode> {
if (!resource.deployedResource || !resource.region || !resource.stackName || !resource.resource) {
throw new ToolkitError('Error getting Lambda info from Appbuilder Node, please check your connection')
}
const nodes = (await generateDeployedNode(
resource.deployedResource,
resource.region,
resource.stackName,
resource.resource,
resource.projectRoot
)) as DeployedResourceNode[]
if (nodes.length !== 1) {
throw new ToolkitError('Error getting Lambda info from Appbuilder Node, please check your connection')
}
// lambda function node or undefined
return nodes[0].resource?.explorerNode
}

// from here, we should have a helper function to detect if lambda is deployed
// then return deployed node/normal node on each condition.
export class ResourceNode implements TreeNode {
public readonly id = this.resourceTreeEntity.Id
private readonly type = this.resourceTreeEntity.Type
Expand All @@ -43,6 +66,7 @@ export class ResourceNode implements TreeNode {
return {
resource: this.resourceTreeEntity,
location: this.location.samTemplateUri,
projectRoot: this.location.projectRoot,
workspaceFolder: this.location.workspaceFolder,
region: this.region,
stackName: this.stackName,
Expand All @@ -56,13 +80,13 @@ export class ResourceNode implements TreeNode {
let propertyNodes: TreeNode[] = []

if (this.deployedResource && this.region && this.stackName) {
deployedNodes = await generateDeployedNode(
deployedNodes = (await generateDeployedNode(
this.deployedResource,
this.region,
this.stackName,
this.resourceTreeEntity,
this.location.projectRoot
)
)) as DeployedResourceNode[]
}
if (this.resourceTreeEntity.Type === SERVERLESS_FUNCTION_TYPE) {
propertyNodes = generatePropertyNodes(this.resourceTreeEntity)
Expand All @@ -72,10 +96,7 @@ export class ResourceNode implements TreeNode {
}

public getTreeItem(): vscode.TreeItem {
// Determine the initial TreeItem collapsible state based on the type
const collapsibleState = this.deployedResource
? vscode.TreeItemCollapsibleState.Collapsed
: vscode.TreeItemCollapsibleState.None
const collapsibleState = vscode.TreeItemCollapsibleState.Collapsed

// Create the TreeItem with the determined collapsible state
const item = new vscode.TreeItem(this.resourceTreeEntity.Id, collapsibleState)
Expand All @@ -100,7 +121,11 @@ export class ResourceNode implements TreeNode {
private getIconPath(): IconPath | undefined {
switch (this.type) {
case SERVERLESS_FUNCTION_TYPE:
if (this.deployedResource) {
return getIcon('aws-lambda-deployed-function')
}
return getIcon('aws-lambda-function')
// add deployed lambda function type
case s3BucketType:
return getIcon('aws-s3-bucket')
case appRunnerType:
Expand All @@ -115,6 +140,9 @@ export class ResourceNode implements TreeNode {
private getResourceId(): ResourceTypeId {
switch (this.type) {
case SERVERLESS_FUNCTION_TYPE:
if (this.deployedResource) {
return ResourceTypeId.DeployedFunction
}
return ResourceTypeId.Function
case 'Api':
return ResourceTypeId.Api
Expand Down
Loading
Loading