import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { Providers } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { ResourceManagementClient } from "../resourceManagementClient" ; import { Provider , ProvidersListNextOptionalParams , ProvidersListOptionalParams , ProvidersListAtTenantScopeNextOptionalParams , ProvidersListAtTenantScopeOptionalParams , ProvidersUnregisterOptionalParams , ProvidersUnregisterResponse , ProvidersRegisterOptionalParams , ProvidersRegisterResponse , ProvidersListResponse , ProvidersListAtTenantScopeResponse , ProvidersGetOptionalParams , ProvidersGetResponse , ProvidersGetAtTenantScopeOptionalParams , ProvidersGetAtTenantScopeResponse , ProvidersListNextResponse , ProvidersListAtTenantScopeNextResponse } from "../models" ; /** Class containing Providers operations. */ export class ProvidersImpl implements Providers { private readonly client : ResourceManagementClient ; param client constructor ( client ) { this . client = client ; } param options public list ( options ? ) { const iter = this . listPagingAll ( options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listPagingPage ( options ) ; } } ; } private async * listPagingPage ( options ? ) { let result = await this . _list ( options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listNext ( continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listPagingAll ( options ? ) { for await ( const page of this . listPagingPage ( options ) ) { yield * page ; } } param options public listAtTenantScope ( options ? ) { const iter = this . listAtTenantScopePagingAll ( options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listAtTenantScopePagingPage ( options ) ; } } ; } private async * listAtTenantScopePagingPage ( options ? ) { let result = await this . _listAtTenantScope ( options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listAtTenantScopeNext ( continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listAtTenantScopePagingAll ( options ? ) { for await ( const page of this . listAtTenantScopePagingPage ( options ) ) { yield * page ; } } param resourceProviderNamespace param options unregister ( resourceProviderNamespace , options ? ) { return this . client . sendOperationRequest ( { resourceProviderNamespace , options } , unregisterOperationSpec ) ; } param resourceProviderNamespace param options register ( resourceProviderNamespace , options ? ) { return this . client . sendOperationRequest ( { resourceProviderNamespace , options } , registerOperationSpec ) ; } param options private _list ( options ? ) { return this . client . sendOperationRequest ( { options } , listOperationSpec ) ; } param options private _listAtTenantScope ( options ? ) { return this . client . sendOperationRequest ( { options } , listAtTenantScopeOperationSpec ) ; } param resourceProviderNamespace param options get ( resourceProviderNamespace , options ? ) { return this . client . sendOperationRequest ( { resourceProviderNamespace , options } , getOperationSpec ) ; } param resourceProviderNamespace param options getAtTenantScope ( resourceProviderNamespace , options ? ) { return this . client . sendOperationRequest ( { resourceProviderNamespace , options } , getAtTenantScopeOperationSpec ) ; } param nextLink param options private _listNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listNextOperationSpec ) ; } param nextLink param options private _listAtTenantScopeNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listAtTenantScopeNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const unregisterOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . Provider } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceProviderNamespace ] , headerParameters : [ Parameters . accept ] , serializer } ; const registerOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . Provider } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceProviderNamespace ] , headerParameters : [ Parameters . accept ] , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/providers" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ProviderListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion , Parameters . top , Parameters . expand ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAtTenantScopeOperationSpec = { path : "/providers" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ProviderListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion , Parameters . top , Parameters . expand ] , urlParameters : [ Parameters . $host ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . Provider } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion , Parameters . expand ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceProviderNamespace ] , headerParameters : [ Parameters . accept ] , serializer } ; const getAtTenantScopeOperationSpec = { path : "/providers/{resourceProviderNamespace}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . Provider } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion , Parameters . expand ] , urlParameters : [ Parameters . $host , Parameters . resourceProviderNamespace ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ProviderListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion , Parameters . top , Parameters . expand ] , urlParameters : [ Parameters . $host , Parameters . nextLink , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAtTenantScopeNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ProviderListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion , Parameters . top , Parameters . expand ] , urlParameters : [ Parameters . $host , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ;