/// import { Tunnel, TunnelEndpoint, TunnelPort, ClusterDetails, NamedRateStatus, TunnelReportProgressEventArgs } from '@microsoft/dev-tunnels-contracts'; import { ProductHeaderValue, TunnelManagementClient } from './tunnelManagementClient'; import { TunnelRequestOptions } from './tunnelRequestOptions'; import { AxiosAdapter, Method } from 'axios'; import * as https from 'https'; import { CancellationToken, Event } from 'vscode-jsonrpc'; type NullableIfNotBoolean = T extends boolean ? T : T | null; export declare enum ManagementApiVersions { Version20230927preview = "2023-09-27-preview" } export declare class TunnelManagementHttpClient implements TunnelManagementClient { readonly httpsAgent?: https.Agent | undefined; private readonly adapter?; additionalRequestHeaders?: { [header: string]: string; }; apiVersion: string; private readonly baseAddress; private readonly userTokenCallback; private readonly userAgents; private readonly reportProgressEmitter; /** * Event that is raised to report tunnel management progress. * * See `Progress` for a description of the different progress events that can be reported. */ readonly onReportProgress: Event; trace: (msg: string) => void; /** * Initializes a new instance of the `TunnelManagementHttpClient` class * with a client authentication callback, service URI, and HTTP handler. * * @param userAgent { name, version } object or a comment string to use as the User-Agent header. * @param apiVersion ApiVersion to be used for requests, value should be one of ManagementApiVersions enum. * @param userTokenCallback Optional async callback for retrieving a client authentication * header value with access token, for AAD or GitHub user authentication. This may be omitted * for anonymous tunnel clients, or if tunnel access tokens will be specified via * `TunnelRequestOptions.accessToken`. * @param tunnelServiceUri Optional tunnel service URI (not including any path). Defaults to * the global tunnel service URI. * @param httpsAgent Optional agent that will be invoked for HTTPS requests to the tunnel * service. * @param adapter Optional axios adapter to use for HTTP requests. */ constructor(userAgents: (ProductHeaderValue | string)[] | ProductHeaderValue | string, apiVersion: ManagementApiVersions, userTokenCallback?: () => Promise, tunnelServiceUri?: string, httpsAgent?: https.Agent | undefined, adapter?: AxiosAdapter | undefined); listTunnels(clusterId?: string, domain?: string, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; getTunnel(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; createTunnel(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; createOrUpdateTunnel(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; updateTunnel(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; deleteTunnel(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; updateTunnelEndpoint(tunnel: Tunnel, endpoint: TunnelEndpoint, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; deleteTunnelEndpoints(tunnel: Tunnel, id: string, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; listUserLimits(cancellation?: CancellationToken): Promise; listTunnelPorts(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; getTunnelPort(tunnel: Tunnel, portNumber: number, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; createTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; updateTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; createOrUpdateTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; deleteTunnelPort(tunnel: Tunnel, portNumber: number, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise; listClusters(cancellation?: CancellationToken): Promise; /** * Sends an HTTP request to the tunnel management API, targeting a specific tunnel. * This protected method enables subclasses to support additional tunnel management APIs. * @param method HTTP request method. * @param tunnel Tunnel that the request is targeting. * @param accessTokenScopes Required array of access scopes for tokens in `tunnel.accessTokens` * that could be used to authorize the request. * @param path Optional request sub-path relative to the tunnel. * @param query Optional query string to append to the request. * @param options Request options. * @param body Optional request body object. * @param allowNotFound If true, a 404 response is returned as a null or false result * instead of an error. * @param cancellationToken Optional cancellation token for the request. * @param isCreate Set to true if this is a tunnel create request, default is false. * @returns Result of the request. */ protected sendTunnelRequest(method: Method, tunnel: Tunnel, accessTokenScopes: string[], path?: string, query?: string, options?: TunnelRequestOptions, body?: object, allowNotFound?: boolean, cancellation?: CancellationToken, isCreate?: boolean): Promise>; /** * Sends an HTTP request to the tunnel management API. * This protected method enables subclasses to support additional tunnel management APIs. * @param method HTTP request method. * @param clusterId Optional tunnel service cluster ID to direct the request to. If unspecified, * the request will use the global traffic-manager to find the nearest cluster. * @param path Required request path. * @param query Optional query string to append to the request. * @param options Request options. * @param body Optional request body object. * @param allowNotFound If true, a 404 response is returned as a null or false result * instead of an error. * @param cancellationToken Optional cancellation token for the request. * @returns Result of the request. */ protected sendRequest(method: Method, clusterId: string | undefined, path: string, query?: string, options?: TunnelRequestOptions, body?: object, allowNotFound?: boolean, cancellation?: CancellationToken): Promise>; checkNameAvailablility(tunnelName: string, cancellation?: CancellationToken): Promise; private raiseReportProgress; private getResponseErrorMessage; private buildUri; private buildUriForTunnel; private getAxiosRequestConfig; private convertTunnelForRequest; private convertTunnelPortForRequest; private tunnelRequestOptionsToQueryString; /** * Axios request that can be overridden for unit tests purposes. * @param config axios request config * @param _cancellation the cancellation token for the request (used by unit tests to simulate timeouts). */ private axiosRequest; /** * Makes an HTTP request using Axios, while tracing request and response details. */ private request; private traceHeaders; private traceAuthorizationHeader; private traceContent; private static replaceTokensInContent; } export {}; //# sourceMappingURL=tunnelManagementHttpClient.d.ts.map