import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { Datasets } 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 { DatasetResource , DatasetsListByFactoryNextOptionalParams , DatasetsListByFactoryOptionalParams , DatasetsListByFactoryResponse , DatasetsCreateOrUpdateOptionalParams , DatasetsCreateOrUpdateResponse , DatasetsGetOptionalParams , DatasetsGetResponse , DatasetsDeleteOptionalParams , DatasetsListByFactoryNextResponse } from "../models" ; /** Class containing Datasets operations. */ export class DatasetsImpl implements Datasets { private readonly client : DataFactoryClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param factoryName param options public listByFactory ( resourceGroupName , factoryName , options ? ) { const iter = this . listByFactoryPagingAll ( resourceGroupName , factoryName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listByFactoryPagingPage ( resourceGroupName , factoryName , options ) ; } } ; } private async * listByFactoryPagingPage ( resourceGroupName , factoryName , options ? ) { let result = await this . _listByFactory ( resourceGroupName , factoryName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listByFactoryNext ( resourceGroupName , factoryName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listByFactoryPagingAll ( resourceGroupName , factoryName , options ? ) { for await ( const page of this . listByFactoryPagingPage ( resourceGroupName , factoryName , options ) ) { yield * page ; } } param resourceGroupName param factoryName param options private _listByFactory ( resourceGroupName , factoryName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , factoryName , options } , listByFactoryOperationSpec ) ; } param resourceGroupName param factoryName param datasetName param dataset param options createOrUpdate ( resourceGroupName , factoryName , datasetName , dataset , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , factoryName , datasetName , dataset , options } , createOrUpdateOperationSpec ) ; } param resourceGroupName param factoryName param datasetName param options get ( resourceGroupName , factoryName , datasetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , factoryName , datasetName , options } , getOperationSpec ) ; } param resourceGroupName param factoryName param datasetName param options delete ( resourceGroupName , factoryName , datasetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , factoryName , datasetName , options } , deleteOperationSpec ) ; } param resourceGroupName param factoryName param nextLink param options private _listByFactoryNext ( resourceGroupName , factoryName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , factoryName , nextLink , options } , listByFactoryNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const listByFactoryOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DatasetListResponse } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName ] , headerParameters : [ Parameters . accept ] , serializer } ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . DatasetResource } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . dataset , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName , Parameters . datasetName ] , headerParameters : [ Parameters . accept , Parameters . contentType , Parameters . ifMatch ] , mediaType : "json" , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DatasetResource } , 304 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName , Parameters . datasetName ] , headerParameters : [ Parameters . accept , Parameters . ifNoneMatch ] , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}" , httpMethod : "DELETE" , responses : { 200 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName , Parameters . datasetName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listByFactoryNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DatasetListResponse } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . nextLink , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . factoryName ] , headerParameters : [ Parameters . accept ] , serializer } ;