import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { PrivateEndpointConnections } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { KeyVaultManagementClient } from "../keyVaultManagementClient" ; import { PollerLike , PollOperationState , LroEngine } from "@azure/core-lro" ; import { LroImpl } from "../lroImpl" ; import { PrivateEndpointConnection , PrivateEndpointConnectionsListByResourceNextOptionalParams , PrivateEndpointConnectionsListByResourceOptionalParams , PrivateEndpointConnectionsGetOptionalParams , PrivateEndpointConnectionsGetResponse , PrivateEndpointConnectionsPutOptionalParams , PrivateEndpointConnectionsPutResponse , PrivateEndpointConnectionsDeleteOptionalParams , PrivateEndpointConnectionsDeleteResponse , PrivateEndpointConnectionsListByResourceResponse , PrivateEndpointConnectionsListByResourceNextResponse } from "../models" ; /** Class containing PrivateEndpointConnections operations. */ export class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { private readonly client : KeyVaultManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param vaultName param options public listByResource ( resourceGroupName , vaultName , options ? ) { const iter = this . listByResourcePagingAll ( resourceGroupName , vaultName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listByResourcePagingPage ( resourceGroupName , vaultName , options ) ; } } ; } private async * listByResourcePagingPage ( resourceGroupName , vaultName , options ? ) { let result = await this . _listByResource ( resourceGroupName , vaultName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listByResourceNext ( resourceGroupName , vaultName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listByResourcePagingAll ( resourceGroupName , vaultName , options ? ) { for await ( const page of this . listByResourcePagingPage ( resourceGroupName , vaultName , options ) ) { yield * page ; } } param resourceGroupName param vaultName param privateEndpointConnectionName param options get ( resourceGroupName , vaultName , privateEndpointConnectionName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vaultName , privateEndpointConnectionName , options } , getOperationSpec ) ; } param resourceGroupName param vaultName param privateEndpointConnectionName param properties param options put ( resourceGroupName , vaultName , privateEndpointConnectionName , properties , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vaultName , privateEndpointConnectionName , properties , options } , putOperationSpec ) ; } param resourceGroupName param vaultName param privateEndpointConnectionName param options async beginDelete ( resourceGroupName , vaultName , privateEndpointConnectionName , options ? ) { const directSendOperation = async ( args , spec ) : Promise < PrivateEndpointConnectionsDeleteResponse > => { 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 , vaultName , privateEndpointConnectionName , options } , deleteOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vaultName param privateEndpointConnectionName param options async beginDeleteAndWait ( resourceGroupName , vaultName , privateEndpointConnectionName , options ? ) { const poller = await this . beginDelete ( resourceGroupName , vaultName , privateEndpointConnectionName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vaultName param options private _listByResource ( resourceGroupName , vaultName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vaultName , options } , listByResourceOperationSpec ) ; } param resourceGroupName param vaultName param nextLink param options private _listByResourceNext ( resourceGroupName , vaultName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vaultName , nextLink , options } , listByResourceNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . PrivateEndpointConnection } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . vaultName , Parameters . privateEndpointConnectionName ] , headerParameters : [ Parameters . accept ] , serializer } ; const putOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . PrivateEndpointConnection , headersMapper : Mappers . PrivateEndpointConnectionsPutHeaders } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . properties , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . vaultName , Parameters . privateEndpointConnectionName ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" , httpMethod : "DELETE" , responses : { 200 : { bodyMapper : Mappers . PrivateEndpointConnection } , 201 : { bodyMapper : Mappers . PrivateEndpointConnection } , 202 : { bodyMapper : Mappers . PrivateEndpointConnection } , 204 : { bodyMapper : Mappers . PrivateEndpointConnection } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . vaultName , Parameters . privateEndpointConnectionName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listByResourceOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . PrivateEndpointConnectionListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . vaultName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listByResourceNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . PrivateEndpointConnectionListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . vaultName , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ;