in src/shared/sam/debugger/awsSamDebugger.ts [197:266]
public async provideDebugConfigurations(
folder: vscode.WorkspaceFolder | undefined,
token?: vscode.CancellationToken
): Promise<AwsSamDebuggerConfiguration[] | undefined> {
if (token?.isCancellationRequested) {
return undefined
}
const configs: AwsSamDebuggerConfiguration[] = []
if (folder) {
const folderPath = folder.uri.fsPath
const templates = globals.templateRegistry.registeredItems
for (const templateDatum of templates) {
if (isInDirectory(folderPath, templateDatum.path)) {
if (!templateDatum.item.Resources) {
getLogger().error(`provideDebugConfigurations: invalid template: ${templateDatum.path}`)
continue
}
for (const resourceKey of Object.keys(templateDatum.item.Resources)) {
const resource = templateDatum.item.Resources[resourceKey]
if (resource) {
// we do not know enough to populate the runtime field for Image-based Lambdas
const runtimeName = CloudFormation.isZipLambdaResource(resource?.Properties)
? CloudFormation.getStringForProperty(
resource?.Properties,
'Runtime',
templateDatum.item
) ?? ''
: ''
configs.push(
createTemplateAwsSamDebugConfig(
folder,
runtimeName,
false,
resourceKey,
templateDatum.path
)
)
const events = resource?.Properties?.Events
if (events) {
// Check for api resources to add
for (const key in events) {
const value = events[key]
if (value.Type === 'Api') {
const properties = value.Properties as CloudFormation.ApiEventProperties
configs.push(
createApiAwsSamDebugConfig(
folder,
runtimeName,
resourceKey,
templateDatum.path,
{
path: properties?.Path,
httpMethod: properties?.Method,
}
)
)
}
}
}
}
}
}
}
getLogger().verbose(`provideDebugConfigurations: debugconfigs: ${JSON.stringify(configs)}`)
}
return configs
}