import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { ResourceLinks } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { ManagementLinkClient } from "../managementLinkClient" ; import { ResourceLink , ResourceLinksListAtSubscriptionNextOptionalParams , ResourceLinksListAtSubscriptionOptionalParams , ResourceLinksListAtSourceScopeNextOptionalParams , ResourceLinksListAtSourceScopeOptionalParams , ResourceLinksDeleteOptionalParams , ResourceLinksCreateOrUpdateOptionalParams , ResourceLinksCreateOrUpdateResponse , ResourceLinksGetOptionalParams , ResourceLinksGetResponse , ResourceLinksListAtSubscriptionResponse , ResourceLinksListAtSourceScopeResponse , ResourceLinksListAtSubscriptionNextResponse , ResourceLinksListAtSourceScopeNextResponse } from "../models" ; /** Class containing ResourceLinks operations. */ export class ResourceLinksImpl implements ResourceLinks { private readonly client : ManagementLinkClient ; param client constructor ( client ) { this . client = client ; } param options public listAtSubscription ( options ? ) { const iter = this . listAtSubscriptionPagingAll ( options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listAtSubscriptionPagingPage ( options ) ; } } ; } private async * listAtSubscriptionPagingPage ( options ? ) { let result = await this . _listAtSubscription ( options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listAtSubscriptionNext ( continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listAtSubscriptionPagingAll ( options ? ) { for await ( const page of this . listAtSubscriptionPagingPage ( options ) ) { yield * page ; } } param scope param options public listAtSourceScope ( scope , options ? ) { const iter = this . listAtSourceScopePagingAll ( scope , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listAtSourceScopePagingPage ( scope , options ) ; } } ; } private async * listAtSourceScopePagingPage ( scope , options ? ) { let result = await this . _listAtSourceScope ( scope , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listAtSourceScopeNext ( scope , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listAtSourceScopePagingAll ( scope , options ? ) { for await ( const page of this . listAtSourceScopePagingPage ( scope , options ) ) { yield * page ; } } param linkId param options delete ( linkId , options ? ) { return this . client . sendOperationRequest ( { linkId , options } , deleteOperationSpec ) ; } param linkId param parameters param options createOrUpdate ( linkId , parameters , options ? ) { return this . client . sendOperationRequest ( { linkId , parameters , options } , createOrUpdateOperationSpec ) ; } param linkId param options get ( linkId , options ? ) { return this . client . sendOperationRequest ( { linkId , options } , getOperationSpec ) ; } param options private _listAtSubscription ( options ? ) { return this . client . sendOperationRequest ( { options } , listAtSubscriptionOperationSpec ) ; } param scope param options private _listAtSourceScope ( scope , options ? ) { return this . client . sendOperationRequest ( { scope , options } , listAtSourceScopeOperationSpec ) ; } param nextLink param options private _listAtSubscriptionNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listAtSubscriptionNextOperationSpec ) ; } param scope param nextLink param options private _listAtSourceScopeNext ( scope , nextLink , options ? ) { return this . client . sendOperationRequest ( { scope , nextLink , options } , listAtSourceScopeNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const deleteOperationSpec = { path : "/{linkId}" , httpMethod : "DELETE" , responses : { 200 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . linkId ] , serializer } ; const createOrUpdateOperationSpec = { path : "/{linkId}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . ResourceLink } , 201 : { bodyMapper : Mappers . ResourceLink } } , requestBody : Parameters . parameters , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . linkId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const getOperationSpec = { path : "/{linkId}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ResourceLink } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . linkId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAtSubscriptionOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/links" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ResourceLinkResult } } , queryParameters : [ Parameters . apiVersion , Parameters . filter ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAtSourceScopeOperationSpec = { path : "/{scope}/providers/Microsoft.Resources/links" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ResourceLinkResult } } , queryParameters : [ Parameters . apiVersion , Parameters . filter1 ] , urlParameters : [ Parameters . $host , Parameters . scope ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAtSubscriptionNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ResourceLinkResult } } , queryParameters : [ Parameters . apiVersion , Parameters . filter ] , urlParameters : [ Parameters . $host , Parameters . nextLink , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAtSourceScopeNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ResourceLinkResult } } , queryParameters : [ Parameters . apiVersion , Parameters . filter1 ] , urlParameters : [ Parameters . $host , Parameters . nextLink , Parameters . scope ] , headerParameters : [ Parameters . accept ] , serializer } ;