@uipath/admin-tool 1.203.0-preview.203 → 1.204.0-preview.206
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/dist/index-0t7092fj.js +2375 -0
- package/dist/index-40a6zw4t.js +2246 -0
- package/dist/index-esy280as.js +634 -0
- package/dist/index-f7cp1ap1.js +2411 -0
- package/dist/index-m2vj29s2.js +6501 -0
- package/dist/index-xd0zd702.js +2740 -0
- package/dist/jmespath-v0jttxep.js +1485 -0
- package/dist/js-yaml-qv0npwpc.js +3153 -0
- package/dist/tool-016jy57n.js +1376 -0
- package/dist/tool-1yh8g550.js +52 -0
- package/dist/tool-687d8jq8.js +2531 -0
- package/dist/tool-mhb6cezm.js +2859 -0
- package/dist/tool-pmf56f99.js +1977 -0
- package/dist/tool-v13kh7v7.js +6601 -0
- package/dist/tool.js +70 -48739
- package/package.json +2 -2
|
@@ -0,0 +1,2246 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLoginStatusAsync
|
|
3
|
+
} from "./tool-016jy57n.js";
|
|
4
|
+
import {
|
|
5
|
+
InvalidArgumentError,
|
|
6
|
+
Option,
|
|
7
|
+
OutputFormatter,
|
|
8
|
+
RESULTS,
|
|
9
|
+
addSdkUserAgentHeader,
|
|
10
|
+
catchError,
|
|
11
|
+
extractErrorDetails,
|
|
12
|
+
getSdkUserAgentToken,
|
|
13
|
+
installSdkUserAgentHeader,
|
|
14
|
+
instructionsFor,
|
|
15
|
+
processContext
|
|
16
|
+
} from "./tool-v13kh7v7.js";
|
|
17
|
+
import"./tool-1yh8g550.js";
|
|
18
|
+
|
|
19
|
+
// ../vpngateway-sdk/generated/src/runtime.ts
|
|
20
|
+
var BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
|
21
|
+
|
|
22
|
+
class Configuration {
|
|
23
|
+
configuration;
|
|
24
|
+
constructor(configuration = {}) {
|
|
25
|
+
this.configuration = configuration;
|
|
26
|
+
}
|
|
27
|
+
set config(configuration) {
|
|
28
|
+
this.configuration = configuration;
|
|
29
|
+
}
|
|
30
|
+
get basePath() {
|
|
31
|
+
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
|
|
32
|
+
}
|
|
33
|
+
get fetchApi() {
|
|
34
|
+
return this.configuration.fetchApi;
|
|
35
|
+
}
|
|
36
|
+
get middleware() {
|
|
37
|
+
return this.configuration.middleware || [];
|
|
38
|
+
}
|
|
39
|
+
get queryParamsStringify() {
|
|
40
|
+
return this.configuration.queryParamsStringify || querystring;
|
|
41
|
+
}
|
|
42
|
+
get username() {
|
|
43
|
+
return this.configuration.username;
|
|
44
|
+
}
|
|
45
|
+
get password() {
|
|
46
|
+
return this.configuration.password;
|
|
47
|
+
}
|
|
48
|
+
get apiKey() {
|
|
49
|
+
const apiKey = this.configuration.apiKey;
|
|
50
|
+
if (apiKey) {
|
|
51
|
+
return typeof apiKey === "function" ? apiKey : () => apiKey;
|
|
52
|
+
}
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
get accessToken() {
|
|
56
|
+
const accessToken = this.configuration.accessToken;
|
|
57
|
+
if (accessToken) {
|
|
58
|
+
return typeof accessToken === "function" ? accessToken : async () => accessToken;
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
get headers() {
|
|
63
|
+
return this.configuration.headers;
|
|
64
|
+
}
|
|
65
|
+
get credentials() {
|
|
66
|
+
return this.configuration.credentials;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
var DefaultConfig = new Configuration;
|
|
70
|
+
|
|
71
|
+
class BaseAPI {
|
|
72
|
+
configuration;
|
|
73
|
+
static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
|
|
74
|
+
middleware;
|
|
75
|
+
constructor(configuration = DefaultConfig) {
|
|
76
|
+
this.configuration = configuration;
|
|
77
|
+
this.middleware = configuration.middleware;
|
|
78
|
+
}
|
|
79
|
+
withMiddleware(...middlewares) {
|
|
80
|
+
const next = this.clone();
|
|
81
|
+
next.middleware = next.middleware.concat(...middlewares);
|
|
82
|
+
return next;
|
|
83
|
+
}
|
|
84
|
+
withPreMiddleware(...preMiddlewares) {
|
|
85
|
+
const middlewares = preMiddlewares.map((pre) => ({ pre }));
|
|
86
|
+
return this.withMiddleware(...middlewares);
|
|
87
|
+
}
|
|
88
|
+
withPostMiddleware(...postMiddlewares) {
|
|
89
|
+
const middlewares = postMiddlewares.map((post) => ({ post }));
|
|
90
|
+
return this.withMiddleware(...middlewares);
|
|
91
|
+
}
|
|
92
|
+
isJsonMime(mime) {
|
|
93
|
+
if (!mime) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return BaseAPI.jsonRegex.test(mime);
|
|
97
|
+
}
|
|
98
|
+
async request(context, initOverrides) {
|
|
99
|
+
const { url, init } = await this.createFetchParams(context, initOverrides);
|
|
100
|
+
const response = await this.fetchApi(url, init);
|
|
101
|
+
if (response && (response.status >= 200 && response.status < 300)) {
|
|
102
|
+
return response;
|
|
103
|
+
}
|
|
104
|
+
throw new ResponseError(response, "Response returned an error code");
|
|
105
|
+
}
|
|
106
|
+
async createFetchParams(context, initOverrides) {
|
|
107
|
+
let url = this.configuration.basePath + context.path;
|
|
108
|
+
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
|
|
109
|
+
url += "?" + this.configuration.queryParamsStringify(context.query);
|
|
110
|
+
}
|
|
111
|
+
const headers = Object.assign({}, this.configuration.headers, context.headers);
|
|
112
|
+
Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
|
|
113
|
+
const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
|
|
114
|
+
const initParams = {
|
|
115
|
+
method: context.method,
|
|
116
|
+
headers,
|
|
117
|
+
body: context.body,
|
|
118
|
+
credentials: this.configuration.credentials
|
|
119
|
+
};
|
|
120
|
+
const overriddenInit = {
|
|
121
|
+
...initParams,
|
|
122
|
+
...await initOverrideFn({
|
|
123
|
+
init: initParams,
|
|
124
|
+
context
|
|
125
|
+
})
|
|
126
|
+
};
|
|
127
|
+
let body;
|
|
128
|
+
if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) {
|
|
129
|
+
body = overriddenInit.body;
|
|
130
|
+
} else if (this.isJsonMime(headers["Content-Type"])) {
|
|
131
|
+
body = JSON.stringify(overriddenInit.body);
|
|
132
|
+
} else {
|
|
133
|
+
body = overriddenInit.body;
|
|
134
|
+
}
|
|
135
|
+
const init = {
|
|
136
|
+
...overriddenInit,
|
|
137
|
+
body
|
|
138
|
+
};
|
|
139
|
+
return { url, init };
|
|
140
|
+
}
|
|
141
|
+
fetchApi = async (url, init) => {
|
|
142
|
+
let fetchParams = { url, init };
|
|
143
|
+
for (const middleware of this.middleware) {
|
|
144
|
+
if (middleware.pre) {
|
|
145
|
+
fetchParams = await middleware.pre({
|
|
146
|
+
fetch: this.fetchApi,
|
|
147
|
+
...fetchParams
|
|
148
|
+
}) || fetchParams;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
let response = undefined;
|
|
152
|
+
try {
|
|
153
|
+
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
|
154
|
+
} catch (e) {
|
|
155
|
+
for (const middleware of this.middleware) {
|
|
156
|
+
if (middleware.onError) {
|
|
157
|
+
response = await middleware.onError({
|
|
158
|
+
fetch: this.fetchApi,
|
|
159
|
+
url: fetchParams.url,
|
|
160
|
+
init: fetchParams.init,
|
|
161
|
+
error: e,
|
|
162
|
+
response: response ? response.clone() : undefined
|
|
163
|
+
}) || response;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (response === undefined) {
|
|
167
|
+
if (e instanceof Error) {
|
|
168
|
+
throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
|
|
169
|
+
} else {
|
|
170
|
+
throw e;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for (const middleware of this.middleware) {
|
|
175
|
+
if (middleware.post) {
|
|
176
|
+
response = await middleware.post({
|
|
177
|
+
fetch: this.fetchApi,
|
|
178
|
+
url: fetchParams.url,
|
|
179
|
+
init: fetchParams.init,
|
|
180
|
+
response: response.clone()
|
|
181
|
+
}) || response;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return response;
|
|
185
|
+
};
|
|
186
|
+
clone() {
|
|
187
|
+
const constructor = this.constructor;
|
|
188
|
+
const next = new constructor(this.configuration);
|
|
189
|
+
next.middleware = this.middleware.slice();
|
|
190
|
+
return next;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function isBlob(value) {
|
|
194
|
+
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
195
|
+
}
|
|
196
|
+
function isFormData(value) {
|
|
197
|
+
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
class ResponseError extends Error {
|
|
201
|
+
response;
|
|
202
|
+
name = "ResponseError";
|
|
203
|
+
constructor(response, msg) {
|
|
204
|
+
super(msg);
|
|
205
|
+
this.response = response;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
class FetchError extends Error {
|
|
210
|
+
cause;
|
|
211
|
+
name = "FetchError";
|
|
212
|
+
constructor(cause, msg) {
|
|
213
|
+
super(msg);
|
|
214
|
+
this.cause = cause;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
class RequiredError extends Error {
|
|
219
|
+
field;
|
|
220
|
+
name = "RequiredError";
|
|
221
|
+
constructor(field, msg) {
|
|
222
|
+
super(msg);
|
|
223
|
+
this.field = field;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function querystring(params, prefix = "") {
|
|
227
|
+
return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
|
|
228
|
+
}
|
|
229
|
+
function querystringSingleKey(key, value, keyPrefix = "") {
|
|
230
|
+
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
|
|
231
|
+
if (value instanceof Array) {
|
|
232
|
+
const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
|
|
233
|
+
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
|
234
|
+
}
|
|
235
|
+
if (value instanceof Set) {
|
|
236
|
+
const valueAsArray = Array.from(value);
|
|
237
|
+
return querystringSingleKey(key, valueAsArray, keyPrefix);
|
|
238
|
+
}
|
|
239
|
+
if (value instanceof Date) {
|
|
240
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
|
|
241
|
+
}
|
|
242
|
+
if (value instanceof Object) {
|
|
243
|
+
return querystring(value, fullKey);
|
|
244
|
+
}
|
|
245
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
|
246
|
+
}
|
|
247
|
+
class JSONApiResponse {
|
|
248
|
+
raw;
|
|
249
|
+
transformer;
|
|
250
|
+
constructor(raw, transformer = (jsonValue) => jsonValue) {
|
|
251
|
+
this.raw = raw;
|
|
252
|
+
this.transformer = transformer;
|
|
253
|
+
}
|
|
254
|
+
async value() {
|
|
255
|
+
return this.transformer(await this.raw.json());
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
class VoidApiResponse {
|
|
260
|
+
raw;
|
|
261
|
+
constructor(raw) {
|
|
262
|
+
this.raw = raw;
|
|
263
|
+
}
|
|
264
|
+
async value() {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
// ../vpngateway-sdk/package.json
|
|
269
|
+
var package_default = {
|
|
270
|
+
name: "@uipath/admin-vpngateway-sdk",
|
|
271
|
+
author: "UiPath",
|
|
272
|
+
license: "SEE LICENSE IN LICENSE.txt",
|
|
273
|
+
version: "1.204.0",
|
|
274
|
+
description: "SDK for the UiPath Hypervisor VPN Gateway management APIs.",
|
|
275
|
+
repository: {
|
|
276
|
+
type: "git",
|
|
277
|
+
url: "https://github.com/UiPath/cli.git",
|
|
278
|
+
directory: "packages/admin/vpngateway-sdk"
|
|
279
|
+
},
|
|
280
|
+
publishConfig: {
|
|
281
|
+
registry: "https://npm.pkg.github.com/@uipath"
|
|
282
|
+
},
|
|
283
|
+
keywords: [
|
|
284
|
+
"uipath",
|
|
285
|
+
"vpn-gateway",
|
|
286
|
+
"hypervisor",
|
|
287
|
+
"sdk"
|
|
288
|
+
],
|
|
289
|
+
type: "module",
|
|
290
|
+
main: "./dist/index.js",
|
|
291
|
+
types: "./dist/src/index.d.ts",
|
|
292
|
+
exports: {
|
|
293
|
+
".": {
|
|
294
|
+
types: "./dist/src/index.d.ts",
|
|
295
|
+
default: "./dist/index.js"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
files: [
|
|
299
|
+
"dist"
|
|
300
|
+
],
|
|
301
|
+
private: true,
|
|
302
|
+
scripts: {
|
|
303
|
+
build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
304
|
+
typecheck: "tsc --noEmit",
|
|
305
|
+
generate: "bun run src/scripts/generate-sdk.ts",
|
|
306
|
+
lint: "biome check ."
|
|
307
|
+
},
|
|
308
|
+
devDependencies: {
|
|
309
|
+
"@openapitools/openapi-generator-cli": "^2.31.1",
|
|
310
|
+
"@types/node": "^25.5.0",
|
|
311
|
+
"@uipath/auth": "workspace:*",
|
|
312
|
+
"@uipath/common": "workspace:*",
|
|
313
|
+
"@uipath/filesystem": "workspace:*",
|
|
314
|
+
typescript: "^7.0.2"
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
// ../vpngateway-sdk/src/user-agent.ts
|
|
319
|
+
var SDK_USER_AGENT = getSdkUserAgentToken(package_default);
|
|
320
|
+
installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
|
|
321
|
+
// ../vpngateway-sdk/generated/src/models/FreezingMetadata.ts
|
|
322
|
+
function FreezingMetadataFromJSON(json) {
|
|
323
|
+
return FreezingMetadataFromJSONTyped(json, false);
|
|
324
|
+
}
|
|
325
|
+
function FreezingMetadataFromJSONTyped(json, ignoreDiscriminator) {
|
|
326
|
+
if (json == null) {
|
|
327
|
+
return json;
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
frozen: json["Frozen"] == null ? undefined : json["Frozen"],
|
|
331
|
+
daysToFreeze: json["DaysToFreeze"] == null ? undefined : json["DaysToFreeze"],
|
|
332
|
+
freezingValidationMessage: json["FreezingValidationMessage"] == null ? undefined : json["FreezingValidationMessage"]
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
// ../vpngateway-sdk/generated/src/models/GatewayPrivateEndpoint.ts
|
|
336
|
+
function GatewayPrivateEndpointFromJSON(json) {
|
|
337
|
+
return GatewayPrivateEndpointFromJSONTyped(json, false);
|
|
338
|
+
}
|
|
339
|
+
function GatewayPrivateEndpointFromJSONTyped(json, ignoreDiscriminator) {
|
|
340
|
+
if (json == null) {
|
|
341
|
+
return json;
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
id: json["Id"],
|
|
345
|
+
name: json["Name"],
|
|
346
|
+
targetResourceId: json["TargetResourceId"] == null ? undefined : json["TargetResourceId"],
|
|
347
|
+
privateEndpointNames: json["PrivateEndpointNames"] == null ? undefined : json["PrivateEndpointNames"],
|
|
348
|
+
state: json["State"]
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayClientRootCertificate.ts
|
|
352
|
+
function VpnGatewayClientRootCertificateFromJSON(json) {
|
|
353
|
+
return VpnGatewayClientRootCertificateFromJSONTyped(json, false);
|
|
354
|
+
}
|
|
355
|
+
function VpnGatewayClientRootCertificateFromJSONTyped(json, ignoreDiscriminator) {
|
|
356
|
+
if (json == null) {
|
|
357
|
+
return json;
|
|
358
|
+
}
|
|
359
|
+
return {
|
|
360
|
+
name: json["Name"],
|
|
361
|
+
publicCertificateData: json["PublicCertificateData"]
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayClientConfiguration.ts
|
|
366
|
+
function VpnGatewayClientConfigurationFromJSON(json) {
|
|
367
|
+
return VpnGatewayClientConfigurationFromJSONTyped(json, false);
|
|
368
|
+
}
|
|
369
|
+
function VpnGatewayClientConfigurationFromJSONTyped(json, ignoreDiscriminator) {
|
|
370
|
+
if (json == null) {
|
|
371
|
+
return json;
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
rootAddressSpace: json["RootAddressSpace"] == null ? undefined : json["RootAddressSpace"],
|
|
375
|
+
clientAddressSpaces: json["ClientAddressSpaces"],
|
|
376
|
+
vpnClientRootCertificates: json["VpnClientRootCertificates"].map(VpnGatewayClientRootCertificateFromJSON)
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayConnectionIPSecPolicy.ts
|
|
381
|
+
function VpnGatewayConnectionIPSecPolicyFromJSON(json) {
|
|
382
|
+
return VpnGatewayConnectionIPSecPolicyFromJSONTyped(json, false);
|
|
383
|
+
}
|
|
384
|
+
function VpnGatewayConnectionIPSecPolicyFromJSONTyped(json, ignoreDiscriminator) {
|
|
385
|
+
if (json == null) {
|
|
386
|
+
return json;
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
key: json["Key"] == null ? undefined : json["Key"],
|
|
390
|
+
saLifeTimeSeconds: json["SaLifeTimeSeconds"],
|
|
391
|
+
saDataSizeKilobytes: json["SaDataSizeKilobytes"],
|
|
392
|
+
iPsecEncryption: json["IPsecEncryption"],
|
|
393
|
+
iPsecIntegrity: json["IPsecIntegrity"],
|
|
394
|
+
ikeEncryption: json["IkeEncryption"],
|
|
395
|
+
ikeIntegrity: json["IkeIntegrity"],
|
|
396
|
+
dhGroup: json["DhGroup"],
|
|
397
|
+
pfsGroup: json["PfsGroup"]
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
function VpnGatewayConnectionIPSecPolicyToJSON(json) {
|
|
401
|
+
return VpnGatewayConnectionIPSecPolicyToJSONTyped(json, false);
|
|
402
|
+
}
|
|
403
|
+
function VpnGatewayConnectionIPSecPolicyToJSONTyped(value, ignoreDiscriminator = false) {
|
|
404
|
+
if (value == null) {
|
|
405
|
+
return value;
|
|
406
|
+
}
|
|
407
|
+
return {
|
|
408
|
+
Key: value["key"],
|
|
409
|
+
SaLifeTimeSeconds: value["saLifeTimeSeconds"],
|
|
410
|
+
SaDataSizeKilobytes: value["saDataSizeKilobytes"],
|
|
411
|
+
IPsecEncryption: value["iPsecEncryption"],
|
|
412
|
+
IPsecIntegrity: value["iPsecIntegrity"],
|
|
413
|
+
IkeEncryption: value["ikeEncryption"],
|
|
414
|
+
IkeIntegrity: value["ikeIntegrity"],
|
|
415
|
+
DhGroup: value["dhGroup"],
|
|
416
|
+
PfsGroup: value["pfsGroup"]
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayConnection.ts
|
|
421
|
+
function VpnGatewayConnectionFromJSON(json) {
|
|
422
|
+
return VpnGatewayConnectionFromJSONTyped(json, false);
|
|
423
|
+
}
|
|
424
|
+
function VpnGatewayConnectionFromJSONTyped(json, ignoreDiscriminator) {
|
|
425
|
+
if (json == null) {
|
|
426
|
+
return json;
|
|
427
|
+
}
|
|
428
|
+
return {
|
|
429
|
+
key: json["Key"],
|
|
430
|
+
name: json["Name"],
|
|
431
|
+
description: json["Description"] == null ? undefined : json["Description"],
|
|
432
|
+
targetIpAddress: json["TargetIpAddress"] == null ? undefined : json["TargetIpAddress"],
|
|
433
|
+
targetAddressSpaces: json["TargetAddressSpaces"] == null ? undefined : json["TargetAddressSpaces"],
|
|
434
|
+
expressRouteTargetResourceId: json["ExpressRouteTargetResourceId"] == null ? undefined : json["ExpressRouteTargetResourceId"],
|
|
435
|
+
internal: json["Internal"] == null ? undefined : json["Internal"],
|
|
436
|
+
state: json["State"],
|
|
437
|
+
insertedDateTime: json["InsertedDateTime"] == null ? undefined : new Date(json["InsertedDateTime"]),
|
|
438
|
+
ipSecPolicy: json["IpSecPolicy"] == null ? undefined : VpnGatewayConnectionIPSecPolicyFromJSON(json["IpSecPolicy"]),
|
|
439
|
+
bgpEnabled: (json["BGPEnabled"] ?? json["BgpEnabled"]) == null ? undefined : json["BGPEnabled"] ?? json["BgpEnabled"],
|
|
440
|
+
bgpPeerAddress: (json["BGPPeerAddress"] ?? json["BgpPeerAddress"]) == null ? undefined : json["BGPPeerAddress"] ?? json["BgpPeerAddress"],
|
|
441
|
+
asn: (json["ASN"] ?? json["Asn"]) == null ? undefined : json["ASN"] ?? json["Asn"],
|
|
442
|
+
primaryCustomBGPAddress: json["PrimaryCustomBGPAddress"] == null ? undefined : json["PrimaryCustomBGPAddress"]
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayNva.ts
|
|
447
|
+
function VpnGatewayNvaFromJSON(json) {
|
|
448
|
+
return VpnGatewayNvaFromJSONTyped(json, false);
|
|
449
|
+
}
|
|
450
|
+
function VpnGatewayNvaFromJSONTyped(json, ignoreDiscriminator) {
|
|
451
|
+
if (json == null) {
|
|
452
|
+
return json;
|
|
453
|
+
}
|
|
454
|
+
return {
|
|
455
|
+
id: json["Id"],
|
|
456
|
+
state: json["State"],
|
|
457
|
+
nextHopIpAddress: json["NextHopIpAddress"] == null ? undefined : json["NextHopIpAddress"],
|
|
458
|
+
privateIpAddress: json["PrivateIpAddress"] == null ? undefined : json["PrivateIpAddress"],
|
|
459
|
+
targetVnetResourceId: json["TargetVnetResourceId"] == null ? undefined : json["TargetVnetResourceId"],
|
|
460
|
+
hubVnetResourceId: json["HubVnetResourceId"] == null ? undefined : json["HubVnetResourceId"],
|
|
461
|
+
reverseBgpDummyVnetResourceId: json["ReverseBgpDummyVnetResourceId"] == null ? undefined : json["ReverseBgpDummyVnetResourceId"],
|
|
462
|
+
routes: json["Routes"] == null ? undefined : json["Routes"],
|
|
463
|
+
autoPeerHub: json["AutoPeerHub"] == null ? undefined : json["AutoPeerHub"],
|
|
464
|
+
autoPeerBgp: json["AutoPeerBgp"] == null ? undefined : json["AutoPeerBgp"],
|
|
465
|
+
hubPeeringState: json["HubPeeringState"] == null ? undefined : json["HubPeeringState"],
|
|
466
|
+
bgpPeeringState: json["BgpPeeringState"] == null ? undefined : json["BgpPeeringState"],
|
|
467
|
+
subscriptionKey: json["SubscriptionKey"] == null ? undefined : json["SubscriptionKey"]
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayPeering.ts
|
|
472
|
+
function VpnGatewayPeeringFromJSON(json) {
|
|
473
|
+
return VpnGatewayPeeringFromJSONTyped(json, false);
|
|
474
|
+
}
|
|
475
|
+
function VpnGatewayPeeringFromJSONTyped(json, ignoreDiscriminator) {
|
|
476
|
+
if (json == null) {
|
|
477
|
+
return json;
|
|
478
|
+
}
|
|
479
|
+
return {
|
|
480
|
+
key: json["Key"],
|
|
481
|
+
name: json["Name"] == null ? undefined : json["Name"],
|
|
482
|
+
targetResourceId: json["TargetResourceId"] == null ? undefined : json["TargetResourceId"],
|
|
483
|
+
targetAddressSpaces: json["TargetAddressSpaces"] == null ? undefined : json["TargetAddressSpaces"],
|
|
484
|
+
state: json["State"],
|
|
485
|
+
insertedDateTime: json["InsertedDateTime"] == null ? undefined : new Date(json["InsertedDateTime"])
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayTrustedCertificate.ts
|
|
490
|
+
function VpnGatewayTrustedCertificateFromJSON(json) {
|
|
491
|
+
return VpnGatewayTrustedCertificateFromJSONTyped(json, false);
|
|
492
|
+
}
|
|
493
|
+
function VpnGatewayTrustedCertificateFromJSONTyped(json, ignoreDiscriminator) {
|
|
494
|
+
if (json == null) {
|
|
495
|
+
return json;
|
|
496
|
+
}
|
|
497
|
+
return {
|
|
498
|
+
name: json["Name"],
|
|
499
|
+
publicCertificateData: json["PublicCertificateData"]
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
function VpnGatewayTrustedCertificateToJSON(json) {
|
|
503
|
+
return VpnGatewayTrustedCertificateToJSONTyped(json, false);
|
|
504
|
+
}
|
|
505
|
+
function VpnGatewayTrustedCertificateToJSONTyped(value, ignoreDiscriminator = false) {
|
|
506
|
+
if (value == null) {
|
|
507
|
+
return value;
|
|
508
|
+
}
|
|
509
|
+
return {
|
|
510
|
+
Name: value["name"],
|
|
511
|
+
PublicCertificateData: value["publicCertificateData"]
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// ../vpngateway-sdk/generated/src/models/VpnGateway.ts
|
|
516
|
+
function VpnGatewayFromJSON(json) {
|
|
517
|
+
return VpnGatewayFromJSONTyped(json, false);
|
|
518
|
+
}
|
|
519
|
+
function VpnGatewayFromJSONTyped(json, ignoreDiscriminator) {
|
|
520
|
+
if (json == null) {
|
|
521
|
+
return json;
|
|
522
|
+
}
|
|
523
|
+
return {
|
|
524
|
+
key: json["Key"],
|
|
525
|
+
name: json["Name"],
|
|
526
|
+
description: json["Description"] == null ? undefined : json["Description"],
|
|
527
|
+
vnetAddressSpace: json["VnetAddressSpace"],
|
|
528
|
+
vnetGatewaySubnetAddressSpace: json["VnetGatewaySubnetAddressSpace"],
|
|
529
|
+
publicIp: json["PublicIp"] == null ? undefined : json["PublicIp"],
|
|
530
|
+
resourceId: json["ResourceId"] == null ? undefined : json["ResourceId"],
|
|
531
|
+
location: json["Location"] == null ? undefined : json["Location"],
|
|
532
|
+
state: json["State"],
|
|
533
|
+
sku: json["Sku"] == null ? undefined : json["Sku"],
|
|
534
|
+
gatewayType: json["GatewayType"] == null ? undefined : json["GatewayType"],
|
|
535
|
+
insertedDateTime: json["InsertedDateTime"] == null ? undefined : new Date(json["InsertedDateTime"]),
|
|
536
|
+
dnsServers: json["DnsServers"] == null ? undefined : json["DnsServers"],
|
|
537
|
+
internalDnsServer: json["InternalDnsServer"] == null ? undefined : json["InternalDnsServer"],
|
|
538
|
+
connections: json["Connections"] == null ? undefined : json["Connections"].map(VpnGatewayConnectionFromJSON),
|
|
539
|
+
privateEndpoints: json["PrivateEndpoints"] == null ? undefined : json["PrivateEndpoints"].map(GatewayPrivateEndpointFromJSON),
|
|
540
|
+
privateEndpointNames: json["PrivateEndpointNames"] == null ? undefined : json["PrivateEndpointNames"],
|
|
541
|
+
maxUserConnections: json["MaxUserConnections"] == null ? undefined : json["MaxUserConnections"],
|
|
542
|
+
peerings: json["Peerings"] == null ? undefined : json["Peerings"].map(VpnGatewayPeeringFromJSON),
|
|
543
|
+
vpnGatewayClientConfiguration: json["VpnGatewayClientConfiguration"] == null ? undefined : VpnGatewayClientConfigurationFromJSON(json["VpnGatewayClientConfiguration"]),
|
|
544
|
+
bgpEnabled: (json["BGPEnabled"] ?? json["BgpEnabled"]) == null ? undefined : json["BGPEnabled"] ?? json["BgpEnabled"],
|
|
545
|
+
asn: (json["ASN"] ?? json["Asn"]) == null ? undefined : json["ASN"] ?? json["Asn"],
|
|
546
|
+
primaryBGPAddress: json["PrimaryBGPAddress"] == null ? undefined : json["PrimaryBGPAddress"],
|
|
547
|
+
primaryApipaAddresses: json["PrimaryApipaAddresses"] == null ? undefined : json["PrimaryApipaAddresses"],
|
|
548
|
+
trustedCertificates: json["TrustedCertificates"] == null ? undefined : json["TrustedCertificates"].map(VpnGatewayTrustedCertificateFromJSON),
|
|
549
|
+
nva: json["Nva"] == null ? undefined : VpnGatewayNvaFromJSON(json["Nva"]),
|
|
550
|
+
freezing: json["Freezing"] == null ? undefined : FreezingMetadataFromJSON(json["Freezing"])
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// ../vpngateway-sdk/generated/src/models/ODataValueOfIEnumerableOfVpnGateway.ts
|
|
555
|
+
function ODataValueOfIEnumerableOfVpnGatewayFromJSON(json) {
|
|
556
|
+
return ODataValueOfIEnumerableOfVpnGatewayFromJSONTyped(json, false);
|
|
557
|
+
}
|
|
558
|
+
function ODataValueOfIEnumerableOfVpnGatewayFromJSONTyped(json, ignoreDiscriminator) {
|
|
559
|
+
if (json == null) {
|
|
560
|
+
return json;
|
|
561
|
+
}
|
|
562
|
+
return {
|
|
563
|
+
value: json["value"] == null ? undefined : json["value"].map(VpnGatewayFromJSON)
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayConnectionCreationRequest.ts
|
|
567
|
+
function VpnGatewayConnectionCreationRequestToJSON(json) {
|
|
568
|
+
return VpnGatewayConnectionCreationRequestToJSONTyped(json, false);
|
|
569
|
+
}
|
|
570
|
+
function VpnGatewayConnectionCreationRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
571
|
+
if (value == null) {
|
|
572
|
+
return value;
|
|
573
|
+
}
|
|
574
|
+
return {
|
|
575
|
+
Name: value["name"],
|
|
576
|
+
TargetIpAddress: value["targetIpAddress"],
|
|
577
|
+
TargetAddressSpaces: value["targetAddressSpaces"],
|
|
578
|
+
ExpressRouteTargetResourceId: value["expressRouteTargetResourceId"],
|
|
579
|
+
SharedKey: value["sharedKey"],
|
|
580
|
+
Internal: value["internal"],
|
|
581
|
+
BgpEnabled: value["bgpEnabled"],
|
|
582
|
+
Asn: value["asn"],
|
|
583
|
+
BgpPeerAddress: value["bgpPeerAddress"],
|
|
584
|
+
PrimaryCustomBGPAddress: value["primaryCustomBGPAddress"],
|
|
585
|
+
IpSecPolicy: VpnGatewayConnectionIPSecPolicyToJSON(value["ipSecPolicy"])
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayConnectionEditRequest.ts
|
|
589
|
+
function VpnGatewayConnectionEditRequestToJSON(json) {
|
|
590
|
+
return VpnGatewayConnectionEditRequestToJSONTyped(json, false);
|
|
591
|
+
}
|
|
592
|
+
function VpnGatewayConnectionEditRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
593
|
+
if (value == null) {
|
|
594
|
+
return value;
|
|
595
|
+
}
|
|
596
|
+
return {
|
|
597
|
+
Name: value["name"],
|
|
598
|
+
TargetIpAddress: value["targetIpAddress"],
|
|
599
|
+
TargetAddressSpaces: value["targetAddressSpaces"],
|
|
600
|
+
SharedKey: value["sharedKey"],
|
|
601
|
+
BgpEnabled: value["bgpEnabled"],
|
|
602
|
+
Asn: value["asn"],
|
|
603
|
+
BgpPeerAddress: value["bgpPeerAddress"],
|
|
604
|
+
PrimaryCustomBGPAddress: value["primaryCustomBGPAddress"],
|
|
605
|
+
IpSecPolicy: VpnGatewayConnectionIPSecPolicyToJSON(value["ipSecPolicy"])
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayConnectionsEditConnectionParameters.ts
|
|
609
|
+
function VpnGatewayConnectionsEditConnectionParametersToJSON(json) {
|
|
610
|
+
return VpnGatewayConnectionsEditConnectionParametersToJSONTyped(json, false);
|
|
611
|
+
}
|
|
612
|
+
function VpnGatewayConnectionsEditConnectionParametersToJSONTyped(value, ignoreDiscriminator = false) {
|
|
613
|
+
if (value == null) {
|
|
614
|
+
return value;
|
|
615
|
+
}
|
|
616
|
+
return {
|
|
617
|
+
request: VpnGatewayConnectionEditRequestToJSON(value["request"])
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayCreationRequest.ts
|
|
621
|
+
var VpnGatewayCreationRequestSkuEnum = {
|
|
622
|
+
Basic: "Basic"
|
|
623
|
+
};
|
|
624
|
+
var VpnGatewayCreationRequestTypeEnum = {
|
|
625
|
+
Vpn: "Vpn",
|
|
626
|
+
ExpressRoute: "ExpressRoute"
|
|
627
|
+
};
|
|
628
|
+
function VpnGatewayCreationRequestToJSON(json) {
|
|
629
|
+
return VpnGatewayCreationRequestToJSONTyped(json, false);
|
|
630
|
+
}
|
|
631
|
+
function VpnGatewayCreationRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
632
|
+
if (value == null) {
|
|
633
|
+
return value;
|
|
634
|
+
}
|
|
635
|
+
return {
|
|
636
|
+
Name: value["name"],
|
|
637
|
+
Description: value["description"],
|
|
638
|
+
VnetAddressSpace: value["vnetAddressSpace"],
|
|
639
|
+
DnsServers: value["dnsServers"],
|
|
640
|
+
Sku: value["sku"],
|
|
641
|
+
Type: value["type"],
|
|
642
|
+
PrimaryApipaAddresses: value["primaryApipaAddresses"],
|
|
643
|
+
TrustedCertificates: value["trustedCertificates"] == null ? undefined : value["trustedCertificates"].map(VpnGatewayTrustedCertificateToJSON)
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayEditRequest.ts
|
|
647
|
+
function VpnGatewayEditRequestToJSON(json) {
|
|
648
|
+
return VpnGatewayEditRequestToJSONTyped(json, false);
|
|
649
|
+
}
|
|
650
|
+
function VpnGatewayEditRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
651
|
+
if (value == null) {
|
|
652
|
+
return value;
|
|
653
|
+
}
|
|
654
|
+
return {
|
|
655
|
+
Name: value["name"],
|
|
656
|
+
Description: value["description"],
|
|
657
|
+
DnsServers: value["dnsServers"],
|
|
658
|
+
PrimaryApipaAddresses: value["primaryApipaAddresses"],
|
|
659
|
+
Sku: value["sku"],
|
|
660
|
+
TrustedCertificates: value["trustedCertificates"] == null ? undefined : value["trustedCertificates"].map(VpnGatewayTrustedCertificateToJSON)
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewayTenantConfiguration.ts
|
|
664
|
+
function VpnGatewayTenantConfigurationFromJSON(json) {
|
|
665
|
+
return VpnGatewayTenantConfigurationFromJSONTyped(json, false);
|
|
666
|
+
}
|
|
667
|
+
function VpnGatewayTenantConfigurationFromJSONTyped(json, ignoreDiscriminator) {
|
|
668
|
+
if (json == null) {
|
|
669
|
+
return json;
|
|
670
|
+
}
|
|
671
|
+
return {
|
|
672
|
+
canCreateVpnGateway: json["CanCreateVpnGateway"],
|
|
673
|
+
validationError: json["ValidationError"] == null ? undefined : json["ValidationError"]
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewaysCreateConnectionParameters.ts
|
|
677
|
+
function VpnGatewaysCreateConnectionParametersToJSON(json) {
|
|
678
|
+
return VpnGatewaysCreateConnectionParametersToJSONTyped(json, false);
|
|
679
|
+
}
|
|
680
|
+
function VpnGatewaysCreateConnectionParametersToJSONTyped(value, ignoreDiscriminator = false) {
|
|
681
|
+
if (value == null) {
|
|
682
|
+
return value;
|
|
683
|
+
}
|
|
684
|
+
return {
|
|
685
|
+
request: VpnGatewayConnectionCreationRequestToJSON(value["request"])
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewaysCreateVpnGatewayParameters.ts
|
|
689
|
+
function VpnGatewaysCreateVpnGatewayParametersToJSON(json) {
|
|
690
|
+
return VpnGatewaysCreateVpnGatewayParametersToJSONTyped(json, false);
|
|
691
|
+
}
|
|
692
|
+
function VpnGatewaysCreateVpnGatewayParametersToJSONTyped(value, ignoreDiscriminator = false) {
|
|
693
|
+
if (value == null) {
|
|
694
|
+
return value;
|
|
695
|
+
}
|
|
696
|
+
return {
|
|
697
|
+
request: VpnGatewayCreationRequestToJSON(value["request"])
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
// ../vpngateway-sdk/generated/src/models/VpnGatewaysEditVpnGatewayParameters.ts
|
|
701
|
+
function VpnGatewaysEditVpnGatewayParametersToJSON(json) {
|
|
702
|
+
return VpnGatewaysEditVpnGatewayParametersToJSONTyped(json, false);
|
|
703
|
+
}
|
|
704
|
+
function VpnGatewaysEditVpnGatewayParametersToJSONTyped(value, ignoreDiscriminator = false) {
|
|
705
|
+
if (value == null) {
|
|
706
|
+
return value;
|
|
707
|
+
}
|
|
708
|
+
return {
|
|
709
|
+
request: VpnGatewayEditRequestToJSON(value["request"])
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
// ../vpngateway-sdk/generated/src/apis/VpnGatewayConnectionsApi.ts
|
|
713
|
+
class VpnGatewayConnectionsApi extends BaseAPI {
|
|
714
|
+
async vpnGatewayConnectionsDeleteByKeyRaw(requestParameters, initOverrides) {
|
|
715
|
+
if (requestParameters["key"] == null) {
|
|
716
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling vpnGatewayConnectionsDeleteByKey().');
|
|
717
|
+
}
|
|
718
|
+
const queryParameters = {};
|
|
719
|
+
if (requestParameters["apiVersion"] != null) {
|
|
720
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
721
|
+
}
|
|
722
|
+
const headerParameters = {};
|
|
723
|
+
let urlPath = `/odata/VpnGatewayConnections/{key}`;
|
|
724
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
725
|
+
const response = await this.request({
|
|
726
|
+
path: urlPath,
|
|
727
|
+
method: "DELETE",
|
|
728
|
+
headers: headerParameters,
|
|
729
|
+
query: queryParameters
|
|
730
|
+
}, initOverrides);
|
|
731
|
+
return new VoidApiResponse(response);
|
|
732
|
+
}
|
|
733
|
+
async vpnGatewayConnectionsDeleteByKey(requestParameters, initOverrides) {
|
|
734
|
+
await this.vpnGatewayConnectionsDeleteByKeyRaw(requestParameters, initOverrides);
|
|
735
|
+
}
|
|
736
|
+
async vpnGatewayConnectionsEditConnectionByKeyRaw(requestParameters, initOverrides) {
|
|
737
|
+
if (requestParameters["key"] == null) {
|
|
738
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling vpnGatewayConnectionsEditConnectionByKey().');
|
|
739
|
+
}
|
|
740
|
+
const queryParameters = {};
|
|
741
|
+
if (requestParameters["apiVersion"] != null) {
|
|
742
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
743
|
+
}
|
|
744
|
+
const headerParameters = {};
|
|
745
|
+
headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
|
|
746
|
+
let urlPath = `/odata/VpnGatewayConnections/{key}/EditConnection`;
|
|
747
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
748
|
+
const response = await this.request({
|
|
749
|
+
path: urlPath,
|
|
750
|
+
method: "POST",
|
|
751
|
+
headers: headerParameters,
|
|
752
|
+
query: queryParameters,
|
|
753
|
+
body: VpnGatewayConnectionsEditConnectionParametersToJSON(requestParameters["vpnGatewayConnectionsEditConnectionParameters"])
|
|
754
|
+
}, initOverrides);
|
|
755
|
+
return new JSONApiResponse(response, (jsonValue) => VpnGatewayConnectionFromJSON(jsonValue));
|
|
756
|
+
}
|
|
757
|
+
async vpnGatewayConnectionsEditConnectionByKey(requestParameters, initOverrides) {
|
|
758
|
+
const response = await this.vpnGatewayConnectionsEditConnectionByKeyRaw(requestParameters, initOverrides);
|
|
759
|
+
return await response.value();
|
|
760
|
+
}
|
|
761
|
+
async vpnGatewayConnectionsGetVpnGatewayConnectionByKeyRaw(requestParameters, initOverrides) {
|
|
762
|
+
if (requestParameters["key"] == null) {
|
|
763
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling vpnGatewayConnectionsGetVpnGatewayConnectionByKey().');
|
|
764
|
+
}
|
|
765
|
+
const queryParameters = {};
|
|
766
|
+
if (requestParameters["apiVersion"] != null) {
|
|
767
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
768
|
+
}
|
|
769
|
+
if (requestParameters["$select"] != null) {
|
|
770
|
+
queryParameters["$select"] = requestParameters["$select"];
|
|
771
|
+
}
|
|
772
|
+
if (requestParameters["$expand"] != null) {
|
|
773
|
+
queryParameters["$expand"] = requestParameters["$expand"];
|
|
774
|
+
}
|
|
775
|
+
const headerParameters = {};
|
|
776
|
+
let urlPath = `/odata/VpnGatewayConnections/{key}`;
|
|
777
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
778
|
+
const response = await this.request({
|
|
779
|
+
path: urlPath,
|
|
780
|
+
method: "GET",
|
|
781
|
+
headers: headerParameters,
|
|
782
|
+
query: queryParameters
|
|
783
|
+
}, initOverrides);
|
|
784
|
+
return new JSONApiResponse(response, (jsonValue) => VpnGatewayConnectionFromJSON(jsonValue));
|
|
785
|
+
}
|
|
786
|
+
async vpnGatewayConnectionsGetVpnGatewayConnectionByKey(requestParameters, initOverrides) {
|
|
787
|
+
const response = await this.vpnGatewayConnectionsGetVpnGatewayConnectionByKeyRaw(requestParameters, initOverrides);
|
|
788
|
+
return await response.value();
|
|
789
|
+
}
|
|
790
|
+
async vpnGatewayConnectionsRefreshConnectionByKeyRaw(requestParameters, initOverrides) {
|
|
791
|
+
if (requestParameters["key"] == null) {
|
|
792
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling vpnGatewayConnectionsRefreshConnectionByKey().');
|
|
793
|
+
}
|
|
794
|
+
const queryParameters = {};
|
|
795
|
+
if (requestParameters["apiVersion"] != null) {
|
|
796
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
797
|
+
}
|
|
798
|
+
const headerParameters = {};
|
|
799
|
+
let urlPath = `/odata/VpnGatewayConnections/{key}/RefreshConnection`;
|
|
800
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
801
|
+
const response = await this.request({
|
|
802
|
+
path: urlPath,
|
|
803
|
+
method: "POST",
|
|
804
|
+
headers: headerParameters,
|
|
805
|
+
query: queryParameters
|
|
806
|
+
}, initOverrides);
|
|
807
|
+
return new VoidApiResponse(response);
|
|
808
|
+
}
|
|
809
|
+
async vpnGatewayConnectionsRefreshConnectionByKey(requestParameters, initOverrides) {
|
|
810
|
+
await this.vpnGatewayConnectionsRefreshConnectionByKeyRaw(requestParameters, initOverrides);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
// ../vpngateway-sdk/generated/src/apis/VpnGatewaysApi.ts
|
|
814
|
+
class VpnGatewaysApi extends BaseAPI {
|
|
815
|
+
async vpnGatewaysCreateConnectionByKeyRaw(requestParameters, initOverrides) {
|
|
816
|
+
if (requestParameters["key"] == null) {
|
|
817
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling vpnGatewaysCreateConnectionByKey().');
|
|
818
|
+
}
|
|
819
|
+
const queryParameters = {};
|
|
820
|
+
if (requestParameters["apiVersion"] != null) {
|
|
821
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
822
|
+
}
|
|
823
|
+
const headerParameters = {};
|
|
824
|
+
headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
|
|
825
|
+
let urlPath = `/odata/VpnGateways/{key}/CreateConnection`;
|
|
826
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
827
|
+
const response = await this.request({
|
|
828
|
+
path: urlPath,
|
|
829
|
+
method: "POST",
|
|
830
|
+
headers: headerParameters,
|
|
831
|
+
query: queryParameters,
|
|
832
|
+
body: VpnGatewaysCreateConnectionParametersToJSON(requestParameters["vpnGatewaysCreateConnectionParameters"])
|
|
833
|
+
}, initOverrides);
|
|
834
|
+
return new JSONApiResponse(response, (jsonValue) => VpnGatewayConnectionFromJSON(jsonValue));
|
|
835
|
+
}
|
|
836
|
+
async vpnGatewaysCreateConnectionByKey(requestParameters, initOverrides) {
|
|
837
|
+
const response = await this.vpnGatewaysCreateConnectionByKeyRaw(requestParameters, initOverrides);
|
|
838
|
+
return await response.value();
|
|
839
|
+
}
|
|
840
|
+
async vpnGatewaysCreateVpnGatewayRaw(requestParameters, initOverrides) {
|
|
841
|
+
const queryParameters = {};
|
|
842
|
+
if (requestParameters["apiVersion"] != null) {
|
|
843
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
844
|
+
}
|
|
845
|
+
const headerParameters = {};
|
|
846
|
+
headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
|
|
847
|
+
let urlPath = `/odata/VpnGateways/CreateVpnGateway`;
|
|
848
|
+
const response = await this.request({
|
|
849
|
+
path: urlPath,
|
|
850
|
+
method: "POST",
|
|
851
|
+
headers: headerParameters,
|
|
852
|
+
query: queryParameters,
|
|
853
|
+
body: VpnGatewaysCreateVpnGatewayParametersToJSON(requestParameters["vpnGatewaysCreateVpnGatewayParameters"])
|
|
854
|
+
}, initOverrides);
|
|
855
|
+
return new JSONApiResponse(response, (jsonValue) => VpnGatewayFromJSON(jsonValue));
|
|
856
|
+
}
|
|
857
|
+
async vpnGatewaysCreateVpnGateway(requestParameters = {}, initOverrides) {
|
|
858
|
+
const response = await this.vpnGatewaysCreateVpnGatewayRaw(requestParameters, initOverrides);
|
|
859
|
+
return await response.value();
|
|
860
|
+
}
|
|
861
|
+
async vpnGatewaysDeleteByKeyRaw(requestParameters, initOverrides) {
|
|
862
|
+
if (requestParameters["key"] == null) {
|
|
863
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling vpnGatewaysDeleteByKey().');
|
|
864
|
+
}
|
|
865
|
+
const queryParameters = {};
|
|
866
|
+
if (requestParameters["apiVersion"] != null) {
|
|
867
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
868
|
+
}
|
|
869
|
+
const headerParameters = {};
|
|
870
|
+
let urlPath = `/odata/VpnGateways/{key}`;
|
|
871
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
872
|
+
const response = await this.request({
|
|
873
|
+
path: urlPath,
|
|
874
|
+
method: "DELETE",
|
|
875
|
+
headers: headerParameters,
|
|
876
|
+
query: queryParameters
|
|
877
|
+
}, initOverrides);
|
|
878
|
+
return new VoidApiResponse(response);
|
|
879
|
+
}
|
|
880
|
+
async vpnGatewaysDeleteByKey(requestParameters, initOverrides) {
|
|
881
|
+
await this.vpnGatewaysDeleteByKeyRaw(requestParameters, initOverrides);
|
|
882
|
+
}
|
|
883
|
+
async vpnGatewaysEditVpnGatewayByKeyRaw(requestParameters, initOverrides) {
|
|
884
|
+
if (requestParameters["key"] == null) {
|
|
885
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling vpnGatewaysEditVpnGatewayByKey().');
|
|
886
|
+
}
|
|
887
|
+
const queryParameters = {};
|
|
888
|
+
if (requestParameters["apiVersion"] != null) {
|
|
889
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
890
|
+
}
|
|
891
|
+
const headerParameters = {};
|
|
892
|
+
headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
|
|
893
|
+
let urlPath = `/odata/VpnGateways/{key}/EditVpnGateway`;
|
|
894
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
895
|
+
const response = await this.request({
|
|
896
|
+
path: urlPath,
|
|
897
|
+
method: "POST",
|
|
898
|
+
headers: headerParameters,
|
|
899
|
+
query: queryParameters,
|
|
900
|
+
body: VpnGatewaysEditVpnGatewayParametersToJSON(requestParameters["vpnGatewaysEditVpnGatewayParameters"])
|
|
901
|
+
}, initOverrides);
|
|
902
|
+
return new JSONApiResponse(response, (jsonValue) => VpnGatewayFromJSON(jsonValue));
|
|
903
|
+
}
|
|
904
|
+
async vpnGatewaysEditVpnGatewayByKey(requestParameters, initOverrides) {
|
|
905
|
+
const response = await this.vpnGatewaysEditVpnGatewayByKeyRaw(requestParameters, initOverrides);
|
|
906
|
+
return await response.value();
|
|
907
|
+
}
|
|
908
|
+
async vpnGatewaysGetVpnGatewayByKeyRaw(requestParameters, initOverrides) {
|
|
909
|
+
if (requestParameters["key"] == null) {
|
|
910
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling vpnGatewaysGetVpnGatewayByKey().');
|
|
911
|
+
}
|
|
912
|
+
const queryParameters = {};
|
|
913
|
+
if (requestParameters["apiVersion"] != null) {
|
|
914
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
915
|
+
}
|
|
916
|
+
if (requestParameters["$select"] != null) {
|
|
917
|
+
queryParameters["$select"] = requestParameters["$select"];
|
|
918
|
+
}
|
|
919
|
+
if (requestParameters["$expand"] != null) {
|
|
920
|
+
queryParameters["$expand"] = requestParameters["$expand"];
|
|
921
|
+
}
|
|
922
|
+
const headerParameters = {};
|
|
923
|
+
let urlPath = `/odata/VpnGateways/{key}`;
|
|
924
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
925
|
+
const response = await this.request({
|
|
926
|
+
path: urlPath,
|
|
927
|
+
method: "GET",
|
|
928
|
+
headers: headerParameters,
|
|
929
|
+
query: queryParameters
|
|
930
|
+
}, initOverrides);
|
|
931
|
+
return new JSONApiResponse(response, (jsonValue) => VpnGatewayFromJSON(jsonValue));
|
|
932
|
+
}
|
|
933
|
+
async vpnGatewaysGetVpnGatewayByKey(requestParameters, initOverrides) {
|
|
934
|
+
const response = await this.vpnGatewaysGetVpnGatewayByKeyRaw(requestParameters, initOverrides);
|
|
935
|
+
return await response.value();
|
|
936
|
+
}
|
|
937
|
+
async vpnGatewaysGetVpnGatewaysRaw(requestParameters, initOverrides) {
|
|
938
|
+
const queryParameters = {};
|
|
939
|
+
if (requestParameters["apiVersion"] != null) {
|
|
940
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
941
|
+
}
|
|
942
|
+
if (requestParameters["$select"] != null) {
|
|
943
|
+
queryParameters["$select"] = requestParameters["$select"];
|
|
944
|
+
}
|
|
945
|
+
if (requestParameters["$expand"] != null) {
|
|
946
|
+
queryParameters["$expand"] = requestParameters["$expand"];
|
|
947
|
+
}
|
|
948
|
+
if (requestParameters["$filter"] != null) {
|
|
949
|
+
queryParameters["$filter"] = requestParameters["$filter"];
|
|
950
|
+
}
|
|
951
|
+
if (requestParameters["$orderby"] != null) {
|
|
952
|
+
queryParameters["$orderby"] = requestParameters["$orderby"];
|
|
953
|
+
}
|
|
954
|
+
if (requestParameters["$top"] != null) {
|
|
955
|
+
queryParameters["$top"] = requestParameters["$top"];
|
|
956
|
+
}
|
|
957
|
+
if (requestParameters["$skip"] != null) {
|
|
958
|
+
queryParameters["$skip"] = requestParameters["$skip"];
|
|
959
|
+
}
|
|
960
|
+
if (requestParameters["$count"] != null) {
|
|
961
|
+
queryParameters["$count"] = requestParameters["$count"];
|
|
962
|
+
}
|
|
963
|
+
const headerParameters = {};
|
|
964
|
+
let urlPath = `/odata/VpnGateways`;
|
|
965
|
+
const response = await this.request({
|
|
966
|
+
path: urlPath,
|
|
967
|
+
method: "GET",
|
|
968
|
+
headers: headerParameters,
|
|
969
|
+
query: queryParameters
|
|
970
|
+
}, initOverrides);
|
|
971
|
+
return new JSONApiResponse(response, (jsonValue) => ODataValueOfIEnumerableOfVpnGatewayFromJSON(jsonValue));
|
|
972
|
+
}
|
|
973
|
+
async vpnGatewaysGetVpnGateways(requestParameters = {}, initOverrides) {
|
|
974
|
+
const response = await this.vpnGatewaysGetVpnGatewaysRaw(requestParameters, initOverrides);
|
|
975
|
+
return await response.value();
|
|
976
|
+
}
|
|
977
|
+
async vpnGatewaysRedeployByKeyRaw(requestParameters, initOverrides) {
|
|
978
|
+
if (requestParameters["key"] == null) {
|
|
979
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling vpnGatewaysRedeployByKey().');
|
|
980
|
+
}
|
|
981
|
+
const queryParameters = {};
|
|
982
|
+
if (requestParameters["apiVersion"] != null) {
|
|
983
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
984
|
+
}
|
|
985
|
+
const headerParameters = {};
|
|
986
|
+
let urlPath = `/odata/VpnGateways/{key}/Redeploy`;
|
|
987
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
988
|
+
const response = await this.request({
|
|
989
|
+
path: urlPath,
|
|
990
|
+
method: "POST",
|
|
991
|
+
headers: headerParameters,
|
|
992
|
+
query: queryParameters
|
|
993
|
+
}, initOverrides);
|
|
994
|
+
return new VoidApiResponse(response);
|
|
995
|
+
}
|
|
996
|
+
async vpnGatewaysRedeployByKey(requestParameters, initOverrides) {
|
|
997
|
+
await this.vpnGatewaysRedeployByKeyRaw(requestParameters, initOverrides);
|
|
998
|
+
}
|
|
999
|
+
async vpnGatewaysTenantConfigurationRaw(requestParameters, initOverrides) {
|
|
1000
|
+
const queryParameters = {};
|
|
1001
|
+
if (requestParameters["apiVersion"] != null) {
|
|
1002
|
+
queryParameters["api-version"] = requestParameters["apiVersion"];
|
|
1003
|
+
}
|
|
1004
|
+
const headerParameters = {};
|
|
1005
|
+
let urlPath = `/odata/VpnGateways/TenantConfiguration`;
|
|
1006
|
+
const response = await this.request({
|
|
1007
|
+
path: urlPath,
|
|
1008
|
+
method: "GET",
|
|
1009
|
+
headers: headerParameters,
|
|
1010
|
+
query: queryParameters
|
|
1011
|
+
}, initOverrides);
|
|
1012
|
+
return new JSONApiResponse(response, (jsonValue) => VpnGatewayTenantConfigurationFromJSON(jsonValue));
|
|
1013
|
+
}
|
|
1014
|
+
async vpnGatewaysTenantConfiguration(requestParameters = {}, initOverrides) {
|
|
1015
|
+
const response = await this.vpnGatewaysTenantConfigurationRaw(requestParameters, initOverrides);
|
|
1016
|
+
return await response.value();
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
// ../vpngateway-sdk/src/client-factory.ts
|
|
1020
|
+
async function resolveConfig(options) {
|
|
1021
|
+
const status = await getLoginStatusAsync();
|
|
1022
|
+
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
1023
|
+
throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
|
|
1024
|
+
}
|
|
1025
|
+
if (!status.organizationId) {
|
|
1026
|
+
throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
|
|
1027
|
+
}
|
|
1028
|
+
const tenant = options?.tenantName ?? status.tenantName;
|
|
1029
|
+
if (!tenant) {
|
|
1030
|
+
throw new Error("Tenant not available. Pass --tenant <name> or log in with a tenant context.");
|
|
1031
|
+
}
|
|
1032
|
+
const basePath = `${status.baseUrl}/${encodeURIComponent(status.organizationId)}/${encodeURIComponent(tenant)}/hypervisor_`;
|
|
1033
|
+
const bearerToken = options?.s2sToken ?? status.accessToken;
|
|
1034
|
+
return {
|
|
1035
|
+
config: new Configuration({
|
|
1036
|
+
basePath,
|
|
1037
|
+
headers: addSdkUserAgentHeader({
|
|
1038
|
+
Authorization: `Bearer ${bearerToken}`,
|
|
1039
|
+
"x-uipath-source": "UiPath.CLI"
|
|
1040
|
+
}, SDK_USER_AGENT)
|
|
1041
|
+
}),
|
|
1042
|
+
organizationId: status.organizationId,
|
|
1043
|
+
tenantName: tenant
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
async function createApiClient(ApiClass, options) {
|
|
1047
|
+
const { config, organizationId, tenantName } = await resolveConfig(options);
|
|
1048
|
+
return {
|
|
1049
|
+
api: new ApiClass(config),
|
|
1050
|
+
organizationId,
|
|
1051
|
+
tenantName
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
// ../vpngateway-commands/src/helpers/report-error.ts
|
|
1055
|
+
var LOCAL_THROW_INSTRUCTIONS = "Review the message above and adjust the command. Run with --help for usage.";
|
|
1056
|
+
async function reportError(error, loginInstructions) {
|
|
1057
|
+
const details = await extractErrorDetails(error);
|
|
1058
|
+
const isAuth = details.result === RESULTS.AuthenticationError;
|
|
1059
|
+
const hasHttpStatus = details.context?.httpStatus !== undefined;
|
|
1060
|
+
const instructions = isAuth ? loginInstructions : hasHttpStatus ? instructionsFor("backend", error) : LOCAL_THROW_INSTRUCTIONS;
|
|
1061
|
+
OutputFormatter.error({
|
|
1062
|
+
Result: details.result,
|
|
1063
|
+
...details.errorCode ? { ErrorCode: details.errorCode } : {},
|
|
1064
|
+
Message: details.message,
|
|
1065
|
+
Instructions: instructions,
|
|
1066
|
+
...details.retry ? { Retry: details.retry } : {}
|
|
1067
|
+
});
|
|
1068
|
+
processContext.exit(1);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
// ../vpngateway-commands/src/helpers/validators.ts
|
|
1072
|
+
var IPV4_OCTET = /^(25[0-5]|2[0-4]\d|[01]?\d?\d)$/;
|
|
1073
|
+
function errorMessage(err) {
|
|
1074
|
+
return err instanceof Error ? err.message : String(err);
|
|
1075
|
+
}
|
|
1076
|
+
function asInvalidArgument(fn) {
|
|
1077
|
+
try {
|
|
1078
|
+
return fn();
|
|
1079
|
+
} catch (err) {
|
|
1080
|
+
throw new InvalidArgumentError(errorMessage(err));
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
function assertIpv4(value, label) {
|
|
1084
|
+
const trimmed = value.trim();
|
|
1085
|
+
const parts = trimmed.split(".");
|
|
1086
|
+
if (parts.length !== 4 || !parts.every((p) => IPV4_OCTET.test(p))) {
|
|
1087
|
+
throw new Error(`Invalid ${label}: '${value}'. Expected an IPv4 address like '203.0.113.10'.`);
|
|
1088
|
+
}
|
|
1089
|
+
return trimmed;
|
|
1090
|
+
}
|
|
1091
|
+
function cidrToIntRange(ip, prefix) {
|
|
1092
|
+
const [a = 0, b = 0, c = 0, d = 0] = ip.split(".").map(Number);
|
|
1093
|
+
const ipInt = ((a * 256 + b) * 256 + c) * 256 + d;
|
|
1094
|
+
const size = 2 ** (32 - prefix);
|
|
1095
|
+
const networkStart = Math.floor(ipInt / size) * size;
|
|
1096
|
+
return { start: networkStart, end: networkStart + size - 1 };
|
|
1097
|
+
}
|
|
1098
|
+
var APIPA_START = 2851995648;
|
|
1099
|
+
var APIPA_END = 2852061183;
|
|
1100
|
+
function assertCidr(value, label, options = {}) {
|
|
1101
|
+
const trimmed = value.trim();
|
|
1102
|
+
const slash = trimmed.indexOf("/");
|
|
1103
|
+
if (slash === -1) {
|
|
1104
|
+
throw new Error(`Invalid ${label}: '${value}'. Expected CIDR notation like '10.0.0.0/24'.`);
|
|
1105
|
+
}
|
|
1106
|
+
const ip = trimmed.slice(0, slash);
|
|
1107
|
+
const prefixText = trimmed.slice(slash + 1);
|
|
1108
|
+
const prefix = Number.parseInt(prefixText, 10);
|
|
1109
|
+
assertIpv4(ip, `${label} address`);
|
|
1110
|
+
if (prefixText.length === 0 || !Number.isInteger(prefix) || prefix < 0 || prefix > 32 || String(prefix) !== prefixText) {
|
|
1111
|
+
throw new Error(`Invalid ${label}: '${value}'. Prefix length must be an integer between 0 and 32.`);
|
|
1112
|
+
}
|
|
1113
|
+
if (options.maxPrefix !== undefined && prefix > options.maxPrefix) {
|
|
1114
|
+
throw new Error(`Invalid ${label}: '${value}'. Prefix /${prefix} is too small; maximum allowed is /${options.maxPrefix}.`);
|
|
1115
|
+
}
|
|
1116
|
+
if (options.minPrefix !== undefined && prefix < options.minPrefix) {
|
|
1117
|
+
throw new Error(`Invalid ${label}: '${value}'. Prefix /${prefix} is too wide; minimum allowed is /${options.minPrefix}.`);
|
|
1118
|
+
}
|
|
1119
|
+
if (options.rejectDefaultRoute && ip === "0.0.0.0" && prefix === 0) {
|
|
1120
|
+
throw new Error(`Invalid ${label}: '0.0.0.0/0' (default route) is not allowed.`);
|
|
1121
|
+
}
|
|
1122
|
+
if (options.rejectApipa) {
|
|
1123
|
+
const { start, end } = cidrToIntRange(ip, prefix);
|
|
1124
|
+
if (start <= APIPA_END && APIPA_START <= end) {
|
|
1125
|
+
throw new Error(`Invalid ${label}: '${value}' overlaps the 169.254.0.0/16 APIPA range, which is reserved.`);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
return trimmed;
|
|
1129
|
+
}
|
|
1130
|
+
var RESERVED_APIPA_ADDRESSES = new Set([
|
|
1131
|
+
"169.254.21.2",
|
|
1132
|
+
"169.254.22.2",
|
|
1133
|
+
"169.254.21.6",
|
|
1134
|
+
"169.254.22.6"
|
|
1135
|
+
]);
|
|
1136
|
+
function assertApipaBgp(value, label = "APIPA address") {
|
|
1137
|
+
const trimmed = assertIpv4(value, label);
|
|
1138
|
+
const parts = trimmed.split(".");
|
|
1139
|
+
if (parts[0] !== "169" || parts[1] !== "254") {
|
|
1140
|
+
throw new Error(`Invalid ${label}: '${value}'. Must start with 169.254 (APIPA range).`);
|
|
1141
|
+
}
|
|
1142
|
+
if (parts[2] !== "21" && parts[2] !== "22") {
|
|
1143
|
+
throw new Error(`Invalid ${label}: '${value}'. Third octet must be 21 or 22.`);
|
|
1144
|
+
}
|
|
1145
|
+
if (RESERVED_APIPA_ADDRESSES.has(trimmed)) {
|
|
1146
|
+
throw new Error(`${label} '${value}' is reserved.`);
|
|
1147
|
+
}
|
|
1148
|
+
return trimmed;
|
|
1149
|
+
}
|
|
1150
|
+
var FORBIDDEN_SHARED_KEY_CHARS = /[\s\-~]/;
|
|
1151
|
+
function assertSharedKey(value) {
|
|
1152
|
+
if (!value) {
|
|
1153
|
+
throw new Error("Shared key is required.");
|
|
1154
|
+
}
|
|
1155
|
+
if (value.length > 128) {
|
|
1156
|
+
throw new Error(`Shared key is too long (${value.length} chars). Max 128.`);
|
|
1157
|
+
}
|
|
1158
|
+
if (FORBIDDEN_SHARED_KEY_CHARS.test(value)) {
|
|
1159
|
+
throw new Error("Shared key must not contain spaces, dashes, or tildes.");
|
|
1160
|
+
}
|
|
1161
|
+
if (!/^[\x21-\x7e]+$/.test(value)) {
|
|
1162
|
+
throw new Error("Shared key must contain only printable ASCII characters.");
|
|
1163
|
+
}
|
|
1164
|
+
return value;
|
|
1165
|
+
}
|
|
1166
|
+
var RESERVED_ASNS = new Set([65515, 64512]);
|
|
1167
|
+
function assertAsn(value) {
|
|
1168
|
+
if (!Number.isInteger(value) || value <= 0) {
|
|
1169
|
+
throw new Error(`Invalid ASN: '${value}'. Must be a positive integer.`);
|
|
1170
|
+
}
|
|
1171
|
+
if (RESERVED_ASNS.has(value)) {
|
|
1172
|
+
throw new Error(`ASN ${value} is reserved.`);
|
|
1173
|
+
}
|
|
1174
|
+
return value;
|
|
1175
|
+
}
|
|
1176
|
+
function assertBase64X509(data, certName) {
|
|
1177
|
+
if (!data.trim()) {
|
|
1178
|
+
throw new Error(`Trusted certificate '${certName}' has empty PublicCertificateData.`);
|
|
1179
|
+
}
|
|
1180
|
+
let decoded;
|
|
1181
|
+
try {
|
|
1182
|
+
decoded = Buffer.from(data, "base64");
|
|
1183
|
+
} catch {
|
|
1184
|
+
throw new Error(`Trusted certificate '${certName}' has invalid Base64 PublicCertificateData.`);
|
|
1185
|
+
}
|
|
1186
|
+
if (decoded.length === 0) {
|
|
1187
|
+
throw new Error(`Trusted certificate '${certName}' has invalid Base64 PublicCertificateData.`);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
function assertTrustedCertSpec(value) {
|
|
1191
|
+
if (/^name=/i.test(value) && /,publicCertificateData=/i.test(value)) {
|
|
1192
|
+
throw new Error(`Invalid --trusted-cert '${value}'. Use the simple '<cert-name>=<base64-cert-data>' form (e.g. 'MyRootCA=MIIE7zCC...'); do NOT use 'name=X,publicCertificateData=Y'.`);
|
|
1193
|
+
}
|
|
1194
|
+
const eq = value.indexOf("=");
|
|
1195
|
+
if (eq <= 0 || eq === value.length - 1) {
|
|
1196
|
+
throw new Error(`Invalid --trusted-cert '${value}'. Expected '<cert-name>=<base64-cert-data>' (e.g. 'MyRootCA=MIIE7zCC...').`);
|
|
1197
|
+
}
|
|
1198
|
+
const name = value.slice(0, eq).trim();
|
|
1199
|
+
const publicCertificateData = value.slice(eq + 1).trim();
|
|
1200
|
+
if (!name) {
|
|
1201
|
+
throw new Error(`Invalid --trusted-cert '${value}'. Certificate name must not be empty.`);
|
|
1202
|
+
}
|
|
1203
|
+
assertBase64X509(publicCertificateData, name);
|
|
1204
|
+
return { name, publicCertificateData };
|
|
1205
|
+
}
|
|
1206
|
+
function assertTrustedCerts(certs, options = {}) {
|
|
1207
|
+
const maxCount = options.maxCount ?? 10;
|
|
1208
|
+
if (certs.length > maxCount) {
|
|
1209
|
+
throw new Error(`Too many trusted certificates: ${certs.length}. Maximum is ${maxCount}.`);
|
|
1210
|
+
}
|
|
1211
|
+
const seenNames = new Set;
|
|
1212
|
+
const seenData = new Set;
|
|
1213
|
+
for (const cert of certs) {
|
|
1214
|
+
const lower = cert.name.toLocaleLowerCase("en-US");
|
|
1215
|
+
if (seenNames.has(lower)) {
|
|
1216
|
+
throw new Error(`Duplicate trusted certificate name: '${cert.name}'.`);
|
|
1217
|
+
}
|
|
1218
|
+
seenNames.add(lower);
|
|
1219
|
+
if (seenData.has(cert.publicCertificateData)) {
|
|
1220
|
+
throw new Error(`Duplicate trusted certificate data for '${cert.name}'.`);
|
|
1221
|
+
}
|
|
1222
|
+
seenData.add(cert.publicCertificateData);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
function assertIpsecPolicy(policy) {
|
|
1226
|
+
if (policy.saLifeTimeSeconds < 300) {
|
|
1227
|
+
throw new Error(`Invalid --ipsec-sa-lifetime ${policy.saLifeTimeSeconds}: must be at least 300 seconds.`);
|
|
1228
|
+
}
|
|
1229
|
+
const size = policy.saDataSizeKilobytes;
|
|
1230
|
+
if (size !== 0 && (size < 1024 || size > 2147483647)) {
|
|
1231
|
+
throw new Error(`Invalid --ipsec-sa-data-size ${size}: must be 0 or between 1024 and 2147483647.`);
|
|
1232
|
+
}
|
|
1233
|
+
if (policy.iPsecEncryption.toUpperCase().includes("GCMAES") && policy.iPsecEncryption.toLowerCase() !== policy.iPsecIntegrity.toLowerCase()) {
|
|
1234
|
+
throw new Error(`When --ipsec-encryption is a GCMAES variant ('${policy.iPsecEncryption}'), --ipsec-integrity must match it exactly. Backend rejects mismatched GCM pairs.`);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
function parseIntFlag(value) {
|
|
1238
|
+
const trimmed = value.trim();
|
|
1239
|
+
const n = Number.parseInt(trimmed, 10);
|
|
1240
|
+
if (!Number.isFinite(n) || String(n) !== trimmed) {
|
|
1241
|
+
throw new Error(`Expected an integer, got '${value}'.`);
|
|
1242
|
+
}
|
|
1243
|
+
return n;
|
|
1244
|
+
}
|
|
1245
|
+
function assertMaxCount(items, max, label) {
|
|
1246
|
+
if (items.length > max) {
|
|
1247
|
+
throw new Error(`Too many ${label} entries: ${items.length}. Maximum is ${max}.`);
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
function ipv4Parser(label) {
|
|
1251
|
+
return (value) => asInvalidArgument(() => assertIpv4(value, label));
|
|
1252
|
+
}
|
|
1253
|
+
function appendIpv4(label) {
|
|
1254
|
+
return (value, previous) => asInvalidArgument(() => [...previous, assertIpv4(value, label)]);
|
|
1255
|
+
}
|
|
1256
|
+
function cidrParser(label, options = {}) {
|
|
1257
|
+
return (value) => asInvalidArgument(() => assertCidr(value, label, options));
|
|
1258
|
+
}
|
|
1259
|
+
function appendCidr(label, options = {}) {
|
|
1260
|
+
return (value, previous) => asInvalidArgument(() => [
|
|
1261
|
+
...previous,
|
|
1262
|
+
assertCidr(value, label, options)
|
|
1263
|
+
]);
|
|
1264
|
+
}
|
|
1265
|
+
function appendApipaBgp(label = "APIPA address") {
|
|
1266
|
+
return (value, previous) => asInvalidArgument(() => [...previous, assertApipaBgp(value, label)]);
|
|
1267
|
+
}
|
|
1268
|
+
function sharedKeyParser(value) {
|
|
1269
|
+
return asInvalidArgument(() => assertSharedKey(value));
|
|
1270
|
+
}
|
|
1271
|
+
function asnParser(value) {
|
|
1272
|
+
return asInvalidArgument(() => assertAsn(parseIntFlag(value)));
|
|
1273
|
+
}
|
|
1274
|
+
function intParser(value) {
|
|
1275
|
+
return asInvalidArgument(() => parseIntFlag(value));
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
// ../vpngateway-commands/src/commands/connections.ts
|
|
1279
|
+
var LOGIN_INSTRUCTIONS = "Ensure you are logged in with 'uip login' and that your account has org-admin access to the Hypervisor service. Pass --tenant <name> to target a tenant other than your login context.";
|
|
1280
|
+
var DELETE_INSTRUCTIONS = "This is destructive. Pass --confirm to confirm. The Azure connection resource is removed; on-prem peer must reconnect to a recreated connection.";
|
|
1281
|
+
var EDIT_INSTRUCTIONS = "Most edits trigger a tunnel renegotiation and a brief connectivity drop. Pass --confirm to confirm.";
|
|
1282
|
+
var COMMON_OPTIONS = {
|
|
1283
|
+
tenant: [
|
|
1284
|
+
"--tenant <name>",
|
|
1285
|
+
"Target tenant name. Defaults to the tenant in your login context."
|
|
1286
|
+
]
|
|
1287
|
+
};
|
|
1288
|
+
var IPSEC_ENCRYPTION = [
|
|
1289
|
+
"None",
|
|
1290
|
+
"AES128",
|
|
1291
|
+
"AES192",
|
|
1292
|
+
"AES256",
|
|
1293
|
+
"GCMAES128",
|
|
1294
|
+
"GCMAES192",
|
|
1295
|
+
"GCMAES256"
|
|
1296
|
+
];
|
|
1297
|
+
var IPSEC_INTEGRITY = [
|
|
1298
|
+
"MD5",
|
|
1299
|
+
"SHA1",
|
|
1300
|
+
"SHA256",
|
|
1301
|
+
"SHA384",
|
|
1302
|
+
"GCMAES128",
|
|
1303
|
+
"GCMAES256"
|
|
1304
|
+
];
|
|
1305
|
+
var IKE_ENCRYPTION = ["AES128", "AES192", "AES256", "GCMAES128", "GCMAES256"];
|
|
1306
|
+
var IKE_INTEGRITY = [
|
|
1307
|
+
"MD5",
|
|
1308
|
+
"SHA1",
|
|
1309
|
+
"SHA256",
|
|
1310
|
+
"SHA384",
|
|
1311
|
+
"GCMAES128",
|
|
1312
|
+
"GCMAES256"
|
|
1313
|
+
];
|
|
1314
|
+
var DH_GROUP = [
|
|
1315
|
+
"None",
|
|
1316
|
+
"DHGroup1",
|
|
1317
|
+
"DHGroup2",
|
|
1318
|
+
"DHGroup14",
|
|
1319
|
+
"DHGroup24",
|
|
1320
|
+
"DHGroup2048",
|
|
1321
|
+
"ECP256",
|
|
1322
|
+
"ECP384"
|
|
1323
|
+
];
|
|
1324
|
+
var PFS_GROUP = [
|
|
1325
|
+
"None",
|
|
1326
|
+
"PFS1",
|
|
1327
|
+
"PFS2",
|
|
1328
|
+
"PFS14",
|
|
1329
|
+
"PFS24",
|
|
1330
|
+
"PFS2048",
|
|
1331
|
+
"ECP256",
|
|
1332
|
+
"ECP384",
|
|
1333
|
+
"PFS"
|
|
1334
|
+
];
|
|
1335
|
+
function assembleIpsec(opts) {
|
|
1336
|
+
const {
|
|
1337
|
+
ipsecSaLifetime,
|
|
1338
|
+
ipsecSaDataSize,
|
|
1339
|
+
ipsecEncryption,
|
|
1340
|
+
ipsecIntegrity,
|
|
1341
|
+
ikeEncryption,
|
|
1342
|
+
ikeIntegrity,
|
|
1343
|
+
dhGroup,
|
|
1344
|
+
pfsGroup
|
|
1345
|
+
} = opts;
|
|
1346
|
+
const provided = [
|
|
1347
|
+
ipsecSaLifetime,
|
|
1348
|
+
ipsecSaDataSize,
|
|
1349
|
+
ipsecEncryption,
|
|
1350
|
+
ipsecIntegrity,
|
|
1351
|
+
ikeEncryption,
|
|
1352
|
+
ikeIntegrity,
|
|
1353
|
+
dhGroup,
|
|
1354
|
+
pfsGroup
|
|
1355
|
+
].filter((f) => f !== undefined).length;
|
|
1356
|
+
if (provided === 0)
|
|
1357
|
+
return;
|
|
1358
|
+
if (ipsecSaLifetime === undefined || ipsecSaDataSize === undefined || ipsecEncryption === undefined || ipsecIntegrity === undefined || ikeEncryption === undefined || ikeIntegrity === undefined || dhGroup === undefined || pfsGroup === undefined) {
|
|
1359
|
+
throw new Error("Partial IPsec policy. When using custom IPsec, pass all of: --ipsec-sa-lifetime, --ipsec-sa-data-size, --ipsec-encryption, --ipsec-integrity, --ike-encryption, --ike-integrity, --dh-group, --pfs-group.");
|
|
1360
|
+
}
|
|
1361
|
+
const policy = {
|
|
1362
|
+
saLifeTimeSeconds: ipsecSaLifetime,
|
|
1363
|
+
saDataSizeKilobytes: ipsecSaDataSize,
|
|
1364
|
+
iPsecEncryption: ipsecEncryption,
|
|
1365
|
+
iPsecIntegrity: ipsecIntegrity,
|
|
1366
|
+
ikeEncryption,
|
|
1367
|
+
ikeIntegrity,
|
|
1368
|
+
dhGroup,
|
|
1369
|
+
pfsGroup
|
|
1370
|
+
};
|
|
1371
|
+
assertIpsecPolicy(policy);
|
|
1372
|
+
return policy;
|
|
1373
|
+
}
|
|
1374
|
+
function withIpsecFlags(cmd) {
|
|
1375
|
+
return cmd.option("--ipsec-sa-lifetime <seconds>", "IPsec SA lifetime in seconds (min 300).", intParser).option("--ipsec-sa-data-size <kb>", "IPsec SA data-size in kilobytes (0 or 1024–2147483647).", intParser).addOption(new Option("--ipsec-encryption <alg>", "IPsec encryption algorithm. If a GCMAES variant is chosen, --ipsec-integrity must match it.").choices(IPSEC_ENCRYPTION)).addOption(new Option("--ipsec-integrity <alg>", "IPsec integrity algorithm.").choices(IPSEC_INTEGRITY)).addOption(new Option("--ike-encryption <alg>", "IKE encryption algorithm.").choices(IKE_ENCRYPTION)).addOption(new Option("--ike-integrity <alg>", "IKE integrity algorithm.").choices(IKE_INTEGRITY)).addOption(new Option("--dh-group <group>", "DH group.").choices(DH_GROUP)).addOption(new Option("--pfs-group <group>", "PFS group.").choices(PFS_GROUP));
|
|
1376
|
+
}
|
|
1377
|
+
var GET_EXAMPLES = [
|
|
1378
|
+
{
|
|
1379
|
+
Description: "Fetch a VPN gateway connection by key",
|
|
1380
|
+
Command: "uip admin integrations vpn connections get 00000000-0000-0000-0000-000000000001",
|
|
1381
|
+
Output: {
|
|
1382
|
+
Code: "VpnGatewayConnectionGet",
|
|
1383
|
+
Data: {
|
|
1384
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1385
|
+
name: "site-a",
|
|
1386
|
+
state: "Connected",
|
|
1387
|
+
targetIpAddress: "203.0.113.10",
|
|
1388
|
+
targetAddressSpaces: ["192.168.1.0/24"],
|
|
1389
|
+
bgpEnabled: false
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
];
|
|
1394
|
+
var EDIT_EXAMPLES = [
|
|
1395
|
+
{
|
|
1396
|
+
Description: "Rename a connection (re-supplying the shared key)",
|
|
1397
|
+
Command: "uip admin integrations vpn connections edit 00000000-0000-0000-0000-000000000001 --shared-key 'MyS3cr3tP4ssphr4se' --name new-name --confirm",
|
|
1398
|
+
Output: {
|
|
1399
|
+
Code: "VpnGatewayConnectionEdited",
|
|
1400
|
+
Data: {
|
|
1401
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1402
|
+
name: "new-name"
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
Description: "Replace target address spaces",
|
|
1408
|
+
Command: "uip admin integrations vpn connections edit 00000000-0000-0000-0000-000000000001 --shared-key 'MyS3cr3tP4ssphr4se' --target-address-space 192.168.1.0/24 --target-address-space 10.10.0.0/16 --confirm",
|
|
1409
|
+
Output: {
|
|
1410
|
+
Code: "VpnGatewayConnectionEdited",
|
|
1411
|
+
Data: {
|
|
1412
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1413
|
+
targetAddressSpaces: ["192.168.1.0/24", "10.10.0.0/16"]
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
Description: "Disable BGP on an existing connection",
|
|
1419
|
+
Command: "uip admin integrations vpn connections edit 00000000-0000-0000-0000-000000000001 --shared-key 'MyS3cr3tP4ssphr4se' --no-bgp-enabled --confirm",
|
|
1420
|
+
Output: {
|
|
1421
|
+
Code: "VpnGatewayConnectionEdited",
|
|
1422
|
+
Data: {
|
|
1423
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1424
|
+
bgpEnabled: false
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
];
|
|
1429
|
+
var REFRESH_EXAMPLES = [
|
|
1430
|
+
{
|
|
1431
|
+
Description: "Refresh the connection's reported state from Azure",
|
|
1432
|
+
Command: "uip admin integrations vpn connections refresh 00000000-0000-0000-0000-000000000001",
|
|
1433
|
+
Output: {
|
|
1434
|
+
Code: "VpnGatewayConnectionRefreshRequested",
|
|
1435
|
+
Data: { Key: "00000000-0000-0000-0000-000000000001" }
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
];
|
|
1439
|
+
var DELETE_EXAMPLES = [
|
|
1440
|
+
{
|
|
1441
|
+
Description: "Delete a connection (--confirm is required)",
|
|
1442
|
+
Command: "uip admin integrations vpn connections delete 00000000-0000-0000-0000-000000000001 --confirm",
|
|
1443
|
+
Output: {
|
|
1444
|
+
Code: "VpnGatewayConnectionDeleted",
|
|
1445
|
+
Data: { Key: "00000000-0000-0000-0000-000000000001" }
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
];
|
|
1449
|
+
var CREATE_EXAMPLES = [
|
|
1450
|
+
{
|
|
1451
|
+
Description: "Site-to-site VPN connection without BGP (static routes)",
|
|
1452
|
+
Command: "uip admin integrations vpn connections create 00000000-0000-0000-0000-0000000000aa --name site-a --shared-key 'MyS3cr3tP4ssphr4se' --target-ip 203.0.113.10 --target-address-space 192.168.1.0/24",
|
|
1453
|
+
Output: {
|
|
1454
|
+
Code: "VpnGatewayConnectionCreated",
|
|
1455
|
+
Data: {
|
|
1456
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1457
|
+
name: "site-a",
|
|
1458
|
+
state: "Connecting",
|
|
1459
|
+
targetIpAddress: "203.0.113.10"
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
Description: "Site-to-site VPN connection with BGP",
|
|
1465
|
+
Command: "uip admin integrations vpn connections create 00000000-0000-0000-0000-0000000000aa --name site-a --shared-key 'MyS3cr3tP4ssphr4se' --target-ip 203.0.113.10 --bgp-enabled --asn 65001 --bgp-peer-address 169.254.21.1",
|
|
1466
|
+
Output: {
|
|
1467
|
+
Code: "VpnGatewayConnectionCreated",
|
|
1468
|
+
Data: {
|
|
1469
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1470
|
+
name: "site-a",
|
|
1471
|
+
state: "Connecting",
|
|
1472
|
+
targetIpAddress: "203.0.113.10",
|
|
1473
|
+
bgpEnabled: true,
|
|
1474
|
+
asn: 65001
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
];
|
|
1479
|
+
var registerConnectionsCommand = (vpn) => {
|
|
1480
|
+
const connections = vpn.command("connections").description([
|
|
1481
|
+
"Manage site-to-site connections on a VPN gateway.",
|
|
1482
|
+
"",
|
|
1483
|
+
"Each connection peers one on-prem network with a UiPath VPN gateway.",
|
|
1484
|
+
"Use `connections create 00000000-0000-0000-0000-0000000000aa` to attach a connection to a",
|
|
1485
|
+
"gateway, then manage the connection lifecycle by its own key.",
|
|
1486
|
+
"",
|
|
1487
|
+
"Operations are asynchronous: a `Success` response means the task was",
|
|
1488
|
+
"ENQUEUED, not applied. Poll `connections get <key>` until `state`",
|
|
1489
|
+
"leaves `Connecting`/`Updating` before issuing the next mutation.",
|
|
1490
|
+
"Concurrent mutations on the same gateway return HTTP 409 — wait a",
|
|
1491
|
+
"few seconds and retry."
|
|
1492
|
+
].join(`
|
|
1493
|
+
`));
|
|
1494
|
+
connections.command("get").argument("<key>", "VPN gateway connection key (GUID).").description("Fetch a VPN gateway connection by key.").option(...COMMON_OPTIONS.tenant).examples(GET_EXAMPLES).trackedAction(processContext, async (key, options) => {
|
|
1495
|
+
const [error, result] = await catchError((async () => {
|
|
1496
|
+
const { api } = await createApiClient(VpnGatewayConnectionsApi, {
|
|
1497
|
+
tenantName: options.tenant
|
|
1498
|
+
});
|
|
1499
|
+
return await api.vpnGatewayConnectionsGetVpnGatewayConnectionByKey({ key });
|
|
1500
|
+
})());
|
|
1501
|
+
if (error) {
|
|
1502
|
+
await reportError(error, LOGIN_INSTRUCTIONS);
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
OutputFormatter.success({
|
|
1506
|
+
Result: RESULTS.Success,
|
|
1507
|
+
Code: "VpnGatewayConnectionGet",
|
|
1508
|
+
Data: result
|
|
1509
|
+
});
|
|
1510
|
+
});
|
|
1511
|
+
const createCmd = connections.command("create").argument("<gateway-key>", "Parent VPN gateway key (GUID).").description([
|
|
1512
|
+
"Attach a new site-to-site connection to a VPN gateway.",
|
|
1513
|
+
"",
|
|
1514
|
+
"Required: --name, --shared-key, --target-ip.",
|
|
1515
|
+
"Without BGP: --target-address-space is required (one or more on-prem",
|
|
1516
|
+
"CIDRs). The default route 0.0.0.0/0 is rejected.",
|
|
1517
|
+
"With BGP: pass --bgp-enabled --asn <n> --bgp-peer-address <ip>.",
|
|
1518
|
+
"",
|
|
1519
|
+
"BGP pairing: --bgp-peer-address is the on-prem device's BGP",
|
|
1520
|
+
"endpoint. It must be the /30 partner of an address in the gateway's",
|
|
1521
|
+
"--apipa-address pool. Convention: gateway gets the higher usable",
|
|
1522
|
+
"(e.g. .X+2 of the /30), on-prem peer gets the lower (.X+1). Example:",
|
|
1523
|
+
"gateway has 169.254.21.10 → on-prem peer is 169.254.21.9 (both in",
|
|
1524
|
+
"the 169.254.21.8/30 block).",
|
|
1525
|
+
"",
|
|
1526
|
+
"Custom IPsec policy is optional. If you set any --ipsec-*, --ike-*,",
|
|
1527
|
+
"--dh-group, or --pfs-group flag, you must set ALL eight. When",
|
|
1528
|
+
"--ipsec-encryption is a GCMAES variant, --ipsec-integrity must equal it."
|
|
1529
|
+
].join(`
|
|
1530
|
+
`)).requiredOption("--name <name>", "Connection name.").requiredOption("--shared-key <key>", "Pre-shared key. Max 128 ASCII chars; no spaces, dashes, or tildes.", sharedKeyParser).requiredOption("--target-ip <ip>", "On-prem VPN device public IPv4.", ipv4Parser("target IP")).option("--target-address-space <cidr>", "On-prem network CIDR (repeatable). Required without --bgp-enabled. 0.0.0.0/0 is not allowed.", appendCidr("target address space", { rejectDefaultRoute: true }), []).option("--bgp-enabled", "Use BGP for dynamic routing.").option("--asn <num>", "BGP ASN for the on-prem peer (positive integer; 65515 and 64512 are reserved).", asnParser).option("--bgp-peer-address <ip>", "BGP peer IPv4 address on the on-prem device.", ipv4Parser("BGP peer address")).option(...COMMON_OPTIONS.tenant);
|
|
1531
|
+
withIpsecFlags(createCmd).examples(CREATE_EXAMPLES).trackedAction(processContext, async (gatewayKey, options) => {
|
|
1532
|
+
const [error, result] = await catchError((async () => {
|
|
1533
|
+
const ipSecPolicy = assembleIpsec(options);
|
|
1534
|
+
if (options.bgpEnabled) {
|
|
1535
|
+
if (options.asn === undefined) {
|
|
1536
|
+
throw new Error("--asn is required when --bgp-enabled is set.");
|
|
1537
|
+
}
|
|
1538
|
+
if (options.bgpPeerAddress === undefined) {
|
|
1539
|
+
throw new Error("--bgp-peer-address is required when --bgp-enabled is set.");
|
|
1540
|
+
}
|
|
1541
|
+
} else if (options.targetAddressSpace.length === 0) {
|
|
1542
|
+
throw new Error("--target-address-space is required (at least once) when --bgp-enabled is not set.");
|
|
1543
|
+
}
|
|
1544
|
+
const request = {
|
|
1545
|
+
name: options.name,
|
|
1546
|
+
sharedKey: options.sharedKey,
|
|
1547
|
+
targetIpAddress: options.targetIp
|
|
1548
|
+
};
|
|
1549
|
+
if (options.targetAddressSpace.length > 0)
|
|
1550
|
+
request.targetAddressSpaces = options.targetAddressSpace;
|
|
1551
|
+
if (options.bgpEnabled !== undefined)
|
|
1552
|
+
request.bgpEnabled = options.bgpEnabled;
|
|
1553
|
+
if (options.asn !== undefined)
|
|
1554
|
+
request.asn = options.asn;
|
|
1555
|
+
if (options.bgpPeerAddress !== undefined)
|
|
1556
|
+
request.bgpPeerAddress = options.bgpPeerAddress;
|
|
1557
|
+
if (ipSecPolicy)
|
|
1558
|
+
request.ipSecPolicy = ipSecPolicy;
|
|
1559
|
+
const { api } = await createApiClient(VpnGatewaysApi, {
|
|
1560
|
+
tenantName: options.tenant
|
|
1561
|
+
});
|
|
1562
|
+
return await api.vpnGatewaysCreateConnectionByKey({
|
|
1563
|
+
key: gatewayKey,
|
|
1564
|
+
vpnGatewaysCreateConnectionParameters: { request }
|
|
1565
|
+
});
|
|
1566
|
+
})());
|
|
1567
|
+
if (error) {
|
|
1568
|
+
await reportError(error, LOGIN_INSTRUCTIONS);
|
|
1569
|
+
return;
|
|
1570
|
+
}
|
|
1571
|
+
OutputFormatter.success({
|
|
1572
|
+
Result: RESULTS.Success,
|
|
1573
|
+
Code: "VpnGatewayConnectionCreated",
|
|
1574
|
+
Data: result
|
|
1575
|
+
});
|
|
1576
|
+
});
|
|
1577
|
+
const editCmd = connections.command("edit").argument("<key>", "VPN gateway connection key (GUID).").description([
|
|
1578
|
+
"Update a VPN gateway connection's mutable fields.",
|
|
1579
|
+
"",
|
|
1580
|
+
"--shared-key and --confirm are REQUIRED on every edit. Re-supply the",
|
|
1581
|
+
"current PSK; pass --confirm to acknowledge that most edits cause a brief",
|
|
1582
|
+
"tunnel renegotiation and connectivity drop.",
|
|
1583
|
+
"",
|
|
1584
|
+
"Scalar fields you don't pass are preserved. List flags",
|
|
1585
|
+
"(--target-address-space) REPLACE the existing list wholesale —",
|
|
1586
|
+
"to keep an entry you must re-pass it. Use",
|
|
1587
|
+
"--clear-target-address-spaces to empty the list explicitly.",
|
|
1588
|
+
"",
|
|
1589
|
+
"IPsec policy: preserved by default. Pass any",
|
|
1590
|
+
"--ipsec-*/-ike-*/-dh-group/-pfs-group flag to REPLACE it (all eight",
|
|
1591
|
+
"required). Pass --clear-ipsec to remove it entirely.",
|
|
1592
|
+
"",
|
|
1593
|
+
"BGP: preserved by default. Pass --bgp-enabled or --no-bgp-enabled to",
|
|
1594
|
+
"change it; the CLI re-sends ASN and peer address from the current",
|
|
1595
|
+
"connection if you don't override them.",
|
|
1596
|
+
"",
|
|
1597
|
+
"Transitioning from non-BGP to BGP (--bgp-enabled on a connection",
|
|
1598
|
+
"that wasn't BGP-enabled before) requires you to ALSO pass --asn AND",
|
|
1599
|
+
"--bgp-peer-address. The CLI rejects the edit upfront in that case."
|
|
1600
|
+
].join(`
|
|
1601
|
+
`)).requiredOption("--shared-key <key>", "Pre-shared key (required on every edit). Max 128 ASCII chars; no spaces, dashes, or tildes.", sharedKeyParser).option("--name <name>", "Rename the connection.").option("--target-ip <ip>", "On-prem VPN device public IPv4.", ipv4Parser("target IP")).option("--target-address-space <cidr>", "Replace the on-prem CIDR list (repeatable). 0.0.0.0/0 is not allowed.", appendCidr("target address space", { rejectDefaultRoute: true }), []).option("--clear-target-address-spaces", "Remove all target address spaces. Mutually exclusive with --target-address-space. Use with caution: a non-BGP connection without target address spaces is misconfigured.").option("--bgp-enabled", "Enable BGP.").option("--no-bgp-enabled", "Disable BGP.").option("--asn <num>", "BGP ASN.", asnParser).option("--bgp-peer-address <ip>", "BGP peer IPv4.", ipv4Parser("BGP peer address")).option("--clear-ipsec", "Remove the existing IPsec policy. Mutually exclusive with --ipsec-*/-ike-*/-dh-group/-pfs-group flags.").option("--confirm", "Confirm the edit. Required (most edits cause a brief connectivity drop).").option(...COMMON_OPTIONS.tenant);
|
|
1602
|
+
withIpsecFlags(editCmd).examples(EDIT_EXAMPLES).trackedAction(processContext, async (key, options) => {
|
|
1603
|
+
if (!options.confirm) {
|
|
1604
|
+
OutputFormatter.error({
|
|
1605
|
+
Result: RESULTS.Failure,
|
|
1606
|
+
Message: `Refusing to edit connection ${key} without --confirm.`,
|
|
1607
|
+
Instructions: EDIT_INSTRUCTIONS
|
|
1608
|
+
});
|
|
1609
|
+
processContext.exit(1);
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1612
|
+
const [error, result] = await catchError((async () => {
|
|
1613
|
+
const newIpsec = assembleIpsec(options);
|
|
1614
|
+
if (options.clearIpsec && newIpsec) {
|
|
1615
|
+
throw new Error("--clear-ipsec is mutually exclusive with --ipsec-*/-ike-*/-dh-group/-pfs-group flags. Pick one.");
|
|
1616
|
+
}
|
|
1617
|
+
if (options.clearTargetAddressSpaces && options.targetAddressSpace.length > 0) {
|
|
1618
|
+
throw new Error("--clear-target-address-spaces is mutually exclusive with --target-address-space.");
|
|
1619
|
+
}
|
|
1620
|
+
const request = {
|
|
1621
|
+
sharedKey: options.sharedKey
|
|
1622
|
+
};
|
|
1623
|
+
if (options.name !== undefined)
|
|
1624
|
+
request.name = options.name;
|
|
1625
|
+
if (options.targetIp !== undefined)
|
|
1626
|
+
request.targetIpAddress = options.targetIp;
|
|
1627
|
+
const { api } = await createApiClient(VpnGatewayConnectionsApi, {
|
|
1628
|
+
tenantName: options.tenant
|
|
1629
|
+
});
|
|
1630
|
+
const userPassedBgpFlag = options.bgpEnabled !== undefined;
|
|
1631
|
+
const userPassedAsn = options.asn !== undefined;
|
|
1632
|
+
const userPassedBgpPeerAddress = options.bgpPeerAddress !== undefined;
|
|
1633
|
+
const userPassedAddressSpaces = options.targetAddressSpace.length > 0 || options.clearTargetAddressSpaces;
|
|
1634
|
+
const userExplicitlyNonBgp = userPassedBgpFlag && options.bgpEnabled === false;
|
|
1635
|
+
const needsCurrentForIpsec = !newIpsec && !options.clearIpsec;
|
|
1636
|
+
const needsCurrentForBgp = !userExplicitlyNonBgp && (!userPassedBgpFlag || !userPassedAsn || !userPassedBgpPeerAddress);
|
|
1637
|
+
const needsCurrentForAddressSpaces = !userPassedAddressSpaces;
|
|
1638
|
+
const current = needsCurrentForIpsec || needsCurrentForBgp || needsCurrentForAddressSpaces ? await api.vpnGatewayConnectionsGetVpnGatewayConnectionByKey({ key }) : undefined;
|
|
1639
|
+
if (newIpsec) {
|
|
1640
|
+
request.ipSecPolicy = newIpsec;
|
|
1641
|
+
} else if (!options.clearIpsec && current?.ipSecPolicy) {
|
|
1642
|
+
const { key: _existingKey, ...policy } = current.ipSecPolicy;
|
|
1643
|
+
request.ipSecPolicy = policy;
|
|
1644
|
+
}
|
|
1645
|
+
const finalBgpEnabled = userPassedBgpFlag ? options.bgpEnabled : current?.bgpEnabled ?? false;
|
|
1646
|
+
if (finalBgpEnabled && current?.bgpEnabled === false && (!userPassedAsn || !userPassedBgpPeerAddress)) {
|
|
1647
|
+
throw new Error("Enabling BGP on a non-BGP connection requires both --asn and --bgp-peer-address.");
|
|
1648
|
+
}
|
|
1649
|
+
request.bgpEnabled = finalBgpEnabled;
|
|
1650
|
+
if (finalBgpEnabled) {
|
|
1651
|
+
request.asn = userPassedAsn ? options.asn : current?.asn;
|
|
1652
|
+
request.bgpPeerAddress = userPassedBgpPeerAddress ? options.bgpPeerAddress : current?.bgpPeerAddress;
|
|
1653
|
+
} else {
|
|
1654
|
+
if (userPassedAsn)
|
|
1655
|
+
request.asn = options.asn;
|
|
1656
|
+
if (userPassedBgpPeerAddress)
|
|
1657
|
+
request.bgpPeerAddress = options.bgpPeerAddress;
|
|
1658
|
+
}
|
|
1659
|
+
if (options.clearTargetAddressSpaces) {
|
|
1660
|
+
request.targetAddressSpaces = [];
|
|
1661
|
+
} else if (options.targetAddressSpace.length > 0) {
|
|
1662
|
+
request.targetAddressSpaces = options.targetAddressSpace;
|
|
1663
|
+
} else if (current?.targetAddressSpaces) {
|
|
1664
|
+
request.targetAddressSpaces = current.targetAddressSpaces;
|
|
1665
|
+
}
|
|
1666
|
+
return await api.vpnGatewayConnectionsEditConnectionByKey({
|
|
1667
|
+
key,
|
|
1668
|
+
vpnGatewayConnectionsEditConnectionParameters: {
|
|
1669
|
+
request
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
})());
|
|
1673
|
+
if (error) {
|
|
1674
|
+
await reportError(error, LOGIN_INSTRUCTIONS);
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
OutputFormatter.success({
|
|
1678
|
+
Result: RESULTS.Success,
|
|
1679
|
+
Code: "VpnGatewayConnectionEdited",
|
|
1680
|
+
Data: result
|
|
1681
|
+
});
|
|
1682
|
+
});
|
|
1683
|
+
connections.command("refresh").argument("<key>", "VPN gateway connection key (GUID).").description([
|
|
1684
|
+
"Queue a background refresh of the connection's state.",
|
|
1685
|
+
"",
|
|
1686
|
+
"Connection states are also refreshed automatically by a periodic",
|
|
1687
|
+
"background job. Use this command only when you don't want to wait",
|
|
1688
|
+
"for the next cycle.",
|
|
1689
|
+
"",
|
|
1690
|
+
"The CLI returns immediately once the task is queued. Call",
|
|
1691
|
+
"`connections get <key>` afterwards to read the updated state.",
|
|
1692
|
+
"Rejected if the connection has another operation in flight."
|
|
1693
|
+
].join(`
|
|
1694
|
+
`)).option(...COMMON_OPTIONS.tenant).examples(REFRESH_EXAMPLES).trackedAction(processContext, async (key, options) => {
|
|
1695
|
+
const [error] = await catchError((async () => {
|
|
1696
|
+
const { api } = await createApiClient(VpnGatewayConnectionsApi, {
|
|
1697
|
+
tenantName: options.tenant
|
|
1698
|
+
});
|
|
1699
|
+
await api.vpnGatewayConnectionsRefreshConnectionByKey({
|
|
1700
|
+
key
|
|
1701
|
+
});
|
|
1702
|
+
})());
|
|
1703
|
+
if (error) {
|
|
1704
|
+
await reportError(error, LOGIN_INSTRUCTIONS);
|
|
1705
|
+
return;
|
|
1706
|
+
}
|
|
1707
|
+
OutputFormatter.success({
|
|
1708
|
+
Result: RESULTS.Success,
|
|
1709
|
+
Code: "VpnGatewayConnectionRefreshRequested",
|
|
1710
|
+
Data: { Key: key }
|
|
1711
|
+
});
|
|
1712
|
+
});
|
|
1713
|
+
connections.command("delete").argument("<key>", "VPN gateway connection key (GUID).").description([
|
|
1714
|
+
"Deletes the connection.",
|
|
1715
|
+
"",
|
|
1716
|
+
"This is destructive and cannot be undone.",
|
|
1717
|
+
"",
|
|
1718
|
+
"Pass --confirm to confirm. Without it the command exits with an error so",
|
|
1719
|
+
"non-interactive callers can't accidentally trigger deletion."
|
|
1720
|
+
].join(`
|
|
1721
|
+
`)).option("--confirm", "Confirm deletion. Required (the command refuses without it).").option(...COMMON_OPTIONS.tenant).examples(DELETE_EXAMPLES).trackedAction(processContext, async (key, options) => {
|
|
1722
|
+
if (!options.confirm) {
|
|
1723
|
+
OutputFormatter.error({
|
|
1724
|
+
Result: RESULTS.Failure,
|
|
1725
|
+
Message: `Refusing to delete connection ${key} without --confirm.`,
|
|
1726
|
+
Instructions: DELETE_INSTRUCTIONS
|
|
1727
|
+
});
|
|
1728
|
+
processContext.exit(1);
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
const [error] = await catchError((async () => {
|
|
1732
|
+
const { api } = await createApiClient(VpnGatewayConnectionsApi, {
|
|
1733
|
+
tenantName: options.tenant
|
|
1734
|
+
});
|
|
1735
|
+
await api.vpnGatewayConnectionsDeleteByKey({ key });
|
|
1736
|
+
})());
|
|
1737
|
+
if (error) {
|
|
1738
|
+
await reportError(error, LOGIN_INSTRUCTIONS);
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
OutputFormatter.success({
|
|
1742
|
+
Result: RESULTS.Success,
|
|
1743
|
+
Code: "VpnGatewayConnectionDeleted",
|
|
1744
|
+
Data: { Key: key }
|
|
1745
|
+
});
|
|
1746
|
+
});
|
|
1747
|
+
};
|
|
1748
|
+
|
|
1749
|
+
// ../vpngateway-commands/src/commands/gateways.ts
|
|
1750
|
+
function appendTrustedCert(value, previous) {
|
|
1751
|
+
try {
|
|
1752
|
+
return [...previous, assertTrustedCertSpec(value)];
|
|
1753
|
+
} catch (err) {
|
|
1754
|
+
throw new InvalidArgumentError(errorMessage(err));
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
var LOGIN_INSTRUCTIONS2 = "Ensure you are logged in with 'uip login' and that your account has org-admin access to the Hypervisor service. Pass --tenant <name> to target a tenant other than your login context.";
|
|
1758
|
+
var DELETE_INSTRUCTIONS2 = "This is destructive. Pass --confirm to confirm. Once deleted, all connections, peerings, and certificates on the gateway are gone.";
|
|
1759
|
+
var VPN_VNET_MAX_PREFIX = 27;
|
|
1760
|
+
var VPN_VNET_MIN_PREFIX = 8;
|
|
1761
|
+
var DNS_SERVERS_LIMIT = 3;
|
|
1762
|
+
var APIPA_ADDRESSES_LIMIT = 2;
|
|
1763
|
+
var TRUSTED_CERTIFICATES_LIMIT = 10;
|
|
1764
|
+
var COMMON_OPTIONS2 = {
|
|
1765
|
+
tenant: [
|
|
1766
|
+
"--tenant <name>",
|
|
1767
|
+
"Target tenant name. Defaults to the tenant in your login context."
|
|
1768
|
+
]
|
|
1769
|
+
};
|
|
1770
|
+
var LIST_EXAMPLES = [
|
|
1771
|
+
{
|
|
1772
|
+
Description: "List all VPN gateways for the current tenant",
|
|
1773
|
+
Command: "uip admin integrations vpn gateways list",
|
|
1774
|
+
Output: {
|
|
1775
|
+
Code: "VpnGatewayList",
|
|
1776
|
+
Data: {
|
|
1777
|
+
count: 1,
|
|
1778
|
+
value: [
|
|
1779
|
+
{
|
|
1780
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1781
|
+
name: "prod-gw",
|
|
1782
|
+
state: "Deployed",
|
|
1783
|
+
gatewayType: "Vpn",
|
|
1784
|
+
sku: "Basic",
|
|
1785
|
+
vnetAddressSpace: "10.0.0.0/24",
|
|
1786
|
+
location: "westus",
|
|
1787
|
+
publicIp: "20.0.0.1",
|
|
1788
|
+
connections: []
|
|
1789
|
+
}
|
|
1790
|
+
]
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
];
|
|
1795
|
+
var GET_EXAMPLES2 = [
|
|
1796
|
+
{
|
|
1797
|
+
Description: "Fetch a gateway and its connections by key",
|
|
1798
|
+
Command: "uip admin integrations vpn gateways get 00000000-0000-0000-0000-000000000001",
|
|
1799
|
+
Output: {
|
|
1800
|
+
Code: "VpnGatewayGet",
|
|
1801
|
+
Data: {
|
|
1802
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1803
|
+
name: "prod-gw",
|
|
1804
|
+
state: "Deployed",
|
|
1805
|
+
gatewayType: "Vpn",
|
|
1806
|
+
sku: "Basic",
|
|
1807
|
+
vnetAddressSpace: "10.0.0.0/24",
|
|
1808
|
+
location: "westus",
|
|
1809
|
+
publicIp: "20.0.0.1",
|
|
1810
|
+
connections: [
|
|
1811
|
+
{
|
|
1812
|
+
key: "11111111-1111-1111-1111-111111111111",
|
|
1813
|
+
name: "site-a",
|
|
1814
|
+
state: "Connected",
|
|
1815
|
+
targetIpAddress: "203.0.113.10"
|
|
1816
|
+
}
|
|
1817
|
+
],
|
|
1818
|
+
trustedCertificates: [
|
|
1819
|
+
{
|
|
1820
|
+
name: "corp-root-ca",
|
|
1821
|
+
publicCertificateData: "MIIDazCCAlOgAwIBAgIUHs9..."
|
|
1822
|
+
}
|
|
1823
|
+
]
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
];
|
|
1828
|
+
var TENANT_CONFIG_EXAMPLES = [
|
|
1829
|
+
{
|
|
1830
|
+
Description: "Check whether the tenant is allowed to provision a VPN gateway",
|
|
1831
|
+
Command: "uip admin integrations vpn gateways tenant-config",
|
|
1832
|
+
Output: {
|
|
1833
|
+
Code: "VpnGatewayTenantConfig",
|
|
1834
|
+
Data: { canCreateVpnGateway: true }
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
];
|
|
1838
|
+
var EDIT_EXAMPLES2 = [
|
|
1839
|
+
{
|
|
1840
|
+
Description: "Rename a gateway",
|
|
1841
|
+
Command: "uip admin integrations vpn gateways edit 00000000-0000-0000-0000-000000000001 --name new-name",
|
|
1842
|
+
Output: {
|
|
1843
|
+
Code: "VpnGatewayEdited",
|
|
1844
|
+
Data: {
|
|
1845
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1846
|
+
name: "new-name"
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
},
|
|
1850
|
+
{
|
|
1851
|
+
Description: "Replace the DNS server list with two entries",
|
|
1852
|
+
Command: "uip admin integrations vpn gateways edit 00000000-0000-0000-0000-000000000001 --dns-server 1.1.1.1 --dns-server 8.8.8.8",
|
|
1853
|
+
Output: {
|
|
1854
|
+
Code: "VpnGatewayEdited",
|
|
1855
|
+
Data: {
|
|
1856
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1857
|
+
dnsServers: ["1.1.1.1", "8.8.8.8"]
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
Description: "Remove all DNS servers from a gateway",
|
|
1863
|
+
Command: "uip admin integrations vpn gateways edit 00000000-0000-0000-0000-000000000001 --clear-dns-servers",
|
|
1864
|
+
Output: {
|
|
1865
|
+
Code: "VpnGatewayEdited",
|
|
1866
|
+
Data: {
|
|
1867
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1868
|
+
dnsServers: []
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
},
|
|
1872
|
+
{
|
|
1873
|
+
Description: "Push trusted certificates from on-disk Base64 files (multi-line cert content via shell substitution)",
|
|
1874
|
+
Command: 'ROOT=$(cat root.b64); INTER=$(cat inter.b64); uip admin integrations vpn gateways edit 00000000-0000-0000-0000-000000000001 --trusted-cert "Root=$ROOT" --trusted-cert "Inter=$INTER"',
|
|
1875
|
+
Output: {
|
|
1876
|
+
Code: "VpnGatewayEdited",
|
|
1877
|
+
Data: {
|
|
1878
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1879
|
+
trustedCertificates: [
|
|
1880
|
+
{
|
|
1881
|
+
name: "Root",
|
|
1882
|
+
publicCertificateData: "MIIE7zCC..."
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
name: "Inter",
|
|
1886
|
+
publicCertificateData: "MIIFLDCC..."
|
|
1887
|
+
}
|
|
1888
|
+
]
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
];
|
|
1893
|
+
var REDEPLOY_EXAMPLES = [
|
|
1894
|
+
{
|
|
1895
|
+
Description: "Retry deployment of a gateway in the Failed state",
|
|
1896
|
+
Command: "uip admin integrations vpn gateways redeploy 00000000-0000-0000-0000-000000000001",
|
|
1897
|
+
Output: {
|
|
1898
|
+
Code: "VpnGatewayRedeployRequested",
|
|
1899
|
+
Data: { Key: "00000000-0000-0000-0000-000000000001" }
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
];
|
|
1903
|
+
var DELETE_EXAMPLES2 = [
|
|
1904
|
+
{
|
|
1905
|
+
Description: "Delete a gateway (--confirm is required)",
|
|
1906
|
+
Command: "uip admin integrations vpn gateways delete 00000000-0000-0000-0000-000000000001 --confirm",
|
|
1907
|
+
Output: {
|
|
1908
|
+
Code: "VpnGatewayDeleted",
|
|
1909
|
+
Data: { Key: "00000000-0000-0000-0000-000000000001" }
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
];
|
|
1913
|
+
var CREATE_EXAMPLES2 = [
|
|
1914
|
+
{
|
|
1915
|
+
Description: "Provision a basic VPN gateway in a /24 VNet",
|
|
1916
|
+
Command: "uip admin integrations vpn gateways create --name prod-gw --vnet-address-space 10.0.0.0/24",
|
|
1917
|
+
Output: {
|
|
1918
|
+
Code: "VpnGatewayCreated",
|
|
1919
|
+
Data: {
|
|
1920
|
+
key: "00000000-0000-0000-0000-000000000001",
|
|
1921
|
+
name: "prod-gw",
|
|
1922
|
+
state: "Provisioning",
|
|
1923
|
+
gatewayType: "Vpn",
|
|
1924
|
+
sku: "Basic",
|
|
1925
|
+
vnetAddressSpace: "10.0.0.0/24"
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
Description: "Full lifecycle: provision a BGP-ready gateway with DNS, APIPA, and trusted certs, then poll for readiness before attaching connections",
|
|
1931
|
+
Command: [
|
|
1932
|
+
"ROOT=$(cat root.b64); INTER=$(cat inter.b64)",
|
|
1933
|
+
"GW_KEY=$(uip admin integrations vpn gateways create \\",
|
|
1934
|
+
" --name prod-gw \\",
|
|
1935
|
+
" --vnet-address-space 10.0.0.0/24 \\",
|
|
1936
|
+
" --dns-server 172.23.0.105 --dns-server 172.23.2.89 \\",
|
|
1937
|
+
" --apipa-address 169.254.21.10 \\",
|
|
1938
|
+
' --trusted-cert "Root=$ROOT" --trusted-cert "Inter=$INTER" \\',
|
|
1939
|
+
" --output-filter Data.key --output plain)",
|
|
1940
|
+
"# Poll until state becomes Deployed before creating connections:",
|
|
1941
|
+
"until uip admin integrations vpn gateways get $GW_KEY \\",
|
|
1942
|
+
" --output-filter Data.state --output plain | grep -q Deployed; do",
|
|
1943
|
+
" sleep 30",
|
|
1944
|
+
"done",
|
|
1945
|
+
"uip admin integrations vpn connections create $GW_KEY \\",
|
|
1946
|
+
' --name site-a --shared-key "MyS3cr3tP4ssphr4se" \\',
|
|
1947
|
+
" --target-ip 203.0.113.10 \\",
|
|
1948
|
+
" --bgp-enabled --asn 65001 --bgp-peer-address 169.254.21.9"
|
|
1949
|
+
].join(`
|
|
1950
|
+
`),
|
|
1951
|
+
Output: {
|
|
1952
|
+
Code: "VpnGatewayConnectionCreated",
|
|
1953
|
+
Data: {
|
|
1954
|
+
key: "11111111-1111-1111-1111-111111111111",
|
|
1955
|
+
name: "site-a",
|
|
1956
|
+
state: "Connecting"
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
];
|
|
1961
|
+
var registerGatewaysCommand = (vpn) => {
|
|
1962
|
+
const gateways = vpn.command("gateways").description([
|
|
1963
|
+
"Manage VPN gateways for the current tenant.",
|
|
1964
|
+
"",
|
|
1965
|
+
"A VPN gateway lets cloud and serverless robots reach on-prem",
|
|
1966
|
+
"networks privately over a site-to-site IPsec tunnel. The gateway",
|
|
1967
|
+
"is hosted in a network whose address space you provide at",
|
|
1968
|
+
"create time.",
|
|
1969
|
+
"",
|
|
1970
|
+
"Operations are asynchronous: a `Success` response means the task",
|
|
1971
|
+
"was ENQUEUED, not applied. Poll `gateways get <key>` until `state`",
|
|
1972
|
+
"is `Deployed` before issuing the next mutation (or before",
|
|
1973
|
+
"creating connections). Concurrent mutations on the same gateway",
|
|
1974
|
+
"return HTTP 409 — wait a few seconds and retry."
|
|
1975
|
+
].join(`
|
|
1976
|
+
`));
|
|
1977
|
+
gateways.command("list").description([
|
|
1978
|
+
"List all VPN gateways for the current tenant.",
|
|
1979
|
+
"",
|
|
1980
|
+
"Returns a summary of each gateway (key, name, state, type, SKU, VNet,",
|
|
1981
|
+
"location, public IP, connection count). Use `gateways get <key>` for the",
|
|
1982
|
+
"full record including connections, peerings, and trusted certificates."
|
|
1983
|
+
].join(`
|
|
1984
|
+
`)).option(...COMMON_OPTIONS2.tenant).examples(LIST_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
1985
|
+
const [error, result] = await catchError((async () => {
|
|
1986
|
+
const { api } = await createApiClient(VpnGatewaysApi, {
|
|
1987
|
+
tenantName: options.tenant
|
|
1988
|
+
});
|
|
1989
|
+
return await api.vpnGatewaysGetVpnGateways({
|
|
1990
|
+
$expand: "Connections"
|
|
1991
|
+
});
|
|
1992
|
+
})());
|
|
1993
|
+
if (error) {
|
|
1994
|
+
await reportError(error, LOGIN_INSTRUCTIONS2);
|
|
1995
|
+
return;
|
|
1996
|
+
}
|
|
1997
|
+
const gws = result.value ?? [];
|
|
1998
|
+
OutputFormatter.success({
|
|
1999
|
+
Result: RESULTS.Success,
|
|
2000
|
+
Code: "VpnGatewayList",
|
|
2001
|
+
Data: { count: gws.length, value: gws }
|
|
2002
|
+
});
|
|
2003
|
+
});
|
|
2004
|
+
gateways.command("get").argument("<key>", "VPN gateway key (GUID).").description("Fetch a VPN gateway by key, with its connections.").option(...COMMON_OPTIONS2.tenant).examples(GET_EXAMPLES2).trackedAction(processContext, async (key, options) => {
|
|
2005
|
+
const [error, result] = await catchError((async () => {
|
|
2006
|
+
const { api } = await createApiClient(VpnGatewaysApi, {
|
|
2007
|
+
tenantName: options.tenant
|
|
2008
|
+
});
|
|
2009
|
+
return await api.vpnGatewaysGetVpnGatewayByKey({
|
|
2010
|
+
key,
|
|
2011
|
+
$expand: "Connections"
|
|
2012
|
+
});
|
|
2013
|
+
})());
|
|
2014
|
+
if (error) {
|
|
2015
|
+
await reportError(error, LOGIN_INSTRUCTIONS2);
|
|
2016
|
+
return;
|
|
2017
|
+
}
|
|
2018
|
+
OutputFormatter.success({
|
|
2019
|
+
Result: RESULTS.Success,
|
|
2020
|
+
Code: "VpnGatewayGet",
|
|
2021
|
+
Data: result
|
|
2022
|
+
});
|
|
2023
|
+
});
|
|
2024
|
+
gateways.command("tenant-config").description([
|
|
2025
|
+
"Check whether the current tenant is allowed to provision a VPN gateway.",
|
|
2026
|
+
"",
|
|
2027
|
+
"Returns `canCreateVpnGateway` and an optional `validationError` reason."
|
|
2028
|
+
].join(`
|
|
2029
|
+
`)).option(...COMMON_OPTIONS2.tenant).examples(TENANT_CONFIG_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
2030
|
+
const [error, result] = await catchError((async () => {
|
|
2031
|
+
const { api } = await createApiClient(VpnGatewaysApi, {
|
|
2032
|
+
tenantName: options.tenant
|
|
2033
|
+
});
|
|
2034
|
+
return await api.vpnGatewaysTenantConfiguration({});
|
|
2035
|
+
})());
|
|
2036
|
+
if (error) {
|
|
2037
|
+
await reportError(error, LOGIN_INSTRUCTIONS2);
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
OutputFormatter.success({
|
|
2041
|
+
Result: RESULTS.Success,
|
|
2042
|
+
Code: "VpnGatewayTenantConfig",
|
|
2043
|
+
Data: result
|
|
2044
|
+
});
|
|
2045
|
+
});
|
|
2046
|
+
gateways.command("create").description([
|
|
2047
|
+
"Provision a new VPN gateway hosted in a network using the",
|
|
2048
|
+
"provided address space.",
|
|
2049
|
+
"",
|
|
2050
|
+
"The gateway is created asynchronously. Call `gateways get <key>` or",
|
|
2051
|
+
"`gateways list` to track state (Provisioning, then Deployed or Failed).",
|
|
2052
|
+
"On Failed, use `gateways redeploy <key>` to retry.",
|
|
2053
|
+
"",
|
|
2054
|
+
`--vnet-address-space must be a CIDR with prefix between /${VPN_VNET_MIN_PREFIX}`,
|
|
2055
|
+
`and /${VPN_VNET_MAX_PREFIX} (e.g. /16, /24, /27). The 169.254.0.0/16 APIPA`,
|
|
2056
|
+
"range is rejected because it collides with BGP APIPA addresses",
|
|
2057
|
+
"(169.254.21.0/24 and 169.254.22.0/24) used internally for peering."
|
|
2058
|
+
].join(`
|
|
2059
|
+
`)).requiredOption("--name <name>", "Gateway name.").requiredOption("--vnet-address-space <cidr>", `VNet CIDR (prefix between /${VPN_VNET_MIN_PREFIX} and /${VPN_VNET_MAX_PREFIX}). Immutable after create.`, cidrParser("VNet address space", {
|
|
2060
|
+
minPrefix: VPN_VNET_MIN_PREFIX,
|
|
2061
|
+
maxPrefix: VPN_VNET_MAX_PREFIX,
|
|
2062
|
+
rejectDefaultRoute: true,
|
|
2063
|
+
rejectApipa: true
|
|
2064
|
+
})).option("--description <text>", "Free-form description.").option("--dns-server <ip>", `DNS server IP (repeatable, max ${DNS_SERVERS_LIMIT}).`, appendIpv4("DNS server"), []).option("--apipa-address <ip>", `APIPA BGP peering address (repeatable, max ${APIPA_ADDRESSES_LIMIT}). Must be in 169.254.21.0/24 or 169.254.22.0/24.`, appendApipaBgp("APIPA address"), []).option("--trusted-cert <cert-name=base64>", `Trusted root certificate (repeatable, max ${TRUSTED_CERTIFICATES_LIMIT}). Format: '<cert-name>=<base64-X509>', e.g. 'MyRootCA=MIIE7zCC...'.`, appendTrustedCert, []).option(...COMMON_OPTIONS2.tenant).examples(CREATE_EXAMPLES2).trackedAction(processContext, async (options) => {
|
|
2065
|
+
const [error, result] = await catchError((async () => {
|
|
2066
|
+
assertMaxCount(options.dnsServer, DNS_SERVERS_LIMIT, "DNS server");
|
|
2067
|
+
assertMaxCount(options.apipaAddress, APIPA_ADDRESSES_LIMIT, "APIPA address");
|
|
2068
|
+
assertTrustedCerts(options.trustedCert, {
|
|
2069
|
+
maxCount: TRUSTED_CERTIFICATES_LIMIT
|
|
2070
|
+
});
|
|
2071
|
+
const request = {
|
|
2072
|
+
name: options.name,
|
|
2073
|
+
vnetAddressSpace: options.vnetAddressSpace,
|
|
2074
|
+
type: VpnGatewayCreationRequestTypeEnum.Vpn,
|
|
2075
|
+
sku: VpnGatewayCreationRequestSkuEnum.Basic
|
|
2076
|
+
};
|
|
2077
|
+
if (options.description !== undefined)
|
|
2078
|
+
request.description = options.description;
|
|
2079
|
+
if (options.dnsServer.length > 0)
|
|
2080
|
+
request.dnsServers = options.dnsServer;
|
|
2081
|
+
if (options.apipaAddress.length > 0)
|
|
2082
|
+
request.primaryApipaAddresses = options.apipaAddress;
|
|
2083
|
+
if (options.trustedCert.length > 0)
|
|
2084
|
+
request.trustedCertificates = options.trustedCert;
|
|
2085
|
+
const { api } = await createApiClient(VpnGatewaysApi, {
|
|
2086
|
+
tenantName: options.tenant
|
|
2087
|
+
});
|
|
2088
|
+
return await api.vpnGatewaysCreateVpnGateway({
|
|
2089
|
+
vpnGatewaysCreateVpnGatewayParameters: { request }
|
|
2090
|
+
});
|
|
2091
|
+
})());
|
|
2092
|
+
if (error) {
|
|
2093
|
+
await reportError(error, LOGIN_INSTRUCTIONS2);
|
|
2094
|
+
return;
|
|
2095
|
+
}
|
|
2096
|
+
OutputFormatter.success({
|
|
2097
|
+
Result: RESULTS.Success,
|
|
2098
|
+
Code: "VpnGatewayCreated",
|
|
2099
|
+
Data: result
|
|
2100
|
+
});
|
|
2101
|
+
});
|
|
2102
|
+
gateways.command("edit").argument("<key>", "VPN gateway key (GUID).").description([
|
|
2103
|
+
"Update a VPN gateway's mutable fields.",
|
|
2104
|
+
"",
|
|
2105
|
+
"Scalar fields (--name, --description) you don't pass are preserved.",
|
|
2106
|
+
"Lists you DO pass replace the existing list wholesale. Pass each member",
|
|
2107
|
+
"you want to keep when using --dns-server, --apipa-address, or",
|
|
2108
|
+
"--trusted-cert. Pass --clear-dns-servers / --clear-apipa-addresses /",
|
|
2109
|
+
"--clear-trusted-certs to remove all entries (mutually exclusive with the",
|
|
2110
|
+
"matching populated flag)."
|
|
2111
|
+
].join(`
|
|
2112
|
+
`)).option("--name <name>", "Rename the gateway.").option("--description <text>", "Update description.").option("--dns-server <ip>", `Replace the DNS server list (repeatable, max ${DNS_SERVERS_LIMIT}).`, appendIpv4("DNS server"), []).option("--clear-dns-servers", "Remove all DNS servers. Mutually exclusive with --dns-server.").option("--apipa-address <ip>", `Replace the APIPA address list (repeatable, max ${APIPA_ADDRESSES_LIMIT}). Must be in 169.254.21.0/24 or 169.254.22.0/24.`, appendApipaBgp("APIPA address"), []).option("--clear-apipa-addresses", "Remove all APIPA BGP addresses. Mutually exclusive with --apipa-address.").option("--trusted-cert <cert-name=base64>", `Replace the trusted certificate list (repeatable, max ${TRUSTED_CERTIFICATES_LIMIT}). Format: '<cert-name>=<base64-X509>', e.g. 'MyRootCA=MIIE7zCC...'.`, appendTrustedCert, []).option("--clear-trusted-certs", "Remove all trusted certificates. Mutually exclusive with --trusted-cert.").option(...COMMON_OPTIONS2.tenant).examples(EDIT_EXAMPLES2).trackedAction(processContext, async (key, options) => {
|
|
2113
|
+
const [error, result] = await catchError((async () => {
|
|
2114
|
+
if (options.clearDnsServers && options.dnsServer.length > 0)
|
|
2115
|
+
throw new Error("--clear-dns-servers is mutually exclusive with --dns-server.");
|
|
2116
|
+
if (options.clearApipaAddresses && options.apipaAddress.length > 0)
|
|
2117
|
+
throw new Error("--clear-apipa-addresses is mutually exclusive with --apipa-address.");
|
|
2118
|
+
if (options.clearTrustedCerts && options.trustedCert.length > 0)
|
|
2119
|
+
throw new Error("--clear-trusted-certs is mutually exclusive with --trusted-cert.");
|
|
2120
|
+
assertMaxCount(options.dnsServer, DNS_SERVERS_LIMIT, "DNS server");
|
|
2121
|
+
assertMaxCount(options.apipaAddress, APIPA_ADDRESSES_LIMIT, "APIPA address");
|
|
2122
|
+
assertTrustedCerts(options.trustedCert, {
|
|
2123
|
+
maxCount: TRUSTED_CERTIFICATES_LIMIT
|
|
2124
|
+
});
|
|
2125
|
+
const request = {};
|
|
2126
|
+
if (options.name !== undefined)
|
|
2127
|
+
request.name = options.name;
|
|
2128
|
+
if (options.description !== undefined)
|
|
2129
|
+
request.description = options.description;
|
|
2130
|
+
if (options.clearDnsServers)
|
|
2131
|
+
request.dnsServers = [];
|
|
2132
|
+
else if (options.dnsServer.length > 0)
|
|
2133
|
+
request.dnsServers = options.dnsServer;
|
|
2134
|
+
if (options.clearApipaAddresses)
|
|
2135
|
+
request.primaryApipaAddresses = [];
|
|
2136
|
+
else if (options.apipaAddress.length > 0)
|
|
2137
|
+
request.primaryApipaAddresses = options.apipaAddress;
|
|
2138
|
+
if (options.clearTrustedCerts)
|
|
2139
|
+
request.trustedCertificates = [];
|
|
2140
|
+
else if (options.trustedCert.length > 0)
|
|
2141
|
+
request.trustedCertificates = options.trustedCert;
|
|
2142
|
+
if (Object.keys(request).length === 0) {
|
|
2143
|
+
throw new Error("No edit fields provided. Pass at least one of --name, --description, --dns-server, --apipa-address, --trusted-cert, or a --clear-* flag.");
|
|
2144
|
+
}
|
|
2145
|
+
const { api } = await createApiClient(VpnGatewaysApi, {
|
|
2146
|
+
tenantName: options.tenant
|
|
2147
|
+
});
|
|
2148
|
+
return await api.vpnGatewaysEditVpnGatewayByKey({
|
|
2149
|
+
key,
|
|
2150
|
+
vpnGatewaysEditVpnGatewayParameters: { request }
|
|
2151
|
+
});
|
|
2152
|
+
})());
|
|
2153
|
+
if (error) {
|
|
2154
|
+
await reportError(error, LOGIN_INSTRUCTIONS2);
|
|
2155
|
+
return;
|
|
2156
|
+
}
|
|
2157
|
+
OutputFormatter.success({
|
|
2158
|
+
Result: RESULTS.Success,
|
|
2159
|
+
Code: "VpnGatewayEdited",
|
|
2160
|
+
Data: result
|
|
2161
|
+
});
|
|
2162
|
+
});
|
|
2163
|
+
gateways.command("redeploy").argument("<key>", "VPN gateway key (GUID).").description([
|
|
2164
|
+
"Retry the last background task on a gateway whose previous deployment",
|
|
2165
|
+
"attempt didn't complete cleanly (e.g., a Provision/Edit task faulted",
|
|
2166
|
+
"or timed out).",
|
|
2167
|
+
"",
|
|
2168
|
+
"Rejected if the gateway is frozen, has an active task in flight, or is",
|
|
2169
|
+
"in an unsupported state."
|
|
2170
|
+
].join(`
|
|
2171
|
+
`)).option(...COMMON_OPTIONS2.tenant).examples(REDEPLOY_EXAMPLES).trackedAction(processContext, async (key, options) => {
|
|
2172
|
+
const [error] = await catchError((async () => {
|
|
2173
|
+
const { api } = await createApiClient(VpnGatewaysApi, {
|
|
2174
|
+
tenantName: options.tenant
|
|
2175
|
+
});
|
|
2176
|
+
await api.vpnGatewaysRedeployByKey({ key });
|
|
2177
|
+
})());
|
|
2178
|
+
if (error) {
|
|
2179
|
+
await reportError(error, LOGIN_INSTRUCTIONS2);
|
|
2180
|
+
return;
|
|
2181
|
+
}
|
|
2182
|
+
OutputFormatter.success({
|
|
2183
|
+
Result: RESULTS.Success,
|
|
2184
|
+
Code: "VpnGatewayRedeployRequested",
|
|
2185
|
+
Data: { Key: key }
|
|
2186
|
+
});
|
|
2187
|
+
});
|
|
2188
|
+
gateways.command("delete").argument("<key>", "VPN gateway key (GUID).").description([
|
|
2189
|
+
"Deletes the gateway and all related infrastructure.",
|
|
2190
|
+
"",
|
|
2191
|
+
"This is destructive and cannot be undone.",
|
|
2192
|
+
"",
|
|
2193
|
+
"Pass --confirm to confirm. Without it the command exits with an error so",
|
|
2194
|
+
"non-interactive callers can't accidentally trigger deletion."
|
|
2195
|
+
].join(`
|
|
2196
|
+
`)).option("--confirm", "Confirm deletion. Required (the command refuses without it).").option(...COMMON_OPTIONS2.tenant).examples(DELETE_EXAMPLES2).trackedAction(processContext, async (key, options) => {
|
|
2197
|
+
if (!options.confirm) {
|
|
2198
|
+
OutputFormatter.error({
|
|
2199
|
+
Result: RESULTS.Failure,
|
|
2200
|
+
Message: `Refusing to delete gateway ${key} without --confirm.`,
|
|
2201
|
+
Instructions: DELETE_INSTRUCTIONS2
|
|
2202
|
+
});
|
|
2203
|
+
processContext.exit(1);
|
|
2204
|
+
return;
|
|
2205
|
+
}
|
|
2206
|
+
const [error] = await catchError((async () => {
|
|
2207
|
+
const { api } = await createApiClient(VpnGatewaysApi, {
|
|
2208
|
+
tenantName: options.tenant
|
|
2209
|
+
});
|
|
2210
|
+
await api.vpnGatewaysDeleteByKey({ key });
|
|
2211
|
+
})());
|
|
2212
|
+
if (error) {
|
|
2213
|
+
await reportError(error, LOGIN_INSTRUCTIONS2);
|
|
2214
|
+
return;
|
|
2215
|
+
}
|
|
2216
|
+
OutputFormatter.success({
|
|
2217
|
+
Result: RESULTS.Success,
|
|
2218
|
+
Code: "VpnGatewayDeleted",
|
|
2219
|
+
Data: { Key: key }
|
|
2220
|
+
});
|
|
2221
|
+
});
|
|
2222
|
+
};
|
|
2223
|
+
|
|
2224
|
+
// ../vpngateway-commands/src/commands/vpn.ts
|
|
2225
|
+
var registerVpnCommand = (parent) => {
|
|
2226
|
+
const integrations = getOrCreateIntegrationsCommand(parent);
|
|
2227
|
+
const vpn = integrations.command("vpn").description("Manage UiPath VPN gateways and connections.");
|
|
2228
|
+
registerGatewaysCommand(vpn);
|
|
2229
|
+
registerConnectionsCommand(vpn);
|
|
2230
|
+
};
|
|
2231
|
+
function getOrCreateIntegrationsCommand(parent) {
|
|
2232
|
+
const existing = parent.commands.find((c) => c.name() === "integrations");
|
|
2233
|
+
if (existing)
|
|
2234
|
+
return existing;
|
|
2235
|
+
return parent.command("integrations").description("Manage UiPath integration configuration (VPN, ...).");
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
// ../vpngateway-commands/src/index.ts
|
|
2239
|
+
var registerCommands = async (program) => {
|
|
2240
|
+
registerVpnCommand(program);
|
|
2241
|
+
};
|
|
2242
|
+
export {
|
|
2243
|
+
registerCommands
|
|
2244
|
+
};
|
|
2245
|
+
|
|
2246
|
+
//# debugId=7894022BB1A452E864756E2164756E21
|