@microsoft/dev-tunnels-management 1.0.8 → 1.0.7303
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/index.d.ts +4 -4
- package/index.js +18 -18
- package/package.json +1 -1
- package/tsbuildinfo.json +1 -1
- package/tunnelAccessTokenProperties.d.ts +43 -43
- package/tunnelAccessTokenProperties.js +138 -138
- package/tunnelManagementClient.d.ts +132 -132
- package/tunnelManagementClient.js +14 -14
- package/tunnelManagementHttpClient.d.ts +92 -92
- package/tunnelManagementHttpClient.js +573 -573
- package/tunnelRequestOptions.d.ts +68 -68
- package/tunnelRequestOptions.js +4 -4
- package/version.d.ts +4 -4
- package/version.js +12 -12
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ClusterDetails, Tunnel, TunnelConnectionMode, TunnelEndpoint, TunnelPort } from '@microsoft/dev-tunnels-contracts';
|
|
3
|
-
import { TunnelRequestOptions } from './tunnelRequestOptions';
|
|
4
|
-
import * as https from 'https';
|
|
5
|
-
/**
|
|
6
|
-
* Interface for a client that manages tunnels and tunnel ports
|
|
7
|
-
* via the tunnel service management API.
|
|
8
|
-
*/
|
|
9
|
-
export interface TunnelManagementClient {
|
|
10
|
-
/**
|
|
11
|
-
* Override https agent for axios requests.
|
|
12
|
-
*/
|
|
13
|
-
httpsAgent?: https.Agent;
|
|
14
|
-
/**
|
|
15
|
-
* Lists tunnels that are owned by the caller.
|
|
16
|
-
*
|
|
17
|
-
* The list can be filtered by setting `TunnelRequestOptions.tags`. Ports will not be
|
|
18
|
-
* included in the returned tunnels unless `TunnelRequestOptions.includePorts` is set to true.
|
|
19
|
-
*
|
|
20
|
-
* @param clusterId A tunnel cluster ID, or null to list tunnels globally.
|
|
21
|
-
* @param domain Tunnel domain, or null for the default domain.
|
|
22
|
-
* @param options Request options.
|
|
23
|
-
*/
|
|
24
|
-
listTunnels(clusterId?: string, domain?: string, options?: TunnelRequestOptions): Promise<Tunnel[]>;
|
|
25
|
-
/**
|
|
26
|
-
* Gets one tunnel by ID or name.
|
|
27
|
-
*
|
|
28
|
-
* Ports will not be included in the returned tunnel unless `TunnelRequestOptions.includePorts`
|
|
29
|
-
* is set to true.
|
|
30
|
-
*
|
|
31
|
-
* @param tunnel Tunnel object including at least either a tunnel name (globally unique,
|
|
32
|
-
* if configured) or tunnel ID and cluster ID.
|
|
33
|
-
* @param options Request options.
|
|
34
|
-
*/
|
|
35
|
-
getTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel | null>;
|
|
36
|
-
/**
|
|
37
|
-
* Creates a tunnel.
|
|
38
|
-
* @param tunnel
|
|
39
|
-
* @param options
|
|
40
|
-
*/
|
|
41
|
-
createTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
|
|
42
|
-
/**
|
|
43
|
-
* Updates properties of a tunnel.
|
|
44
|
-
* @param tunnel
|
|
45
|
-
* @param options
|
|
46
|
-
*/
|
|
47
|
-
updateTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
|
|
48
|
-
/**
|
|
49
|
-
* Deletes a tunnel.
|
|
50
|
-
* @param tunnel
|
|
51
|
-
* @param options
|
|
52
|
-
*/
|
|
53
|
-
deleteTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<boolean>;
|
|
54
|
-
/**
|
|
55
|
-
* Creates or updates an endpoint for the tunnel.
|
|
56
|
-
* @param tunnel
|
|
57
|
-
* @param endpoint
|
|
58
|
-
* @param options
|
|
59
|
-
*/
|
|
60
|
-
updateTunnelEndpoint(tunnel: Tunnel, endpoint: TunnelEndpoint, options?: TunnelRequestOptions): Promise<TunnelEndpoint>;
|
|
61
|
-
/**
|
|
62
|
-
* Deletes a tunnel endpoint.
|
|
63
|
-
* @param tunnel
|
|
64
|
-
* @param hostId
|
|
65
|
-
* @param connectionMode
|
|
66
|
-
* @param options
|
|
67
|
-
*/
|
|
68
|
-
deleteTunnelEndpoints(tunnel: Tunnel, hostId: string, connectionMode?: TunnelConnectionMode, options?: TunnelRequestOptions): Promise<boolean>;
|
|
69
|
-
/**
|
|
70
|
-
* Lists ports on a tunnel.
|
|
71
|
-
*
|
|
72
|
-
* The list can be filtered by setting `TunnelRequestOptions.tags`.
|
|
73
|
-
*
|
|
74
|
-
* @param tunnel Tunnel object including at least either a tunnel name (globally unique,
|
|
75
|
-
* if configured) or tunnel ID and cluster ID.
|
|
76
|
-
* @param options Request options.
|
|
77
|
-
*/
|
|
78
|
-
listTunnelPorts(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<TunnelPort[]>;
|
|
79
|
-
/**
|
|
80
|
-
* Gets one port on a tunnel by port number.
|
|
81
|
-
* @param tunnel
|
|
82
|
-
* @param portNumber
|
|
83
|
-
* @param options
|
|
84
|
-
*/
|
|
85
|
-
getTunnelPort(tunnel: Tunnel, portNumber: number, options?: TunnelRequestOptions): Promise<TunnelPort | null>;
|
|
86
|
-
/**
|
|
87
|
-
* Creates a tunnel port.
|
|
88
|
-
* @param tunnel
|
|
89
|
-
* @param tunnelPort
|
|
90
|
-
* @param options
|
|
91
|
-
*/
|
|
92
|
-
createTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions): Promise<TunnelPort>;
|
|
93
|
-
/**
|
|
94
|
-
* Updates properties of a tunnel port.
|
|
95
|
-
* @param tunnel
|
|
96
|
-
* @param tunnelPort
|
|
97
|
-
* @param options
|
|
98
|
-
*/
|
|
99
|
-
updateTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions): Promise<TunnelPort>;
|
|
100
|
-
/**
|
|
101
|
-
* Deletes a tunnel port.
|
|
102
|
-
* @param tunnel
|
|
103
|
-
* @param portNumber
|
|
104
|
-
* @param options
|
|
105
|
-
*/
|
|
106
|
-
deleteTunnelPort(tunnel: Tunnel, portNumber: number, options?: TunnelRequestOptions): Promise<boolean>;
|
|
107
|
-
/**
|
|
108
|
-
* Lists details of tunneling service clusters in all supported Azure regions.
|
|
109
|
-
*/
|
|
110
|
-
listClusters(): Promise<ClusterDetails[]>;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Interface for the user agent product information for TunnelManagementClient
|
|
114
|
-
*/
|
|
115
|
-
export interface ProductHeaderValue {
|
|
116
|
-
/**
|
|
117
|
-
* Product name.
|
|
118
|
-
*/
|
|
119
|
-
name: string;
|
|
120
|
-
/**
|
|
121
|
-
* Product version. If not supplied, 'unknown' version is used.
|
|
122
|
-
*/
|
|
123
|
-
version?: string;
|
|
124
|
-
}
|
|
125
|
-
export declare abstract class TunnelAuthenticationSchemes {
|
|
126
|
-
/** Authentication scheme for AAD (or Microsoft account) access tokens. */
|
|
127
|
-
static readonly aad = "aad";
|
|
128
|
-
/** Authentication scheme for GitHub access tokens. */
|
|
129
|
-
static readonly github = "github";
|
|
130
|
-
/** Authentication scheme for tunnel access tokens. */
|
|
131
|
-
static readonly tunnel = "tunnel";
|
|
132
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ClusterDetails, Tunnel, TunnelConnectionMode, TunnelEndpoint, TunnelPort } from '@microsoft/dev-tunnels-contracts';
|
|
3
|
+
import { TunnelRequestOptions } from './tunnelRequestOptions';
|
|
4
|
+
import * as https from 'https';
|
|
5
|
+
/**
|
|
6
|
+
* Interface for a client that manages tunnels and tunnel ports
|
|
7
|
+
* via the tunnel service management API.
|
|
8
|
+
*/
|
|
9
|
+
export interface TunnelManagementClient {
|
|
10
|
+
/**
|
|
11
|
+
* Override https agent for axios requests.
|
|
12
|
+
*/
|
|
13
|
+
httpsAgent?: https.Agent;
|
|
14
|
+
/**
|
|
15
|
+
* Lists tunnels that are owned by the caller.
|
|
16
|
+
*
|
|
17
|
+
* The list can be filtered by setting `TunnelRequestOptions.tags`. Ports will not be
|
|
18
|
+
* included in the returned tunnels unless `TunnelRequestOptions.includePorts` is set to true.
|
|
19
|
+
*
|
|
20
|
+
* @param clusterId A tunnel cluster ID, or null to list tunnels globally.
|
|
21
|
+
* @param domain Tunnel domain, or null for the default domain.
|
|
22
|
+
* @param options Request options.
|
|
23
|
+
*/
|
|
24
|
+
listTunnels(clusterId?: string, domain?: string, options?: TunnelRequestOptions): Promise<Tunnel[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Gets one tunnel by ID or name.
|
|
27
|
+
*
|
|
28
|
+
* Ports will not be included in the returned tunnel unless `TunnelRequestOptions.includePorts`
|
|
29
|
+
* is set to true.
|
|
30
|
+
*
|
|
31
|
+
* @param tunnel Tunnel object including at least either a tunnel name (globally unique,
|
|
32
|
+
* if configured) or tunnel ID and cluster ID.
|
|
33
|
+
* @param options Request options.
|
|
34
|
+
*/
|
|
35
|
+
getTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a tunnel.
|
|
38
|
+
* @param tunnel
|
|
39
|
+
* @param options
|
|
40
|
+
*/
|
|
41
|
+
createTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
|
|
42
|
+
/**
|
|
43
|
+
* Updates properties of a tunnel.
|
|
44
|
+
* @param tunnel
|
|
45
|
+
* @param options
|
|
46
|
+
*/
|
|
47
|
+
updateTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
|
|
48
|
+
/**
|
|
49
|
+
* Deletes a tunnel.
|
|
50
|
+
* @param tunnel
|
|
51
|
+
* @param options
|
|
52
|
+
*/
|
|
53
|
+
deleteTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* Creates or updates an endpoint for the tunnel.
|
|
56
|
+
* @param tunnel
|
|
57
|
+
* @param endpoint
|
|
58
|
+
* @param options
|
|
59
|
+
*/
|
|
60
|
+
updateTunnelEndpoint(tunnel: Tunnel, endpoint: TunnelEndpoint, options?: TunnelRequestOptions): Promise<TunnelEndpoint>;
|
|
61
|
+
/**
|
|
62
|
+
* Deletes a tunnel endpoint.
|
|
63
|
+
* @param tunnel
|
|
64
|
+
* @param hostId
|
|
65
|
+
* @param connectionMode
|
|
66
|
+
* @param options
|
|
67
|
+
*/
|
|
68
|
+
deleteTunnelEndpoints(tunnel: Tunnel, hostId: string, connectionMode?: TunnelConnectionMode, options?: TunnelRequestOptions): Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Lists ports on a tunnel.
|
|
71
|
+
*
|
|
72
|
+
* The list can be filtered by setting `TunnelRequestOptions.tags`.
|
|
73
|
+
*
|
|
74
|
+
* @param tunnel Tunnel object including at least either a tunnel name (globally unique,
|
|
75
|
+
* if configured) or tunnel ID and cluster ID.
|
|
76
|
+
* @param options Request options.
|
|
77
|
+
*/
|
|
78
|
+
listTunnelPorts(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<TunnelPort[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Gets one port on a tunnel by port number.
|
|
81
|
+
* @param tunnel
|
|
82
|
+
* @param portNumber
|
|
83
|
+
* @param options
|
|
84
|
+
*/
|
|
85
|
+
getTunnelPort(tunnel: Tunnel, portNumber: number, options?: TunnelRequestOptions): Promise<TunnelPort | null>;
|
|
86
|
+
/**
|
|
87
|
+
* Creates a tunnel port.
|
|
88
|
+
* @param tunnel
|
|
89
|
+
* @param tunnelPort
|
|
90
|
+
* @param options
|
|
91
|
+
*/
|
|
92
|
+
createTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions): Promise<TunnelPort>;
|
|
93
|
+
/**
|
|
94
|
+
* Updates properties of a tunnel port.
|
|
95
|
+
* @param tunnel
|
|
96
|
+
* @param tunnelPort
|
|
97
|
+
* @param options
|
|
98
|
+
*/
|
|
99
|
+
updateTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions): Promise<TunnelPort>;
|
|
100
|
+
/**
|
|
101
|
+
* Deletes a tunnel port.
|
|
102
|
+
* @param tunnel
|
|
103
|
+
* @param portNumber
|
|
104
|
+
* @param options
|
|
105
|
+
*/
|
|
106
|
+
deleteTunnelPort(tunnel: Tunnel, portNumber: number, options?: TunnelRequestOptions): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* Lists details of tunneling service clusters in all supported Azure regions.
|
|
109
|
+
*/
|
|
110
|
+
listClusters(): Promise<ClusterDetails[]>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Interface for the user agent product information for TunnelManagementClient
|
|
114
|
+
*/
|
|
115
|
+
export interface ProductHeaderValue {
|
|
116
|
+
/**
|
|
117
|
+
* Product name.
|
|
118
|
+
*/
|
|
119
|
+
name: string;
|
|
120
|
+
/**
|
|
121
|
+
* Product version. If not supplied, 'unknown' version is used.
|
|
122
|
+
*/
|
|
123
|
+
version?: string;
|
|
124
|
+
}
|
|
125
|
+
export declare abstract class TunnelAuthenticationSchemes {
|
|
126
|
+
/** Authentication scheme for AAD (or Microsoft account) access tokens. */
|
|
127
|
+
static readonly aad = "aad";
|
|
128
|
+
/** Authentication scheme for GitHub access tokens. */
|
|
129
|
+
static readonly github = "github";
|
|
130
|
+
/** Authentication scheme for tunnel access tokens. */
|
|
131
|
+
static readonly tunnel = "tunnel";
|
|
132
|
+
}
|
|
133
133
|
//# sourceMappingURL=tunnelManagementClient.d.ts.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT license.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.TunnelAuthenticationSchemes = void 0;
|
|
6
|
-
class TunnelAuthenticationSchemes {
|
|
7
|
-
}
|
|
8
|
-
exports.TunnelAuthenticationSchemes = TunnelAuthenticationSchemes;
|
|
9
|
-
/** Authentication scheme for AAD (or Microsoft account) access tokens. */
|
|
10
|
-
TunnelAuthenticationSchemes.aad = 'aad';
|
|
11
|
-
/** Authentication scheme for GitHub access tokens. */
|
|
12
|
-
TunnelAuthenticationSchemes.github = 'github';
|
|
13
|
-
/** Authentication scheme for tunnel access tokens. */
|
|
14
|
-
TunnelAuthenticationSchemes.tunnel = 'tunnel';
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT license.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.TunnelAuthenticationSchemes = void 0;
|
|
6
|
+
class TunnelAuthenticationSchemes {
|
|
7
|
+
}
|
|
8
|
+
exports.TunnelAuthenticationSchemes = TunnelAuthenticationSchemes;
|
|
9
|
+
/** Authentication scheme for AAD (or Microsoft account) access tokens. */
|
|
10
|
+
TunnelAuthenticationSchemes.aad = 'aad';
|
|
11
|
+
/** Authentication scheme for GitHub access tokens. */
|
|
12
|
+
TunnelAuthenticationSchemes.github = 'github';
|
|
13
|
+
/** Authentication scheme for tunnel access tokens. */
|
|
14
|
+
TunnelAuthenticationSchemes.tunnel = 'tunnel';
|
|
15
15
|
//# sourceMappingURL=tunnelManagementClient.js.map
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Tunnel, TunnelConnectionMode, TunnelEndpoint, TunnelPort, ClusterDetails } from '@microsoft/dev-tunnels-contracts';
|
|
3
|
-
import { ProductHeaderValue, TunnelManagementClient } from './tunnelManagementClient';
|
|
4
|
-
import { TunnelRequestOptions } from './tunnelRequestOptions';
|
|
5
|
-
import { Method } from 'axios';
|
|
6
|
-
import * as https from 'https';
|
|
7
|
-
declare type NullableIfNotBoolean<T> = T extends boolean ? T : T | null;
|
|
8
|
-
export declare class TunnelManagementHttpClient implements TunnelManagementClient {
|
|
9
|
-
readonly httpsAgent?: https.Agent | undefined;
|
|
10
|
-
additionalRequestHeaders?: {
|
|
11
|
-
[header: string]: string;
|
|
12
|
-
};
|
|
13
|
-
private readonly baseAddress;
|
|
14
|
-
private readonly userTokenCallback;
|
|
15
|
-
private readonly userAgents;
|
|
16
|
-
trace: (msg: string) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Initializes a new instance of the `TunnelManagementHttpClient` class
|
|
19
|
-
* with a client authentication callback, service URI, and HTTP handler.
|
|
20
|
-
*
|
|
21
|
-
* @param userAgent { name, version } object or a comment string to use as the User-Agent header.
|
|
22
|
-
* @param userTokenCallback Optional async callback for retrieving a client authentication
|
|
23
|
-
* header value with access token, for AAD or GitHub user authentication. This may be omitted
|
|
24
|
-
* for anonymous tunnel clients, or if tunnel access tokens will be specified via
|
|
25
|
-
* `TunnelRequestOptions.accessToken`.
|
|
26
|
-
* @param tunnelServiceUri Optional tunnel service URI (not including any path). Defaults to
|
|
27
|
-
* the global tunnel service URI.
|
|
28
|
-
* @param httpsAgent Optional agent that will be invoked for HTTPS requests to the tunnel
|
|
29
|
-
* service.
|
|
30
|
-
*/
|
|
31
|
-
constructor(userAgents: (ProductHeaderValue | string)[] | ProductHeaderValue | string, userTokenCallback?: () => Promise<string | null>, tunnelServiceUri?: string, httpsAgent?: https.Agent | undefined);
|
|
32
|
-
listTunnels(clusterId?: string, domain?: string, options?: TunnelRequestOptions): Promise<Tunnel[]>;
|
|
33
|
-
getTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel | null>;
|
|
34
|
-
createTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
|
|
35
|
-
updateTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
|
|
36
|
-
deleteTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<boolean>;
|
|
37
|
-
updateTunnelEndpoint(tunnel: Tunnel, endpoint: TunnelEndpoint, options?: TunnelRequestOptions): Promise<TunnelEndpoint>;
|
|
38
|
-
deleteTunnelEndpoints(tunnel: Tunnel, hostId: string, connectionMode?: TunnelConnectionMode, options?: TunnelRequestOptions): Promise<boolean>;
|
|
39
|
-
listTunnelPorts(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<TunnelPort[]>;
|
|
40
|
-
getTunnelPort(tunnel: Tunnel, portNumber: number, options?: TunnelRequestOptions): Promise<TunnelPort | null>;
|
|
41
|
-
createTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions): Promise<TunnelPort>;
|
|
42
|
-
updateTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions): Promise<TunnelPort>;
|
|
43
|
-
deleteTunnelPort(tunnel: Tunnel, portNumber: number, options?: TunnelRequestOptions): Promise<boolean>;
|
|
44
|
-
listClusters(): Promise<ClusterDetails[]>;
|
|
45
|
-
/**
|
|
46
|
-
* Sends an HTTP request to the tunnel management API, targeting a specific tunnel.
|
|
47
|
-
* This protected method enables subclasses to support additional tunnel management APIs.
|
|
48
|
-
* @param method HTTP request method.
|
|
49
|
-
* @param tunnel Tunnel that the request is targeting.
|
|
50
|
-
* @param accessTokenScopes Required array of access scopes for tokens in `tunnel.accessTokens`
|
|
51
|
-
* that could be used to authorize the request.
|
|
52
|
-
* @param path Optional request sub-path relative to the tunnel.
|
|
53
|
-
* @param query Optional query string to append to the request.
|
|
54
|
-
* @param options Request options.
|
|
55
|
-
* @param body Optional request body object.
|
|
56
|
-
* @param allowNotFound If true, a 404 response is returned as a null or false result
|
|
57
|
-
* instead of an error.
|
|
58
|
-
* @returns Result of the request.
|
|
59
|
-
*/
|
|
60
|
-
protected sendTunnelRequest<TResult>(method: Method, tunnel: Tunnel, accessTokenScopes: string[], path?: string, query?: string, options?: TunnelRequestOptions, body?: object, allowNotFound?: boolean): Promise<NullableIfNotBoolean<TResult>>;
|
|
61
|
-
/**
|
|
62
|
-
* Sends an HTTP request to the tunnel management API.
|
|
63
|
-
* This protected method enables subclasses to support additional tunnel management APIs.
|
|
64
|
-
* @param method HTTP request method.
|
|
65
|
-
* @param clusterId Optional tunnel service cluster ID to direct the request to. If unspecified,
|
|
66
|
-
* the request will use the global traffic-manager to find the nearest cluster.
|
|
67
|
-
* @param path Required request path.
|
|
68
|
-
* @param query Optional query string to append to the request.
|
|
69
|
-
* @param options Request options.
|
|
70
|
-
* @param body Optional request body object.
|
|
71
|
-
* @param allowNotFound If true, a 404 response is returned as a null or false result
|
|
72
|
-
* instead of an error.
|
|
73
|
-
* @returns Result of the request.
|
|
74
|
-
*/
|
|
75
|
-
protected sendRequest<TResult>(method: Method, clusterId: string | undefined, path: string, query?: string, options?: TunnelRequestOptions, body?: object, allowNotFound?: boolean): Promise<NullableIfNotBoolean<TResult>>;
|
|
76
|
-
private getResponseErrorMessage;
|
|
77
|
-
private buildUri;
|
|
78
|
-
private buildUriForTunnel;
|
|
79
|
-
private getAxiosRequestConfig;
|
|
80
|
-
private convertTunnelForRequest;
|
|
81
|
-
private convertTunnelPortForRequest;
|
|
82
|
-
private tunnelRequestOptionsToQueryString;
|
|
83
|
-
/**
|
|
84
|
-
* Makes an HTTP request using Axios, while tracing request and response details.
|
|
85
|
-
*/
|
|
86
|
-
private request;
|
|
87
|
-
private traceHeaders;
|
|
88
|
-
private traceAuthorizationHeader;
|
|
89
|
-
private traceContent;
|
|
90
|
-
private static replaceTokensInContent;
|
|
91
|
-
}
|
|
92
|
-
export {};
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Tunnel, TunnelConnectionMode, TunnelEndpoint, TunnelPort, ClusterDetails } from '@microsoft/dev-tunnels-contracts';
|
|
3
|
+
import { ProductHeaderValue, TunnelManagementClient } from './tunnelManagementClient';
|
|
4
|
+
import { TunnelRequestOptions } from './tunnelRequestOptions';
|
|
5
|
+
import { Method } from 'axios';
|
|
6
|
+
import * as https from 'https';
|
|
7
|
+
declare type NullableIfNotBoolean<T> = T extends boolean ? T : T | null;
|
|
8
|
+
export declare class TunnelManagementHttpClient implements TunnelManagementClient {
|
|
9
|
+
readonly httpsAgent?: https.Agent | undefined;
|
|
10
|
+
additionalRequestHeaders?: {
|
|
11
|
+
[header: string]: string;
|
|
12
|
+
};
|
|
13
|
+
private readonly baseAddress;
|
|
14
|
+
private readonly userTokenCallback;
|
|
15
|
+
private readonly userAgents;
|
|
16
|
+
trace: (msg: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Initializes a new instance of the `TunnelManagementHttpClient` class
|
|
19
|
+
* with a client authentication callback, service URI, and HTTP handler.
|
|
20
|
+
*
|
|
21
|
+
* @param userAgent { name, version } object or a comment string to use as the User-Agent header.
|
|
22
|
+
* @param userTokenCallback Optional async callback for retrieving a client authentication
|
|
23
|
+
* header value with access token, for AAD or GitHub user authentication. This may be omitted
|
|
24
|
+
* for anonymous tunnel clients, or if tunnel access tokens will be specified via
|
|
25
|
+
* `TunnelRequestOptions.accessToken`.
|
|
26
|
+
* @param tunnelServiceUri Optional tunnel service URI (not including any path). Defaults to
|
|
27
|
+
* the global tunnel service URI.
|
|
28
|
+
* @param httpsAgent Optional agent that will be invoked for HTTPS requests to the tunnel
|
|
29
|
+
* service.
|
|
30
|
+
*/
|
|
31
|
+
constructor(userAgents: (ProductHeaderValue | string)[] | ProductHeaderValue | string, userTokenCallback?: () => Promise<string | null>, tunnelServiceUri?: string, httpsAgent?: https.Agent | undefined);
|
|
32
|
+
listTunnels(clusterId?: string, domain?: string, options?: TunnelRequestOptions): Promise<Tunnel[]>;
|
|
33
|
+
getTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel | null>;
|
|
34
|
+
createTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
|
|
35
|
+
updateTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<Tunnel>;
|
|
36
|
+
deleteTunnel(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<boolean>;
|
|
37
|
+
updateTunnelEndpoint(tunnel: Tunnel, endpoint: TunnelEndpoint, options?: TunnelRequestOptions): Promise<TunnelEndpoint>;
|
|
38
|
+
deleteTunnelEndpoints(tunnel: Tunnel, hostId: string, connectionMode?: TunnelConnectionMode, options?: TunnelRequestOptions): Promise<boolean>;
|
|
39
|
+
listTunnelPorts(tunnel: Tunnel, options?: TunnelRequestOptions): Promise<TunnelPort[]>;
|
|
40
|
+
getTunnelPort(tunnel: Tunnel, portNumber: number, options?: TunnelRequestOptions): Promise<TunnelPort | null>;
|
|
41
|
+
createTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions): Promise<TunnelPort>;
|
|
42
|
+
updateTunnelPort(tunnel: Tunnel, tunnelPort: TunnelPort, options?: TunnelRequestOptions): Promise<TunnelPort>;
|
|
43
|
+
deleteTunnelPort(tunnel: Tunnel, portNumber: number, options?: TunnelRequestOptions): Promise<boolean>;
|
|
44
|
+
listClusters(): Promise<ClusterDetails[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Sends an HTTP request to the tunnel management API, targeting a specific tunnel.
|
|
47
|
+
* This protected method enables subclasses to support additional tunnel management APIs.
|
|
48
|
+
* @param method HTTP request method.
|
|
49
|
+
* @param tunnel Tunnel that the request is targeting.
|
|
50
|
+
* @param accessTokenScopes Required array of access scopes for tokens in `tunnel.accessTokens`
|
|
51
|
+
* that could be used to authorize the request.
|
|
52
|
+
* @param path Optional request sub-path relative to the tunnel.
|
|
53
|
+
* @param query Optional query string to append to the request.
|
|
54
|
+
* @param options Request options.
|
|
55
|
+
* @param body Optional request body object.
|
|
56
|
+
* @param allowNotFound If true, a 404 response is returned as a null or false result
|
|
57
|
+
* instead of an error.
|
|
58
|
+
* @returns Result of the request.
|
|
59
|
+
*/
|
|
60
|
+
protected sendTunnelRequest<TResult>(method: Method, tunnel: Tunnel, accessTokenScopes: string[], path?: string, query?: string, options?: TunnelRequestOptions, body?: object, allowNotFound?: boolean): Promise<NullableIfNotBoolean<TResult>>;
|
|
61
|
+
/**
|
|
62
|
+
* Sends an HTTP request to the tunnel management API.
|
|
63
|
+
* This protected method enables subclasses to support additional tunnel management APIs.
|
|
64
|
+
* @param method HTTP request method.
|
|
65
|
+
* @param clusterId Optional tunnel service cluster ID to direct the request to. If unspecified,
|
|
66
|
+
* the request will use the global traffic-manager to find the nearest cluster.
|
|
67
|
+
* @param path Required request path.
|
|
68
|
+
* @param query Optional query string to append to the request.
|
|
69
|
+
* @param options Request options.
|
|
70
|
+
* @param body Optional request body object.
|
|
71
|
+
* @param allowNotFound If true, a 404 response is returned as a null or false result
|
|
72
|
+
* instead of an error.
|
|
73
|
+
* @returns Result of the request.
|
|
74
|
+
*/
|
|
75
|
+
protected sendRequest<TResult>(method: Method, clusterId: string | undefined, path: string, query?: string, options?: TunnelRequestOptions, body?: object, allowNotFound?: boolean): Promise<NullableIfNotBoolean<TResult>>;
|
|
76
|
+
private getResponseErrorMessage;
|
|
77
|
+
private buildUri;
|
|
78
|
+
private buildUriForTunnel;
|
|
79
|
+
private getAxiosRequestConfig;
|
|
80
|
+
private convertTunnelForRequest;
|
|
81
|
+
private convertTunnelPortForRequest;
|
|
82
|
+
private tunnelRequestOptionsToQueryString;
|
|
83
|
+
/**
|
|
84
|
+
* Makes an HTTP request using Axios, while tracing request and response details.
|
|
85
|
+
*/
|
|
86
|
+
private request;
|
|
87
|
+
private traceHeaders;
|
|
88
|
+
private traceAuthorizationHeader;
|
|
89
|
+
private traceContent;
|
|
90
|
+
private static replaceTokensInContent;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
93
93
|
//# sourceMappingURL=tunnelManagementHttpClient.d.ts.map
|