import { RestorePoints } 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 { RestorePoint , RestorePointsCreateOptionalParams , RestorePointsCreateResponse , RestorePointsDeleteOptionalParams , RestorePointsGetOptionalParams , RestorePointsGetResponse } from "../models" ; /** Class containing RestorePoints operations. */ export class RestorePointsImpl implements RestorePoints { private readonly client : ComputeManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param restorePointCollectionName param restorePointName param parameters param options async beginCreate ( resourceGroupName , restorePointCollectionName , restorePointName , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < RestorePointsCreateResponse > => { 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 , restorePointCollectionName , restorePointName , parameters , options } , createOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param restorePointCollectionName param restorePointName param parameters param options async beginCreateAndWait ( resourceGroupName , restorePointCollectionName , restorePointName , parameters , options ? ) { const poller = await this . beginCreate ( resourceGroupName , restorePointCollectionName , restorePointName , parameters , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param restorePointCollectionName param restorePointName param options async beginDelete ( resourceGroupName , restorePointCollectionName , restorePointName , 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 , restorePointCollectionName , restorePointName , options } , deleteOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param restorePointCollectionName param restorePointName param options async beginDeleteAndWait ( resourceGroupName , restorePointCollectionName , restorePointName , options ? ) { const poller = await this . beginDelete ( resourceGroupName , restorePointCollectionName , restorePointName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param restorePointCollectionName param restorePointName param options get ( resourceGroupName , restorePointCollectionName , restorePointName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , restorePointCollectionName , restorePointName , options } , getOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const createOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . RestorePoint } , 201 : { bodyMapper : Mappers . RestorePoint } , 202 : { bodyMapper : Mappers . RestorePoint } , 204 : { bodyMapper : Mappers . RestorePoint } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . parameters23 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . restorePointCollectionName , Parameters . restorePointName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" , httpMethod : "DELETE" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . restorePointCollectionName , Parameters . restorePointName ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . RestorePoint } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . restorePointCollectionName , Parameters . restorePointName ] , headerParameters : [ Parameters . accept ] , serializer } ;