import { ApiManagementModels } from "@azure/arm-apimanagement" ; import { AzureTreeItem } from "vscode-azureextensionui" ; import { emptyPolicyXml , policyFormat } from "../../../constants" ; import { IApiTreeRoot } from "../../IApiTreeRoot" ; import { BasePolicyEditor } from "./BasePolicyEditor" ; export class ApiPolicyEditor extends BasePolicyEditor < IApiTreeRoot > { public async getPolicy ( context ) { const policy = await context . root . client . apiPolicy . get ( context . root . resourceGroupName , context . root . serviceName , context . root . apiName , { format : policyFormat } ) ; return policy . _response . bodyAsText ; } public async updatePolicy ( context , policy ) { const policyResult = await context . root . client . apiPolicy . createOrUpdate ( context . root . resourceGroupName , context . root . serviceName , context . root . apiName , policy ) ; return policyResult . _response . bodyAsText ; } public getDefaultPolicy ( ) { return emptyPolicyXml ; } }