import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { VirtualMachineScaleSets } 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 { VirtualMachineScaleSet , VirtualMachineScaleSetsListByLocationNextOptionalParams , VirtualMachineScaleSetsListByLocationOptionalParams , VirtualMachineScaleSetsListNextOptionalParams , VirtualMachineScaleSetsListOptionalParams , VirtualMachineScaleSetsListAllNextOptionalParams , VirtualMachineScaleSetsListAllOptionalParams , VirtualMachineScaleSetSku , VirtualMachineScaleSetsListSkusNextOptionalParams , VirtualMachineScaleSetsListSkusOptionalParams , UpgradeOperationHistoricalStatusInfo , VirtualMachineScaleSetsGetOSUpgradeHistoryNextOptionalParams , VirtualMachineScaleSetsGetOSUpgradeHistoryOptionalParams , VirtualMachineScaleSetsListByLocationResponse , VirtualMachineScaleSetsCreateOrUpdateOptionalParams , VirtualMachineScaleSetsCreateOrUpdateResponse , VirtualMachineScaleSetUpdate , VirtualMachineScaleSetsUpdateOptionalParams , VirtualMachineScaleSetsUpdateResponse , VirtualMachineScaleSetsDeleteOptionalParams , VirtualMachineScaleSetsGetOptionalParams , VirtualMachineScaleSetsGetResponse , VirtualMachineScaleSetsDeallocateOptionalParams , VirtualMachineScaleSetVMInstanceRequiredIDs , VirtualMachineScaleSetsDeleteInstancesOptionalParams , VirtualMachineScaleSetsGetInstanceViewOptionalParams , VirtualMachineScaleSetsGetInstanceViewResponse , VirtualMachineScaleSetsListResponse , VirtualMachineScaleSetsListAllResponse , VirtualMachineScaleSetsListSkusResponse , VirtualMachineScaleSetsGetOSUpgradeHistoryResponse , VirtualMachineScaleSetsPowerOffOptionalParams , VirtualMachineScaleSetsRestartOptionalParams , VirtualMachineScaleSetsStartOptionalParams , VirtualMachineScaleSetsRedeployOptionalParams , VirtualMachineScaleSetsPerformMaintenanceOptionalParams , VirtualMachineScaleSetsUpdateInstancesOptionalParams , VirtualMachineScaleSetsReimageOptionalParams , VirtualMachineScaleSetsReimageAllOptionalParams , VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkOptionalParams , VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse , VMScaleSetConvertToSinglePlacementGroupInput , VirtualMachineScaleSetsConvertToSinglePlacementGroupOptionalParams , OrchestrationServiceStateInput , VirtualMachineScaleSetsSetOrchestrationServiceStateOptionalParams , VirtualMachineScaleSetsListByLocationNextResponse , VirtualMachineScaleSetsListNextResponse , VirtualMachineScaleSetsListAllNextResponse , VirtualMachineScaleSetsListSkusNextResponse , VirtualMachineScaleSetsGetOSUpgradeHistoryNextResponse } from "../models" ; /** Class containing VirtualMachineScaleSets operations. */ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { 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 vmScaleSetName param options public listSkus ( resourceGroupName , vmScaleSetName , options ? ) { const iter = this . listSkusPagingAll ( resourceGroupName , vmScaleSetName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listSkusPagingPage ( resourceGroupName , vmScaleSetName , options ) ; } } ; } private async * listSkusPagingPage ( resourceGroupName , vmScaleSetName , options ? ) { let result = await this . _listSkus ( resourceGroupName , vmScaleSetName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listSkusNext ( resourceGroupName , vmScaleSetName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listSkusPagingAll ( resourceGroupName , vmScaleSetName , options ? ) { for await ( const page of this . listSkusPagingPage ( resourceGroupName , vmScaleSetName , options ) ) { yield * page ; } } param resourceGroupName param vmScaleSetName param options public listOSUpgradeHistory ( resourceGroupName , vmScaleSetName , options ? ) { const iter = this . getOSUpgradeHistoryPagingAll ( resourceGroupName , vmScaleSetName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . getOSUpgradeHistoryPagingPage ( resourceGroupName , vmScaleSetName , options ) ; } } ; } private async * getOSUpgradeHistoryPagingPage ( resourceGroupName , vmScaleSetName , options ? ) { let result = await this . _getOSUpgradeHistory ( resourceGroupName , vmScaleSetName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _getOSUpgradeHistoryNext ( resourceGroupName , vmScaleSetName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * getOSUpgradeHistoryPagingAll ( resourceGroupName , vmScaleSetName , options ? ) { for await ( const page of this . getOSUpgradeHistoryPagingPage ( resourceGroupName , vmScaleSetName , options ) ) { yield * page ; } } param location param options private _listByLocation ( location , options ? ) { return this . client . sendOperationRequest ( { location , options } , listByLocationOperationSpec ) ; } param resourceGroupName param vmScaleSetName param parameters param options async beginCreateOrUpdate ( resourceGroupName , vmScaleSetName , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VirtualMachineScaleSetsCreateOrUpdateResponse > => { 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 , vmScaleSetName , parameters , options } , createOrUpdateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param parameters param options async beginCreateOrUpdateAndWait ( resourceGroupName , vmScaleSetName , parameters , options ? ) { const poller = await this . beginCreateOrUpdate ( resourceGroupName , vmScaleSetName , parameters , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param parameters param options async beginUpdate ( resourceGroupName , vmScaleSetName , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VirtualMachineScaleSetsUpdateResponse > => { 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 , vmScaleSetName , parameters , options } , updateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param parameters param options async beginUpdateAndWait ( resourceGroupName , vmScaleSetName , parameters , options ? ) { const poller = await this . beginUpdate ( resourceGroupName , vmScaleSetName , parameters , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param options async beginDelete ( resourceGroupName , vmScaleSetName , 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 , vmScaleSetName , options } , deleteOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param options async beginDeleteAndWait ( resourceGroupName , vmScaleSetName , options ? ) { const poller = await this . beginDelete ( resourceGroupName , vmScaleSetName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param options get ( resourceGroupName , vmScaleSetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmScaleSetName , options } , getOperationSpec ) ; } param resourceGroupName param vmScaleSetName param options async beginDeallocate ( resourceGroupName , vmScaleSetName , 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 , vmScaleSetName , options } , deallocateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param options async beginDeallocateAndWait ( resourceGroupName , vmScaleSetName , options ? ) { const poller = await this . beginDeallocate ( resourceGroupName , vmScaleSetName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param vmInstanceIDs param options async beginDeleteInstances ( resourceGroupName , vmScaleSetName , vmInstanceIDs , 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 , vmScaleSetName , vmInstanceIDs , options } , deleteInstancesOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param vmInstanceIDs param options async beginDeleteInstancesAndWait ( resourceGroupName , vmScaleSetName , vmInstanceIDs , options ? ) { const poller = await this . beginDeleteInstances ( resourceGroupName , vmScaleSetName , vmInstanceIDs , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param options getInstanceView ( resourceGroupName , vmScaleSetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmScaleSetName , options } , getInstanceViewOperationSpec ) ; } 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 vmScaleSetName param options private _listSkus ( resourceGroupName , vmScaleSetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmScaleSetName , options } , listSkusOperationSpec ) ; } param resourceGroupName param vmScaleSetName param options private _getOSUpgradeHistory ( resourceGroupName , vmScaleSetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmScaleSetName , options } , getOSUpgradeHistoryOperationSpec ) ; } param resourceGroupName param vmScaleSetName param options async beginPowerOff ( resourceGroupName , vmScaleSetName , 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 , vmScaleSetName , options } , powerOffOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param options async beginPowerOffAndWait ( resourceGroupName , vmScaleSetName , options ? ) { const poller = await this . beginPowerOff ( resourceGroupName , vmScaleSetName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param options async beginRestart ( resourceGroupName , vmScaleSetName , 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 , vmScaleSetName , options } , restartOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param options async beginRestartAndWait ( resourceGroupName , vmScaleSetName , options ? ) { const poller = await this . beginRestart ( resourceGroupName , vmScaleSetName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param options async beginStart ( resourceGroupName , vmScaleSetName , 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 , vmScaleSetName , options } , startOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param options async beginStartAndWait ( resourceGroupName , vmScaleSetName , options ? ) { const poller = await this . beginStart ( resourceGroupName , vmScaleSetName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param options async beginRedeploy ( resourceGroupName , vmScaleSetName , 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 , vmScaleSetName , options } , redeployOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param options async beginRedeployAndWait ( resourceGroupName , vmScaleSetName , options ? ) { const poller = await this . beginRedeploy ( resourceGroupName , vmScaleSetName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param options async beginPerformMaintenance ( resourceGroupName , vmScaleSetName , 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 , vmScaleSetName , options } , performMaintenanceOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param options async beginPerformMaintenanceAndWait ( resourceGroupName , vmScaleSetName , options ? ) { const poller = await this . beginPerformMaintenance ( resourceGroupName , vmScaleSetName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param vmInstanceIDs param options async beginUpdateInstances ( resourceGroupName , vmScaleSetName , vmInstanceIDs , 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 , vmScaleSetName , vmInstanceIDs , options } , updateInstancesOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param vmInstanceIDs param options async beginUpdateInstancesAndWait ( resourceGroupName , vmScaleSetName , vmInstanceIDs , options ? ) { const poller = await this . beginUpdateInstances ( resourceGroupName , vmScaleSetName , vmInstanceIDs , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param options async beginReimage ( resourceGroupName , vmScaleSetName , 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 , vmScaleSetName , options } , reimageOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param options async beginReimageAndWait ( resourceGroupName , vmScaleSetName , options ? ) { const poller = await this . beginReimage ( resourceGroupName , vmScaleSetName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param options async beginReimageAll ( resourceGroupName , vmScaleSetName , 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 , vmScaleSetName , options } , reimageAllOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param options async beginReimageAllAndWait ( resourceGroupName , vmScaleSetName , options ? ) { const poller = await this . beginReimageAll ( resourceGroupName , vmScaleSetName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmScaleSetName param platformUpdateDomain param options forceRecoveryServiceFabricPlatformUpdateDomainWalk ( resourceGroupName , vmScaleSetName , platformUpdateDomain , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmScaleSetName , platformUpdateDomain , options } , forceRecoveryServiceFabricPlatformUpdateDomainWalkOperationSpec ) ; } param resourceGroupName param vmScaleSetName param parameters param options convertToSinglePlacementGroup ( resourceGroupName , vmScaleSetName , parameters , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmScaleSetName , parameters , options } , convertToSinglePlacementGroupOperationSpec ) ; } param resourceGroupName param vmScaleSetName param parameters param options async beginSetOrchestrationServiceState ( resourceGroupName , vmScaleSetName , parameters , 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 , vmScaleSetName , parameters , options } , setOrchestrationServiceStateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmScaleSetName param parameters param options async beginSetOrchestrationServiceStateAndWait ( resourceGroupName , vmScaleSetName , parameters , options ? ) { const poller = await this . beginSetOrchestrationServiceState ( resourceGroupName , vmScaleSetName , 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 ) ; } param resourceGroupName param vmScaleSetName param nextLink param options private _listSkusNext ( resourceGroupName , vmScaleSetName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmScaleSetName , nextLink , options } , listSkusNextOperationSpec ) ; } param resourceGroupName param vmScaleSetName param nextLink param options private _getOSUpgradeHistoryNext ( resourceGroupName , vmScaleSetName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmScaleSetName , nextLink , options } , getOSUpgradeHistoryNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const listByLocationOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSetListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . location1 ] , headerParameters : [ Parameters . accept ] , serializer } ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSet } , 201 : { bodyMapper : Mappers . VirtualMachineScaleSet } , 202 : { bodyMapper : Mappers . VirtualMachineScaleSet } , 204 : { bodyMapper : Mappers . VirtualMachineScaleSet } } , requestBody : Parameters . parameters15 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const updateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSet } , 201 : { bodyMapper : Mappers . VirtualMachineScaleSet } , 202 : { bodyMapper : Mappers . VirtualMachineScaleSet } , 204 : { bodyMapper : Mappers . VirtualMachineScaleSet } } , requestBody : Parameters . parameters16 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" , httpMethod : "DELETE" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion , Parameters . forceDeletion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSet } } , queryParameters : [ Parameters . apiVersion , Parameters . expand2 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . accept ] , serializer } ; const deallocateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . vmInstanceIDs , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const deleteInstancesOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . vmInstanceIDs1 , queryParameters : [ Parameters . apiVersion , Parameters . forceDeletion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const getInstanceViewOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSetInstanceView } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSetListResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAllOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSetListWithLinkResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listSkusOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSetListSkusResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOSUpgradeHistoryOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSetListOSUpgradeHistory } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . accept ] , serializer } ; const powerOffOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . vmInstanceIDs , queryParameters : [ Parameters . apiVersion , Parameters . skipShutdown ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const restartOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . vmInstanceIDs , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const startOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . vmInstanceIDs , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const redeployOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . vmInstanceIDs , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const performMaintenanceOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . vmInstanceIDs , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const updateInstancesOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . vmInstanceIDs1 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const reimageOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . vmScaleSetReimageInput , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const reimageAllOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . vmInstanceIDs , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const forceRecoveryServiceFabricPlatformUpdateDomainWalkOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . RecoveryWalkResponse } } , queryParameters : [ Parameters . apiVersion , Parameters . platformUpdateDomain ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . accept ] , serializer } ; const convertToSinglePlacementGroupOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup" , httpMethod : "POST" , responses : { 200 : { } } , requestBody : Parameters . parameters17 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const setOrchestrationServiceStateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , requestBody : Parameters . parameters18 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . contentType ] , mediaType : "json" , serializer } ; const listByLocationNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSetListResult } , default : { bodyMapper : Mappers . CloudError } } , 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 . VirtualMachineScaleSetListResult } } , 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 . VirtualMachineScaleSetListWithLinkResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const listSkusNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSetListSkusResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOSUpgradeHistoryNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineScaleSetListOSUpgradeHistory } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink , Parameters . vmScaleSetName ] , headerParameters : [ Parameters . accept ] , serializer } ;