Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ts/src/connections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"buffer": "^5.2.1",
"debug": "^4.1.1",
"vscode-jsonrpc": "^4.0.0",
"@microsoft/dev-tunnels-contracts": ">1.1.1",
"@microsoft/dev-tunnels-management": ">1.1.1",
"@microsoft/dev-tunnels-contracts": ">1.1.6",
"@microsoft/dev-tunnels-management": ">1.1.6",
Comment thread
jramsay marked this conversation as resolved.
"@microsoft/dev-tunnels-ssh": "^3.11.36",
"@microsoft/dev-tunnels-ssh-tcp": "^3.11.36",
"uuid": "^3.3.3",
Expand Down
2 changes: 1 addition & 1 deletion ts/src/management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"buffer": "^5.2.1",
"debug": "^4.1.1",
"vscode-jsonrpc": "^4.0.0",
"@microsoft/dev-tunnels-contracts": ">1.1.1",
"@microsoft/dev-tunnels-contracts": ">1.1.6",
"axios": "^1.6.2"
}
}
45 changes: 35 additions & 10 deletions ts/src/management/tunnelManagementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import {
ClusterDetails,
NamedRateStatus,
Tunnel,
TunnelConnectionMode,
TunnelEndpoint,
TunnelPort,
} from '@microsoft/dev-tunnels-contracts';
import { TunnelRequestOptions } from './tunnelRequestOptions';
import * as https from 'https';
import { CancellationToken } from 'vscode-jsonrpc';

/**
* Interface for a client that manages tunnels and tunnel ports
Expand All @@ -31,11 +31,13 @@ export interface TunnelManagementClient {
* @param clusterId A tunnel cluster ID, or null to list tunnels globally.
* @param domain Tunnel domain, or null for the default domain.
* @param options Request options.
* @param cancellation Optional cancellation token for the request.
*/
listTunnels(
clusterId?: string,
domain?: string,
options?: TunnelRequestOptions,
cancellation?: CancellationToken,
): Promise<Tunnel[]>;

/**
Expand All @@ -47,59 +49,68 @@ export interface TunnelManagementClient {
* @param tunnel Tunnel object including at least either a tunnel name (globally unique,
* if configured) or tunnel ID and cluster ID.
* @param options Request options.
* @param cancellation Optional cancellation token for the request.
*/
getTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel | null>;
getTunnel(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise<Tunnel | null>;

/**
* Creates a tunnel.
* @param tunnel
* @param options
* @param cancellation Optional cancellation token for the request.
*/
createTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
createTunnel(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise<Tunnel>;

/**
* Updates properties of a tunnel.
* @param tunnel
* @param options
* @param cancellation Optional cancellation token for the request.
*/
updateTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
updateTunnel(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise<Tunnel>;

/**
* Updates properties of a tunnel or creates it if it does not exist.
* @param tunnel
* @param options
* @param cancellation Optional cancellation token for the request.
*/
createOrUpdateTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
createOrUpdateTunnel(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise<Tunnel>;

/**
* Deletes a tunnel.
* @param tunnel
* @param options
* @param cancellation Optional cancellation token for the request.
*/
deleteTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<boolean>;
deleteTunnel(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise<boolean>;

/**
* Creates or updates an endpoint for the tunnel.
* @param tunnel
* @param endpoint
* @param options
* @param cancellation Optional cancellation token for the request.
*/
updateTunnelEndpoint(
tunnel: Tunnel,
endpoint: TunnelEndpoint,
options?: TunnelRequestOptions,
cancellation?: CancellationToken,
): Promise<TunnelEndpoint>;

/**
* Deletes a tunnel endpoint.
* @param tunnel
* @param id
* @param options
* @param cancellation Optional cancellation token for the request.
*/
deleteTunnelEndpoints(
tunnel: Tunnel,
id: string,
options?: TunnelRequestOptions,
cancellation?: CancellationToken,
): Promise<boolean>;

/**
Expand All @@ -110,84 +121,98 @@ export interface TunnelManagementClient {
* @param tunnel Tunnel object including at least either a tunnel name (globally unique,
* if configured) or tunnel ID and cluster ID.
* @param options Request options.
* @param cancellation Optional cancellation token for the request.
*/
listTunnelPorts(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<TunnelPort[]>;
listTunnelPorts(tunnel: Tunnel, options?: TunnelRequestOptions, cancellation?: CancellationToken): Promise<TunnelPort[]>;

/**
* Gets one port on a tunnel by port number.
* @param tunnel
* @param portNumber
* @param options
* @param cancellation Optional cancellation token for the request.
*/
getTunnelPort(
tunnel: Tunnel,
portNumber: number,
options?: TunnelRequestOptions,
cancellation?: CancellationToken,
): Promise<TunnelPort | null>;

/**
* Creates a tunnel port.
* @param tunnel
* @param tunnelPort
* @param options
* @param cancellation Optional cancellation token for the request.
*/
createTunnelPort(
tunnel: Tunnel,
tunnelPort: TunnelPort,
options?: TunnelRequestOptions,
cancellation?: CancellationToken,
): Promise<TunnelPort>;

/**
* Updates properties of a tunnel port.
* @param tunnel
* @param tunnelPort
* @param options
* @param cancellation Optional cancellation token for the request.
*/
updateTunnelPort(
tunnel: Tunnel,
tunnelPort: TunnelPort,
options?: TunnelRequestOptions,
cancellation?: CancellationToken,
): Promise<TunnelPort>;

/**
* Updates properties of a tunnel port or creates it if it does not exist.
* @param tunnel
* @param tunnelPort
* @param options
* @param cancellation Optional cancellation token for the request.
*/
createOrUpdateTunnelPort(
tunnel: Tunnel,
tunnelPort: TunnelPort,
options?: TunnelRequestOptions,
cancellation?: CancellationToken,
): Promise<TunnelPort>;

/**
* Deletes a tunnel port.
* @param tunnel
* @param portNumber
* @param options
* @param cancellation Optional cancellation token for the request.
*/
deleteTunnelPort(
tunnel: Tunnel,
portNumber: number,
options?: TunnelRequestOptions,
cancellation?: CancellationToken,
): Promise<boolean>;

/**
* Lists limits and consumption status for the calling user.
* @param cancellation Optional cancellation token for the request.
*/
listUserLimits(): Promise<NamedRateStatus[]>;
listUserLimits(cancellation?: CancellationToken): Promise<NamedRateStatus[]>;

/**
* Lists details of tunneling service clusters in all supported Azure regions.
* @param cancellation Optional cancellation token for the request.
*/
listClusters(): Promise<ClusterDetails[]>;
listClusters(cancellation?: CancellationToken): Promise<ClusterDetails[]>;

/**
* Checks if the tunnel name is available.
* @param tunnelName
* @param cancellation Optional cancellation token for the request.
*/
checkNameAvailablility(tunnelName: string): Promise<boolean>;
checkNameAvailablility(tunnelName: string, cancellation?: CancellationToken): Promise<boolean>;
}

/**
Expand Down
Loading