in src/commands/createFunction/FunctionListStep.ts [71:142]
public async getSubWizard(context: IFunctionWizardContext): Promise<IWizardOptions<IFunctionWizardContext> | undefined> {
const template: IFunctionTemplate | undefined = context.functionTemplate;
if (template) {
const promptSteps: AzureWizardPromptStep<IFunctionWizardContext>[] = [];
switch (context.language) {
case ProjectLanguage.Java:
promptSteps.push(new JavaPackageNameStep(), new JavaFunctionNameStep());
break;
case ProjectLanguage.CSharp:
case ProjectLanguage.FSharp:
promptSteps.push(new DotnetFunctionNameStep(), new DotnetNamespaceStep());
break;
default:
promptSteps.push(new ScriptFunctionNameStep());
break;
}
// Add settings to context that were programmatically passed in
for (const key of Object.keys(this._functionSettings)) {
context[key.toLowerCase()] = this._functionSettings[key];
}
addBindingSettingSteps(template.userPromptedSettings, promptSteps);
const executeSteps: AzureWizardExecuteStep<IFunctionWizardContext>[] = [];
switch (context.language) {
case ProjectLanguage.Java:
executeSteps.push(new JavaFunctionCreateStep());
break;
case ProjectLanguage.CSharp:
case ProjectLanguage.FSharp:
executeSteps.push(await DotnetFunctionCreateStep.createStep(context));
break;
case ProjectLanguage.TypeScript:
executeSteps.push(new TypeScriptFunctionCreateStep());
break;
default:
executeSteps.push(new ScriptFunctionCreateStep());
break;
}
if (!template.isHttpTrigger && !canValidateAzureWebJobStorageOnDebug(context.language) && !await getAzureWebJobsStorage(context, context.projectPath)) {
promptSteps.push(new AzureWebJobsStoragePromptStep());
executeSteps.push(new AzureWebJobsStorageExecuteStep());
}
const title: string = localize('createFunction', 'Create new {0}', template.name);
return { promptSteps, executeSteps, title };
} else if (context.generateFromOpenAPI) {
const promptSteps: AzureWizardPromptStep<IFunctionWizardContext>[] = [];
const executeSteps: AzureWizardExecuteStep<IFunctionWizardContext>[] = [];
switch (context.language) {
case ProjectLanguage.Java:
promptSteps.push(new JavaPackageNameStep());
break;
case ProjectLanguage.CSharp:
promptSteps.push(new DotnetNamespaceStep());
break;
default:
break;
}
promptSteps.push(new OpenAPIGetSpecificationFileStep());
executeSteps.push(await OpenAPICreateStep.createStep(context));
const title: string = localize('createFunction', 'Create new {0}', 'HTTP Triggers from OpenAPI (v2/v3) Specification File');
return { promptSteps, executeSteps, title };
} else {
return undefined;
}
}