import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { DataFlowDebugSession } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { DataFactoryClient } from "../dataFactoryClient" ; import { PollerLike , PollOperationState , LroEngine } from "@azure/core-lro" ; import { LroImpl } from "../lroImpl" ; import { DataFlowDebugSessionInfo , DataFlowDebugSessionQueryByFactoryNextOptionalParams , DataFlowDebugSessionQueryByFactoryOptionalParams , CreateDataFlowDebugSessionRequest , DataFlowDebugSessionCreateOptionalParams , DataFlowDebugSessionCreateResponse , DataFlowDebugSessionQueryByFactoryResponse , DataFlowDebugPackage , DataFlowDebugSessionAddDataFlowOptionalParams , DataFlowDebugSessionAddDataFlowResponse , DeleteDataFlowDebugSessionRequest , DataFlowDebugSessionDeleteOptionalParams , DataFlowDebugCommandRequest , DataFlowDebugSessionExecuteCommandOptionalParams , DataFlowDebugSessionExecuteCommandResponse , DataFlowDebugSessionQueryByFactoryNextResponse } from "../models" ; /** Class containing DataFlowDebugSession operations. */ export class DataFlowDebugSessionImpl implements DataFlowDebugSession { private readonly client : DataFactoryClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param factoryName param options public listQueryByFactory ( resourceGroupName , factoryName , options ? ) { const iter = this . queryByFactoryPagingAll ( resourceGroupName , factoryName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . queryByFactoryPagingPage ( resourceGroupName , factoryName , options ) ; } } ; } private async * queryByFactoryPagingPage ( resourceGroupName , factoryName , options ? ) { let result = await this . _queryByFactory ( resourceGroupName , factoryName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _queryByFactoryNext ( resourceGroupName , factoryName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * queryByFactoryPagingAll ( resourceGroupName , factoryName , options ? ) { for await ( const page of this . queryByFactoryPagingPage ( resourceGroupName , factoryName , options ) ) { yield * page ; } } param resourceGroupName param factoryName param request param options async beginCreate ( resourceGroupName , factoryName , request , options ? ) { const directSendOperation = async ( args , spec ) : Promise < DataFlowDebugSessionCreateResponse > => { 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 , factoryName , request , options } , createOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param factoryName param request param options async beginCreateAndWait ( resourceGroupName , factoryName , request , options ? ) { const poller = await this . beginCreate ( resourceGroupName , factoryName , request , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param factoryName param options private _queryByFactory ( resourceGroupName , factoryName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , factoryName , options } , queryByFactoryOperationSpec ) ; } param resourceGroupName param factoryName param request param options addDataFlow ( resourceGroupName , factoryName , request , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , factoryName , request , options } , addDataFlowOperationSpec ) ; } param resourceGroupName param factoryName param request param options delete ( resourceGroupName , factoryName , request , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , factoryName , request , options } , deleteOperationSpec ) ; } param resourceGroupName param factoryName param request param options async beginExecuteCommand ( resourceGroupName , factoryName , request , options ? ) { const directSendOperation = async ( args , spec ) : Promise < DataFlowDebugSessionExecuteCommandResponse > => { 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 , factoryName , request , options } , executeCommandOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param factoryName param request param options async beginExecuteCommandAndWait ( resourceGroupName , factoryName , request , options ? ) { const poller = await this . beginExecuteCommand ( resourceGroupName , factoryName , request , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param factoryName param nextLink param options private _queryByFactoryNext ( resourceGroupName , factoryName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , factoryName , nextLink , options } , queryByFactoryNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const createOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/createDataFlowDebugSession" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . CreateDataFlowDebugSessionResponse } , 201 : { bodyMapper : Mappers . CreateDataFlowDebugSessionResponse } , 202 : { bodyMapper : Mappers . CreateDataFlowDebugSessionResponse } , 204 : { bodyMapper : Mappers . CreateDataFlowDebugSessionResponse } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . request , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const queryByFactoryOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/queryDataFlowDebugSessions" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . QueryDataFlowDebugSessionsResponse } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName ] , headerParameters : [ Parameters . accept ] , serializer } ; const addDataFlowOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/addDataFlowToDebugSession" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . AddDataFlowToDebugSessionResponse } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . request1 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/deleteDataFlowDebugSession" , httpMethod : "POST" , responses : { 200 : { } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . request2 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const executeCommandOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/executeDataFlowDebugCommand" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . DataFlowDebugCommandResponse } , 201 : { bodyMapper : Mappers . DataFlowDebugCommandResponse } , 202 : { bodyMapper : Mappers . DataFlowDebugCommandResponse } , 204 : { bodyMapper : Mappers . DataFlowDebugCommandResponse } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . request3 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const queryByFactoryNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . QueryDataFlowDebugSessionsResponse } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . nextLink , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName ] , headerParameters : [ Parameters . accept ] , serializer } ;