import type { WebSiteManagementClient , WebSiteManagementModels } from '@azure/arm-appservice' ; import { LocationListStep } from 'vscode-azureextensionui' ; import { webProvider } from '../constants' ; import { createWebSiteClient } from '../utils/azureClients' ; import { nonNullProp } from '../utils/nonNull' ; import { AppKind , WebsiteOS } from './AppKind' ; import { IAppServiceWizardContext } from './IAppServiceWizardContext' ; /**
 * Overwrite the generic 'locationsTask' with a list of locations specific to provider "Microsoft.Web", based on OS and sku
 */ export async function setLocationsTask ( context ) { LocationListStep . setLocationSubset ( context , getWebLocations ( context ) , webProvider ) ; } export async function getWebLocations ( context ) { let options = { } ; if ( context . newSiteOS === WebsiteOS . linux ) { if ( context . newSiteKind === AppKind . functionapp && context . useConsumptionPlan ) { options = { linuxDynamicWorkersEnabled : true } ; } else { options = { linuxWorkersEnabled : true } ; } } if ( context . newPlanSku && context . newPlanSku . tier ) { options . sku = < WebSiteManagementModels . SkuName > context . newPlanSku . tier . replace ( /\s/g , '' ) ; } const client = await createWebSiteClient ( context ) ; const locations = await client . listGeoRegions ( options ) ; return locations . map ( l => nonNullProp ( l , 'name' ) ) ; }