import { callWithTelemetryAndErrorHandling } from "vscode-azureextensionui" ; import { ext } from "../extensionVariables" ; import { assert } from "../fixed_assert" ; import { CaseInsensitiveMap } from "../util/CaseInsensitiveMap" ; import { waitForLanguageServerAvailable } from "./startArmLanguageServer" ; param schema export async function getAvailableResourceTypesAndVersionsNoThrow ( schema ) { try { const map = new CaseInsensitiveMap < string , string [ ] > ( ) ; await callWithTelemetryAndErrorHandling ( "getAvailableResourceTypesAndVersions" , async ( ) => { await waitForLanguageServerAvailable ( ) ; const resourceTypes = < { [ key ] : string [ ] ; } > await ext . languageServerClient ?. sendRequest ( "arm-template/getAvailableResourceTypesAndVersions" , { Schema : schema } ) ; for ( const entry of Object . entries ( resourceTypes ) ) { const key = entry [ 0 ] ; const value = entry [ 1 ] . map ( apiVersion => apiVersion . toLowerCase ( ) ) ; map . set ( key , value ) ; } } ) ; return map ; } catch ( err ) { assert . fail ( "getAvailableResourceTypesAndVersionsNoThrow shouldn't throw" ) ; } }