import { LogAnalytics } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { ComputeManagementClient } from "../computeManagementClient" ; import { PollerLike , PollOperationState , LroEngine } from "@azure/core-lro" ; import { LroImpl } from "../lroImpl" ; import { RequestRateByIntervalInput , LogAnalyticsExportRequestRateByIntervalOptionalParams , LogAnalyticsExportRequestRateByIntervalResponse , ThrottledRequestsInput , LogAnalyticsExportThrottledRequestsOptionalParams , LogAnalyticsExportThrottledRequestsResponse } from "../models" ; /** Class containing LogAnalytics operations. */ export class LogAnalyticsImpl implements LogAnalytics { private readonly client : ComputeManagementClient ; param client constructor ( client ) { this . client = client ; } param location param parameters param options async beginExportRequestRateByInterval ( location , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < LogAnalyticsExportRequestRateByIntervalResponse > => { 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 , { location , parameters , options } , exportRequestRateByIntervalOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "azure-async-operation" } ) ; } param location param parameters param options async beginExportRequestRateByIntervalAndWait ( location , parameters , options ? ) { const poller = await this . beginExportRequestRateByInterval ( location , parameters , options ) ; return poller . pollUntilDone ( ) ; } param location param parameters param options async beginExportThrottledRequests ( location , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < LogAnalyticsExportThrottledRequestsResponse > => { 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 , { location , parameters , options } , exportThrottledRequestsOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "azure-async-operation" } ) ; } param location param parameters param options async beginExportThrottledRequestsAndWait ( location , parameters , options ? ) { const poller = await this . beginExportThrottledRequests ( location , parameters , options ) ; return poller . pollUntilDone ( ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const exportRequestRateByIntervalOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . LogAnalyticsOperationResult } , 201 : { bodyMapper : Mappers . LogAnalyticsOperationResult } , 202 : { bodyMapper : Mappers . LogAnalyticsOperationResult } , 204 : { bodyMapper : Mappers . LogAnalyticsOperationResult } } , requestBody : Parameters . parameters29 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . location1 ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const exportThrottledRequestsOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . LogAnalyticsOperationResult } , 201 : { bodyMapper : Mappers . LogAnalyticsOperationResult } , 202 : { bodyMapper : Mappers . LogAnalyticsOperationResult } , 204 : { bodyMapper : Mappers . LogAnalyticsOperationResult } } , requestBody : Parameters . parameters30 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . location1 ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ;