import { VpnSitesConfiguration } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { NetworkManagementClient } from "../networkManagementClient" ; import { PollerLike , PollOperationState , LroEngine } from "@azure/core-lro" ; import { LroImpl } from "../lroImpl" ; import { GetVpnSitesConfigurationRequest , VpnSitesConfigurationDownloadOptionalParams } from "../models" ; /** Class containing VpnSitesConfiguration operations. */ export class VpnSitesConfigurationImpl implements VpnSitesConfiguration { private readonly client : NetworkManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param virtualWANName param request param options async beginDownload ( resourceGroupName , virtualWANName , request , options ? ) { const directSendOperation = async ( args , spec ) : Promise < void > => { return this . client . sendOperationRequest ( args , spec ) ; } ; const sendOperation = async ( args , spec ) => { let currentRawResponse = undefined ; const providedCallback = args . options ?. onResponse ; const callback = ( rawResponse , flatResponse ) => { currentRawResponse = rawResponse ; providedCallback ?. ( rawResponse , flatResponse ) ; } ; const updatedArgs = { ... args , options : { ... args . options , onResponse : callback } } ; const flatResponse = await directSendOperation ( updatedArgs , spec ) ; return { flatResponse , rawResponse : { statusCode : currentRawResponse ! . status , body : currentRawResponse ! . parsedBody , headers : currentRawResponse ! . headers . toJSON ( ) } } ; } ; const lro = new LroImpl ( sendOperation , { resourceGroupName , virtualWANName , request , options } , downloadOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "location" } ) ; } param resourceGroupName param virtualWANName param request param options async beginDownloadAndWait ( resourceGroupName , virtualWANName , request , options ? ) { const poller = await this . beginDownload ( resourceGroupName , virtualWANName , request , options ) ; return poller . pollUntilDone ( ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const downloadOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnConfiguration" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . request2 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . virtualWANName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ;