├── .azure-pipelines ├── 1esmain.yml ├── SignExtension.signproj ├── common │ ├── build.yml │ ├── lint.yml │ ├── package.yml │ ├── sbom.yml │ └── test.yml ├── compliance │ ├── CredScanSuppressions.json │ ├── PoliCheckExclusions.xml │ ├── compliance.yml │ └── tsaoptions.json ├── linux │ └── xvfb.init ├── main.yml └── release.yml ├── .eslintignore ├── .eslintrc.js ├── .gitattributes ├── .github ├── CODEOWNERS ├── copilot-instructions.md └── workflows │ ├── bump-version-pr.yaml │ ├── feature-request.yml │ ├── info-needed-closer.yml │ ├── locker.yml │ └── main.yml ├── .gitignore ├── .husky └── pre-commit ├── .nvmrc ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE.md ├── NOTICE.html ├── README.md ├── SECURITY.md ├── SUPPORT.md ├── extension.bundle.ts ├── gulpfile.ts ├── main.js ├── package-lock.json ├── package.json ├── package.nls.json ├── resources ├── ManagedIdentityUserAssignedIdentities.svg ├── azFuncFunction.svg ├── azFuncProductionSlot.svg ├── azFuncProxy.svg ├── azFuncSlot.svg ├── azFuncSlots.svg ├── azure-functions.png ├── azure-functions.svg ├── backupTemplates │ ├── Microsoft.Azure.Functions.ExtensionBundle │ │ ├── bindings │ │ │ └── bindings.json │ │ ├── resources │ │ │ ├── Resources.cs-CZ.json │ │ │ ├── Resources.de-DE.json │ │ │ ├── Resources.es-ES.json │ │ │ ├── Resources.fr-FR.json │ │ │ ├── Resources.hu-HU.json │ │ │ ├── Resources.it-IT.json │ │ │ ├── Resources.ja-JP.json │ │ │ ├── Resources.json │ │ │ ├── Resources.ko-KR.json │ │ │ ├── Resources.nl-NL.json │ │ │ ├── Resources.pl-PL.json │ │ │ ├── Resources.pt-BR.json │ │ │ ├── Resources.pt-PT.json │ │ │ ├── Resources.ru-RU.json │ │ │ ├── Resources.sv-SE.json │ │ │ ├── Resources.tr-TR.json │ │ │ ├── Resources.zh-CN.json │ │ │ └── Resources.zh-TW.json │ │ ├── templates │ │ │ └── templates.json │ │ └── version.txt │ ├── ballerina │ │ ├── bindings │ │ │ └── bindings.json │ │ ├── resources │ │ │ └── Resources.json │ │ ├── templates │ │ │ └── templates.json │ │ └── version.txt │ ├── dotnet │ │ ├── ~1 │ │ │ ├── net48 │ │ │ │ ├── item.nupkg │ │ │ │ └── project.nupkg │ │ │ └── version.txt │ │ ├── ~2 │ │ │ ├── netcoreapp2.1 │ │ │ │ ├── item.nupkg │ │ │ │ └── project.nupkg │ │ │ └── version.txt │ │ ├── ~3 │ │ │ ├── net5.0-isolated │ │ │ │ ├── item.nupkg │ │ │ │ └── project.nupkg │ │ │ ├── netcoreapp3.1 │ │ │ │ ├── item.nupkg │ │ │ │ └── project.nupkg │ │ │ └── version.txt │ │ └── ~4 │ │ │ ├── net5.0-isolated │ │ │ ├── item.nupkg │ │ │ └── project.nupkg │ │ │ ├── net6.0-isolated │ │ │ ├── item.nupkg │ │ │ └── project.nupkg │ │ │ ├── net6.0 │ │ │ ├── item.nupkg │ │ │ └── project.nupkg │ │ │ ├── net7.0-isolated │ │ │ ├── item.nupkg │ │ │ └── project.nupkg │ │ │ ├── net8.0-isolated │ │ │ ├── item.nupkg │ │ │ └── project.nupkg │ │ │ ├── net9.0-isolated │ │ │ ├── item.nupkg │ │ │ └── project.nupkg │ │ │ └── version.txt │ ├── java │ │ ├── ~2 │ │ │ ├── bindings │ │ │ │ └── bindings.json │ │ │ ├── resources │ │ │ │ └── Resources.json │ │ │ ├── templates │ │ │ │ └── templates.json │ │ │ └── version.txt │ │ ├── ~3 │ │ │ ├── bindings │ │ │ │ └── bindings.json │ │ │ ├── resources │ │ │ │ └── Resources.json │ │ │ ├── templates │ │ │ │ └── templates.json │ │ │ └── version.txt │ │ └── ~4 │ │ │ ├── bindings │ │ │ └── bindings.json │ │ │ ├── resources │ │ │ └── Resources.json │ │ │ ├── templates │ │ │ └── templates.json │ │ │ └── version.txt │ ├── nodejs-4.x │ │ ├── bindings │ │ │ └── bindings.json │ │ ├── resources │ │ │ ├── Resources.cs-CZ.json │ │ │ ├── Resources.de-DE.json │ │ │ ├── Resources.es-ES.json │ │ │ ├── Resources.fr-FR.json │ │ │ ├── Resources.hu-HU.json │ │ │ ├── Resources.it-IT.json │ │ │ ├── Resources.ja-JP.json │ │ │ ├── Resources.json │ │ │ ├── Resources.ko-KR.json │ │ │ ├── Resources.nl-NL.json │ │ │ ├── Resources.pl-PL.json │ │ │ ├── Resources.pt-BR.json │ │ │ ├── Resources.pt-PT.json │ │ │ ├── Resources.ru-RU.json │ │ │ ├── Resources.sv-SE.json │ │ │ ├── Resources.tr-TR.json │ │ │ ├── Resources.zh-CN.json │ │ │ └── Resources.zh-TW.json │ │ ├── templates │ │ │ └── templates.json │ │ └── version.txt │ ├── pystein │ │ ├── bindings-v2 │ │ │ └── userPrompts.json │ │ ├── resources-v2 │ │ │ ├── Resources.Id-id.json │ │ │ ├── Resources.cs-CZ.json │ │ │ ├── Resources.de-DE.json │ │ │ ├── Resources.en-US.json │ │ │ ├── Resources.es-ES.json │ │ │ ├── Resources.fr-FR.json │ │ │ ├── Resources.hu-HU.json │ │ │ ├── Resources.it-IT.json │ │ │ ├── Resources.ja-JP.json │ │ │ ├── Resources.json │ │ │ ├── Resources.ko-KR.json │ │ │ ├── Resources.nl-NL.json │ │ │ ├── Resources.pl-PL.json │ │ │ ├── Resources.pt-BR.json │ │ │ ├── Resources.pt-PT.json │ │ │ ├── Resources.ru-RU.json │ │ │ ├── Resources.sv-SE.json │ │ │ ├── Resources.tr-TR.json │ │ │ ├── Resources.zh-CN.json │ │ │ └── Resources.zh-TW.json │ │ ├── templates-v2 │ │ │ └── templates.json │ │ └── version.txt │ └── script │ │ ├── ~1 │ │ ├── bindings │ │ │ └── bindings.json │ │ ├── resources │ │ │ ├── Resources.cs-CZ.json │ │ │ ├── Resources.de-DE.json │ │ │ ├── Resources.es-ES.json │ │ │ ├── Resources.fr-FR.json │ │ │ ├── Resources.hu-HU.json │ │ │ ├── Resources.it-IT.json │ │ │ ├── Resources.ja-JP.json │ │ │ ├── Resources.json │ │ │ ├── Resources.ko-KR.json │ │ │ ├── Resources.nl-NL.json │ │ │ ├── Resources.pl-PL.json │ │ │ ├── Resources.pt-BR.json │ │ │ ├── Resources.pt-PT.json │ │ │ ├── Resources.ru-RU.json │ │ │ ├── Resources.sv-SE.json │ │ │ ├── Resources.tr-TR.json │ │ │ ├── Resources.zh-CN.json │ │ │ └── Resources.zh-TW.json │ │ ├── templates │ │ │ └── templates.json │ │ └── version.txt │ │ ├── ~2 │ │ ├── bindings │ │ │ └── bindings.json │ │ ├── resources │ │ │ ├── Resources.cs-CZ.json │ │ │ ├── Resources.de-DE.json │ │ │ ├── Resources.es-ES.json │ │ │ ├── Resources.fr-FR.json │ │ │ ├── Resources.hu-HU.json │ │ │ ├── Resources.it-IT.json │ │ │ ├── Resources.ja-JP.json │ │ │ ├── Resources.json │ │ │ ├── Resources.ko-KR.json │ │ │ ├── Resources.nl-NL.json │ │ │ ├── Resources.pl-PL.json │ │ │ ├── Resources.pt-BR.json │ │ │ ├── Resources.pt-PT.json │ │ │ ├── Resources.ru-RU.json │ │ │ ├── Resources.sv-SE.json │ │ │ ├── Resources.tr-TR.json │ │ │ ├── Resources.zh-CN.json │ │ │ └── Resources.zh-TW.json │ │ ├── templates │ │ │ └── templates.json │ │ └── version.txt │ │ ├── ~3 │ │ ├── bindings │ │ │ └── bindings.json │ │ ├── resources │ │ │ ├── Resources.cs-CZ.json │ │ │ ├── Resources.de-DE.json │ │ │ ├── Resources.es-ES.json │ │ │ ├── Resources.fr-FR.json │ │ │ ├── Resources.hu-HU.json │ │ │ ├── Resources.it-IT.json │ │ │ ├── Resources.ja-JP.json │ │ │ ├── Resources.json │ │ │ ├── Resources.ko-KR.json │ │ │ ├── Resources.nl-NL.json │ │ │ ├── Resources.pl-PL.json │ │ │ ├── Resources.pt-BR.json │ │ │ ├── Resources.pt-PT.json │ │ │ ├── Resources.ru-RU.json │ │ │ ├── Resources.sv-SE.json │ │ │ ├── Resources.tr-TR.json │ │ │ ├── Resources.zh-CN.json │ │ │ └── Resources.zh-TW.json │ │ ├── templates │ │ │ └── templates.json │ │ └── version.txt │ │ └── ~4 │ │ ├── bindings │ │ └── bindings.json │ │ ├── resources │ │ ├── Resources.cs-CZ.json │ │ ├── Resources.de-DE.json │ │ ├── Resources.es-ES.json │ │ ├── Resources.fr-FR.json │ │ ├── Resources.hu-HU.json │ │ ├── Resources.it-IT.json │ │ ├── Resources.ja-JP.json │ │ ├── Resources.json │ │ ├── Resources.ko-KR.json │ │ ├── Resources.nl-NL.json │ │ ├── Resources.pl-PL.json │ │ ├── Resources.pt-BR.json │ │ ├── Resources.pt-PT.json │ │ ├── Resources.ru-RU.json │ │ ├── Resources.sv-SE.json │ │ ├── Resources.tr-TR.json │ │ ├── Resources.zh-CN.json │ │ └── Resources.zh-TW.json │ │ ├── templates │ │ └── templates.json │ │ └── version.txt ├── dark │ ├── AddFunction.svg │ └── CreateNewProject.svg ├── dotnetJsonCli │ ├── Microsoft.DotNet.Cli.CommandLine.dll │ ├── Microsoft.TemplateEngine.Abstractions.dll │ ├── Microsoft.TemplateEngine.Cli.dll │ ├── Microsoft.TemplateEngine.Core.Contracts.dll │ ├── Microsoft.TemplateEngine.Core.dll │ ├── Microsoft.TemplateEngine.Edge.dll │ ├── Microsoft.TemplateEngine.JsonCli.deps.json │ ├── Microsoft.TemplateEngine.JsonCli.dll │ ├── Microsoft.TemplateEngine.JsonCli.runtimeconfig.json │ ├── Microsoft.TemplateEngine.Orchestrator.RunnableProjects.dll │ ├── Microsoft.TemplateEngine.Utils.dll │ ├── Microsoft.TemplateSearch.Common.dll │ └── Newtonsoft.Json.dll ├── durableTaskScheduler │ └── DurableTaskScheduler.svg ├── light │ ├── AddFunction.svg │ └── CreateNewProject.svg ├── readme │ ├── copyFunctionUrl.png │ ├── createFunction.png │ ├── debug.png │ ├── debug3.png │ ├── deploy.png │ ├── deploy │ │ ├── activityLog.png │ │ ├── copyFunctionUrl.png │ │ ├── createComplete.png │ │ ├── createFunctionApp.png │ │ ├── createResource.png │ │ └── deploy.png │ ├── deploy2.png │ └── deploy3.png └── walkthroughs │ ├── empty.md │ └── scenarios.md ├── src ├── FuncVersion.ts ├── FunctionAppResolver.ts ├── How to parse v2 Templates.md ├── LocalResourceProvider.ts ├── agent │ └── agentIntegration.ts ├── api │ └── git.d.ts ├── commands │ ├── CommandAttributes.ts │ ├── SubscriptionListStep.ts │ ├── addBinding │ │ ├── BindingCreateStep.ts │ │ ├── BindingDirectionStep.ts │ │ ├── BindingListStep.ts │ │ ├── IBindingWizardContext.ts │ │ ├── addBinding.ts │ │ ├── createBindingWizard.ts │ │ └── settingSteps │ │ │ ├── AzureConnectionCreateStepBase.ts │ │ │ ├── BindingNameStep.ts │ │ │ ├── BindingSettingStepBase.ts │ │ │ ├── BooleanPromptStep.ts │ │ │ ├── EnumPromptStep.ts │ │ │ ├── LocalAppSettingCreateStep.ts │ │ │ ├── LocalAppSettingListStep.ts │ │ │ ├── LocalAppSettingNameStep.ts │ │ │ ├── LocalAppSettingValueStep.ts │ │ │ ├── StorageConnectionCreateStep.ts │ │ │ ├── StorageTypePromptStep.ts │ │ │ ├── StringPromptStep.ts │ │ │ ├── addBindingSettingSteps.ts │ │ │ ├── cosmosDB │ │ │ ├── CosmosDBConnectionCreateStep.ts │ │ │ ├── CosmosDBListStep.ts │ │ │ └── ICosmosDBWizardContext.ts │ │ │ ├── eventHub │ │ │ ├── EventHubAuthRuleListStep.ts │ │ │ ├── EventHubConnectionCreateStep.ts │ │ │ ├── EventHubCreateStep.ts │ │ │ ├── EventHubListStep.ts │ │ │ ├── EventHubNameStep.ts │ │ │ └── IEventHubWizardContext.ts │ │ │ └── serviceBus │ │ │ ├── IServiceBusWizardContext.ts │ │ │ ├── ServiceBusConnectionCreateStep.ts │ │ │ └── ServiceBusListStep.ts │ ├── addMIConnections │ │ ├── AddMIConnectionsContext.ts │ │ ├── ConnectionsListStep.ts │ │ ├── LocalSettingsAddStep.ts │ │ ├── RemoteSettingsAddStep.ts │ │ ├── SettingsAddBaseStep.ts │ │ ├── addLocalMIConnections.ts │ │ └── addRemoteMIConnections.ts │ ├── api │ │ ├── createFunctionFromApi.ts │ │ ├── downloadAppSettingsFromApi.ts │ │ ├── revealTreeItem.ts │ │ └── uploadAppSettingsFromApi.ts │ ├── appSettings │ │ ├── connectionSettings │ │ │ ├── IConnectionTypesContext.ts │ │ │ ├── ISetConnectionSettingContext.ts │ │ │ ├── azureWebJobsStorage │ │ │ │ ├── IStorageConnectionWizardContext.ts │ │ │ │ ├── StorageConnectionListStep.ts │ │ │ │ ├── StorageConnectionSetSettingStep.ts │ │ │ │ ├── azure │ │ │ │ │ └── StorageAccountGetConnectionStep.ts │ │ │ │ ├── emulator │ │ │ │ │ └── StorageEmulatorGetConnectionStep.ts │ │ │ │ ├── getStorageConnection.ts │ │ │ │ ├── getStorageConnectionString.ts │ │ │ │ ├── getStorageLocalProjectConnections.ts │ │ │ │ └── setConnectionSetting.ts │ │ │ ├── durableTaskScheduler │ │ │ │ ├── DTSConnectionListStep.ts │ │ │ │ ├── DTSConnectionSetSettingStep.ts │ │ │ │ ├── DTSHubNameSetSettingStep.ts │ │ │ │ ├── IDTSConnectionWizardContext.ts │ │ │ │ ├── azure │ │ │ │ │ ├── DTSStartingResourcesLogStep.ts │ │ │ │ │ ├── DurableTaskHubCreateStep.ts │ │ │ │ │ ├── DurableTaskHubListStep.ts │ │ │ │ │ ├── DurableTaskHubNameStep.ts │ │ │ │ │ ├── DurableTaskSchedulerCreateStep.ts │ │ │ │ │ ├── DurableTaskSchedulerGetConnectionStep.ts │ │ │ │ │ ├── DurableTaskSchedulerListStep.ts │ │ │ │ │ └── DurableTaskSchedulerNameStep.ts │ │ │ │ ├── custom │ │ │ │ │ ├── DTSConnectionCustomPromptStep.ts │ │ │ │ │ └── DTSHubNameCustomPromptStep.ts │ │ │ │ ├── emulator │ │ │ │ │ ├── DTSEmulatorGetConnectionsStep.ts │ │ │ │ │ └── DTSEmulatorStartStep.ts │ │ │ │ ├── getDTSConnection.ts │ │ │ │ └── getDTSLocalProjectConnections.ts │ │ │ ├── getVariableSubstitutedKey.ts │ │ │ ├── netherite │ │ │ │ ├── EventHubSetSettingStep.ts │ │ │ │ ├── EventHubsConnectionListStep.ts │ │ │ │ ├── EventHubsNamespaceSetSettingStep.ts │ │ │ │ ├── INetheriteConnectionWizardContext.ts │ │ │ │ ├── azure │ │ │ │ │ ├── EventHubCreateStep.ts │ │ │ │ │ ├── EventHubGetConnectionStep.ts │ │ │ │ │ ├── EventHubListStep.ts │ │ │ │ │ ├── EventHubNameStep.ts │ │ │ │ │ ├── EventHubsNamespaceAuthRuleCreateStep.ts │ │ │ │ │ ├── EventHubsNamespaceAuthRuleListStep.ts │ │ │ │ │ ├── EventHubsNamespaceAuthRuleNameStep.ts │ │ │ │ │ ├── EventHubsNamespaceCreateStep.ts │ │ │ │ │ ├── EventHubsNamespaceGetConnectionStep.ts │ │ │ │ │ ├── EventHubsNamespaceListStep.ts │ │ │ │ │ └── EventHubsNamespaceNameStep.ts │ │ │ │ ├── emulator │ │ │ │ │ ├── NetheriteEmulatorGetConnectionStep.ts │ │ │ │ │ └── NetheriteHostEventHubNameStep.ts │ │ │ │ ├── getNetheriteConnection.ts │ │ │ │ └── getNetheriteLocalProjectConnections.ts │ │ │ ├── notifyFailedToConfigureHost.ts │ │ │ ├── setConnectionSetting.ts │ │ │ └── sqlDatabase │ │ │ │ ├── ISqlDatabaseConnectionWizardContext.ts │ │ │ │ ├── SqlConnectionListStep.ts │ │ │ │ ├── SqlDbConnectionSetSettingStep.ts │ │ │ │ ├── azure │ │ │ │ ├── SqlDatabaseCreateStep.ts │ │ │ │ ├── SqlDatabaseGetConnectionStep.ts │ │ │ │ ├── SqlDatabaseListStep.ts │ │ │ │ ├── SqlDatabaseNameStep.ts │ │ │ │ ├── SqlServerCreateStep.ts │ │ │ │ ├── SqlServerListStep.ts │ │ │ │ ├── SqlServerNameStep.ts │ │ │ │ ├── SqlServerPasswordAuthStep.ts │ │ │ │ └── SqlServerUsernameAuthStep.ts │ │ │ │ ├── custom │ │ │ │ └── SqlDbConnectionCustomPromptStep.ts │ │ │ │ ├── getSQLConnection.ts │ │ │ │ └── getSqlDbLocalProjectConnections.ts │ │ ├── downloadAppSettings.ts │ │ ├── localSettings │ │ │ ├── LocalSettingsClient.ts │ │ │ ├── decryptLocalSettings.ts │ │ │ ├── encryptLocalSettings.ts │ │ │ ├── getLocalSettingsFile.ts │ │ │ └── setAzureWebJobsStorage.ts │ │ ├── toggleSlotSetting.ts │ │ └── uploadAppSettings.ts │ ├── browseWebsite.ts │ ├── configureDeploymentSource.ts │ ├── copyFunctionUrl.ts │ ├── createChildNode.ts │ ├── createFunction │ │ ├── FunctionCreateStepBase.ts │ │ ├── FunctionListStep.ts │ │ ├── FunctionNameStepBase.ts │ │ ├── FunctionSubWizard.ts │ │ ├── IFunctionWizardContext.ts │ │ ├── JobsListStep.ts │ │ ├── actionStepsV2 │ │ │ ├── ActionSchemaStepBase.ts │ │ │ ├── AppendToFileExecuteStep.ts │ │ │ ├── GetTemplateFileContentExecuteStep.ts │ │ │ ├── JobNameExecuteStep.ts │ │ │ ├── ShowMarkdownPreviewExecuteStep.ts │ │ │ ├── WriteToFileExecuteStep.ts │ │ │ └── actionStepFactory.ts │ │ ├── ballerinaSteps │ │ │ ├── BallerinaFunctionCreateStep.ts │ │ │ ├── BallerinaFunctionNameStep.ts │ │ │ └── IBallerinaFunctionWizardContext.ts │ │ ├── createFunction.ts │ │ ├── dotnetSteps │ │ │ ├── DotnetFunctionCreateStep.ts │ │ │ ├── DotnetFunctionNameStep.ts │ │ │ ├── DotnetNamespaceStep.ts │ │ │ └── IDotnetFunctionWizardContext.ts │ │ ├── durableSteps │ │ │ ├── DurableProjectConfigureStep.ts │ │ │ └── DurableStorageTypePromptStep.ts │ │ ├── javaSteps │ │ │ ├── IJavaFunctionWizardContext.ts │ │ │ ├── JavaFunctionCreateStep.ts │ │ │ └── JavaFunctionNameStep.ts │ │ ├── openAPISteps │ │ │ ├── OpenAPICreateStep.ts │ │ │ └── OpenAPIGetSpecificationFileStep.ts │ │ ├── promptStepsV2 │ │ │ ├── BooleanInputStep.ts │ │ │ ├── EnumInputStep.ts │ │ │ ├── ExistingFileStep.ts │ │ │ ├── NewFileStep.ts │ │ │ ├── PromptSchemaStepBase.ts │ │ │ ├── QuickPickInputStep.ts │ │ │ ├── StringInputStep.ts │ │ │ └── promptStepFactory.ts │ │ └── scriptSteps │ │ │ ├── IPythonFunctionWizardContext.ts │ │ │ ├── IScriptFunctionWizardContext.ts │ │ │ ├── NodeV4FunctionCreateStep.ts │ │ │ ├── NodeV4FunctionNameStep.ts │ │ │ ├── ScriptFunctionCreateStep.ts │ │ │ ├── ScriptFunctionNameStep.ts │ │ │ └── TypeScriptFunctionCreateStep.ts │ ├── createFunctionApp │ │ ├── AuthenticationPromptStep.ts │ │ ├── FunctionAppCreateStep.ts │ │ ├── FunctionAppHostingPlanStep.ts │ │ ├── IFunctionAppWizardContext.ts │ │ ├── UniqueNamePromptStep.ts │ │ ├── containerImage │ │ │ ├── ContainerizedFunctionAppCreateStep.ts │ │ │ ├── DeployWorkspaceProjectStep.ts │ │ │ └── detectDockerfile.ts │ │ ├── createCreateFunctionAppComponents.ts │ │ ├── createFunctionApp.ts │ │ ├── flex │ │ │ ├── InstanceMemoryMBPromptStep.ts │ │ │ └── MaximumInstanceCountPromptStep.ts │ │ └── stacks │ │ │ ├── FunctionAppEOLWarningStep.ts │ │ │ ├── FunctionAppStackStep.ts │ │ │ ├── backupStacks.ts │ │ │ ├── getStackPicks.ts │ │ │ └── models │ │ │ ├── AppStackModel.ts │ │ │ ├── FlexSkuModel.ts │ │ │ └── FunctionAppStackModel.ts │ ├── createNewProject │ │ ├── FolderListStep.ts │ │ ├── IProjectWizardContext.ts │ │ ├── NewProjectLanguageStep.ts │ │ ├── OpenBehaviorStep.ts │ │ ├── OpenFolderStep.ts │ │ ├── ProgrammingModelStep.ts │ │ ├── ProjectCreateStep │ │ │ ├── BallerinaProjectCreateStep.ts │ │ │ ├── CustomProjectCreateStep.ts │ │ │ ├── DotnetProjectCreateStep.ts │ │ │ ├── GradleProjectCreateSteps.ts │ │ │ ├── JavaScriptProjectCreateStep.ts │ │ │ ├── MavenProjectCreateSteps.ts │ │ │ ├── PowerShellProjectCreateStep.ts │ │ │ ├── ProjectCreateStepBase.ts │ │ │ ├── PythonProjectCreateStep.ts │ │ │ ├── ScriptProjectCreateStep.ts │ │ │ └── TypeScriptProjectCreateStep.ts │ │ ├── ballerinaSteps │ │ │ ├── BallerinaBackendStep.ts │ │ │ ├── IBallerinaProjectWizardContext.ts │ │ │ └── addBallerinaCreateProjectSteps.ts │ │ ├── createNewProject.ts │ │ ├── dockerfileSteps │ │ │ └── CreateDockerfileProjectStep.ts │ │ ├── dotnetSteps │ │ │ └── DotnetRuntimeStep.ts │ │ ├── javaSteps │ │ │ ├── IJavaProjectWizardContext.ts │ │ │ ├── JavaAppNameStep.ts │ │ │ ├── JavaArtifactIdStep.ts │ │ │ ├── JavaBuildToolStep.ts │ │ │ ├── JavaGroupIdStep.ts │ │ │ ├── JavaPackageNameStep.ts │ │ │ ├── JavaProjectVersionStep.ts │ │ │ ├── JavaVersionStep.ts │ │ │ ├── JavaVersions.ts │ │ │ └── addJavaCreateProjectSteps.ts │ │ ├── pythonSteps │ │ │ ├── EnterPythonAliasStep.ts │ │ │ ├── IPythonVenvWizardContext.ts │ │ │ ├── PythonAliasListStep.ts │ │ │ ├── PythonVenvCreateStep.ts │ │ │ └── pythonVersion.ts │ │ └── verifyIsProject.ts │ ├── createSlot.ts │ ├── deleteContainerizedFunctionApp │ │ ├── DeleteContainerizedFunctionAppStep.ts │ │ └── DeleteFunctionAppWizardContext.ts │ ├── deleteFunction.ts │ ├── deleteFunctionApp.ts │ ├── deleteNode.ts │ ├── deploy │ │ ├── DeployFunctionCoreToolsStep.ts │ │ ├── FunctionAppListStep.ts │ │ ├── deploy.ts │ │ ├── getOrCreateFunctionApp.ts │ │ ├── getWarningForExtensionBundle.ts │ │ ├── getWarningsForConnectionSettings.ts │ │ ├── notifyDeployComplete.ts │ │ ├── promptForEventGrid.ts │ │ ├── runPreDeployTask.ts │ │ ├── showCoreToolsWarning.ts │ │ ├── validateRemoteBuild.ts │ │ └── verifyAppSettings.ts │ ├── deployments │ │ ├── connectToGitHub.ts │ │ ├── disconnectRepo.ts │ │ ├── redeployDeployment.ts │ │ ├── viewCommitInGitHub.ts │ │ └── viewDeploymentLogs.ts │ ├── durableTaskScheduler │ │ ├── copyEmulatorConnectionString.ts │ │ ├── copySchedulerConnectionString.ts │ │ ├── copySchedulerEndpoint.ts │ │ ├── createScheduler.ts │ │ ├── createTaskHub.ts │ │ ├── deleteScheduler.ts │ │ ├── deleteTaskHub.ts │ │ ├── openTaskHubDashboard.ts │ │ ├── startEmulator.ts │ │ └── stopEmulator.ts │ ├── editAppSetting.ts │ ├── executeFunction │ │ ├── eventGrid │ │ │ ├── EventGridCodeLensProvider.ts │ │ │ ├── EventGridExecuteFunctionContext.ts │ │ │ ├── EventGridFileOpenStep.ts │ │ │ ├── EventGridSourceStep.ts │ │ │ ├── EventGridTypeStep.ts │ │ │ ├── eventGridSources.ts │ │ │ ├── executeEventGridFunction.ts │ │ │ └── sendEventGridRequest.ts │ │ └── executeFunction.ts │ ├── identity │ │ ├── EnableSystemIdentityStep.ts │ │ ├── FunctionAppUserAssignedIdentitiesListStep.ts │ │ ├── ManagedIdentityAssignContext.ts │ │ ├── ManagedIdentityAssignStep.ts │ │ ├── ManagedIdentityUnassignStep.ts │ │ ├── assignManagedIdentity.ts │ │ ├── enableSystemIdentity.ts │ │ └── unassignManagedIdentity.ts │ ├── initProjectForVSCode │ │ ├── InitVSCodeLanguageStep.ts │ │ ├── InitVSCodeStep │ │ │ ├── BallerinaInitVSCodeStep.ts │ │ │ ├── DotnetInitVSCodeStep.ts │ │ │ ├── DotnetScriptInitVSCodeStep.ts │ │ │ ├── InitVSCodeStepBase.ts │ │ │ ├── JavaInitVSCodeStep.ts │ │ │ ├── JavaScriptInitVSCodeStep.ts │ │ │ ├── PowerShellInitVSCodeStep.ts │ │ │ ├── PythonInitVSCodeStep.ts │ │ │ ├── ScriptInitVSCodeStep.ts │ │ │ └── TypeScriptInitVSCodeStep.ts │ │ ├── detectProjectLanguage.ts │ │ ├── initProjectForVSCode.ts │ │ ├── javaSteps │ │ │ └── addJavaInitVSCodeSteps.ts │ │ └── pythonSteps │ │ │ ├── PythonVenvListStep.ts │ │ │ └── addPythonInitVSCodeSteps.ts │ ├── logstream │ │ ├── enableFileLogging.ts │ │ ├── startStreamingLogs.ts │ │ └── stopStreamingLogs.ts │ ├── openFile.ts │ ├── openInPortal.ts │ ├── pickFuncProcess.ts │ ├── registerCommands.ts │ ├── remoteDebug │ │ ├── getRemoteDebugLanguage.ts │ │ └── startRemoteDebug.ts │ ├── remoteDebugJava │ │ ├── DebugProxy.ts │ │ └── remoteDebugJavaFunctionApp.ts │ ├── renameAppSetting.ts │ ├── restartFunctionApp.ts │ ├── startFunctionApp.ts │ ├── stopFunctionApp.ts │ ├── swapSlot.ts │ ├── updateDisabledState.ts │ └── viewProperties.ts ├── constants-nls.ts ├── constants.ts ├── debug │ ├── BallerinaDebugProvider.ts │ ├── FuncDebugProviderBase.ts │ ├── FuncTaskProvider.ts │ ├── JavaDebugProvider.ts │ ├── NodeDebugProvider.ts │ ├── PowerShellDebugProvider.ts │ ├── PythonDebugProvider.ts │ ├── PythonExtension.api.d.ts │ ├── storageProviders │ │ ├── validateDTSConnectionPreDebug.ts │ │ ├── validateNetheriteConnectionPreDebug.ts │ │ ├── validateSQLConnectionPreDebug.ts │ │ └── validateStorageConnectionPreDebug.ts │ └── validatePreDebug.ts ├── downloadAzureProject │ ├── handleUri.ts │ └── setupProjectFolder.ts ├── errors.ts ├── extension.ts ├── extensionVariables.ts ├── funcConfig │ ├── README.md │ ├── function.ts │ ├── host.ts │ └── local.settings.ts ├── funcCoreTools │ ├── funcHostTask.ts │ ├── generateLinuxErrorMessages.ts │ ├── getBrewPackageName.ts │ ├── getFuncCliPath.ts │ ├── getFuncPackageManagers.ts │ ├── getLocalFuncCoreToolsVersion.ts │ ├── getNpmDistTag.ts │ ├── hasMinFuncCliVersion.ts │ ├── installFuncCoreTools.ts │ ├── installOrUpdateFuncCoreTools.ts │ ├── tryGetLocalFuncVersion.ts │ ├── uninstallFuncCoreTools.ts │ ├── updateFuncCoreTools.ts │ ├── validateFuncCoreToolsInstalled.ts │ └── validateFuncCoreToolsIsLatest.ts ├── getExtensionApi.ts ├── localize.ts ├── templates │ ├── CentralTemplateProvider.ts │ ├── FunctionV2Template.ts │ ├── IBindingTemplate.ts │ ├── IFunctionTemplate.ts │ ├── ITemplates.ts │ ├── README.md │ ├── TemplateProviderBase.ts │ ├── ballerina │ │ ├── BallerinaTemplateProvider.ts │ │ └── getBallerinaVerifiedTemplateIds.ts │ ├── dotnet │ │ ├── DotnetTemplateProvider.ts │ │ ├── executeDotnetTemplateCommand.ts │ │ ├── getDotnetVerifiedTemplateIds.ts │ │ └── parseDotnetTemplates.ts │ ├── java │ │ ├── JavaTemplateProvider.ts │ │ └── getJavaVerifiedTemplateIds.ts │ └── script │ │ ├── NodeV4Provider.ts │ │ ├── PysteinTemplateProvider.ts │ │ ├── ScriptBundleTemplateProvider.ts │ │ ├── ScriptTemplateProvider.ts │ │ ├── getScriptResourcesLanguage.ts │ │ ├── getScriptVerifiedTemplateIds.ts │ │ ├── parseScriptTemplates.ts │ │ └── parseScriptTemplatesV2.ts ├── tree │ ├── AzureAccountTreeItemWithProjects.ts │ ├── FunctionBase.ts │ ├── FunctionTreeItemBase.ts │ ├── FunctionsTreeItemBase.ts │ ├── IProjectTreeItem.ts │ ├── ResolvedFunctionAppBase.ts │ ├── ResolvedFunctionAppResource.ts │ ├── SlotContainerTreeItemBase.ts │ ├── SlotTreeItem.ts │ ├── SlotsTreeItem.ts │ ├── SubscriptionTreeItem.ts │ ├── containerizedFunctionApp │ │ ├── AppSettingsClient.ts │ │ ├── ContainerFunctionItem.ts │ │ ├── ContainerFunctionTreeItem.ts │ │ ├── ContainerFunctionsTreeItem.ts │ │ ├── ContainerTreeItem.ts │ │ ├── ImageTreeItem.ts │ │ └── ResolvedContainerizedFunctionAppResource.ts │ ├── durableTaskScheduler │ │ ├── ContainerClient.ts │ │ ├── DurableTaskHubResourceModel.ts │ │ ├── DurableTaskSchedulerClient.ts │ │ ├── DurableTaskSchedulerDashboardModel.ts │ │ ├── DurableTaskSchedulerDataBranchProvider.ts │ │ ├── DurableTaskSchedulerEmulatorClient.ts │ │ ├── DurableTaskSchedulerEmulatorWorkspaceResourceModel.ts │ │ ├── DurableTaskSchedulerEmulatorsWorkspaceResource.ts │ │ ├── DurableTaskSchedulerEmulatorsWorkspaceResourceModel.ts │ │ ├── DurableTaskSchedulerEndpointModel.ts │ │ ├── DurableTaskSchedulerErrorWorkspaceResourceModel.ts │ │ ├── DurableTaskSchedulerModel.ts │ │ ├── DurableTaskSchedulerResourceModel.ts │ │ ├── DurableTaskSchedulerTaskHubWorkspaceResourceModel.ts │ │ ├── DurableTaskSchedulerWorkspaceDataBranchProvider.ts │ │ ├── DurableTaskSchedulerWorkspaceResourceModel.ts │ │ └── DurableTaskSchedulerWorkspaceResourceProvider.ts │ ├── localProject │ │ ├── InitLocalProjectTreeItem.ts │ │ ├── InvalidLocalProjectTreeItem.ts │ │ ├── LocalFunctionTreeItem.ts │ │ ├── LocalFunctionsTreeItem.ts │ │ ├── LocalProjectTreeItem.ts │ │ ├── LocalProjectTreeItemBase.ts │ │ └── createRefreshFileWatcher.ts │ ├── projectContextValues.ts │ └── remoteProject │ │ ├── ManagedIdentityTreeItem.ts │ │ ├── RemoteFunction.ts │ │ ├── RemoteFunctionTreeItem.ts │ │ ├── RemoteFunctionsTreeItem.ts │ │ ├── SystemIdentityTreeItemBase.ts │ │ ├── UserAssignedIdentitiesTreeItem.ts │ │ └── UserAssignedIdentityTreeItem.ts ├── utils │ ├── AzureActivity.ts │ ├── activityUtils.ts │ ├── azure.ts │ ├── azureClients.ts │ ├── ballerinaUtils.ts │ ├── bundleFeedUtils.ts │ ├── cancellation.ts │ ├── cliFeedUtils.ts │ ├── cpUtils.ts │ ├── delay.ts │ ├── dotnetUtils.ts │ ├── durableUtils.ts │ ├── envUtils.ts │ ├── feedUtils.ts │ ├── fs.ts │ ├── getCoreNodeModule.ts │ ├── gitUtils.ts │ ├── gradleUtils.ts │ ├── javaUtils.ts │ ├── managedIdentityUtils.ts │ ├── mavenUtils.ts │ ├── nodeJsUtils.ts │ ├── nonNull.ts │ ├── nugetUtils.ts │ ├── openUrl.ts │ ├── parseJson.ts │ ├── pickAppResource.ts │ ├── pickFunctionApp.ts │ ├── programmingModelUtils.ts │ ├── pythonUtils.ts │ ├── requestUtils.ts │ ├── taskUtils.ts │ ├── telemetryUtils.ts │ ├── templateVersionUtils.ts │ ├── textUtils.ts │ ├── treeUtils.ts │ ├── validateUtils.ts │ ├── venvUtils.ts │ ├── verifyExtensionBundle.ts │ ├── windowsProcessTree.ts │ └── workspace.ts ├── vsCodeConfig │ ├── README.md │ ├── extensions.ts │ ├── launch.ts │ ├── promptToReinitializeProject.ts │ ├── settings.ts │ ├── tasks.ts │ ├── verifyInitForVSCode.ts │ ├── verifyPythonVenv.ts │ ├── verifyTargetFramework.ts │ └── verifyVSCodeConfigOnActivate.ts ├── vscode-azurecontainerapps.api.d.ts ├── vscode-azurefunctions.api.d.ts └── workspace │ ├── LocalFunction.ts │ ├── LocalProject.ts │ ├── listLocalFunctions.ts │ └── listLocalProjects.ts ├── test ├── .eslintrc.js ├── ParsedFunctionJson.test.ts ├── addParallelSuite.ts ├── api.test.ts ├── assertThrowsAsync.ts ├── convertToValidPackageName.test.ts ├── createFunction │ ├── FunctionTesterBase.ts │ ├── createFunction.Ballerina.ts │ ├── createFunction.CSharp.test.ts │ ├── createFunction.JavaScript.v1.test.ts │ └── createFunction.Script.v2.test.ts ├── envUtils.test.ts ├── fsUtils.test.ts ├── getScriptResourcesLanguage.test.ts ├── global.test.ts ├── hasMinFuncCliVersion.test.ts ├── index.ts ├── nightly │ ├── createProjectAndDeploy.test.ts │ ├── functionAppOperations.test.ts │ ├── getRotatingValue.ts │ └── global.nightly.test.ts ├── nugetUtils.test.ts ├── parseJson.test.ts ├── project │ ├── createAndValidateProject.ts │ ├── createNewProject.test.ts │ ├── createNewPythonProject.test.ts │ ├── initProjectForVSCode.test.ts │ └── validateProject.ts ├── runTest.ts ├── runWithSetting.ts ├── templateCount.test.ts ├── test.code-workspace ├── tryParseFuncVersion.test.ts ├── updateBackupTemplates.ts ├── utils │ └── javaUtils.ts ├── validateCSharpNamespace.test.ts ├── venvUtils.test.ts └── verifyVersionAndLanguage.test.ts ├── tools └── JsonCli │ ├── .azure-pipelines │ ├── 1esmain.yml │ └── main.yml │ ├── .vscode │ ├── extensions.json │ ├── launch.json │ ├── settings.json │ └── tasks.json │ ├── README.md │ ├── resources │ └── FinalPublicKey.snk │ └── src │ ├── CommandLineParser.cs │ ├── Installer.cs │ ├── Microsoft.TemplateEngine.JsonCli.csproj │ ├── Models │ └── Models.cs │ ├── Package.cs │ ├── Program.cs │ ├── Signing.csproj │ ├── nuget.config │ └── src.sln ├── tsconfig.json ├── vscode.proposed.authLearnMore.d.ts ├── vscode.proposed.authenticationChallenges.d.ts └── webpack.config.js /.azure-pipelines/SignExtension.signproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 9 | 10 | 11 | VSCodePublisher 12 | 13 | 14 | 15 | 16 | 17 | runtime; build; native; contentfiles; analyzers; buildtransitive 18 | all 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /.azure-pipelines/common/build.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: NodeTool@0 3 | displayName: 'Use Node' 4 | inputs: 5 | versionSource: fromFile 6 | versionFilePath: .nvmrc 7 | 8 | - task: Npm@1 9 | displayName: 'npm ci' 10 | inputs: 11 | command: ci 12 | 13 | - task: Npm@1 14 | displayName: 'Build' 15 | inputs: 16 | command: custom 17 | customCommand: run build 18 | -------------------------------------------------------------------------------- /.azure-pipelines/common/lint.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: Npm@1 3 | displayName: 'Lint' 4 | inputs: 5 | command: custom 6 | customCommand: run lint 7 | 8 | - task: ComponentGovernanceComponentDetection@0 9 | displayName: 'Component Detection' 10 | condition: ne(variables['System.PullRequest.IsFork'], 'True') 11 | -------------------------------------------------------------------------------- /.azure-pipelines/common/package.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: Npm@1 3 | displayName: 'cleanReadme' 4 | inputs: 5 | command: custom 6 | customCommand: run cleanReadme 7 | 8 | - task: Npm@1 9 | displayName: 'Package' 10 | inputs: 11 | command: custom 12 | customCommand: run package 13 | 14 | - task: CopyFiles@2 15 | displayName: 'Copy vsix to staging directory' 16 | inputs: 17 | Contents: '**/*.vsix' 18 | TargetFolder: '$(build.artifactstagingdirectory)' 19 | 20 | - task: PublishBuildArtifacts@1 21 | displayName: 'Publish artifacts: vsix' 22 | inputs: 23 | PathtoPublish: '$(build.artifactstagingdirectory)' 24 | ArtifactName: vsix 25 | # Only publish vsix from linux build since we use this to release and want to stay consistent 26 | condition: and(eq(variables['Agent.OS'], 'Linux'), ne(variables['System.PullRequest.IsFork'], 'True')) 27 | -------------------------------------------------------------------------------- /.azure-pipelines/common/sbom.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 3 | displayName: "SBoM Generation Task" 4 | inputs: 5 | BuildDropPath: "$(Build.ArtifactStagingDirectory)" 6 | condition: ne(variables['System.PullRequest.IsFork'], 'True') 7 | 8 | - task: PublishBuildArtifacts@1 9 | displayName: "Publish artifacts: sbom" 10 | inputs: 11 | PathtoPublish: "$(Build.ArtifactStagingDirectory)/_manifest" 12 | ArtifactName: _manifest 13 | condition: ne(variables['System.PullRequest.IsFork'], 'True') 14 | -------------------------------------------------------------------------------- /.azure-pipelines/compliance/CredScanSuppressions.json: -------------------------------------------------------------------------------- 1 | { 2 | "tool": "Credential Scanner", 3 | "suppressions": [ 4 | { 5 | "hash": "hyUQad0BbWEvyeHXVCMsYvGIRuQBIpJOaWLtDacGhZI=", 6 | "_justification": "This is a false positive" 7 | }, 8 | { 9 | "hash": "LHAa+3RRy0CJ+V2y9g8jHCBcn6KglfpSovPRZAjea0I=", 10 | "_justification": "This is a false positive" 11 | }, 12 | { 13 | "hash": "MLu73wzE/Z2ueMqbNMnRman8BgXOcNKO2nO50WY4C8U=", 14 | "_justification": "This is a false positive" 15 | }, 16 | { 17 | "hash": "f5OEvErpkTa9NH7vzpAEBelEWfIeyYOZFoMHOc9yKWc=", 18 | "_justification": "This is a false positive" 19 | }, 20 | { 21 | "folder": "/resources/backupTemplates", 22 | "_justification": "folder to be suppressed because the templates contain lots of fake passwords and secrets" 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /.azure-pipelines/compliance/PoliCheckExclusions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | NODE_MODULES|BACKUPTEMPLATES|DIST 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.azure-pipelines/compliance/tsaoptions.json: -------------------------------------------------------------------------------- 1 | { 2 | "tsaVersion": "TsaV2", 3 | "codeBase": "NewOrUpdate", 4 | "codeBaseName": "vscode-azurefunctions", 5 | "tsaStamp": "DevDiv", 6 | "notificationAliases": [ 7 | "AzCode@microsoft.com" 8 | ], 9 | "codebaseAdmins": [ 10 | "REDMOND\\jinglou", 11 | "REDMOND\\AzCode" 12 | ], 13 | "instanceUrl": "https://devdiv.visualstudio.com", 14 | "projectName": "DevDiv", 15 | "areaPath": "DevDiv\\VS Azure Tools\\AzCode Extensions", 16 | "iterationPath": "DevDiv", 17 | "allTools": true 18 | } 19 | -------------------------------------------------------------------------------- /.azure-pipelines/linux/xvfb.init: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # COPIED FROM https://github.com/microsoft/vscode/blob/01e9903967417ba243cec705445eef9ecbfebfea/build/azure-pipelines/linux/xvfb.init 4 | # 5 | # 6 | # /etc/rc.d/init.d/xvfbd 7 | # 8 | # chkconfig: 345 95 28 9 | # description: Starts/Stops X Virtual Framebuffer server 10 | # processname: Xvfb 11 | # 12 | ### BEGIN INIT INFO 13 | # Provides: xvfb 14 | # Required-Start: $remote_fs $syslog 15 | # Required-Stop: $remote_fs $syslog 16 | # Default-Start: 2 3 4 5 17 | # Default-Stop: 0 1 6 18 | # Short-Description: Start xvfb at boot time 19 | # Description: Enable xvfb provided by daemon. 20 | ### END INIT INFO 21 | 22 | [ "${NETWORKING}" = "no" ] && exit 0 23 | 24 | PROG="/usr/bin/Xvfb" 25 | PROG_OPTIONS=":10 -ac -screen 0 1024x768x24" 26 | PROG_OUTPUT="/tmp/Xvfb.out" 27 | 28 | case "$1" in 29 | start) 30 | echo "Starting : X Virtual Frame Buffer " 31 | $PROG $PROG_OPTIONS>>$PROG_OUTPUT 2>&1 & 32 | disown -ar 33 | ;; 34 | stop) 35 | echo "Shutting down : X Virtual Frame Buffer" 36 | killproc $PROG 37 | RETVAL=$? 38 | [ $RETVAL -eq 0 ] && /bin/rm -f /var/lock/subsys/Xvfb 39 | /var/run/Xvfb.pid 40 | echo 41 | ;; 42 | restart|reload) 43 | $0 stop 44 | $0 start 45 | RETVAL=$? 46 | ;; 47 | status) 48 | status Xvfb 49 | RETVAL=$? 50 | ;; 51 | *) 52 | echo $"Usage: $0 (start|stop|restart|reload|status)" 53 | exit 1 54 | esac 55 | 56 | exit $RETVAL 57 | -------------------------------------------------------------------------------- /.azure-pipelines/main.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | ${{ if eq(variables['Build.Reason'], 'Schedule') }}: 3 | ENABLE_LONG_RUNNING_TESTS: false 4 | ENABLE_COMPLIANCE: true 5 | 6 | jobs: 7 | - job: Windows 8 | pool: 9 | vmImage: windows-latest 10 | steps: 11 | - template: common/build.yml 12 | - template: common/package.yml 13 | - template: common/lint.yml 14 | - template: compliance/compliance.yml # Only works on Windows 15 | - template: common/test.yml 16 | 17 | - job: Linux 18 | pool: 19 | vmImage: ubuntu-latest 20 | steps: 21 | - template: common/build.yml 22 | - template: common/package.yml 23 | - template: common/sbom.yml # Only generate on linux 24 | - template: common/lint.yml 25 | - template: common/test.yml 26 | variables: 27 | Codeql.Enabled: $[in(variables['Build.Reason'], 'Schedule')] # Enable CodeQL only on scheduled builds because it is slow 28 | 29 | - job: macOS 30 | pool: 31 | vmImage: macOS-latest 32 | steps: 33 | - template: common/build.yml 34 | - template: common/package.yml 35 | - template: common/lint.yml 36 | - template: common/test.yml 37 | 38 | trigger: none # disable pipeline 39 | 40 | # trigger: 41 | # branches: 42 | # include: 43 | # - '*' 44 | 45 | # pr: 46 | # branches: 47 | # include: 48 | # - '*' 49 | 50 | # schedules: 51 | # - cron: "30 7 * * *" 52 | # displayName: Nightly at 12:30 PT 53 | # always: true # Run even when there are no code changes 54 | # branches: 55 | # include: 56 | # - main 57 | -------------------------------------------------------------------------------- /.azure-pipelines/release.yml: -------------------------------------------------------------------------------- 1 | trigger: none # Only run this pipeline when manually triggered 2 | 3 | parameters: 4 | - name: publishVersion 5 | displayName: Version to publish 6 | type: string 7 | - name: dryRun 8 | displayName: Dry run 9 | type: boolean 10 | default: false 11 | 12 | resources: 13 | pipelines: 14 | - pipeline: build # identifier to use in pipeline resource variables 15 | source: \Azure Tools\VSCode\Extensions\vscode-azurefunctions # name of the pipeline that produces the artifacts 16 | repositories: 17 | - repository: azExtTemplates 18 | type: github 19 | name: microsoft/vscode-azuretools 20 | ref: main 21 | endpoint: GitHub-AzureTools # The service connection to use when accessing this repository 22 | 23 | variables: 24 | # Required by MicroBuild template 25 | - name: TeamName 26 | value: "Azure Tools for VS Code" 27 | 28 | # Use those templates 29 | extends: 30 | template: azure-pipelines/release-extension.yml@azExtTemplates 31 | parameters: 32 | pipelineID: $(resources.pipeline.build.pipelineID) 33 | runID: $(resources.pipeline.build.runID) 34 | publishVersion: ${{ parameters.publishVersion }} 35 | dryRun: ${{ parameters.dryRun }} 36 | environmentName: AzCodeDeploy 37 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | gulpfile.ts 2 | .eslintrc.js 3 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "extends": "@microsoft/eslint-config-azuretools" 3 | }; 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | NOTICE.html linguist-vendored=true 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @Microsoft/vscodeazuretoolsdev 2 | -------------------------------------------------------------------------------- /.github/copilot-instructions.md: -------------------------------------------------------------------------------- 1 | # Coding Instructions for GitHub Copilot 2 | 3 | - Never commit or suggest changes to `main.js`. 4 | -------------------------------------------------------------------------------- /.github/workflows/bump-version-pr.yaml: -------------------------------------------------------------------------------- 1 | name: Bump version after release 2 | 3 | # Run when release is published, or manually triggered 4 | on: 5 | release: 6 | types: [published] 7 | workflow_dispatch: 8 | 9 | jobs: 10 | bump: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | 15 | - name: Bump version 16 | id: bump 17 | uses: alexweininger/bump-prerelease-version@v0.1.1 18 | 19 | - name: Create pull request 20 | uses: peter-evans/create-pull-request@v4 21 | with: 22 | title: ${{ env.MESSAGE }} 23 | body: Automatically created by ${{ env.RUN_LINK }} 24 | commit-message: ${{ env.MESSAGE }} 25 | branch: bot/bump-${{ steps.bump.outputs.new-version }} 26 | base: main 27 | author: GitHub 28 | token: ${{ secrets.PAT_GITHUB }} 29 | env: 30 | RUN_LINK: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} 31 | MESSAGE: Bump version after release 32 | -------------------------------------------------------------------------------- /.github/workflows/info-needed-closer.yml: -------------------------------------------------------------------------------- 1 | name: Info Needed Closer 2 | on: 3 | schedule: 4 | - cron: 30 5 * * * # 10:30pm PT 5 | workflow_dispatch: 6 | 7 | jobs: 8 | main: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout Actions 12 | uses: actions/checkout@v2 13 | with: 14 | repository: "microsoft/vscode-github-triage-actions" 15 | path: ./actions 16 | ref: stable 17 | - name: Install Actions 18 | run: npm install --production --prefix ./actions 19 | - name: Run Info Needed Closer 20 | uses: ./actions/needs-more-info-closer 21 | with: 22 | app_id: ${{ secrets.AZURETOOLS_VSCODE_BOT_APP_ID }} 23 | app_installation_id: ${{ secrets.AZURETOOLS_VSCODE_BOT_APP_INSTALLATION_ID }} 24 | app_private_key: ${{ secrets.AZURETOOLS_VSCODE_BOT_APP_PRIVATE_KEY }} 25 | label: info-needed 26 | closeDays: 14 27 | closeComment: "This issue has been closed automatically because it needs more information and has not had recent activity. See also our [issue reporting](https://aka.ms/azcodeissuereporting) guidelines.\n\nHappy Coding!" 28 | pingDays: 80 29 | pingComment: "Hey @${assignee}, this issue might need further attention.\n\n@${author}, you can help us out by closing this issue if the problem no longer exists, or adding more information." 30 | -------------------------------------------------------------------------------- /.github/workflows/locker.yml: -------------------------------------------------------------------------------- 1 | name: Locker 2 | on: 3 | schedule: 4 | - cron: 0 5 * * * # 10:00pm PT 5 | workflow_dispatch: 6 | 7 | jobs: 8 | main: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout Actions 12 | uses: actions/checkout@v2 13 | with: 14 | repository: "microsoft/vscode-github-triage-actions" 15 | path: ./actions 16 | ref: stable 17 | - name: Install Actions 18 | run: npm install --production --prefix ./actions 19 | - name: Run Locker 20 | uses: ./actions/locker 21 | with: 22 | app_id: ${{ secrets.AZURETOOLS_VSCODE_BOT_APP_ID }} 23 | app_installation_id: ${{ secrets.AZURETOOLS_VSCODE_BOT_APP_INSTALLATION_ID }} 24 | app_private_key: ${{ secrets.AZURETOOLS_VSCODE_BOT_APP_PRIVATE_KEY }} 25 | daysSinceClose: 45 26 | daysSinceUpdate: 7 27 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Node PR Lint, Build and Test 2 | 3 | on: 4 | # Trigger when manually run 5 | workflow_dispatch: 6 | 7 | # Trigger on pushes to `main` or `rel/*` 8 | push: 9 | branches: 10 | - main 11 | - rel/* 12 | 13 | # Trigger on pull requests to `main` or `rel/*` 14 | pull_request: 15 | branches: 16 | - main 17 | - rel/* 18 | 19 | jobs: 20 | Build: 21 | # Use template from https://github.com/microsoft/vscode-azuretools/tree/main/.github/workflows 22 | uses: microsoft/vscode-azuretools/.github/workflows/jobs.yml@main 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # Output 61 | out 62 | bin 63 | obj 64 | *.vsix 65 | .vscode-test 66 | testWorkspace 67 | test-results.xml 68 | dist 69 | stats.json 70 | 71 | # debugging artifacts 72 | resources/backupTemplates/dotnet/**/cache/ 73 | 74 | # macOS related extra files 75 | .DS_Store 76 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx vscode-sort-package-json 5 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 20.18.1 2 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "dbaeumer.vscode-eslint", 4 | "ms-vscode.azure-account", 5 | "ms-azuretools.vscode-azureresourcegroups" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.codeActionsOnSave": { 3 | "source.fixAll.eslint": "explicit", 4 | "source.organizeImports": "explicit" 5 | }, 6 | "editor.detectIndentation": false, 7 | "editor.formatOnSave": true, 8 | "editor.insertSpaces": true, 9 | "editor.tabSize": 4, 10 | "files.exclude": { 11 | "tools/JsonCli/src/**": true 12 | }, 13 | "files.insertFinalNewline": true, 14 | "files.trimTrailingWhitespace": true, 15 | "search.exclude": { 16 | "out": true, 17 | "**/node_modules": true, 18 | ".vscode-test": true, 19 | "resources/backup*Templates": true 20 | }, 21 | "typescript.preferences.importModuleSpecifier": "relative", 22 | "typescript.tsdk": "node_modules/typescript/lib" 23 | } 24 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "npm", 6 | "script": "compile", 7 | "group": { 8 | "kind": "build", 9 | "isDefault": true 10 | }, 11 | "isBackground": true, 12 | "presentation": { 13 | "reveal": "never" 14 | }, 15 | "problemMatcher": "$tsc-watch" 16 | }, 17 | { 18 | "type": "npm", 19 | "script": "lint", 20 | "problemMatcher": "$eslint-stylish" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .azure-pipelines/** 2 | .eslintignore 3 | .eslintrc.js 4 | .github/** 5 | .gitignore 6 | .vscode-test/** 7 | .vscode/** 8 | *.tgz 9 | **/*.gif 10 | **/*.map 11 | **/*.ts 12 | build/** 13 | dist/test/** 14 | docs/** 15 | gulp* 16 | node_modules/** 17 | out/** 18 | resources/readme/** 19 | src/** 20 | stats.json 21 | test-results.xml 22 | test/** 23 | testWorkspace/** 24 | tools/** 25 | tsconfig.json 26 | typings/** 27 | webpack.config* 28 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | # Support 2 | 3 | ## How to file issues and get help 4 | 5 | This project uses GitHub Issues to track bugs and feature requests. Please see https://aka.ms/azCodeIssueReporting for our issue reporting guidelines. 6 | 7 | ## Microsoft Support Policy 8 | 9 | Support for this project is limited to the resources listed above. 10 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See LICENSE.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | "use strict"; 7 | 8 | // This is the extension entrypoint module, which imports extension.bundle.js, the actual extension code. 9 | // 10 | // This is in a separate file so we can properly measure extension.bundle.js load time. 11 | 12 | let perfStats = { 13 | loadStartTime: Date.now(), 14 | loadEndTime: undefined 15 | }; 16 | 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | 19 | const extension = require('./out/src/extension'); 20 | 21 | async function activate(ctx) { 22 | return await extension.activateInternal(ctx, perfStats, true /* ignoreBundle */); 23 | } 24 | 25 | async function deactivate(ctx) { 26 | return await extension.deactivateInternal(ctx, perfStats); 27 | } 28 | 29 | // Export as entrypoints for vscode 30 | exports.activate = activate; 31 | exports.deactivate = deactivate; 32 | 33 | perfStats.loadEndTime = Date.now(); 34 | -------------------------------------------------------------------------------- /resources/azFuncFunction.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /resources/azFuncProxy.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | 10 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /resources/azFuncSlot.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/azFuncSlots.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/azure-functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/azure-functions.png -------------------------------------------------------------------------------- /resources/azure-functions.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /resources/backupTemplates/Microsoft.Azure.Functions.ExtensionBundle/version.txt: -------------------------------------------------------------------------------- 1 | 4.17.0 -------------------------------------------------------------------------------- /resources/backupTemplates/ballerina/version.txt: -------------------------------------------------------------------------------- 1 | 1.0.0 2 | -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~1/net48/item.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~1/net48/item.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~1/net48/project.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~1/net48/project.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~1/version.txt: -------------------------------------------------------------------------------- 1 | 1.13.2 -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~2/netcoreapp2.1/item.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~2/netcoreapp2.1/item.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~2/netcoreapp2.1/project.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~2/netcoreapp2.1/project.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~2/version.txt: -------------------------------------------------------------------------------- 1 | 2.60.0 -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~3/net5.0-isolated/item.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~3/net5.0-isolated/item.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~3/net5.0-isolated/project.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~3/net5.0-isolated/project.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~3/netcoreapp3.1/item.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~3/netcoreapp3.1/item.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~3/netcoreapp3.1/project.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~3/netcoreapp3.1/project.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~3/version.txt: -------------------------------------------------------------------------------- 1 | 3.50.0 -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net5.0-isolated/item.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net5.0-isolated/item.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net5.0-isolated/project.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net5.0-isolated/project.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net6.0-isolated/item.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net6.0-isolated/item.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net6.0-isolated/project.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net6.0-isolated/project.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net6.0/item.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net6.0/item.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net6.0/project.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net6.0/project.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net7.0-isolated/item.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net7.0-isolated/item.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net7.0-isolated/project.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net7.0-isolated/project.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net8.0-isolated/item.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net8.0-isolated/item.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net8.0-isolated/project.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net8.0-isolated/project.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net9.0-isolated/item.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net9.0-isolated/item.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/net9.0-isolated/project.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/backupTemplates/dotnet/~4/net9.0-isolated/project.nupkg -------------------------------------------------------------------------------- /resources/backupTemplates/dotnet/~4/version.txt: -------------------------------------------------------------------------------- 1 | 4.104.0 -------------------------------------------------------------------------------- /resources/backupTemplates/java/~2/version.txt: -------------------------------------------------------------------------------- 1 | 1.35.0 -------------------------------------------------------------------------------- /resources/backupTemplates/java/~3/version.txt: -------------------------------------------------------------------------------- 1 | 1.35.0 -------------------------------------------------------------------------------- /resources/backupTemplates/java/~4/version.txt: -------------------------------------------------------------------------------- 1 | 1.36.0 -------------------------------------------------------------------------------- /resources/backupTemplates/nodejs-4.x/version.txt: -------------------------------------------------------------------------------- 1 | 1.0 -------------------------------------------------------------------------------- /resources/backupTemplates/pystein/version.txt: -------------------------------------------------------------------------------- 1 | 3.24.0 2 | -------------------------------------------------------------------------------- /resources/backupTemplates/script/~1/version.txt: -------------------------------------------------------------------------------- 1 | 1.13.2 -------------------------------------------------------------------------------- /resources/backupTemplates/script/~2/version.txt: -------------------------------------------------------------------------------- 1 | 2.60.0 -------------------------------------------------------------------------------- /resources/backupTemplates/script/~3/version.txt: -------------------------------------------------------------------------------- 1 | 3.50.0 -------------------------------------------------------------------------------- /resources/backupTemplates/script/~4/version.txt: -------------------------------------------------------------------------------- 1 | 4.104.0 -------------------------------------------------------------------------------- /resources/dark/AddFunction.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/dark/CreateNewProject.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.DotNet.Cli.CommandLine.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Microsoft.DotNet.Cli.CommandLine.dll -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.TemplateEngine.Abstractions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Microsoft.TemplateEngine.Abstractions.dll -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.TemplateEngine.Cli.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Microsoft.TemplateEngine.Cli.dll -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.TemplateEngine.Core.Contracts.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Microsoft.TemplateEngine.Core.Contracts.dll -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.TemplateEngine.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Microsoft.TemplateEngine.Core.dll -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.TemplateEngine.Edge.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Microsoft.TemplateEngine.Edge.dll -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.TemplateEngine.JsonCli.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Microsoft.TemplateEngine.JsonCli.dll -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.TemplateEngine.JsonCli.runtimeconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "tfm": "net6.0", 4 | "framework": { 5 | "name": "Microsoft.NETCore.App", 6 | "version": "6.0.0" 7 | }, 8 | "configProperties": { 9 | "System.Reflection.Metadata.MetadataUpdater.IsSupported": false 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.dll -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.TemplateEngine.Utils.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Microsoft.TemplateEngine.Utils.dll -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Microsoft.TemplateSearch.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Microsoft.TemplateSearch.Common.dll -------------------------------------------------------------------------------- /resources/dotnetJsonCli/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/dotnetJsonCli/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /resources/light/AddFunction.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/light/CreateNewProject.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/readme/copyFunctionUrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/copyFunctionUrl.png -------------------------------------------------------------------------------- /resources/readme/createFunction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/createFunction.png -------------------------------------------------------------------------------- /resources/readme/debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/debug.png -------------------------------------------------------------------------------- /resources/readme/debug3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/debug3.png -------------------------------------------------------------------------------- /resources/readme/deploy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/deploy.png -------------------------------------------------------------------------------- /resources/readme/deploy/activityLog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/deploy/activityLog.png -------------------------------------------------------------------------------- /resources/readme/deploy/copyFunctionUrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/deploy/copyFunctionUrl.png -------------------------------------------------------------------------------- /resources/readme/deploy/createComplete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/deploy/createComplete.png -------------------------------------------------------------------------------- /resources/readme/deploy/createFunctionApp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/deploy/createFunctionApp.png -------------------------------------------------------------------------------- /resources/readme/deploy/createResource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/deploy/createResource.png -------------------------------------------------------------------------------- /resources/readme/deploy/deploy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/deploy/deploy.png -------------------------------------------------------------------------------- /resources/readme/deploy2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/deploy2.png -------------------------------------------------------------------------------- /resources/readme/deploy3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/resources/readme/deploy3.png -------------------------------------------------------------------------------- /resources/walkthroughs/empty.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/walkthroughs/scenarios.md: -------------------------------------------------------------------------------- 1 | | If you want to... | Then... | 2 | |-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| 3 | | Build a web API | Implement an endpoint for your web applications using the [HTTP trigger](https://aka.ms/functions-getstarted-httptrigger) | 4 | | Run scheduled tasks | Execute code on [pre-defined time intervals](https://aka.ms/functions-getstarted-timertrigger) | 5 | | Build a serverless workflow | Create an event-driven workflow from a series of functions using [durable functions](https://aka.ms/functions-getstarted-durablefunctions) | 6 | | Process file uploads | Run code when a file is uploaded or changed in [blob storage](https://aka.ms/functions-getstarted-blobstorage) | 7 | | Respond to database changes | Run custom logic when a document is created or updated in [Azure Cosmos DB](https://aka.ms/functions-getstarted-cosmosdb) | 8 | -------------------------------------------------------------------------------- /src/commands/addBinding/BindingDirectionStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardPromptStep, type IAzureQuickPickItem } from '@microsoft/vscode-azext-utils'; 7 | import { localize } from '../../localize'; 8 | import { type IBindingWizardContext } from './IBindingWizardContext'; 9 | 10 | export class BindingDirectionStep extends AzureWizardPromptStep { 11 | public hideStepCount: boolean = true; 12 | 13 | public async prompt(context: IBindingWizardContext): Promise { 14 | const placeHolder: string = localize('selectDirection', 'Select binding direction'); 15 | const picks: IAzureQuickPickItem[] = [ 16 | { label: 'in', data: 'in' }, 17 | { label: 'out', data: 'out' } 18 | ]; 19 | context.bindingDirection = (await context.ui.showQuickPick(picks, { placeHolder })).data; 20 | } 21 | 22 | public shouldPrompt(context: IBindingWizardContext): boolean { 23 | return !context.bindingDirection; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/addBinding/IBindingWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type ProjectLanguage } from "../../constants"; 7 | import { type IFunctionBinding } from "../../funcConfig/function"; 8 | import { type FuncVersion } from "../../FuncVersion"; 9 | import { type IBindingTemplate } from "../../templates/IBindingTemplate"; 10 | import { type IFunctionWizardContext } from "../createFunction/IFunctionWizardContext"; 11 | 12 | export interface IBindingWizardContext extends IFunctionWizardContext { 13 | functionJsonPath: string; 14 | language: ProjectLanguage; 15 | version: FuncVersion; 16 | bindingDirection?: string; 17 | bindingTemplate?: IBindingTemplate; 18 | binding?: IFunctionBinding; 19 | bindingName?: string; 20 | useStorageEmulator?: boolean; 21 | } 22 | -------------------------------------------------------------------------------- /src/commands/addBinding/createBindingWizard.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizard } from "@microsoft/vscode-azext-utils"; 7 | import { localize } from "../../localize"; 8 | import { BindingCreateStep } from "./BindingCreateStep"; 9 | import { BindingDirectionStep } from "./BindingDirectionStep"; 10 | import { BindingListStep } from "./BindingListStep"; 11 | import { type IBindingWizardContext } from "./IBindingWizardContext"; 12 | 13 | export function createBindingWizard(wizardContext: IBindingWizardContext): AzureWizard { 14 | return new AzureWizard(wizardContext, { 15 | promptSteps: [new BindingDirectionStep(), new BindingListStep()], 16 | executeSteps: [new BindingCreateStep()], 17 | title: localize('addBinding', 'Add new binding') 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/BooleanPromptStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils"; 7 | import { type BindingSettingValue } from "../../../funcConfig/function"; 8 | import { type IBindingSetting } from "../../../templates/IBindingTemplate"; 9 | import { envUtils } from "../../../utils/envUtils"; 10 | import { type IBindingWizardContext } from "../IBindingWizardContext"; 11 | import { BindingSettingStepBase } from "./BindingSettingStepBase"; 12 | 13 | export class BooleanPromptStep extends BindingSettingStepBase { 14 | public async promptCore(context: IBindingWizardContext): Promise { 15 | let picks: IAzureQuickPickItem[] = [true, false].map(v => { return { label: String(v), data: v }; }); 16 | 17 | // Make sure the correct default value is at the top of the list 18 | if (!envUtils.isEnvironmentVariableSet(this._setting.defaultValue)) { 19 | picks = picks.reverse(); 20 | } 21 | 22 | return (await context.ui.showQuickPick(picks, { placeHolder: (this._setting as IBindingSetting).description || this._setting.label })).data; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/EnumPromptStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils"; 7 | import { type BindingSettingValue } from "../../../funcConfig/function"; 8 | import { type IBindingSetting } from "../../../templates/IBindingTemplate"; 9 | import { type IBindingWizardContext } from "../IBindingWizardContext"; 10 | import { BindingSettingStepBase } from "./BindingSettingStepBase"; 11 | 12 | export class EnumPromptStep extends BindingSettingStepBase { 13 | // not used by v2 schema so enforce IBindingSetting 14 | protected readonly _setting: IBindingSetting; 15 | 16 | public async promptCore(context: IBindingWizardContext): Promise { 17 | const picks: IAzureQuickPickItem[] = this._setting.enums.map(e => { return { data: e.value, label: e.displayName }; }); 18 | return (await context.ui.showQuickPick(picks, { placeHolder: this._setting.label })).data; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/LocalAppSettingNameStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type BindingSettingValue } from '../../../funcConfig/function'; 7 | import { localize } from '../../../localize'; 8 | import { type IBindingWizardContext } from '../IBindingWizardContext'; 9 | import { BindingSettingStepBase } from './BindingSettingStepBase'; 10 | 11 | export class LocalAppSettingNameStep extends BindingSettingStepBase { 12 | public async promptCore(context: IBindingWizardContext): Promise { 13 | const appSettingSuffix: string = `_${this._resourceType.toUpperCase()}`; 14 | return await context.ui.showInputBox({ 15 | placeHolder: localize('appSettingKeyPlaceholder', 'Local app setting key'), 16 | prompt: localize('appSettingKeyPrompt', 'Provide a key for a connection string'), 17 | value: `example${appSettingSuffix}` 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/LocalAppSettingValueStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardPromptStep } from '@microsoft/vscode-azext-utils'; 7 | import { localize } from '../../../localize'; 8 | import { type IBindingWizardContext } from '../IBindingWizardContext'; 9 | 10 | export class LocalAppSettingValueStep extends AzureWizardPromptStep { 11 | private readonly _key: string; 12 | 13 | public constructor(key: string) { 14 | super(); 15 | this._key = key; 16 | } 17 | 18 | public async prompt(context: IBindingWizardContext): Promise { 19 | context[this._key] = await context.ui.showInputBox({ 20 | placeHolder: localize('appSettingValuePlaceholder', 'App setting value'), 21 | prompt: localize('appSettingValuePrompt', 'Provide a connection string') 22 | }); 23 | } 24 | 25 | public shouldPrompt(context: IBindingWizardContext): boolean { 26 | return !context[this._key]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/StorageConnectionCreateStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IStorageAccountWizardContext } from '@microsoft/vscode-azext-azureutils'; 7 | import { getStorageConnectionString } from '../../appSettings/connectionSettings/azureWebJobsStorage/getStorageConnectionString'; 8 | import { type IFunctionWizardContext } from '../../createFunction/IFunctionWizardContext'; 9 | import { AzureConnectionCreateStepBase, type IConnection } from './AzureConnectionCreateStepBase'; 10 | 11 | export class StorageConnectionCreateStep extends AzureConnectionCreateStepBase { 12 | public async getConnection(context: IStorageAccountWizardContext & IFunctionWizardContext): Promise { 13 | return await getStorageConnectionString(context); 14 | } 15 | 16 | public shouldExecute(context: IStorageAccountWizardContext & IFunctionWizardContext): boolean { 17 | return !!context.storageAccount || !!context.useStorageEmulator; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/cosmosDB/CosmosDBListStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type CosmosDBManagementClient } from '@azure/arm-cosmosdb'; 7 | import { uiUtils } from '@microsoft/vscode-azext-azureutils'; 8 | import { AzureWizardPromptStep } from '@microsoft/vscode-azext-utils'; 9 | import { localize } from '../../../../localize'; 10 | import { promptForResource } from '../../../../utils/azure'; 11 | import { createCosmosDBClient } from '../../../../utils/azureClients'; 12 | import { type ICosmosDBWizardContext } from './ICosmosDBWizardContext'; 13 | 14 | export class CosmosDBListStep extends AzureWizardPromptStep { 15 | public async prompt(context: ICosmosDBWizardContext): Promise { 16 | const placeHolder: string = localize('placeHolder', 'Select a database account'); 17 | const client: CosmosDBManagementClient = await createCosmosDBClient(context); 18 | context.databaseAccount = await promptForResource(context, placeHolder, 19 | uiUtils.listAllIterator(client.databaseAccounts.list())); 20 | } 21 | 22 | public shouldPrompt(context: ICosmosDBWizardContext): boolean { 23 | return !context.databaseAccount; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/cosmosDB/ICosmosDBWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type DatabaseAccountGetResults } from '@azure/arm-cosmosdb'; 7 | import { type ISubscriptionActionContext } from '@microsoft/vscode-azext-utils'; 8 | 9 | export interface ICosmosDBWizardContext extends ISubscriptionActionContext { 10 | databaseAccount?: DatabaseAccountGetResults; 11 | } 12 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/eventHub/EventHubNameStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IBindingWizardContext } from '../../IBindingWizardContext'; 7 | import { StringPromptStep } from '../StringPromptStep'; 8 | import { type IEventHubWizardContext } from './IEventHubWizardContext'; 9 | 10 | export class EventHubNameStep extends StringPromptStep { 11 | public shouldPrompt(context: IEventHubWizardContext & IBindingWizardContext): boolean { 12 | // If the user decides to create a new app setting, `EventHubListStep` will take care of prompting 13 | // Otherwise, prompt to manually enter the name of the event hub using this step 14 | return !context.eventHubsNamespace && !context.eventhubname; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/eventHub/IEventHubWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type AuthorizationRule, type EHNamespace, type Eventhub } from '@azure/arm-eventhub'; 7 | import { type IResourceGroupWizardContext } from '@microsoft/vscode-azext-azureutils'; 8 | import { type ISubscriptionActionContext } from '@microsoft/vscode-azext-utils'; 9 | 10 | export interface IEventHubWizardContext extends ISubscriptionActionContext, IResourceGroupWizardContext { 11 | /** 12 | * NOTE: The name of this variable should not change. It matches the name of the binding setting written to function.json 13 | */ 14 | eventhubname?: string; 15 | newEventHubsNamespaceName?: string; 16 | eventHubsNamespace?: EHNamespace; 17 | newEventHubName?: string; 18 | eventHub?: Eventhub; 19 | newAuthRuleName?: string; 20 | authRule?: AuthorizationRule; 21 | isNamespaceAuthRule?: boolean; 22 | } 23 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/serviceBus/IServiceBusWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type SBNamespace } from '@azure/arm-servicebus'; 7 | import { type ISubscriptionActionContext } from '@microsoft/vscode-azext-utils'; 8 | 9 | export interface IServiceBusWizardContext extends ISubscriptionActionContext { 10 | sbNamespace?: SBNamespace; 11 | } 12 | -------------------------------------------------------------------------------- /src/commands/addBinding/settingSteps/serviceBus/ServiceBusListStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type ServiceBusManagementClient } from '@azure/arm-servicebus'; 7 | import { uiUtils } from '@microsoft/vscode-azext-azureutils'; 8 | import { AzureWizardPromptStep } from '@microsoft/vscode-azext-utils'; 9 | import { localize } from '../../../../localize'; 10 | import { promptForResource } from '../../../../utils/azure'; 11 | import { createServiceBusClient } from '../../../../utils/azureClients'; 12 | import { type IServiceBusWizardContext } from './IServiceBusWizardContext'; 13 | 14 | export class ServiceBusListStep extends AzureWizardPromptStep { 15 | public async prompt(context: IServiceBusWizardContext): Promise { 16 | const placeHolder: string = localize('placeHolder', 'Select a service bus namespace'); 17 | const client: ServiceBusManagementClient = await createServiceBusClient(context); 18 | context.sbNamespace = await promptForResource(context, placeHolder, 19 | uiUtils.listAllIterator(client.namespaces.list())); 20 | } 21 | 22 | public shouldPrompt(context: IServiceBusWizardContext): boolean { 23 | return !context.sbNamespace; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/addMIConnections/AddMIConnectionsContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IResourceGroupWizardContext, type Role } from "@microsoft/vscode-azext-azureutils"; 7 | import { type ExecuteActivityContext, type ISubscriptionActionContext } from "@microsoft/vscode-azext-utils"; 8 | import { type SlotTreeItem } from "../../tree/SlotTreeItem"; 9 | import { type Connection } from "./ConnectionsListStep"; 10 | 11 | export interface AddMIConnectionsContext extends ExecuteActivityContext, IResourceGroupWizardContext, ISubscriptionActionContext { 12 | functionapp?: SlotTreeItem; 13 | connections?: Connection[]; 14 | connectionsToAdd?: Connection[]; 15 | roles?: Role[]; 16 | localSettingsPath?: string; 17 | } 18 | -------------------------------------------------------------------------------- /src/commands/api/createFunctionFromApi.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { callWithTelemetryAndErrorHandling, type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import type * as api from '../../vscode-azurefunctions.api'; 8 | import { createFunctionInternal } from "../createFunction/createFunction"; 9 | 10 | export async function createFunctionFromApi(options: api.ICreateFunctionOptions): Promise { 11 | return await callWithTelemetryAndErrorHandling('api.createFunction', async (context: IActionContext) => { 12 | await createFunctionInternal(context, options); 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /src/commands/api/downloadAppSettingsFromApi.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | import { callWithTelemetryAndErrorHandling, type IActionContext } from "@microsoft/vscode-azext-utils"; 6 | import { type IAppSettingsClient } from "../../vscode-azurefunctions.api"; 7 | import { downloadAppSettingsInternal } from "../appSettings/downloadAppSettings"; 8 | 9 | export async function downloadAppSettingsFromApi(client: IAppSettingsClient): Promise { 10 | return await callWithTelemetryAndErrorHandling('api.downloadAppSettings', async (context: IActionContext) => { 11 | await downloadAppSettingsInternal(context, client); 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /src/commands/api/revealTreeItem.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { callWithTelemetryAndErrorHandling, type AzExtTreeItem, type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import { ext } from "../../extensionVariables"; 8 | 9 | export async function revealTreeItem(resourceId: string): Promise { 10 | return await callWithTelemetryAndErrorHandling('api.revealTreeItem', async (context: IActionContext) => { 11 | const node: AzExtTreeItem | undefined = await ext.rgApi.tree.findTreeItem(resourceId, { ...context, loadAll: true }); 12 | if (node) { 13 | await ext.rgApi.treeView.reveal(node, { select: true, focus: true, expand: true }); 14 | } 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /src/commands/api/uploadAppSettingsFromApi.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | import { callWithTelemetryAndErrorHandling, type IActionContext } from "@microsoft/vscode-azext-utils"; 6 | import { type IAppSettingsClient } from "../../vscode-azurefunctions.api"; 7 | import { uploadAppSettingsInternal } from "../appSettings/uploadAppSettings"; 8 | 9 | export async function uploadAppSettingsFromApi(client: IAppSettingsClient, exclude?: (RegExp | string)[]): Promise { 10 | return await callWithTelemetryAndErrorHandling('api.uploadAppSettings', async (context: IActionContext) => { 11 | await uploadAppSettingsInternal(context, client, undefined, exclude); 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/IConnectionTypesContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type ConnectionType } from "../../../constants"; 7 | 8 | export type StorageConnectionType = ConnectionType.Azure | ConnectionType.Emulator; 9 | export type DTSConnectionType = ConnectionType; 10 | export type EventHubsConnectionType = ConnectionType.Azure | ConnectionType.Emulator; 11 | export type SqlDbConnectionType = ConnectionType.Azure | ConnectionType.Custom; 12 | 13 | export interface IConnectionTypesContext { 14 | azureWebJobsStorageType?: StorageConnectionType; 15 | dtsConnectionType?: DTSConnectionType; 16 | eventHubsConnectionType?: EventHubsConnectionType; 17 | sqlDbConnectionType?: SqlDbConnectionType; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/azureWebJobsStorage/IStorageConnectionWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IStorageAccountWizardContext } from "@microsoft/vscode-azext-azureutils"; 7 | import { type StorageConnectionType } from "../IConnectionTypesContext"; 8 | import { type ISetConnectionSettingContext } from "../ISetConnectionSettingContext"; 9 | 10 | export interface IStorageConnectionWizardContext extends ISetConnectionSettingContext { 11 | azureWebJobsStorageType?: StorageConnectionType; 12 | 13 | // All properties from `IStorageConnectionSetSettingsContext` apply 14 | } 15 | 16 | export type IStorageAzureConnectionWizard = IStorageAccountWizardContext & IStorageConnectionWizardContext; 17 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/azureWebJobsStorage/azure/StorageAccountGetConnectionStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardExecuteStep } from '@microsoft/vscode-azext-utils'; 7 | import { type IStorageAzureConnectionWizard } from '../IStorageConnectionWizardContext'; 8 | import { getStorageConnectionString } from '../getStorageConnectionString'; 9 | 10 | export class StorageAccountGetConnectionStep extends AzureWizardExecuteStep { 11 | public priority: number = 230; 12 | 13 | public async execute(context: T): Promise { 14 | context.newStorageConnectionSettingValue = (await getStorageConnectionString(context)).connectionString; 15 | } 16 | 17 | public shouldExecute(context: T): boolean { 18 | return !!context.storageAccount; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/azureWebJobsStorage/emulator/StorageEmulatorGetConnectionStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardExecuteStep } from '@microsoft/vscode-azext-utils'; 7 | import { localStorageEmulatorConnectionString } from '../../../../../constants'; 8 | import { type IStorageAzureConnectionWizard } from '../IStorageConnectionWizardContext'; 9 | 10 | export class StorageEmulatorGetConnectionStep extends AzureWizardExecuteStep { 11 | public priority: number = 230; 12 | 13 | public async execute(context: T): Promise { 14 | // Todo: We could probably create a similar step for starting the azurite emulator, similar to the DTS flow 15 | context.newStorageConnectionSettingValue = localStorageEmulatorConnectionString; 16 | } 17 | 18 | public shouldExecute(context: T): boolean { 19 | return !context.newStorageConnectionSettingValue; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/azureWebJobsStorage/getStorageConnection.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type StringDictionary } from "@azure/arm-appservice"; 7 | import { type ParsedSite } from "@microsoft/vscode-azext-azureappservice"; 8 | import { type ISubscriptionActionContext } from "@microsoft/vscode-azext-utils"; 9 | import { type IFuncDeployContext } from "../../../deploy/deploy"; 10 | import { type IStorageConnectionSetSettingsContext } from "../ISetConnectionSettingContext"; 11 | 12 | type StorageConnectionContext = IFuncDeployContext & ISubscriptionActionContext; 13 | 14 | export async function getStorageConnectionIfNeeded(_context: StorageConnectionContext, _appSettings: StringDictionary, _site: ParsedSite, _projectPath: string): Promise { 15 | // Skip validation on deploy - we already connect the storage account for the user when the Function App is initially created 16 | 17 | // Todo: In the future we can probably do more here, but first we would need to be able to correctly validate identity based scenarios, see: 18 | // https://github.com/microsoft/vscode-azurefunctions/issues/3688 19 | return undefined; 20 | } 21 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/azureWebJobsStorage/getStorageLocalProjectConnections.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzExtFsExtra, type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import * as path from "path"; 8 | import { ConnectionKey, localSettingsFileName } from "../../../../constants"; 9 | import { type ILocalSettingsJson } from "../../../../funcConfig/local.settings"; 10 | 11 | export async function getStorageLocalSettingsValue(context: IActionContext & { projectPath: string }, localSettingsKey: string = ConnectionKey.Storage): Promise { 12 | const localSettingsFilePath = path.join(context.projectPath, localSettingsFileName); 13 | if (!await AzExtFsExtra.pathExists(localSettingsFilePath)) { 14 | return undefined; 15 | } 16 | 17 | const localSettings = await AzExtFsExtra.readJSON(localSettingsFilePath) as ILocalSettingsJson; 18 | return localSettings?.Values?.[localSettingsKey]; 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/azureWebJobsStorage/setConnectionSetting.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { MismatchBehavior, setLocalAppSetting } from "../../../../funcConfig/local.settings"; 7 | import { type ISetConnectionSettingContext } from "../ISetConnectionSettingContext"; 8 | 9 | export async function setLocalSetting(context: ISetConnectionSettingContext, key: string, value: string): Promise { 10 | await setLocalAppSetting(context, context.projectPath, key, value, MismatchBehavior.Overwrite); 11 | } 12 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/durableTaskScheduler/emulator/DTSEmulatorGetConnectionsStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardExecuteStep } from '@microsoft/vscode-azext-utils'; 7 | import { getSchedulerConnectionString, SchedulerAuthenticationType } from '../../../../durableTaskScheduler/copySchedulerConnectionString'; 8 | import { type IDTSConnectionWizardContext } from '../IDTSConnectionWizardContext'; 9 | 10 | export class DTSEmulatorGetConnectionsStep extends AzureWizardExecuteStep { 11 | public priority: number = 200; 12 | 13 | public async execute(context: T): Promise { 14 | if (context.dtsEmulator) { 15 | context.newDTSConnectionSettingValue = getSchedulerConnectionString(context.dtsEmulator.schedulerEndpoint.toString(), SchedulerAuthenticationType.None); 16 | } 17 | 18 | context.newDTSHubConnectionSettingValue = 'default'; 19 | } 20 | 21 | public shouldExecute(context: T): boolean { 22 | return !context.newDTSConnectionSettingValue || !context.newDTSHubConnectionSettingValue; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/getVariableSubstitutedKey.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | /** 7 | * If a variable substituted key is used, grabs the connection key name it is referencing. 8 | * 9 | * Note: The `host.json` often specifies which connection key name to use by referencing a variable-substituted name. 10 | * Instead of hardcoding the connection key, `host.json` uses a placeholder surrounded with parenthesis (e.g. %TASKHUB_NAME%) 11 | * that is replaced at runtime with the actual value from `local.settings.json` or the app’s configuration settings. 12 | * 13 | * Example: `%TASKHUB_NAME%` => `TASKHUB_NAME` 14 | */ 15 | export function tryGetVariableSubstitutedKey(key?: string): string | undefined { 16 | if (!key) { 17 | return undefined; 18 | } 19 | 20 | if (key.startsWith('%') && key.endsWith('%')) { 21 | return key.replace(/^%(.*)%$/, '$1'); 22 | } else { 23 | return undefined; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/netherite/azure/EventHubGetConnectionStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardExecuteStep, nonNullValueAndProp } from '@microsoft/vscode-azext-utils'; 7 | import { type INetheriteAzureConnectionWizardContext } from '../INetheriteConnectionWizardContext'; 8 | 9 | export class EventHubGetConnectionStep extends AzureWizardExecuteStep { 10 | public priority: number = 236; 11 | 12 | public async execute(context: T): Promise { 13 | context.newEventHubConnectionSettingValue = nonNullValueAndProp(context.eventHub, 'name'); 14 | } 15 | 16 | public shouldExecute(context: T): boolean { 17 | return !!context.eventHub; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/netherite/emulator/NetheriteEmulatorGetConnectionStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardExecuteStep } from '@microsoft/vscode-azext-utils'; 7 | import { localEventHubsEmulatorConnectionString } from '../../../../../constants'; 8 | import { type INetheriteConnectionWizardContext } from '../INetheriteConnectionWizardContext'; 9 | 10 | export class NetheriteEmulatorGetConnectionStep extends AzureWizardExecuteStep { 11 | public priority: number = 230; 12 | 13 | public async execute(context: T): Promise { 14 | context.newEventHubsNamespaceConnectionSettingValue = localEventHubsEmulatorConnectionString; 15 | } 16 | 17 | public shouldExecute(context: T): boolean { 18 | return !context.newEventHubsNamespaceConnectionSettingValue; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/notifyFailedToConfigureHost.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import { hostFileName } from "../../../constants"; 8 | import { viewOutput } from "../../../constants-nls"; 9 | import { ext } from "../../../extensionVariables"; 10 | import { localize } from "../../../localize"; 11 | 12 | export function notifyFailedToConfigureHost(context: IActionContext, message: string): void { 13 | ext.outputChannel.appendLog(message); 14 | 15 | const notification: string = localize('failedToConfigureHost', 'Failed to configure your "{0}".', hostFileName); 16 | void context.ui.showWarningMessage(notification, { title: viewOutput }).then(result => { 17 | if (result.title === viewOutput) { 18 | ext.outputChannel.show(); 19 | } 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /src/commands/appSettings/connectionSettings/setConnectionSetting.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { MismatchBehavior, setLocalAppSetting } from "../../../funcConfig/local.settings"; 7 | import { type ISetConnectionSettingContext } from "./ISetConnectionSettingContext"; 8 | 9 | export async function setLocalSetting(context: ISetConnectionSettingContext, key: string, value: string): Promise { 10 | await setLocalAppSetting(context, context.projectPath, key, value, MismatchBehavior.Overwrite); 11 | } 12 | -------------------------------------------------------------------------------- /src/commands/appSettings/localSettings/decryptLocalSettings.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import * as path from 'path'; 8 | import { type Uri } from "vscode"; 9 | import { ext } from '../../../extensionVariables'; 10 | import { localize } from '../../../localize'; 11 | import { cpUtils } from '../../../utils/cpUtils'; 12 | import { getLocalSettingsFile } from './getLocalSettingsFile'; 13 | 14 | export async function decryptLocalSettings(context: IActionContext, uri?: Uri): Promise { 15 | const message: string = localize('selectLocalSettings', 'Select the settings file to decrypt.'); 16 | const localSettingsPath: string = uri ? uri.fsPath : await getLocalSettingsFile(context, message); 17 | ext.outputChannel.show(true); 18 | await cpUtils.executeCommand(ext.outputChannel, path.dirname(localSettingsPath), 'func', 'settings', 'decrypt'); 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/appSettings/localSettings/encryptLocalSettings.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import * as path from 'path'; 8 | import { type Uri } from "vscode"; 9 | import { ext } from "../../../extensionVariables"; 10 | import { localize } from '../../../localize'; 11 | import { cpUtils } from "../../../utils/cpUtils"; 12 | import { getLocalSettingsFile } from './getLocalSettingsFile'; 13 | 14 | export async function encryptLocalSettings(context: IActionContext, uri?: Uri): Promise { 15 | const message: string = localize('selectLocalSettings', 'Select the settings file to encrypt.'); 16 | const localSettingsPath: string = uri ? uri.fsPath : await getLocalSettingsFile(context, message); 17 | ext.outputChannel.show(true); 18 | await cpUtils.executeCommand(ext.outputChannel, path.dirname(localSettingsPath), 'func', 'settings', 'encrypt'); 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/appSettings/toggleSlotSetting.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AppSettingTreeItem } from "@microsoft/vscode-azext-azureappsettings"; 7 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 8 | import { functionFilter } from "../../constants"; 9 | import { ext } from "../../extensionVariables"; 10 | 11 | export async function toggleSlotSetting(context: IActionContext, node?: AppSettingTreeItem): Promise { 12 | if (!node) { 13 | node = await ext.rgApi.pickAppResource(context, { 14 | filter: functionFilter, 15 | expectedChildContextValue: new RegExp(AppSettingTreeItem.contextValue) 16 | }); 17 | } 18 | 19 | await node.toggleSlotSetting(context); 20 | } 21 | -------------------------------------------------------------------------------- /src/commands/browseWebsite.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { nonNullValueAndProp, type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import { type SlotTreeItem } from '../tree/SlotTreeItem'; 8 | import { type ContainerTreeItem } from '../tree/containerizedFunctionApp/ContainerTreeItem'; 9 | import { openUrl } from '../utils/openUrl'; 10 | import { pickAppResource } from '../utils/pickAppResource'; 11 | 12 | export async function browseWebsite(context: IActionContext, node?: SlotTreeItem | ContainerTreeItem): Promise { 13 | if (!node) { 14 | node = await pickAppResource(context); 15 | } 16 | await node.initSite(context); 17 | await openUrl(nonNullValueAndProp(node.site, 'defaultHostUrl')); 18 | } 19 | -------------------------------------------------------------------------------- /src/commands/configureDeploymentSource.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { editScmType } from '@microsoft/vscode-azext-azureappservice'; 7 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 8 | import { type SlotTreeItem } from '../tree/SlotTreeItem'; 9 | import { pickFunctionApp } from '../utils/pickFunctionApp'; 10 | 11 | export async function configureDeploymentSource(context: IActionContext, node?: SlotTreeItem): Promise { 12 | if (!node) { 13 | node = await pickFunctionApp(context); 14 | } 15 | 16 | await node.initSite(context); 17 | const updatedScmType: string | undefined = await editScmType(context, node.site, node.subscription); 18 | if (updatedScmType !== undefined) { 19 | context.telemetry.properties.updatedScmType = updatedScmType; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/commands/copyFunctionUrl.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import * as vscode from 'vscode'; 8 | import { functionFilter } from '../constants'; 9 | import { ext } from '../extensionVariables'; 10 | import { localize } from '../localize'; 11 | import { type FunctionTreeItemBase } from '../tree/FunctionTreeItemBase'; 12 | 13 | export async function copyFunctionUrl(context: IActionContext, node?: FunctionTreeItemBase): Promise { 14 | if (!node) { 15 | const noItemFoundErrorMessage: string = localize('noHTTPFunctions', 'No HTTP functions found.'); 16 | node = await ext.rgApi.pickAppResource({ ...context, noItemFoundErrorMessage }, { 17 | filter: functionFilter, 18 | expectedChildContextValue: /Function;Http;/i 19 | }); 20 | } 21 | 22 | const triggerRequest = await node.getTriggerRequest(context); 23 | if (triggerRequest) { 24 | await vscode.env.clipboard.writeText(triggerRequest.url); 25 | } else { 26 | throw new Error(localize('CopyFailedForNonHttp', 'Function URLs can only be used for HTTP triggers.')); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/commands/createChildNode.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type AzExtParentTreeItem, type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import { functionFilter } from '../constants'; 8 | import { ext } from '../extensionVariables'; 9 | 10 | export async function createChildNode(context: IActionContext, expectedContextValue: string | RegExp, node?: AzExtParentTreeItem): Promise { 11 | if (!node) { 12 | node = await ext.rgApi.pickAppResource({ ...context, suppressCreatePick: true }, { 13 | filter: functionFilter, 14 | expectedChildContextValue: expectedContextValue 15 | }); 16 | } 17 | 18 | await node.createChild(context); 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/createFunction/actionStepsV2/AppendToFileExecuteStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzExtFsExtra, nonNullProp } from "@microsoft/vscode-azext-utils"; 7 | import { type FunctionV2WizardContext } from "../IFunctionWizardContext"; 8 | import { WriteToFileExecuteStep } from "./WriteToFileExecuteStep"; 9 | 10 | export class AppendToFileExecuteStep extends WriteToFileExecuteStep { 11 | protected async writeToFile(context: T, filePath: string): Promise { 12 | const sourceKey = nonNullProp(this.action, 'source'); 13 | const source = context[sourceKey] as string; 14 | 15 | await AzExtFsExtra.appendFile(filePath, source); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/commands/createFunction/actionStepsV2/ShowMarkdownPreviewExecuteStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { nonNullProp } from "@microsoft/vscode-azext-utils"; 7 | import { assertTemplateIsV2 } from "../../../utils/templateVersionUtils"; 8 | import { showMarkdownPreviewContent } from "../../../utils/textUtils"; 9 | import { getWorkspaceSetting } from "../../../vsCodeConfig/settings"; 10 | import { type FunctionV2WizardContext } from "../IFunctionWizardContext"; 11 | import { ActionSchemaStepBase } from "./ActionSchemaStepBase"; 12 | 13 | export class ShowMarkdownPreviewExecuteStep extends ActionSchemaStepBase { 14 | public async executeAction(context: T): Promise { 15 | assertTemplateIsV2(context.functionTemplate); 16 | 17 | const filename = nonNullProp(this.action, 'filePath'); 18 | const content = context.functionTemplate.files[filename] ?? ''; 19 | await showMarkdownPreviewContent(content, filename, /* openToSide: */ true); 20 | } 21 | 22 | public shouldExecute(_context: T): boolean { 23 | return !!getWorkspaceSetting('showMarkdownPreview'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/createFunction/ballerinaSteps/IBallerinaFunctionWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IFunctionTemplate } from '../../../templates/IFunctionTemplate'; 7 | import { type IFunctionWizardContext } from '../IFunctionWizardContext'; 8 | 9 | export interface IBallerinaFunctionWizardContext extends IFunctionWizardContext { 10 | functionTemplate?: IBallerinaFunctionTemplate; 11 | } 12 | 13 | export interface IBallerinaFunctionTemplate extends IFunctionTemplate { 14 | templateFiles: { [filename: string]: string }; 15 | } 16 | -------------------------------------------------------------------------------- /src/commands/createFunction/dotnetSteps/IDotnetFunctionWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { ProjectLanguage } from '../../../constants'; 7 | import { type IFunctionWizardContext } from '../IFunctionWizardContext'; 8 | 9 | export interface IDotnetFunctionWizardContext extends IFunctionWizardContext { 10 | namespace?: string; 11 | } 12 | 13 | export function getFileExtension(context: IDotnetFunctionWizardContext): string { 14 | return context.language === ProjectLanguage.FSharp ? '.fs' : '.cs'; 15 | } 16 | -------------------------------------------------------------------------------- /src/commands/createFunction/javaSteps/IJavaFunctionWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IFunctionTemplate } from '../../../templates/IFunctionTemplate'; 7 | import { type IFunctionWizardContext } from '../IFunctionWizardContext'; 8 | 9 | export interface IJavaFunctionWizardContext extends IFunctionWizardContext { 10 | functionTemplate?: IJavaFunctionTemplate; 11 | } 12 | 13 | export interface IJavaFunctionTemplate extends IFunctionTemplate { 14 | templateFiles: { [filename: string]: string }; 15 | } 16 | -------------------------------------------------------------------------------- /src/commands/createFunction/promptStepsV2/BooleanInputStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils"; 7 | import { envUtils } from "../../../utils/envUtils"; 8 | import { type FunctionV2WizardContext } from "../IFunctionWizardContext"; 9 | import { QuickPickInputStep } from "./QuickPickInputStep"; 10 | 11 | export class BooleanInputStep extends QuickPickInputStep { 12 | protected async getPicks(_context: T): Promise[]> { 13 | let picks: IAzureQuickPickItem[] = [true, false].map(v => { return { label: String(v), data: v }; }); 14 | 15 | // Make sure the correct default value is at the top of the list 16 | if (!envUtils.isEnvironmentVariableSet(this.input.defaultValue)) { 17 | picks = picks.reverse(); 18 | } 19 | 20 | return picks; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/commands/createFunction/promptStepsV2/EnumInputStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { nonNullProp, type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils"; 7 | import { type FunctionV2WizardContext } from "../IFunctionWizardContext"; 8 | import { QuickPickInputStep } from "./QuickPickInputStep"; 9 | 10 | export class EnumInputStep extends QuickPickInputStep { 11 | protected async getPicks(_context: T): Promise[]> { 12 | const enums = nonNullProp(this.input, 'enum'); 13 | return enums.map(e => { return { data: e.value, label: e.display }; }); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/commands/createFunction/promptStepsV2/QuickPickInputStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils"; 7 | import { localize } from "../../../localize"; 8 | import { type FunctionV2WizardContext } from "../IFunctionWizardContext"; 9 | import { PromptSchemaStepBase } from "./PromptSchemaStepBase"; 10 | 11 | export abstract class QuickPickInputStep extends PromptSchemaStepBase { 12 | protected async promptAction(context: T): Promise { 13 | const picks: IAzureQuickPickItem[] = await this.getPicks(context); 14 | 15 | if (!this.input.required) { 16 | picks.push({ 17 | label: localize('skipForNow', '$(clock) Skip for now'), 18 | data: undefined, 19 | suppressPersistence: true 20 | }); 21 | } 22 | 23 | return (await context.ui.showQuickPick(picks, { placeHolder: this.input.help })).data; 24 | } 25 | 26 | protected abstract getPicks(context: T): Promise[]>; 27 | } 28 | -------------------------------------------------------------------------------- /src/commands/createFunction/promptStepsV2/StringInputStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type AzExtInputBoxOptions } from "@microsoft/vscode-azext-utils"; 7 | import { type ParsedInput } from "../../../templates/script/parseScriptTemplatesV2"; 8 | import { type FunctionV2WizardContext } from "../IFunctionWizardContext"; 9 | import { PromptSchemaStepBase } from "./PromptSchemaStepBase"; 10 | 11 | export class StringInputStep extends PromptSchemaStepBase { 12 | 13 | public constructor(readonly input: ParsedInput) { 14 | super(input); 15 | } 16 | 17 | protected async promptAction(context: T): Promise { 18 | const options: AzExtInputBoxOptions = { 19 | title: this.input.label, 20 | prompt: this.input.help, 21 | value: this.input.defaultValue, 22 | validateInput: value => { 23 | return this.validateInput(value, this.input); 24 | } 25 | }; 26 | 27 | return await context.ui.showInputBox(options); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/commands/createFunction/scriptSteps/IPythonFunctionWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IScriptFunctionWizardContext } from './IScriptFunctionWizardContext'; 7 | 8 | export enum FunctionLocation { 9 | MainScript, 10 | SelectedScript, 11 | Document 12 | } 13 | 14 | export interface IPythonFunctionWizardContext extends IScriptFunctionWizardContext { 15 | functionLocation?: FunctionLocation; 16 | functionScript?: string; 17 | } 18 | -------------------------------------------------------------------------------- /src/commands/createFunction/scriptSteps/IScriptFunctionWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IScriptFunctionTemplate } from '../../../templates/script/parseScriptTemplates'; 7 | import { type IFunctionWizardContext } from '../IFunctionWizardContext'; 8 | 9 | export interface IScriptFunctionWizardContext extends IFunctionWizardContext { 10 | functionTemplate?: IScriptFunctionTemplate; 11 | } 12 | -------------------------------------------------------------------------------- /src/commands/createFunctionApp/stacks/models/FlexSkuModel.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | export interface Sku { 7 | skuCode: string; 8 | instanceMemoryMB: InstanceMemoryMB[]; 9 | maximumInstanceCount: MaximumInstanceCount, 10 | functionAppConfigProperties: { 11 | runtime: { 12 | name: string, 13 | version: string 14 | } 15 | } 16 | } 17 | 18 | interface InstanceMemoryMB { 19 | size: string; 20 | isDefault: boolean; 21 | } 22 | 23 | interface MaximumInstanceCount { 24 | lowestMaximumInstanceCount: number; 25 | highestMaximumInstanceCount: number; 26 | defaultValue: number; 27 | } 28 | -------------------------------------------------------------------------------- /src/commands/createNewProject/ProjectCreateStep/CustomProjectCreateStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IHostJsonV2 } from '../../../funcConfig/host'; 7 | import { type IProjectWizardContext } from '../IProjectWizardContext'; 8 | import { ScriptProjectCreateStep } from './ScriptProjectCreateStep'; 9 | 10 | export class CustomProjectCreateStep extends ScriptProjectCreateStep { 11 | protected async getHostContent(context: IProjectWizardContext): Promise { 12 | const hostJson: IHostJsonV2 = await super.getHostContent(context); 13 | hostJson.customHandler = { 14 | description: { 15 | defaultExecutablePath: '', 16 | workingDirectory: '', 17 | arguments: [] 18 | } 19 | }; 20 | return hostJson; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/commands/createNewProject/ballerinaSteps/BallerinaBackendStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardPromptStep, type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils"; 7 | import { BallerinaBackend } from "../../../constants"; 8 | import { localize } from "../../../localize"; 9 | import { type IBallerinaProjectWizardContext } from "./IBallerinaProjectWizardContext"; 10 | 11 | export class BallerinaBackendStep extends AzureWizardPromptStep { 12 | 13 | public async prompt(context: IBallerinaProjectWizardContext): Promise { 14 | const picks: IAzureQuickPickItem[] = [ 15 | { label: 'JVM', data: BallerinaBackend.jvm }, 16 | { label: 'Native', data: BallerinaBackend.native }, 17 | ]; 18 | const placeHolder: string = localize('selectBallerinaBackend', 'Select the backend for Ballerina project'); 19 | context.balBackend = (await context.ui.showQuickPick(picks, { placeHolder })).data; 20 | } 21 | 22 | public shouldPrompt(context: IBallerinaProjectWizardContext): boolean { 23 | return !context.balBackend; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/createNewProject/ballerinaSteps/IBallerinaProjectWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import * as path from 'path'; 7 | import { type BallerinaBackend } from '../../../constants'; 8 | import { type IProjectWizardContext } from "../IProjectWizardContext"; 9 | 10 | export interface IBallerinaProjectWizardContext extends IProjectWizardContext { 11 | balBackend?: BallerinaBackend; 12 | } 13 | 14 | export function getBallerinaPackagePath(projectPath: string): string { 15 | return path.join(projectPath); 16 | } 17 | 18 | export function getBallerinaFunctionFilePath(projectPath: string, functionName: string): string { 19 | return path.join(getBallerinaPackagePath(projectPath), functionName + '.bal'); 20 | } 21 | -------------------------------------------------------------------------------- /src/commands/createNewProject/ballerinaSteps/addBallerinaCreateProjectSteps.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type AzureWizardExecuteStep, type AzureWizardPromptStep } from "@microsoft/vscode-azext-utils"; 7 | import { ballerinaUtils } from "../../../utils/ballerinaUtils"; 8 | import { type IProjectWizardContext } from "../IProjectWizardContext"; 9 | import { BallerinaProjectCreateStep } from "../ProjectCreateStep/BallerinaProjectCreateStep"; 10 | import { BallerinaBackendStep } from "./BallerinaBackendStep"; 11 | import { type IBallerinaProjectWizardContext } from "./IBallerinaProjectWizardContext"; 12 | 13 | export async function addBallerinaCreateProjectSteps( 14 | context: IBallerinaProjectWizardContext, 15 | promptSteps: AzureWizardPromptStep[], 16 | executeSteps: AzureWizardExecuteStep[]): Promise { 17 | await ballerinaUtils.getBallerinaVersion(context); 18 | promptSteps.push(new BallerinaBackendStep()); 19 | executeSteps.push(new BallerinaProjectCreateStep()); 20 | } 21 | -------------------------------------------------------------------------------- /src/commands/createNewProject/javaSteps/JavaAppNameStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils"; 7 | import { type InputBoxOptions } from "vscode"; 8 | import { localize } from "../../../localize"; 9 | import { nonNullProp } from "../../../utils/nonNull"; 10 | import { type IJavaProjectWizardContext } from "./IJavaProjectWizardContext"; 11 | 12 | export class JavaAppNameStep extends AzureWizardPromptStep { 13 | public async prompt(context: IJavaProjectWizardContext): Promise { 14 | const options: InputBoxOptions = { 15 | placeHolder: localize('appNamePlaceHolder', 'App name'), 16 | prompt: localize('appNamePrompt', 'Provide an app name'), 17 | value: `${nonNullProp(context, 'javaArtifactId')}-${Date.now()}` 18 | }; 19 | context.javaAppName = await context.ui.showInputBox(options); 20 | } 21 | 22 | public shouldPrompt(context: IJavaProjectWizardContext): boolean { 23 | return !context.javaAppName; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/createNewProject/javaSteps/JavaArtifactIdStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils"; 7 | import * as path from 'path'; 8 | import { type InputBoxOptions } from "vscode"; 9 | import { localize } from "../../../localize"; 10 | import { validateMavenIdentifier, type IJavaProjectWizardContext } from "./IJavaProjectWizardContext"; 11 | 12 | export class JavaArtifactIdStep extends AzureWizardPromptStep { 13 | public async prompt(context: IJavaProjectWizardContext): Promise { 14 | const options: InputBoxOptions = { 15 | placeHolder: localize('artifactIdPlaceholder', 'Artifact id'), 16 | prompt: localize('artifactIdPrompt', 'Provide an artifact id'), 17 | validateInput: validateMavenIdentifier, 18 | value: path.basename(context.projectPath) 19 | }; 20 | context.javaArtifactId = await context.ui.showInputBox(options); 21 | } 22 | 23 | public shouldPrompt(context: IJavaProjectWizardContext): boolean { 24 | return !context.javaArtifactId; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/commands/createNewProject/javaSteps/JavaGroupIdStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils"; 7 | import { type InputBoxOptions } from "vscode"; 8 | import { localize } from "../../../localize"; 9 | import { validateMavenIdentifier, type IJavaProjectWizardContext } from "./IJavaProjectWizardContext"; 10 | 11 | export class JavaGroupIdStep extends AzureWizardPromptStep { 12 | public async prompt(context: IJavaProjectWizardContext): Promise { 13 | const options: InputBoxOptions = { 14 | placeHolder: localize('groupIdPlaceholder', 'Group id'), 15 | prompt: localize('groupIdPrompt', 'Provide a group id'), 16 | validateInput: validateMavenIdentifier, 17 | value: 'com.function' 18 | }; 19 | context.javaGroupId = await context.ui.showInputBox(options); 20 | } 21 | 22 | public shouldPrompt(context: IJavaProjectWizardContext): boolean { 23 | return !context.javaGroupId; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/createNewProject/javaSteps/JavaProjectVersionStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils"; 7 | import { type InputBoxOptions } from "vscode"; 8 | import { localize } from "../../../localize"; 9 | import { type IJavaProjectWizardContext } from "./IJavaProjectWizardContext"; 10 | 11 | export class JavaProjectVersionStep extends AzureWizardPromptStep { 12 | public async prompt(context: IJavaProjectWizardContext): Promise { 13 | const options: InputBoxOptions = { 14 | placeHolder: localize('versionPlaceHolder', 'Version'), 15 | prompt: localize('versionPrompt', 'Provide a version for your project'), 16 | value: '1.0-SNAPSHOT' 17 | }; 18 | context.javaProjectVersion = await context.ui.showInputBox(options); 19 | } 20 | 21 | public shouldPrompt(context: IJavaProjectWizardContext): boolean { 22 | return !context.javaProjectVersion; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/commands/createNewProject/pythonSteps/IPythonVenvWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import { type FuncVersion } from "../../../FuncVersion"; 8 | 9 | export interface IPythonVenvWizardContext extends IActionContext { 10 | projectPath: string; 11 | version: FuncVersion; 12 | pythonAlias?: string; 13 | manuallyEnterAlias?: boolean; 14 | useExistingVenv?: boolean; 15 | venvName?: string; 16 | suppressSkipVenv?: boolean; 17 | } 18 | -------------------------------------------------------------------------------- /src/commands/createSlot.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import { functionFilter } from '../constants'; 8 | import { ext } from '../extensionVariables'; 9 | import { type SlotTreeItem } from '../tree/SlotTreeItem'; 10 | import { SlotsTreeItem } from '../tree/SlotsTreeItem'; 11 | 12 | export async function createSlot(context: IActionContext, node?: SlotsTreeItem): Promise { 13 | if (!node) { 14 | node = await ext.rgApi.pickAppResource(context, { 15 | filter: functionFilter, 16 | expectedChildContextValue: SlotsTreeItem.contextValue 17 | }); 18 | } 19 | 20 | const slotNode: SlotTreeItem = await node.createChild(context); 21 | return slotNode.fullId; 22 | } 23 | -------------------------------------------------------------------------------- /src/commands/deleteContainerizedFunctionApp/DeleteFunctionAppWizardContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type Site } from "@azure/arm-appservice"; 7 | import { type ExecuteActivityContext, type IActionContext, type ISubscriptionActionContext } from "@microsoft/vscode-azext-utils"; 8 | 9 | export interface DeleteFunctionappWizardContext extends ISubscriptionActionContext, IActionContext, ExecuteActivityContext { 10 | site: Site; 11 | } 12 | -------------------------------------------------------------------------------- /src/commands/deleteFunction.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type AzExtTreeItem, type IActionContext, type ITreeItemPickerContext } from '@microsoft/vscode-azext-utils'; 7 | import { localize } from '../localize'; 8 | import { deleteNode } from './deleteNode'; 9 | 10 | export async function deleteFunction(context: IActionContext, node?: AzExtTreeItem): Promise { 11 | (context).noItemFoundErrorMessage = localize('noFunctionsToDelete', 'No matching functions found or your function app is read-only.'); 12 | await deleteNode(context, /Remote;ReadWrite;Function;/i, node); 13 | } 14 | -------------------------------------------------------------------------------- /src/commands/deleteFunctionApp.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import { type SlotTreeItem } from '../tree/SlotTreeItem'; 8 | import { pickAppResource } from '../utils/pickAppResource'; 9 | 10 | export async function deleteFunctionApp(context: IActionContext, node?: SlotTreeItem): Promise { 11 | if (!node) { 12 | node = await pickAppResource({ ...context, suppressCreatePick: true }); 13 | } 14 | 15 | await node.deleteTreeItem(context); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/commands/deleteNode.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type AzExtTreeItem, type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import { functionFilter } from '../constants'; 8 | import { ext } from '../extensionVariables'; 9 | 10 | export async function deleteNode(context: IActionContext, expectedContextValue: string | RegExp, node?: AzExtTreeItem): Promise { 11 | if (!node) { 12 | node = await ext.rgApi.pickAppResource({ ...context, suppressCreatePick: true }, { 13 | filter: functionFilter, 14 | expectedChildContextValue: expectedContextValue 15 | }); 16 | } 17 | 18 | await node.deleteTreeItem(context); 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/deployments/disconnectRepo.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { DeploymentsTreeItem, disconnectRepo as disconnectRepository } from "@microsoft/vscode-azext-azureappservice"; 7 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 8 | import { functionFilter } from "../../constants"; 9 | import { ext } from "../../extensionVariables"; 10 | import { isResolvedFunctionApp } from "../../tree/ResolvedFunctionAppResource"; 11 | 12 | export async function disconnectRepo(context: IActionContext, node?: DeploymentsTreeItem): Promise { 13 | if (!node) { 14 | node = await ext.rgApi.pickAppResource(context, { 15 | filter: functionFilter, 16 | expectedChildContextValue: new RegExp(DeploymentsTreeItem.contextValueConnected) 17 | }); 18 | } 19 | 20 | if (isResolvedFunctionApp(node.parent)) { 21 | await disconnectRepository(context, node.site, node.subscription); 22 | await node.refresh(context); 23 | } else { 24 | throw Error('Internal error: Action not supported.'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/commands/deployments/redeployDeployment.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { DeploymentTreeItem } from "@microsoft/vscode-azext-azureappservice"; 7 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 8 | import { functionFilter } from "../../constants"; 9 | import { ext } from "../../extensionVariables"; 10 | 11 | export async function redeployDeployment(context: IActionContext, node?: DeploymentTreeItem): Promise { 12 | if (!node) { 13 | node = await ext.rgApi.pickAppResource(context, { 14 | filter: functionFilter, 15 | expectedChildContextValue: DeploymentTreeItem.contextValue 16 | }); 17 | } 18 | await node.redeployDeployment(context); 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/deployments/viewCommitInGitHub.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type DeploymentTreeItem } from "@microsoft/vscode-azext-azureappservice"; 7 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 8 | import { functionFilter } from "../../constants"; 9 | import { ext } from "../../extensionVariables"; 10 | 11 | export async function viewCommitInGitHub(context: IActionContext, node?: DeploymentTreeItem): Promise { 12 | if (!node) { 13 | node = await ext.rgApi.pickAppResource(context, { 14 | filter: functionFilter, 15 | expectedChildContextValue: 'deployment/github' 16 | }); 17 | } 18 | await node.viewCommitInGitHub(context); 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/deployments/viewDeploymentLogs.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { DeploymentTreeItem } from "@microsoft/vscode-azext-azureappservice"; 7 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 8 | import { functionFilter } from "../../constants"; 9 | import { ext } from "../../extensionVariables"; 10 | 11 | export async function viewDeploymentLogs(context: IActionContext, node?: DeploymentTreeItem): Promise { 12 | if (!node) { 13 | node = await ext.rgApi.pickAppResource(context, { 14 | filter: functionFilter, 15 | expectedChildContextValue: DeploymentTreeItem.contextValue 16 | }); 17 | } 18 | await node.viewDeploymentLogs(context); 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/durableTaskScheduler/copySchedulerEndpoint.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import { localize } from "../../localize"; 8 | import { ext } from "../../extensionVariables"; 9 | import { env } from "vscode"; 10 | import { type DurableTaskSchedulerEndpointModel } from "../../tree/durableTaskScheduler/DurableTaskSchedulerEndpointModel"; 11 | 12 | export function copySchedulerEndpointCommandFactory() { 13 | return async (_: IActionContext, scheduler: DurableTaskSchedulerEndpointModel | undefined): Promise => { 14 | if (!scheduler) { 15 | throw new Error(localize('noSchedulerSelectedErrorMessage', 'No scheduler was selected.')); 16 | } 17 | 18 | const { endpointUrl } = scheduler; 19 | 20 | await env.clipboard.writeText(endpointUrl.toString()); 21 | 22 | ext.outputChannel.show(); 23 | ext.outputChannel.appendLog(localize('schedulerEndpointCopiedMessage', 'Endpoint copied to clipboard: {0}', endpointUrl.toString())); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/durableTaskScheduler/openTaskHubDashboard.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { openUrl, type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import { localize } from '../../localize'; 8 | import { type DurableTaskSchedulerDashboardModel } from "../../tree/durableTaskScheduler/DurableTaskSchedulerDashboardModel"; 9 | 10 | export async function openTaskHubDashboard(_: IActionContext, taskHub: DurableTaskSchedulerDashboardModel | undefined): Promise { 11 | if (!taskHub) { 12 | throw new Error(localize('noTaskHubSelectedErrorMessage', 'No task hub was selected.')); 13 | } 14 | 15 | await openUrl(taskHub?.dashboardUrl.toString(/* skipEncoding: */ true)); 16 | } 17 | -------------------------------------------------------------------------------- /src/commands/durableTaskScheduler/startEmulator.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import { type DurableTaskSchedulerEmulatorClient } from "../../tree/durableTaskScheduler/DurableTaskSchedulerEmulatorClient"; 8 | 9 | export function startEmulatorCommandFactory(emulatorClient: DurableTaskSchedulerEmulatorClient) { 10 | return async (_: IActionContext): Promise => { 11 | return await emulatorClient.startEmulator(); 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /src/commands/durableTaskScheduler/stopEmulator.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import { type DurableTaskSchedulerEmulatorWorkspaceResourceModel } from "../../tree/durableTaskScheduler/DurableTaskSchedulerEmulatorWorkspaceResourceModel"; 8 | import { type DurableTaskSchedulerEmulatorClient } from "../../tree/durableTaskScheduler/DurableTaskSchedulerEmulatorClient"; 9 | import { localize } from "../../localize"; 10 | 11 | export function stopEmulatorCommandFactory(emulatorClient: DurableTaskSchedulerEmulatorClient) { 12 | return async (_: IActionContext, emulator: DurableTaskSchedulerEmulatorWorkspaceResourceModel | undefined) => { 13 | if (!emulator) { 14 | throw new Error(localize('noEmulatorSelected', 'No emulator was selected.')); 15 | } 16 | 17 | await emulatorClient.stopEmulator(emulator.id); 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /src/commands/editAppSetting.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AppSettingTreeItem } from '@microsoft/vscode-azext-azureappsettings'; 7 | import { nonNullValue } from '@microsoft/vscode-azext-utils'; 8 | import { functionFilter } from '../constants'; 9 | import { ext } from '../extensionVariables'; 10 | import { type IFunctionAppWizardContext } from './createFunctionApp/IFunctionAppWizardContext'; 11 | import { showEolWarningIfNecessary } from './createFunctionApp/stacks/getStackPicks'; 12 | 13 | export async function editAppSetting(context: IFunctionAppWizardContext, node?: AppSettingTreeItem): Promise { 14 | if (!node) { 15 | node = await ext.rgApi.pickAppResource(context, { 16 | filter: functionFilter, 17 | expectedChildContextValue: new RegExp(AppSettingTreeItem.contextValue) 18 | }); 19 | } 20 | const parent = node.parent.parent; 21 | await showEolWarningIfNecessary(context, nonNullValue(parent)) 22 | await node.edit(context); 23 | } 24 | -------------------------------------------------------------------------------- /src/commands/executeFunction/eventGrid/EventGridCodeLensProvider.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | import { CodeLens, Range, type CodeLensProvider } from 'vscode'; 6 | import { EventGridExecuteFunctionEntryPoint } from '../../../constants'; 7 | import { localize } from '../../../localize'; 8 | 9 | export class EventGridCodeLensProvider implements CodeLensProvider { 10 | public provideCodeLenses(): CodeLens[] { 11 | const firstLineLens = new CodeLens(new Range(0, 0, 0, 0)); 12 | 13 | firstLineLens.command = { 14 | title: localize('saveExecute', 'Save and execute'), 15 | command: 'azureFunctions.eventGrid.sendMockRequest', 16 | arguments: [EventGridExecuteFunctionEntryPoint.CodeLens] 17 | }; 18 | 19 | return [firstLineLens]; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/commands/executeFunction/eventGrid/EventGridExecuteFunctionContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import { type EventGridSource } from "./eventGridSources"; 8 | 9 | export interface EventGridExecuteFunctionContext extends IActionContext { 10 | eventSource?: EventGridSource; 11 | selectedFileName?: string; 12 | selectedFileUrl?: string; 13 | fileOpened?: boolean; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/commands/identity/ManagedIdentityAssignContext.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type ParsedSite } from "@microsoft/vscode-azext-azureappservice"; 7 | import { type IResourceGroupWizardContext } from "@microsoft/vscode-azext-azureutils"; 8 | import { type ExecuteActivityContext } from "@microsoft/vscode-azext-utils"; 9 | 10 | export interface ManagedIdentityAssignContext extends IResourceGroupWizardContext, ExecuteActivityContext { 11 | site?: ParsedSite; 12 | } 13 | -------------------------------------------------------------------------------- /src/commands/initProjectForVSCode/InitVSCodeStep/DotnetScriptInitVSCodeStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type DebugConfiguration } from "vscode"; 7 | import { FuncVersion } from "../../../FuncVersion"; 8 | import { localize } from "../../../localize"; 9 | import { ScriptInitVSCodeStep } from './ScriptInitVSCodeStep'; 10 | 11 | export class DotnetScriptInitVSCodeStep extends ScriptInitVSCodeStep { 12 | protected getDebugConfiguration(version: FuncVersion): DebugConfiguration { 13 | return { 14 | name: localize('attachToNetFunc', "Attach to .NET Script Functions"), 15 | type: version === FuncVersion.v1 ? 'clr' : 'coreclr', 16 | request: 'attach', 17 | processId: '\${command:azureFunctions.pickProcess}' 18 | }; 19 | } 20 | 21 | protected getRecommendedExtensions(): string[] { 22 | return ['ms-dotnettools.csharp']; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/commands/initProjectForVSCode/InitVSCodeStep/PowerShellInitVSCodeStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type DebugConfiguration } from "vscode"; 7 | import { powershellDebugConfig } from "../../../debug/PowerShellDebugProvider"; 8 | import { ScriptInitVSCodeStep } from './ScriptInitVSCodeStep'; 9 | 10 | export class PowerShellInitVSCodeStep extends ScriptInitVSCodeStep { 11 | protected getDebugConfiguration(): DebugConfiguration { 12 | return powershellDebugConfig; 13 | } 14 | 15 | protected getRecommendedExtensions(): string[] { 16 | return ['ms-vscode.PowerShell']; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/commands/initProjectForVSCode/pythonSteps/PythonVenvListStep.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzureWizardPromptStep, type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils"; 7 | import { localize } from "../../../localize"; 8 | import { type IPythonVenvWizardContext } from "../../createNewProject/pythonSteps/IPythonVenvWizardContext"; 9 | 10 | export class PythonVenvListStep extends AzureWizardPromptStep { 11 | public hideStepCount: boolean = true; 12 | 13 | private readonly _venvs: string[]; 14 | 15 | public constructor(venvs: string[]) { 16 | super(); 17 | this._venvs = venvs; 18 | } 19 | 20 | public async prompt(context: IPythonVenvWizardContext): Promise { 21 | const picks: IAzureQuickPickItem[] = this._venvs.map(venv => { return { label: venv, data: venv }; }); 22 | const placeHolder: string = localize('selectVenv', 'Select a virtual environment to use for your project'); 23 | context.venvName = (await context.ui.showQuickPick(picks, { placeHolder, suppressPersistence: true })).data; 24 | } 25 | 26 | public shouldPrompt(context: IPythonVenvWizardContext): boolean { 27 | return !!context.useExistingVenv && !context.venvName; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/commands/logstream/enableFileLogging.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type SiteLogsConfig } from '@azure/arm-appservice'; 7 | import { type ParsedSite } from '@microsoft/vscode-azext-azureappservice'; 8 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 9 | 10 | export async function enableFileLogging(context: IActionContext, site: ParsedSite, logsConfig?: SiteLogsConfig): Promise { 11 | const client = await site.createClient(context); 12 | logsConfig = logsConfig || await client.getLogsConfig(); 13 | 14 | logsConfig.applicationLogs = logsConfig.applicationLogs || {}; 15 | logsConfig.applicationLogs.fileSystem = logsConfig.applicationLogs.fileSystem || {}; 16 | logsConfig.applicationLogs.fileSystem.level = 'Information'; 17 | // Azure will throw errors if these have incomplete information (aka missing a sasUrl). Since we already know these are turned off, just make them undefined 18 | logsConfig.applicationLogs.azureBlobStorage = undefined; 19 | logsConfig.applicationLogs.azureTableStorage = undefined; 20 | await client.updateLogsConfig(logsConfig); 21 | } 22 | -------------------------------------------------------------------------------- /src/commands/openFile.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type FileTreeItem } from '@microsoft/vscode-azext-azureappservice'; 7 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 8 | 9 | export async function openFile(context: IActionContext, node: FileTreeItem): Promise { 10 | context.telemetry.eventVersion = 2; 11 | await node.openReadOnly(context); 12 | } 13 | -------------------------------------------------------------------------------- /src/commands/openInPortal.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { openInPortal as uiOpenInPortal } from '@microsoft/vscode-azext-azureutils'; 7 | import { nonNullProp, type AzExtTreeItem, type IActionContext } from '@microsoft/vscode-azext-utils'; 8 | 9 | export async function openDeploymentInPortal(_context: IActionContext, node: AzExtTreeItem): Promise { 10 | await uiOpenInPortal(node, `${nonNullProp(node, 'parent').parent?.id}/Deployments/${nonNullProp(node, 'id')}`); 11 | } 12 | -------------------------------------------------------------------------------- /src/commands/renameAppSetting.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AppSettingTreeItem } from '@microsoft/vscode-azext-azureappsettings'; 7 | import { nonNullValue } from '@microsoft/vscode-azext-utils'; 8 | import { functionFilter } from '../constants'; 9 | import { ext } from '../extensionVariables'; 10 | import { type IFunctionAppWizardContext } from './createFunctionApp/IFunctionAppWizardContext'; 11 | import { showEolWarningIfNecessary } from './createFunctionApp/stacks/getStackPicks'; 12 | 13 | export async function renameAppSetting(context: IFunctionAppWizardContext, node?: AppSettingTreeItem): Promise { 14 | if (!node) { 15 | node = await ext.rgApi.pickAppResource(context, { 16 | filter: functionFilter, 17 | expectedChildContextValue: new RegExp(AppSettingTreeItem.contextValue) 18 | }); 19 | } 20 | 21 | const parent = node.parent.parent; 22 | 23 | await showEolWarningIfNecessary(context, nonNullValue(parent)) 24 | await node.rename(context); 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/restartFunctionApp.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import { type SlotTreeItem } from '../tree/SlotTreeItem'; 8 | import { startFunctionApp } from './startFunctionApp'; 9 | import { stopFunctionApp } from './stopFunctionApp'; 10 | 11 | export async function restartFunctionApp(context: IActionContext, node?: SlotTreeItem): Promise { 12 | node = await stopFunctionApp(context, node); 13 | await startFunctionApp(context, node); 14 | } 15 | -------------------------------------------------------------------------------- /src/commands/startFunctionApp.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type SiteClient } from '@microsoft/vscode-azext-azureappservice'; 7 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 8 | import { localize } from '../localize'; 9 | import { type SlotTreeItem } from '../tree/SlotTreeItem'; 10 | import { pickFunctionApp } from '../utils/pickFunctionApp'; 11 | 12 | export async function startFunctionApp(context: IActionContext, node?: SlotTreeItem): Promise { 13 | if (!node) { 14 | node = await pickFunctionApp(context); 15 | } 16 | 17 | await node.initSite(context); 18 | const client: SiteClient = await node.site.createClient(context); 19 | await node.runWithTemporaryDescription( 20 | context, 21 | localize('starting', 'Starting...'), 22 | async () => { 23 | await client.start(); 24 | } 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /src/commands/stopFunctionApp.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type SiteClient } from '@microsoft/vscode-azext-azureappservice'; 7 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 8 | import { localize } from '../localize'; 9 | import { type SlotTreeItem } from '../tree/SlotTreeItem'; 10 | import { pickFunctionApp } from '../utils/pickFunctionApp'; 11 | 12 | export async function stopFunctionApp(context: IActionContext, node?: SlotTreeItem): Promise { 13 | if (!node) { 14 | node = await pickFunctionApp(context); 15 | } 16 | 17 | await node.initSite(context); 18 | const client: SiteClient = await node.site.createClient(context); 19 | await node.runWithTemporaryDescription( 20 | context, 21 | localize('stopping', 'Stopping...'), 22 | async () => { 23 | await client.stop(); 24 | } 25 | ); 26 | return node; 27 | } 28 | -------------------------------------------------------------------------------- /src/commands/swapSlot.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import * as appservice from '@microsoft/vscode-azext-azureappservice'; 7 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 8 | import { ResolvedFunctionAppResource } from '../tree/ResolvedFunctionAppResource'; 9 | import { type SlotTreeItem } from '../tree/SlotTreeItem'; 10 | import { pickFunctionApp } from '../utils/pickFunctionApp'; 11 | 12 | export async function swapSlot(context: IActionContext, sourceSlotNode?: SlotTreeItem): Promise { 13 | if (!sourceSlotNode) { 14 | sourceSlotNode = await pickFunctionApp(context, { 15 | expectedChildContextValue: new RegExp(ResolvedFunctionAppResource.pickSlotContextValue) 16 | }); 17 | } 18 | 19 | await sourceSlotNode.initSite(context); 20 | const deploymentSlots: SlotTreeItem[] = await sourceSlotNode.parent?.getCachedChildren(context); 21 | await appservice.swapSlot(context, sourceSlotNode.site, deploymentSlots.map(ds => ds.site)); 22 | await sourceSlotNode.parent?.parent?.refresh(context); 23 | } 24 | -------------------------------------------------------------------------------- /src/debug/NodeDebugProvider.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type DebugConfiguration, type WorkspaceFolder } from 'vscode'; 7 | import { hostStartTaskName } from '../constants'; 8 | import { localize } from '../localize'; 9 | import { FuncDebugProviderBase } from './FuncDebugProviderBase'; 10 | 11 | export const defaultNodeDebugPort: number = 9229; 12 | 13 | export const nodeDebugConfig: DebugConfiguration = { 14 | name: localize('attachNode', 'Attach to Node Functions'), 15 | type: 'node', 16 | request: 'attach', 17 | restart: true, 18 | port: defaultNodeDebugPort, 19 | preLaunchTask: hostStartTaskName 20 | }; 21 | 22 | export class NodeDebugProvider extends FuncDebugProviderBase { 23 | public readonly workerArgKey: string = 'languageWorkers__node__arguments'; 24 | protected readonly defaultPortOrPipeName: number = defaultNodeDebugPort; 25 | protected readonly debugConfig: DebugConfiguration = nodeDebugConfig; 26 | 27 | // eslint-disable-next-line @typescript-eslint/require-await 28 | public async getWorkerArgValue(folder: WorkspaceFolder): Promise { 29 | const port: string | number = this.getDebugPortOrPipeName(folder); 30 | return `--inspect=${port}`; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/debug/PythonExtension.api.d.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | interface IPythonExtensionApi { 7 | debug: { 8 | /** 9 | * Generate an array of strings for commands to pass to the Python executable to launch the debugger for remote debugging. 10 | * Users can append another array of strings of what they want to execute along with relevant arguments to Python. 11 | * E.g `['/Users/..../pythonVSCode/pythonFiles/experimental/ptvsd_launcher.py', '--host', 'localhost', '--port', '57039', '--wait']` 12 | */ 13 | getRemoteLauncherCommand(host: string, port: number, waitUntilDebuggerAttaches?: boolean): Promise 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/errors.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { localize } from './localize'; 7 | 8 | export class NoWorkspaceError extends Error { 9 | public message: string = localize('noWorkspaceError', 'You must have a workspace open to perform this operation.'); 10 | } 11 | 12 | export class NotImplementedError extends Error { 13 | constructor(methodName: string, obj: object) { 14 | super(`Internal Error: "${methodName}" is not implemented on "${obj.constructor.name}".`); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/funcConfig/README.md: -------------------------------------------------------------------------------- 1 | This folder contains logic related to Azure Functions project files, like "local.settings.json", "host.json", and "function.json". 2 | -------------------------------------------------------------------------------- /src/funcCoreTools/getFuncCliPath.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import { type WorkspaceFolder } from "vscode"; 8 | import { ext } from "../extensionVariables"; 9 | import { localize } from "../localize"; 10 | import { getWorkspaceSetting } from "../vsCodeConfig/settings"; 11 | 12 | const settingKey = 'funcCliPath'; 13 | 14 | export async function getFuncCliPath(context: IActionContext, workspacePath: WorkspaceFolder | string | undefined): Promise { 15 | const valueFromSetting = getWorkspaceSetting(settingKey, workspacePath); 16 | if (valueFromSetting) { 17 | context.telemetry.properties.funcCliSource = 'setting'; 18 | return valueFromSetting; 19 | } else { 20 | return ext.defaultFuncCliPath; 21 | } 22 | } 23 | 24 | export function validateNoFuncCliSetting(): void { 25 | if (hasFuncCliSetting()) { 26 | throw new Error(localize('notSupportedWithSetting', 'This operation is not supported when "{0}.{1}" is set.', ext.prefix, settingKey)); 27 | } 28 | } 29 | 30 | export function hasFuncCliSetting(): boolean { 31 | return !!getWorkspaceSetting(settingKey); 32 | } 33 | -------------------------------------------------------------------------------- /src/funcCoreTools/hasMinFuncCliVersion.ts: -------------------------------------------------------------------------------- 1 | 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | 7 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 8 | import * as semver from 'semver'; 9 | import { getMajorVersion, type FuncVersion } from "../FuncVersion"; 10 | import { getLocalFuncCoreToolsVersion } from './getLocalFuncCoreToolsVersion'; 11 | 12 | export async function hasMinFuncCliVersion(context: IActionContext, minVersion: string, projectVersion: FuncVersion): Promise { 13 | const majorVersion: string = getMajorVersion(projectVersion); 14 | if (semver.gtr(minVersion, majorVersion)) { 15 | return false; 16 | } else if (semver.ltr(minVersion, majorVersion)) { 17 | return true; 18 | } else { 19 | try { 20 | const localCliVersion: string | null = await getLocalFuncCoreToolsVersion(context, undefined); 21 | if (localCliVersion) { 22 | return semver.gte(localCliVersion, minVersion); 23 | } 24 | } catch { 25 | // use default 26 | } 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/funcCoreTools/tryGetLocalFuncVersion.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import { tryParseFuncVersion, type FuncVersion } from '../FuncVersion'; 8 | import { getLocalFuncCoreToolsVersion } from './getLocalFuncCoreToolsVersion'; 9 | 10 | export async function tryGetLocalFuncVersion(context: IActionContext, workspacePath: string | undefined): Promise { 11 | try { 12 | const version: string | null = await getLocalFuncCoreToolsVersion(context, workspacePath); 13 | if (version) { 14 | return tryParseFuncVersion(version); 15 | } 16 | } catch (err) { 17 | // swallow errors and return undefined 18 | } 19 | 20 | return undefined; 21 | } 22 | -------------------------------------------------------------------------------- /src/localize.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import * as nls from 'vscode-nls'; 7 | 8 | export const localize: nls.LocalizeFunc = nls.loadMessageBundle(); 9 | -------------------------------------------------------------------------------- /src/templates/FunctionV2Template.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/src/templates/FunctionV2Template.ts -------------------------------------------------------------------------------- /src/templates/ITemplates.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IBindingTemplate } from "./IBindingTemplate"; 7 | import { type FunctionTemplateBase } from "./IFunctionTemplate"; 8 | 9 | export interface ITemplates { 10 | functionTemplates: FunctionTemplateBase[]; 11 | bindingTemplates: IBindingTemplate[]; 12 | } 13 | -------------------------------------------------------------------------------- /src/templates/ballerina/getBallerinaVerifiedTemplateIds.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | export function getBallerinaVerifiedTemplateIds(): string[] { 7 | return [ 8 | 'HttpTrigger-Ballerina', 9 | 'BlobTrigger-Ballerina', 10 | 'CosmosDBTrigger-Ballerina', 11 | 'QueueTrigger-Ballerina', 12 | 'TimerTrigger-Ballerina' 13 | ]; 14 | } 15 | -------------------------------------------------------------------------------- /src/templates/java/getJavaVerifiedTemplateIds.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | export function getJavaVerifiedTemplateIds(): string[] { 7 | return [ 8 | 'BlobTrigger-Java', 9 | 'HttpTrigger-Java', 10 | 'QueueTrigger-Java', 11 | 'TimerTrigger-Java' 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /src/tree/IProjectTreeItem.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import { type FuncVersion } from '../FuncVersion'; 8 | import { type IParsedHostJson } from '../funcConfig/host'; 9 | import { type ProjectSource } from './projectContextValues'; 10 | 11 | export type ApplicationSettings = { [propertyName: string]: string }; 12 | 13 | export type FuncHostRequest = { url: string, rejectUnauthorized?: boolean }; 14 | 15 | export interface IProjectTreeItem { 16 | source: ProjectSource; 17 | getHostRequest(context: IActionContext): Promise; 18 | getHostJson(context: IActionContext): Promise; 19 | getVersion(context: IActionContext): Promise; 20 | getApplicationSettings(context: IActionContext): Promise; 21 | setApplicationSetting(context: IActionContext, key: string, value: string): Promise; 22 | } 23 | -------------------------------------------------------------------------------- /src/tree/durableTaskScheduler/DurableTaskSchedulerDashboardModel.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type Uri } from "vscode"; 7 | 8 | export interface DurableTaskSchedulerDashboardModel { 9 | dashboardUrl: Uri; 10 | } 11 | -------------------------------------------------------------------------------- /src/tree/durableTaskScheduler/DurableTaskSchedulerEmulatorsWorkspaceResource.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type WorkspaceResource } from "@microsoft/vscode-azureresources-api"; 7 | 8 | export class DurableTaskSchedulerEmulatorsWorkspaceResource implements WorkspaceResource { 9 | resourceType: string = 'DurableTaskSchedulerEmulator'; 10 | 11 | id: string = 'DurableTaskSchedulerEmulator'; 12 | 13 | name: string = 'DurableTaskSchedulerEmulator'; 14 | } 15 | -------------------------------------------------------------------------------- /src/tree/durableTaskScheduler/DurableTaskSchedulerEndpointModel.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type Uri } from "vscode"; 7 | 8 | export interface DurableTaskSchedulerEndpointModel { 9 | endpointUrl: Uri; 10 | } 11 | -------------------------------------------------------------------------------- /src/tree/durableTaskScheduler/DurableTaskSchedulerErrorWorkspaceResourceModel.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { ThemeIcon, TreeItem } from "vscode"; 7 | import { type DurableTaskSchedulerWorkspaceResourceModel } from "./DurableTaskSchedulerWorkspaceResourceModel"; 8 | 9 | export class DurableTaskSchedulerErrorWorkspaceResourceModel implements DurableTaskSchedulerWorkspaceResourceModel { 10 | constructor( 11 | private readonly error: string) { 12 | } 13 | 14 | getTreeItem(): TreeItem | Thenable { 15 | const treeItem = new TreeItem(this.error); 16 | 17 | treeItem.contextValue = 'azFunc.dts.emulatorError'; 18 | treeItem.iconPath = new ThemeIcon('warning') 19 | 20 | return treeItem; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/tree/durableTaskScheduler/DurableTaskSchedulerModel.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type AzureResourceModel } from "@microsoft/vscode-azureresources-api"; 7 | import { type ProviderResult, type TreeItem } from "vscode"; 8 | 9 | export interface DurableTaskSchedulerModel extends AzureResourceModel { 10 | getChildren(): ProviderResult; 11 | 12 | getTreeItem(): TreeItem | Thenable; 13 | } 14 | -------------------------------------------------------------------------------- /src/tree/durableTaskScheduler/DurableTaskSchedulerTaskHubWorkspaceResourceModel.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { TreeItem, Uri } from "vscode"; 7 | import { type DurableTaskSchedulerWorkspaceResourceModel } from "./DurableTaskSchedulerWorkspaceResourceModel"; 8 | import { treeUtils } from "../../utils/treeUtils"; 9 | import { type DurableTaskSchedulerDashboardModel } from "./DurableTaskSchedulerDashboardModel"; 10 | 11 | export class DurableTaskSchedulerTaskHubWorkspaceResourceModel implements DurableTaskSchedulerWorkspaceResourceModel, DurableTaskSchedulerDashboardModel { 12 | constructor( 13 | private readonly name: string, 14 | private readonly dashboardEndpoint: Uri) { 15 | } 16 | 17 | getTreeItem(): TreeItem | Thenable { 18 | const treeItem = new TreeItem(this.name); 19 | 20 | treeItem.contextValue = 'azFunc.dts.emulatorTaskHub;azFunc.dts.taskHubDashboard'; 21 | treeItem.iconPath = treeUtils.getIconPath('durableTaskScheduler/DurableTaskScheduler'); 22 | 23 | return treeItem; 24 | } 25 | 26 | get dashboardUrl(): Uri { return Uri.joinPath(this.dashboardEndpoint, 'subscriptions/default/schedulers/default/taskhubs', this.name); } 27 | 28 | id?: string | undefined; 29 | } 30 | -------------------------------------------------------------------------------- /src/tree/durableTaskScheduler/DurableTaskSchedulerWorkspaceResourceModel.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type WorkspaceResourceModel } from "@microsoft/vscode-azureresources-api"; 7 | import { type ProviderResult, type TreeItem } from "vscode"; 8 | 9 | export interface DurableTaskSchedulerWorkspaceResourceModel extends WorkspaceResourceModel { 10 | getChildren?(): ProviderResult; 11 | 12 | getTreeItem(): TreeItem | Thenable; 13 | } 14 | -------------------------------------------------------------------------------- /src/tree/durableTaskScheduler/DurableTaskSchedulerWorkspaceResourceProvider.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type WorkspaceResource, type WorkspaceResourceProvider } from "@microsoft/vscode-azureresources-api"; 7 | import { type Event, type ProviderResult } from "vscode"; 8 | import { DurableTaskSchedulerEmulatorsWorkspaceResource } from "./DurableTaskSchedulerEmulatorsWorkspaceResource"; 9 | 10 | export class DurableTaskSchedulerWorkspaceResourceProvider implements WorkspaceResourceProvider { 11 | onDidChangeResource?: Event | undefined; 12 | 13 | getResources(): ProviderResult { 14 | return [ new DurableTaskSchedulerEmulatorsWorkspaceResource() ]; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/tree/localProject/InvalidLocalProjectTreeItem.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type AzExtParentTreeItem, type AzExtTreeItem } from '@microsoft/vscode-azext-utils'; 7 | import { type WorkspaceFolder } from 'vscode'; 8 | import { LocalProjectTreeItemBase } from './LocalProjectTreeItemBase'; 9 | 10 | export class InvalidLocalProjectTreeItem extends LocalProjectTreeItemBase { 11 | public contextValue: string = 'invalidAzFuncLocalProject'; 12 | 13 | private readonly _projectError: unknown | undefined; 14 | 15 | public constructor(parent: AzExtParentTreeItem, projectPath: string, projectError: unknown, folder: WorkspaceFolder) { 16 | super(parent, projectPath, folder); 17 | this._projectError = projectError; 18 | } 19 | 20 | public hasMoreChildrenImpl(): boolean { 21 | return false; 22 | } 23 | 24 | // eslint-disable-next-line @typescript-eslint/require-await 25 | public async loadMoreChildrenImpl(_clearCache: boolean): Promise { 26 | throw this._projectError; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/tree/localProject/LocalFunctionTreeItem.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import { type ILocalFunction } from '../../workspace/LocalFunction'; 8 | import { FunctionTreeItemBase } from '../FunctionTreeItemBase'; 9 | import { type LocalFunctionsTreeItem } from './LocalFunctionsTreeItem'; 10 | 11 | export class LocalFunctionTreeItem extends FunctionTreeItemBase { 12 | public readonly parent: LocalFunctionsTreeItem; 13 | public readonly functionJsonPath: string | undefined; 14 | 15 | private constructor(parent: LocalFunctionsTreeItem, localFunction: ILocalFunction) { 16 | super(parent, localFunction, /* enableProperties: */ localFunction.functionJsonPath !== undefined); 17 | } 18 | 19 | public static async create(context: IActionContext, parent: LocalFunctionsTreeItem, localFunction: ILocalFunction): Promise { 20 | const ti: LocalFunctionTreeItem = new LocalFunctionTreeItem(parent, localFunction); 21 | await ti.initAsync(context); 22 | return ti; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/tree/localProject/createRefreshFileWatcher.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { callWithTelemetryAndErrorHandling, type AzExtTreeItem, type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | import { Disposable, workspace, type FileSystemWatcher } from 'vscode'; 8 | 9 | export function createRefreshFileWatcher(ti: AzExtTreeItem, globPattern: string): Disposable { 10 | const refreshMethod: () => Promise = async (): Promise => { 11 | await callWithTelemetryAndErrorHandling('refreshFileWatcher', async (context: IActionContext) => { 12 | context.errorHandling.suppressDisplay = true; 13 | context.telemetry.suppressIfSuccessful = true; 14 | await ti.refresh(context); 15 | }); 16 | }; 17 | 18 | const watcher: FileSystemWatcher = workspace.createFileSystemWatcher(globPattern); 19 | return Disposable.from( 20 | watcher, 21 | watcher.onDidChange(refreshMethod), 22 | watcher.onDidCreate(refreshMethod), 23 | watcher.onDidDelete(refreshMethod) 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /src/utils/activityUtils.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type ExecuteActivityContext } from "@microsoft/vscode-azext-utils"; 7 | import { ext } from "../extensionVariables"; 8 | import { getWorkspaceSetting } from "../vsCodeConfig/settings"; 9 | 10 | export async function createActivityContext(options?: { withChildren?: boolean }): Promise { 11 | return { 12 | registerActivity: async (activity) => ext.rgApi.registerActivity(activity), 13 | suppressNotification: await getWorkspaceSetting('suppressActivityNotifications', undefined, 'azureResourceGroups'), 14 | activityChildren: options?.withChildren ? [] : undefined, 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /src/utils/cancellation.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { CancellationTokenSource, type CancellationToken } from "vscode"; 7 | import { delay } from "./delay"; 8 | 9 | export async function withCancellation(action: (token: CancellationToken) => Promise, timeoutMs: number): Promise { 10 | 11 | const cts = new CancellationTokenSource(); 12 | 13 | try { 14 | 15 | const asyncWait = action(cts.token); 16 | const delayWait = delay(timeoutMs); 17 | 18 | await Promise.race([asyncWait, delayWait]); 19 | 20 | cts.cancel(); 21 | 22 | return await asyncWait; 23 | } 24 | finally { 25 | cts.dispose(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/utils/delay.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | export async function delay(ms: number): Promise { 7 | await new Promise((resolve: () => void): NodeJS.Timer => setTimeout(resolve, ms)); 8 | } 9 | -------------------------------------------------------------------------------- /src/utils/envUtils.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See LICENSE.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | export namespace envUtils { 7 | export function isEnvironmentVariableSet(val: string | boolean | number | undefined | null): boolean { 8 | return !/^(false|0)?$/i.test(val === undefined || val === null ? '' : String(val)); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/utils/getCoreNodeModule.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See LICENSE.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import * as vscode from 'vscode'; 7 | 8 | /** 9 | * Returns a node module installed with VSCode, or undefined if it fails. 10 | */ 11 | export function getCoreNodeModule(moduleName: string): T | undefined { 12 | try { 13 | // eslint-disable-next-line @typescript-eslint/no-unsafe-return 14 | return require(`${vscode.env.appRoot}/node_modules.asar/${moduleName}`); 15 | } catch (err) { 16 | // ignore 17 | } 18 | 19 | try { 20 | // eslint-disable-next-line @typescript-eslint/no-unsafe-return 21 | return require(`${vscode.env.appRoot}/node_modules/${moduleName}`); 22 | } catch (err) { 23 | // ignore 24 | } 25 | return undefined; 26 | } 27 | -------------------------------------------------------------------------------- /src/utils/gitUtils.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { Uri } from 'vscode'; 7 | import { getGitApi } from '../getExtensionApi'; 8 | import { cpUtils } from './cpUtils'; 9 | 10 | export namespace gitUtils { 11 | const gitCommand: string = 'git'; 12 | export async function isGitInstalled(workingDirectory: string): Promise { 13 | try { 14 | await cpUtils.executeCommand(undefined, workingDirectory, gitCommand, '--version'); 15 | return true; 16 | } catch (error) { 17 | return false; 18 | } 19 | } 20 | 21 | export async function gitInit(workingDirectory: string): Promise { 22 | const gitApi = await getGitApi(); 23 | await gitApi.init(Uri.file(workingDirectory)); 24 | } 25 | 26 | export async function isInsideRepo(workingDirectory: string): Promise { 27 | try { 28 | await cpUtils.executeCommand(undefined, workingDirectory, gitCommand, 'rev-parse', '--git-dir'); 29 | return true; 30 | } catch (error) { 31 | return false; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/utils/gradleUtils.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import * as vscode from 'vscode'; 8 | import { localize } from '../localize'; 9 | import { cpUtils } from './cpUtils'; 10 | 11 | export namespace gradleUtils { 12 | const gradleCommand: string = 'gradle'; 13 | 14 | export async function validateGradleInstalled(context: IActionContext): Promise { 15 | try { 16 | await cpUtils.executeCommand(undefined, undefined, gradleCommand, '--version'); 17 | } catch (error) { 18 | const message: string = localize('gradleNotFound', 'Failed to find "gradle", please ensure that the gradle bin directory is in your system path.'); 19 | 20 | if (!context.errorHandling.suppressDisplay) { 21 | // don't wait 22 | void vscode.window.showErrorMessage(message); 23 | context.errorHandling.suppressDisplay = true; 24 | } 25 | 26 | throw new Error(message); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/utils/javaUtils.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from "@microsoft/vscode-azext-utils"; 7 | import { nonNullProp } from "./nonNull"; 8 | import { requestUtils } from "./requestUtils"; 9 | 10 | export namespace javaUtils { 11 | const cachedVersions: Map = new Map(); 12 | 13 | export async function getLatestArtifactVersionFromMetaData(context: IActionContext, metaDataUrl: string): Promise { 14 | if (!cachedVersions.has(metaDataUrl)) { 15 | const response = await requestUtils.sendRequestWithExtTimeout(context, { method: 'GET', url: metaDataUrl }); 16 | const metaData: string = nonNullProp(response, 'bodyAsText'); 17 | const match: RegExpMatchArray | null = metaData.match(/(.*)<\/release>/i); 18 | if (match) { 19 | cachedVersions.set(metaDataUrl, match[1].trim()); 20 | } 21 | } 22 | return cachedVersions.get(metaDataUrl); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/utils/nodeJsUtils.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { AzExtFsExtra } from "@microsoft/vscode-azext-utils"; 7 | import * as path from 'path'; 8 | import { packageJsonFileName } from "../constants"; 9 | 10 | interface PackageJson { 11 | dependencies?: Record; 12 | devDependencies?: Record; 13 | } 14 | 15 | export async function tryGetPackageJson(projectPath: string): Promise { 16 | try { 17 | return await AzExtFsExtra.readJSON(path.join(projectPath, packageJsonFileName)); 18 | } catch { 19 | return undefined; 20 | } 21 | } 22 | 23 | export async function hasNodeJsDependency(projectPath: string, depName: string, isDevDependency: boolean = false): Promise { 24 | try { 25 | const packageJson = await tryGetPackageJson(projectPath); 26 | if (isDevDependency) { 27 | return !!packageJson?.devDependencies?.[depName]; 28 | } else { 29 | return !!packageJson?.dependencies?.[depName]; 30 | } 31 | } catch { 32 | return false; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/utils/openUrl.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import * as open from 'open'; 7 | 8 | export async function openUrl(url: string): Promise { 9 | // Using this functionality is blocked by https://github.com/Microsoft/vscode/issues/85930 10 | // Specifically, opening the Live Metrics Stream for Linux Function Apps doesn't work in this extension. 11 | // await vscode.env.openExternal(vscode.Uri.parse(url)); 12 | 13 | await open(url); 14 | } 15 | -------------------------------------------------------------------------------- /src/utils/pickAppResource.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type ITreeItemPickerContext } from "@microsoft/vscode-azext-utils"; 7 | import { type PickAppResourceOptions } from "@microsoft/vscode-azext-utils/hostapi"; 8 | import { functionFilter } from "../constants"; 9 | import { ext } from "../extensionVariables"; 10 | import { type SlotTreeItem } from "../tree/SlotTreeItem"; 11 | 12 | export async function pickAppResource(context: ITreeItemPickerContext, options?: PickAppResourceOptions): Promise { 13 | return await ext.rgApi.pickAppResource(context, { 14 | filter: functionFilter, ...options 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /src/utils/pickFunctionApp.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type ITreeItemPickerContext } from "@microsoft/vscode-azext-utils"; 7 | import { type PickAppResourceOptions } from "@microsoft/vscode-azext-utils/hostapi"; 8 | import { localize } from "../localize"; 9 | import { type SlotTreeItem } from "../tree/SlotTreeItem"; 10 | import { pickAppResource } from "./pickAppResource"; 11 | 12 | export async function pickFunctionApp(context: ITreeItemPickerContext, options?: PickAppResourceOptions): Promise { 13 | const functionApp = await pickAppResource(context, options); 14 | 15 | if (functionApp.contextValue.includes('container')) { 16 | throw new Error(localize('containerFunctionAppError', 'Cannot perform this action on a containerized function app.')); 17 | } else { 18 | return functionApp; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/utils/programmingModelUtils.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { ProjectLanguage } from "../constants"; 7 | 8 | export function isPythonV2Plus(language: string | undefined, model: number | undefined): boolean { 9 | return language === ProjectLanguage.Python && model !== undefined && model > 1; 10 | } 11 | 12 | export const nodeV4Suffix = '-4.x'; 13 | 14 | export function isNodeV4Plus(context: { language?: ProjectLanguage | string, languageModel?: number }): boolean { 15 | const { language, languageModel } = context; 16 | return (language === ProjectLanguage.JavaScript || language === ProjectLanguage.TypeScript) && 17 | languageModel !== undefined && languageModel === 4; 18 | } 19 | -------------------------------------------------------------------------------- /src/utils/telemetryUtils.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type IActionContext } from '@microsoft/vscode-azext-utils'; 7 | 8 | export namespace telemetryUtils { 9 | export async function runWithDurationTelemetry(context: IActionContext, prefix: string, callback: () => Promise): Promise { 10 | const start = Date.now(); 11 | try { 12 | return await callback(); 13 | } finally { 14 | const end = Date.now(); 15 | const durationKey = prefix + 'Duration'; 16 | const countKey = prefix + 'Count'; 17 | const duration = (end - start) / 1000; 18 | 19 | context.telemetry.measurements[durationKey] = duration + (context.telemetry.measurements[durationKey] || 0); 20 | context.telemetry.measurements[countKey] = 1 + (context.telemetry.measurements[countKey] || 0); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/utils/treeUtils.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { type AzExtTreeItem, type TreeItemIconPath } from '@microsoft/vscode-azext-utils'; 7 | import * as path from 'path'; 8 | import { ext } from '../extensionVariables'; 9 | 10 | export namespace treeUtils { 11 | export function getIconPath(iconName: string): string { 12 | return path.join(getResourcesPath(), `${iconName}.svg`); 13 | } 14 | 15 | export function getThemedIconPath(iconName: string): TreeItemIconPath { 16 | return { 17 | light: path.join(getResourcesPath(), 'light', `${iconName}.svg`), 18 | dark: path.join(getResourcesPath(), 'dark', `${iconName}.svg`) 19 | }; 20 | } 21 | 22 | function getResourcesPath(): string { 23 | return ext.context.asAbsolutePath('resources'); 24 | } 25 | 26 | // replace with azext-utils when it's released 27 | export function isAzExtTreeItem(ti: unknown): ti is AzExtTreeItem { 28 | return !!ti && (ti as AzExtTreeItem).fullId !== undefined && (ti as AzExtTreeItem).fullId !== null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/vsCodeConfig/README.md: -------------------------------------------------------------------------------- 1 | This folder contains logic related to VS Code project files, like "settings.json", "tasks.json", and "launch.json". 2 | -------------------------------------------------------------------------------- /src/vsCodeConfig/extensions.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | export interface IExtensionsJson { 7 | recommendations?: string[]; 8 | } 9 | -------------------------------------------------------------------------------- /src/vscode-azurecontainerapps.api.d.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | export interface AzureContainerAppsExtensionApi { 7 | apiVersion: string; 8 | deployWorkspaceProject(options: DeployWorkspaceProjectOptionsContract): Promise; 9 | } 10 | 11 | export interface DeployWorkspaceProjectOptionsContract { 12 | // Existing resources 13 | subscriptionId?: string; 14 | resourceGroupId?: string; 15 | 16 | // Workspace deployment paths (absolute fs path) 17 | rootPath?: string; 18 | srcPath?: string; 19 | dockerfilePath?: string; 20 | 21 | // Options 22 | suppressConfirmation?: boolean; // Suppress any [resource] confirmation prompts 23 | suppressContainerAppCreation?: boolean; 24 | ignoreExistingDeploySettings?: boolean; 25 | shouldSaveDeploySettings?: boolean; 26 | } 27 | 28 | export interface DeployWorkspaceProjectResults { 29 | resourceGroupId?: string; 30 | logAnalyticsWorkspaceId?: string; 31 | managedEnvironmentId?: string; 32 | containerAppId?: string; 33 | 34 | // ACR 35 | registryId?: string; 36 | registryLoginServer?: string; 37 | registryUsername?: string; 38 | registryPassword?: string; 39 | imageName?: string; 40 | } 41 | -------------------------------------------------------------------------------- /test/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "extends": [ 3 | "@microsoft/eslint-config-azuretools", 4 | "@microsoft/eslint-config-azuretools/test" 5 | ] 6 | }; 7 | -------------------------------------------------------------------------------- /test/assertThrowsAsync.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See LICENSE.md in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import * as assert from 'assert'; 7 | 8 | /** 9 | * Same as assert.throws except for async functions 10 | */ 11 | export async function assertThrowsAsync(block: () => Promise, error: RegExp | Function, message?: string): Promise { 12 | let blockSync = (): void => { /* ignore */ }; 13 | try { 14 | await block(); 15 | } catch (e) { 16 | blockSync = (): void => { throw e; }; 17 | } finally { 18 | assert.throws(blockSync, error, message); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/convertToValidPackageName.test.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import * as assert from 'assert'; 7 | import { convertToValidPackageName } from '../extension.bundle'; 8 | 9 | suite('convertToValidPackageName', () => { 10 | const testCases: [string, string, string][] = [ 11 | ['Valid name', 'js1', 'js1'], 12 | ['Invalid casing', 'JS1', 'js1'], 13 | ['Invalid trailing/leading whitespace', ' js1 ', 'js1'], 14 | ['Invalid characters', 'js%$?1', 'js---1'], 15 | ['Invalid first character "."', '.js1', '-js1'], 16 | ['Invalid first character "_"', '_js1', '-js1'], 17 | ['Valid name where "." and "_" aren\'t first', 'js._1', 'js._1'], 18 | ]; 19 | 20 | for (const [testCaseName, name, expected] of testCases) { 21 | test(testCaseName, () => { 22 | assert.equal(convertToValidPackageName(name), expected); 23 | }); 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /test/envUtils.test.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import * as assert from 'assert'; 7 | import { envUtils } from '../extension.bundle'; 8 | 9 | suite('envUtils', () => { 10 | test('isEnvironmentVariableSet', () => { 11 | const trueValues = [ 12 | true, 13 | 'true', 14 | 1, 15 | '1', 16 | 'tRue', 17 | 'anyotherstring', 18 | 2 19 | ]; 20 | 21 | for (const val of trueValues) { 22 | assert.equal(envUtils.isEnvironmentVariableSet(val), true); 23 | } 24 | 25 | const falseValues = [ 26 | undefined, 27 | null, 28 | '', 29 | false, 30 | 'false', 31 | 0, 32 | '0', 33 | 'fAlse' 34 | ]; 35 | 36 | for (const val of falseValues) { 37 | assert.equal(envUtils.isEnvironmentVariableSet(val), false); 38 | } 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /test/hasMinFuncCliVersion.test.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { createTestActionContext } from '@microsoft/vscode-azext-dev'; 7 | import * as assert from 'assert'; 8 | import { FuncVersion, hasMinFuncCliVersion } from '../extension.bundle'; 9 | 10 | suite('hasMinFuncCliVersion', () => { 11 | test('Smaller major version', async () => { 12 | const result: boolean = await hasMinFuncCliVersion(await createTestActionContext(), '2.0.3', FuncVersion.v1); 13 | assert.strictEqual(result, false); 14 | }); 15 | 16 | test('Greater major version', async () => { 17 | const result: boolean = await hasMinFuncCliVersion(await createTestActionContext(), '2.0.3', FuncVersion.v3); 18 | assert.strictEqual(result, true); 19 | }); 20 | 21 | test('Same major version, meets minimum', async () => { 22 | const result: boolean = await hasMinFuncCliVersion(await createTestActionContext(), '3.0.0', FuncVersion.v3); 23 | assert.strictEqual(result, true); 24 | }); 25 | 26 | test('Same major version, doesn\'t meet minimum', async () => { 27 | const result: boolean = await hasMinFuncCliVersion(await createTestActionContext(), '4.9999.0', FuncVersion.v4); 28 | assert.strictEqual(result, false); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /test/runWithSetting.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | import { ext, getGlobalSetting, updateGlobalSetting } from "../extension.bundle"; 7 | 8 | type SettingValue = {} | string | boolean | undefined; 9 | 10 | export async function runWithFuncSetting(key: string, value: SettingValue, callback: () => Promise): Promise { 11 | await runWithSettingInternal(key, value, ext.prefix, callback); 12 | } 13 | 14 | export async function runWithSetting(key: string, value: SettingValue, callback: () => Promise): Promise { 15 | await runWithSettingInternal(key, value, '', callback); 16 | } 17 | 18 | async function runWithSettingInternal(key: string, value: SettingValue, prefix: string, callback: () => Promise): Promise { 19 | const oldValue: SettingValue = getGlobalSetting(key, prefix); 20 | try { 21 | await updateGlobalSetting(key, value, prefix); 22 | await callback(); 23 | } finally { 24 | await updateGlobalSetting(key, oldValue, prefix); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/test.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "../testWorkspace/0" 5 | }, 6 | { 7 | "path": "../testWorkspace/1" 8 | }, 9 | { 10 | "path": "../testWorkspace/2" 11 | }, 12 | { 13 | "path": "../testWorkspace/3" 14 | }, 15 | { 16 | "path": "../testWorkspace/4" 17 | }, 18 | { 19 | "path": "../testWorkspace/5" 20 | }, 21 | { 22 | "path": "../testWorkspace/6" 23 | }, 24 | { 25 | "path": "../testWorkspace/7" 26 | }, 27 | { 28 | "path": "../testWorkspace/8" 29 | }, 30 | { 31 | "path": "../testWorkspace/9" 32 | } 33 | ], 34 | "settings": { 35 | "debug.internalConsoleOptions": "neverOpen", 36 | "azureFunctions.showHiddenStacks": true, 37 | "azureFunctions.requestTimeout": 180 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tools/JsonCli/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-dotnettools.csharp" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /tools/JsonCli/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "editor.insertSpaces": true, 4 | "editor.tabSize": 4, 5 | "files.insertFinalNewline": true, 6 | "files.trimTrailingWhitespace": true, 7 | "search.exclude": { 8 | "bin": true, 9 | "obj": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tools/JsonCli/resources/FinalPublicKey.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-azurefunctions/f77329f843dd2d4e7465af1a2fa918fba129061a/tools/JsonCli/resources/FinalPublicKey.snk -------------------------------------------------------------------------------- /tools/JsonCli/src/Microsoft.TemplateEngine.JsonCli.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0;net7.0;net8.0 6 | true 7 | ..\resources\FinalPublicKey.snk 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tools/JsonCli/src/Package.cs: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | using System; 7 | 8 | namespace Microsoft.TemplateEngine.JsonCli 9 | { 10 | internal class Package 11 | { 12 | public string Name { get; } 13 | 14 | public string Version { get; } 15 | 16 | public Package(string name, string version) 17 | { 18 | Name = name; 19 | Version = version; 20 | } 21 | 22 | public static bool TryParse(string spec, out Package package) 23 | { 24 | int index; 25 | if (string.IsNullOrEmpty(spec) || (index = spec.IndexOf("::", StringComparison.Ordinal)) < 0 || index == spec.Length - 1) 26 | { 27 | package = null; 28 | return false; 29 | } 30 | 31 | string name = spec.Substring(0, index); 32 | string version = spec.Substring(index + 2); 33 | 34 | package = new Package(name, version); 35 | return true; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tools/JsonCli/src/Signing.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Library 6 | net6.0;net7.0 7 | 8 | $(DefaultItemExcludes);**/*.cs 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Microsoft400 20 | StrongName 21 | 22 | 23 | 3PartySHA2 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tools/JsonCli/src/nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es2018", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": ".", 11 | "noUnusedLocals": true, 12 | "noImplicitThis": true, 13 | "noImplicitReturns": true, 14 | "strictNullChecks": true, 15 | "noUnusedParameters": true, 16 | "baseUrl": "./", 17 | "paths": { 18 | "*": [ 19 | "node_modules/@types/*", 20 | "*" 21 | ] 22 | } 23 | }, 24 | "exclude": [ 25 | "node_modules", 26 | ".vscode-test", 27 | "gulpfile.ts" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /vscode.proposed.authLearnMore.d.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | declare module 'vscode' { 7 | 8 | // https://github.com/microsoft/vscode/issues/206587 9 | 10 | export interface AuthenticationGetSessionPresentationOptions { 11 | /** 12 | * An optional Uri to open in the browser to learn more about this authentication request. 13 | */ 14 | learnMore?: Uri; 15 | } 16 | } 17 | 18 | // this proposed api is only included because vscode.proposed.authenticationChallenges.d.ts depends on it 19 | --------------------------------------------------------------------------------