import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { VpnLinkConnections } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { NetworkManagementClient } from "../networkManagementClient" ; import { PollerLike , PollOperationState , LroEngine } from "@azure/core-lro" ; import { LroImpl } from "../lroImpl" ; import { VpnSiteLinkConnection , VpnLinkConnectionsListByVpnConnectionNextOptionalParams , VpnLinkConnectionsListByVpnConnectionOptionalParams , VpnLinkConnectionsResetConnectionOptionalParams , VpnLinkConnectionsGetIkeSasOptionalParams , VpnLinkConnectionsGetIkeSasResponse , VpnLinkConnectionsListByVpnConnectionResponse , VpnLinkConnectionsListByVpnConnectionNextResponse } from "../models" ; /** Class containing VpnLinkConnections operations. */ export class VpnLinkConnectionsImpl implements VpnLinkConnections { private readonly client : NetworkManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param gatewayName param connectionName param options public listByVpnConnection ( resourceGroupName , gatewayName , connectionName , options ? ) { const iter = this . listByVpnConnectionPagingAll ( resourceGroupName , gatewayName , connectionName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listByVpnConnectionPagingPage ( resourceGroupName , gatewayName , connectionName , options ) ; } } ; } private async * listByVpnConnectionPagingPage ( resourceGroupName , gatewayName , connectionName , options ? ) { let result = await this . _listByVpnConnection ( resourceGroupName , gatewayName , connectionName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listByVpnConnectionNext ( resourceGroupName , gatewayName , connectionName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listByVpnConnectionPagingAll ( resourceGroupName , gatewayName , connectionName , options ? ) { for await ( const page of this . listByVpnConnectionPagingPage ( resourceGroupName , gatewayName , connectionName , options ) ) { yield * page ; } } param resourceGroupName param gatewayName param connectionName param linkConnectionName param options async beginResetConnection ( resourceGroupName , gatewayName , connectionName , linkConnectionName , 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 , gatewayName , connectionName , linkConnectionName , options } , resetConnectionOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "location" } ) ; } param resourceGroupName param gatewayName param connectionName param linkConnectionName param options async beginResetConnectionAndWait ( resourceGroupName , gatewayName , connectionName , linkConnectionName , options ? ) { const poller = await this . beginResetConnection ( resourceGroupName , gatewayName , connectionName , linkConnectionName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param gatewayName param connectionName param linkConnectionName param options async beginGetIkeSas ( resourceGroupName , gatewayName , connectionName , linkConnectionName , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VpnLinkConnectionsGetIkeSasResponse > => { 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 , gatewayName , connectionName , linkConnectionName , options } , getIkeSasOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "location" } ) ; } param resourceGroupName param gatewayName param connectionName param linkConnectionName param options async beginGetIkeSasAndWait ( resourceGroupName , gatewayName , connectionName , linkConnectionName , options ? ) { const poller = await this . beginGetIkeSas ( resourceGroupName , gatewayName , connectionName , linkConnectionName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param gatewayName param connectionName param options private _listByVpnConnection ( resourceGroupName , gatewayName , connectionName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , gatewayName , connectionName , options } , listByVpnConnectionOperationSpec ) ; } param resourceGroupName param gatewayName param connectionName param nextLink param options private _listByVpnConnectionNext ( resourceGroupName , gatewayName , connectionName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , gatewayName , connectionName , nextLink , options } , listByVpnConnectionNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const resetConnectionOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection" , httpMethod : "POST" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } , default : { bodyMapper : Mappers . ErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . connectionName , Parameters . gatewayName , Parameters . linkConnectionName ] , headerParameters : [ Parameters . accept ] , serializer } ; const getIkeSasOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas" , httpMethod : "POST" , responses : { 200 : { bodyMapper : { type : { name : "String" } } } , 201 : { bodyMapper : { type : { name : "String" } } } , 202 : { bodyMapper : { type : { name : "String" } } } , 204 : { bodyMapper : { type : { name : "String" } } } , default : { bodyMapper : Mappers . ErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . connectionName , Parameters . gatewayName , Parameters . linkConnectionName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listByVpnConnectionOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ListVpnSiteLinkConnectionsResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . connectionName , Parameters . gatewayName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listByVpnConnectionNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ListVpnSiteLinkConnectionsResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink , Parameters . connectionName , Parameters . gatewayName ] , headerParameters : [ Parameters . accept ] , serializer } ;