import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { CloudServicesUpdateDomain } 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 { UpdateDomain , CloudServicesUpdateDomainListUpdateDomainsNextOptionalParams , CloudServicesUpdateDomainListUpdateDomainsOptionalParams , CloudServicesUpdateDomainWalkUpdateDomainOptionalParams , CloudServicesUpdateDomainGetUpdateDomainOptionalParams , CloudServicesUpdateDomainGetUpdateDomainResponse , CloudServicesUpdateDomainListUpdateDomainsResponse , CloudServicesUpdateDomainListUpdateDomainsNextResponse } from "../models" ; /** Class containing CloudServicesUpdateDomain operations. */ export class CloudServicesUpdateDomainImpl implements CloudServicesUpdateDomain { private readonly client : ComputeManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param cloudServiceName param options public listUpdateDomains ( resourceGroupName , cloudServiceName , options ? ) { const iter = this . listUpdateDomainsPagingAll ( resourceGroupName , cloudServiceName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listUpdateDomainsPagingPage ( resourceGroupName , cloudServiceName , options ) ; } } ; } private async * listUpdateDomainsPagingPage ( resourceGroupName , cloudServiceName , options ? ) { let result = await this . _listUpdateDomains ( resourceGroupName , cloudServiceName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listUpdateDomainsNext ( resourceGroupName , cloudServiceName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listUpdateDomainsPagingAll ( resourceGroupName , cloudServiceName , options ? ) { for await ( const page of this . listUpdateDomainsPagingPage ( resourceGroupName , cloudServiceName , options ) ) { yield * page ; } } param resourceGroupName param cloudServiceName param updateDomain param options async beginWalkUpdateDomain ( resourceGroupName , cloudServiceName , updateDomain , 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 , cloudServiceName , updateDomain , options } , walkUpdateDomainOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param cloudServiceName param updateDomain param options async beginWalkUpdateDomainAndWait ( resourceGroupName , cloudServiceName , updateDomain , options ? ) { const poller = await this . beginWalkUpdateDomain ( resourceGroupName , cloudServiceName , updateDomain , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param cloudServiceName param updateDomain param options getUpdateDomain ( resourceGroupName , cloudServiceName , updateDomain , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , cloudServiceName , updateDomain , options } , getUpdateDomainOperationSpec ) ; } param resourceGroupName param cloudServiceName param options private _listUpdateDomains ( resourceGroupName , cloudServiceName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , cloudServiceName , options } , listUpdateDomainsOperationSpec ) ; } param resourceGroupName param cloudServiceName param nextLink param options private _listUpdateDomainsNext ( resourceGroupName , cloudServiceName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , cloudServiceName , nextLink , options } , listUpdateDomainsNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const walkUpdateDomainOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}" , httpMethod : "PUT" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . parameters34 , queryParameters : [ Parameters . apiVersion2 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . cloudServiceName , Parameters . updateDomain ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const getUpdateDomainOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . UpdateDomain } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion2 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . cloudServiceName , Parameters . updateDomain ] , headerParameters : [ Parameters . accept ] , serializer } ; const listUpdateDomainsOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . UpdateDomainListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion2 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . cloudServiceName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listUpdateDomainsNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . UpdateDomainListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion2 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink , Parameters . cloudServiceName ] , headerParameters : [ Parameters . accept ] , serializer } ;