import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { VirtualMachines } 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 { VirtualMachine , VirtualMachinesListByLocationNextOptionalParams , VirtualMachinesListByLocationOptionalParams , VirtualMachinesListNextOptionalParams , VirtualMachinesListOptionalParams , VirtualMachinesListAllNextOptionalParams , VirtualMachinesListAllOptionalParams , VirtualMachineSize , VirtualMachinesListAvailableSizesOptionalParams , VirtualMachinesListByLocationResponse , VirtualMachineCaptureParameters , VirtualMachinesCaptureOptionalParams , VirtualMachinesCaptureResponse , VirtualMachinesCreateOrUpdateOptionalParams , VirtualMachinesCreateOrUpdateResponse , VirtualMachineUpdate , VirtualMachinesUpdateOptionalParams , VirtualMachinesUpdateResponse , VirtualMachinesDeleteOptionalParams , VirtualMachinesGetOptionalParams , VirtualMachinesGetResponse , VirtualMachinesInstanceViewOptionalParams , VirtualMachinesInstanceViewResponse , VirtualMachinesConvertToManagedDisksOptionalParams , VirtualMachinesDeallocateOptionalParams , VirtualMachinesGeneralizeOptionalParams , VirtualMachinesListResponse , VirtualMachinesListAllResponse , VirtualMachinesListAvailableSizesResponse , VirtualMachinesPowerOffOptionalParams , VirtualMachinesReapplyOptionalParams , VirtualMachinesRestartOptionalParams , VirtualMachinesStartOptionalParams , VirtualMachinesRedeployOptionalParams , VirtualMachinesReimageOptionalParams , VirtualMachinesRetrieveBootDiagnosticsDataOptionalParams , VirtualMachinesRetrieveBootDiagnosticsDataResponse , VirtualMachinesPerformMaintenanceOptionalParams , VirtualMachinesSimulateEvictionOptionalParams , VirtualMachinesAssessPatchesOptionalParams , VirtualMachinesAssessPatchesResponse , VirtualMachineInstallPatchesParameters , VirtualMachinesInstallPatchesOptionalParams , VirtualMachinesInstallPatchesResponse , RunCommandInput , VirtualMachinesRunCommandOptionalParams , VirtualMachinesRunCommandResponse , VirtualMachinesListByLocationNextResponse , VirtualMachinesListNextResponse , VirtualMachinesListAllNextResponse } from "../models" ; /** Class containing VirtualMachines operations. */ export class VirtualMachinesImpl implements VirtualMachines { private readonly client : ComputeManagementClient ; param client constructor ( client ) { this . client = client ; } param location param options public listByLocation ( location , options ? ) { const iter = this . listByLocationPagingAll ( location , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listByLocationPagingPage ( location , options ) ; } } ; } private async * listByLocationPagingPage ( location , options ? ) { let result = await this . _listByLocation ( location , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listByLocationNext ( location , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listByLocationPagingAll ( location , options ? ) { for await ( const page of this . listByLocationPagingPage ( location , options ) ) { yield * page ; } } param resourceGroupName param options public list ( resourceGroupName , options ? ) { const iter = this . listPagingAll ( resourceGroupName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listPagingPage ( resourceGroupName , options ) ; } } ; } private async * listPagingPage ( resourceGroupName , options ? ) { let result = await this . _list ( resourceGroupName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listNext ( resourceGroupName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listPagingAll ( resourceGroupName , options ? ) { for await ( const page of this . listPagingPage ( resourceGroupName , options ) ) { yield * page ; } } param options public listAll ( options ? ) { const iter = this . listAllPagingAll ( options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listAllPagingPage ( options ) ; } } ; } private async * listAllPagingPage ( options ? ) { let result = await this . _listAll ( options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listAllNext ( continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listAllPagingAll ( options ? ) { for await ( const page of this . listAllPagingPage ( options ) ) { yield * page ; } } param resourceGroupName param vmName param options public listAvailableSizes ( resourceGroupName , vmName , options ? ) { const iter = this . listAvailableSizesPagingAll ( resourceGroupName , vmName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listAvailableSizesPagingPage ( resourceGroupName , vmName , options ) ; } } ; } private async * listAvailableSizesPagingPage ( resourceGroupName , vmName , options ? ) { let result = await this . _listAvailableSizes ( resourceGroupName , vmName , options ) ; yield result . value || [ ] ; } private async * listAvailableSizesPagingAll ( resourceGroupName , vmName , options ? ) { for await ( const page of this . listAvailableSizesPagingPage ( resourceGroupName , vmName , options ) ) { yield * page ; } } param location param options private _listByLocation ( location , options ? ) { return this . client . sendOperationRequest ( { location , options } , listByLocationOperationSpec ) ; } param resourceGroupName param vmName param parameters param options async beginCapture ( resourceGroupName , vmName , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VirtualMachinesCaptureResponse > => { 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 , vmName , parameters , options } , captureOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "location" } ) ; } param resourceGroupName param vmName param parameters param options async beginCaptureAndWait ( resourceGroupName , vmName , parameters , options ? ) { const poller = await this . beginCapture ( resourceGroupName , vmName , parameters , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param parameters param options async beginCreateOrUpdate ( resourceGroupName , vmName , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VirtualMachinesCreateOrUpdateResponse > => { 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 , vmName , parameters , options } , createOrUpdateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param parameters param options async beginCreateOrUpdateAndWait ( resourceGroupName , vmName , parameters , options ? ) { const poller = await this . beginCreateOrUpdate ( resourceGroupName , vmName , parameters , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param parameters param options async beginUpdate ( resourceGroupName , vmName , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VirtualMachinesUpdateResponse > => { 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 , vmName , parameters , options } , updateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param parameters param options async beginUpdateAndWait ( resourceGroupName , vmName , parameters , options ? ) { const poller = await this . beginUpdate ( resourceGroupName , vmName , parameters , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options async beginDelete ( resourceGroupName , vmName , 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 , vmName , options } , deleteOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param options async beginDeleteAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginDelete ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options get ( resourceGroupName , vmName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmName , options } , getOperationSpec ) ; } param resourceGroupName param vmName param options instanceView ( resourceGroupName , vmName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmName , options } , instanceViewOperationSpec ) ; } param resourceGroupName param vmName param options async beginConvertToManagedDisks ( resourceGroupName , vmName , 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 , vmName , options } , convertToManagedDisksOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param options async beginConvertToManagedDisksAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginConvertToManagedDisks ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options async beginDeallocate ( resourceGroupName , vmName , 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 , vmName , options } , deallocateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param options async beginDeallocateAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginDeallocate ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options generalize ( resourceGroupName , vmName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmName , options } , generalizeOperationSpec ) ; } param resourceGroupName param options private _list ( resourceGroupName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , options } , listOperationSpec ) ; } param options private _listAll ( options ? ) { return this . client . sendOperationRequest ( { options } , listAllOperationSpec ) ; } param resourceGroupName param vmName param options private _listAvailableSizes ( resourceGroupName , vmName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmName , options } , listAvailableSizesOperationSpec ) ; } param resourceGroupName param vmName param options async beginPowerOff ( resourceGroupName , vmName , 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 , vmName , options } , powerOffOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param options async beginPowerOffAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginPowerOff ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options async beginReapply ( resourceGroupName , vmName , 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 , vmName , options } , reapplyOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param options async beginReapplyAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginReapply ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options async beginRestart ( resourceGroupName , vmName , 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 , vmName , options } , restartOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param options async beginRestartAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginRestart ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options async beginStart ( resourceGroupName , vmName , 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 , vmName , options } , startOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param options async beginStartAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginStart ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options async beginRedeploy ( resourceGroupName , vmName , 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 , vmName , options } , redeployOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param options async beginRedeployAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginRedeploy ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options async beginReimage ( resourceGroupName , vmName , 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 , vmName , options } , reimageOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param options async beginReimageAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginReimage ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options retrieveBootDiagnosticsData ( resourceGroupName , vmName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmName , options } , retrieveBootDiagnosticsDataOperationSpec ) ; } param resourceGroupName param vmName param options async beginPerformMaintenance ( resourceGroupName , vmName , 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 , vmName , options } , performMaintenanceOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param options async beginPerformMaintenanceAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginPerformMaintenance ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param options simulateEviction ( resourceGroupName , vmName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmName , options } , simulateEvictionOperationSpec ) ; } param resourceGroupName param vmName param options async beginAssessPatches ( resourceGroupName , vmName , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VirtualMachinesAssessPatchesResponse > => { 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 , vmName , options } , assessPatchesOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "location" } ) ; } param resourceGroupName param vmName param options async beginAssessPatchesAndWait ( resourceGroupName , vmName , options ? ) { const poller = await this . beginAssessPatches ( resourceGroupName , vmName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param installPatchesInput param options async beginInstallPatches ( resourceGroupName , vmName , installPatchesInput , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VirtualMachinesInstallPatchesResponse > => { 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 , vmName , installPatchesInput , options } , installPatchesOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "location" } ) ; } param resourceGroupName param vmName param installPatchesInput param options async beginInstallPatchesAndWait ( resourceGroupName , vmName , installPatchesInput , options ? ) { const poller = await this . beginInstallPatches ( resourceGroupName , vmName , installPatchesInput , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param parameters param options async beginRunCommand ( resourceGroupName , vmName , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VirtualMachinesRunCommandResponse > => { 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 , vmName , parameters , options } , runCommandOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "location" } ) ; } param resourceGroupName param vmName param parameters param options async beginRunCommandAndWait ( resourceGroupName , vmName , parameters , options ? ) { const poller = await this . beginRunCommand ( resourceGroupName , vmName , parameters , options ) ; return poller . pollUntilDone ( ) ; } param location param nextLink param options private _listByLocationNext ( location , nextLink , options ? ) { return this . client . sendOperationRequest ( { location , nextLink , options } , listByLocationNextOperationSpec ) ; } param resourceGroupName param nextLink param options private _listNext ( resourceGroupName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , nextLink , options } , listNextOperationSpec ) ; } param nextLink param options private _listAllNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listAllNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const listByLocationOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineListResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . location1 ] , headerParameters : [ Parameters . accept ] , serializer } ; const captureOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineCaptureResult } , 201 : { bodyMapper : Mappers . VirtualMachineCaptureResult } , 202 : { bodyMapper : Mappers . VirtualMachineCaptureResult } , 204 : { bodyMapper : Mappers . VirtualMachineCaptureResult } } , requestBody : Parameters . parameters10 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . VirtualMachine } , 201 : { bodyMapper : Mappers . VirtualMachine } , 202 : { bodyMapper : Mappers . VirtualMachine } , 204 : { bodyMapper : Mappers . VirtualMachine } } , requestBody : Parameters . parameters11 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const updateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . VirtualMachine } , 201 : { bodyMapper : Mappers . VirtualMachine } , 202 : { bodyMapper : Mappers . VirtualMachine } , 204 : { bodyMapper : Mappers . VirtualMachine } } , requestBody : Parameters . parameters12 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" , httpMethod : "DELETE" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion , Parameters . forceDeletion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachine } } , queryParameters : [ Parameters . apiVersion , Parameters . expand1 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept ] , serializer } ; const instanceViewOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineInstanceView } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept ] , serializer } ; const convertToManagedDisksOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , serializer } ; const deallocateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion , Parameters . hibernate ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , serializer } ; const generalizeOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize" , httpMethod : "POST" , responses : { 200 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineListResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAllOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineListResult } } , queryParameters : [ Parameters . apiVersion , Parameters . statusOnly ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAvailableSizesOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineSizeListResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept ] , serializer } ; const powerOffOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion , Parameters . skipShutdown ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , serializer } ; const reapplyOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept ] , serializer } ; const restartOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , serializer } ; const startOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , serializer } ; const redeployOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , serializer } ; const reimageOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . parameters13 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const retrieveBootDiagnosticsDataOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . RetrieveBootDiagnosticsDataResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion , Parameters . sasUriExpirationTimeInMinutes ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept ] , serializer } ; const performMaintenanceOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , serializer } ; const simulateEvictionOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction" , httpMethod : "POST" , responses : { 204 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , serializer } ; const assessPatchesOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineAssessPatchesResult } , 201 : { bodyMapper : Mappers . VirtualMachineAssessPatchesResult } , 202 : { bodyMapper : Mappers . VirtualMachineAssessPatchesResult } , 204 : { bodyMapper : Mappers . VirtualMachineAssessPatchesResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept ] , serializer } ; const installPatchesOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineInstallPatchesResult } , 201 : { bodyMapper : Mappers . VirtualMachineInstallPatchesResult } , 202 : { bodyMapper : Mappers . VirtualMachineInstallPatchesResult } , 204 : { bodyMapper : Mappers . VirtualMachineInstallPatchesResult } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . installPatchesInput , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const runCommandOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . RunCommandResult } , 201 : { bodyMapper : Mappers . RunCommandResult } , 202 : { bodyMapper : Mappers . RunCommandResult } , 204 : { bodyMapper : Mappers . RunCommandResult } } , requestBody : Parameters . parameters14 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . contentType , Parameters . accept1 ] , mediaType : "json" , serializer } ; const listByLocationNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineListResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . nextLink , Parameters . location1 ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineListResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAllNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineListResult } } , queryParameters : [ Parameters . apiVersion , Parameters . statusOnly ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ;