@uipath/admin-tool 1.203.0-preview.212 → 1.204.0-preview.211
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-ezfarkxh.js +2531 -0
- package/dist/tool-mhb6cezm.js +2859 -0
- package/dist/tool-ms8jr9tr.js +1977 -0
- package/dist/tool-v13kh7v7.js +6601 -0
- package/dist/tool.js +70 -48739
- package/package.json +2 -2
|
@@ -0,0 +1,2531 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLoginStatusAsync
|
|
3
|
+
} from "./tool-016jy57n.js";
|
|
4
|
+
import {
|
|
5
|
+
OutputFormatter,
|
|
6
|
+
RESULTS,
|
|
7
|
+
addSdkUserAgentHeader,
|
|
8
|
+
catchError,
|
|
9
|
+
extractErrorMessage,
|
|
10
|
+
getFileSystem,
|
|
11
|
+
getSdkUserAgentToken,
|
|
12
|
+
installSdkUserAgentHeader,
|
|
13
|
+
processContext
|
|
14
|
+
} from "./tool-v13kh7v7.js";
|
|
15
|
+
import"./tool-1yh8g550.js";
|
|
16
|
+
// ../apms-tool/package.json
|
|
17
|
+
var package_default = {
|
|
18
|
+
name: "@uipath/apms-tool",
|
|
19
|
+
author: "UiPath",
|
|
20
|
+
license: "SEE LICENSE IN LICENSE.txt",
|
|
21
|
+
version: "1.204.0-preview.211",
|
|
22
|
+
description: "CLI plugin for the UiPath Access Policy Management Service.",
|
|
23
|
+
private: false,
|
|
24
|
+
repository: {
|
|
25
|
+
type: "git",
|
|
26
|
+
url: "https://github.com/UiPath/cli.git",
|
|
27
|
+
directory: "packages/admin/apms-tool"
|
|
28
|
+
},
|
|
29
|
+
publishConfig: {
|
|
30
|
+
registry: "https://npm.pkg.github.com/@uipath"
|
|
31
|
+
},
|
|
32
|
+
keywords: [
|
|
33
|
+
"cli-tool"
|
|
34
|
+
],
|
|
35
|
+
type: "module",
|
|
36
|
+
main: "./dist/tool.js",
|
|
37
|
+
exports: {
|
|
38
|
+
".": "./dist/tool.js"
|
|
39
|
+
},
|
|
40
|
+
bin: {
|
|
41
|
+
"apms-tool": "./dist/index.js"
|
|
42
|
+
},
|
|
43
|
+
files: [
|
|
44
|
+
"dist"
|
|
45
|
+
],
|
|
46
|
+
scripts: {
|
|
47
|
+
build: "bun ../../../tools/build-tool.ts",
|
|
48
|
+
package: "bun run build && bun pm pack",
|
|
49
|
+
lint: "biome check .",
|
|
50
|
+
"lint:fix": "biome check --write .",
|
|
51
|
+
test: "vitest run",
|
|
52
|
+
"test:coverage": "vitest run --coverage"
|
|
53
|
+
},
|
|
54
|
+
devDependencies: {
|
|
55
|
+
"@types/bun": "^1.3.11",
|
|
56
|
+
"@uipath/apms-sdk": "workspace:*",
|
|
57
|
+
"@uipath/auth": "workspace:*",
|
|
58
|
+
"@uipath/common": "workspace:*",
|
|
59
|
+
"@uipath/filesystem": "workspace:*",
|
|
60
|
+
commander: "^14.0.3",
|
|
61
|
+
typescript: "^7.0.2"
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// ../apms-sdk/generated/src/runtime.ts
|
|
66
|
+
var BASE_PATH = "http://localhost:35599".replace(/\/+$/, "");
|
|
67
|
+
|
|
68
|
+
class Configuration {
|
|
69
|
+
configuration;
|
|
70
|
+
constructor(configuration = {}) {
|
|
71
|
+
this.configuration = configuration;
|
|
72
|
+
}
|
|
73
|
+
set config(configuration) {
|
|
74
|
+
this.configuration = configuration;
|
|
75
|
+
}
|
|
76
|
+
get basePath() {
|
|
77
|
+
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
|
|
78
|
+
}
|
|
79
|
+
get fetchApi() {
|
|
80
|
+
return this.configuration.fetchApi;
|
|
81
|
+
}
|
|
82
|
+
get middleware() {
|
|
83
|
+
return this.configuration.middleware || [];
|
|
84
|
+
}
|
|
85
|
+
get queryParamsStringify() {
|
|
86
|
+
return this.configuration.queryParamsStringify || querystring;
|
|
87
|
+
}
|
|
88
|
+
get username() {
|
|
89
|
+
return this.configuration.username;
|
|
90
|
+
}
|
|
91
|
+
get password() {
|
|
92
|
+
return this.configuration.password;
|
|
93
|
+
}
|
|
94
|
+
get apiKey() {
|
|
95
|
+
const apiKey = this.configuration.apiKey;
|
|
96
|
+
if (apiKey) {
|
|
97
|
+
return typeof apiKey === "function" ? apiKey : () => apiKey;
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
get accessToken() {
|
|
102
|
+
const accessToken = this.configuration.accessToken;
|
|
103
|
+
if (accessToken) {
|
|
104
|
+
return typeof accessToken === "function" ? accessToken : async () => accessToken;
|
|
105
|
+
}
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
get headers() {
|
|
109
|
+
return this.configuration.headers;
|
|
110
|
+
}
|
|
111
|
+
get credentials() {
|
|
112
|
+
return this.configuration.credentials;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
var DefaultConfig = new Configuration;
|
|
116
|
+
|
|
117
|
+
class BaseAPI {
|
|
118
|
+
configuration;
|
|
119
|
+
static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
|
|
120
|
+
middleware;
|
|
121
|
+
constructor(configuration = DefaultConfig) {
|
|
122
|
+
this.configuration = configuration;
|
|
123
|
+
this.middleware = configuration.middleware;
|
|
124
|
+
}
|
|
125
|
+
withMiddleware(...middlewares) {
|
|
126
|
+
const next = this.clone();
|
|
127
|
+
next.middleware = next.middleware.concat(...middlewares);
|
|
128
|
+
return next;
|
|
129
|
+
}
|
|
130
|
+
withPreMiddleware(...preMiddlewares) {
|
|
131
|
+
const middlewares = preMiddlewares.map((pre) => ({ pre }));
|
|
132
|
+
return this.withMiddleware(...middlewares);
|
|
133
|
+
}
|
|
134
|
+
withPostMiddleware(...postMiddlewares) {
|
|
135
|
+
const middlewares = postMiddlewares.map((post) => ({ post }));
|
|
136
|
+
return this.withMiddleware(...middlewares);
|
|
137
|
+
}
|
|
138
|
+
isJsonMime(mime) {
|
|
139
|
+
if (!mime) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return BaseAPI.jsonRegex.test(mime);
|
|
143
|
+
}
|
|
144
|
+
async request(context, initOverrides) {
|
|
145
|
+
const { url, init } = await this.createFetchParams(context, initOverrides);
|
|
146
|
+
const response = await this.fetchApi(url, init);
|
|
147
|
+
if (response && (response.status >= 200 && response.status < 300)) {
|
|
148
|
+
return response;
|
|
149
|
+
}
|
|
150
|
+
throw new ResponseError(response, "Response returned an error code");
|
|
151
|
+
}
|
|
152
|
+
async createFetchParams(context, initOverrides) {
|
|
153
|
+
let url = this.configuration.basePath + context.path;
|
|
154
|
+
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
|
|
155
|
+
url += "?" + this.configuration.queryParamsStringify(context.query);
|
|
156
|
+
}
|
|
157
|
+
const headers = Object.assign({}, this.configuration.headers, context.headers);
|
|
158
|
+
Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
|
|
159
|
+
const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
|
|
160
|
+
const initParams = {
|
|
161
|
+
method: context.method,
|
|
162
|
+
headers,
|
|
163
|
+
body: context.body,
|
|
164
|
+
credentials: this.configuration.credentials
|
|
165
|
+
};
|
|
166
|
+
const overriddenInit = {
|
|
167
|
+
...initParams,
|
|
168
|
+
...await initOverrideFn({
|
|
169
|
+
init: initParams,
|
|
170
|
+
context
|
|
171
|
+
})
|
|
172
|
+
};
|
|
173
|
+
let body;
|
|
174
|
+
if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) {
|
|
175
|
+
body = overriddenInit.body;
|
|
176
|
+
} else if (this.isJsonMime(headers["Content-Type"])) {
|
|
177
|
+
body = JSON.stringify(overriddenInit.body);
|
|
178
|
+
} else {
|
|
179
|
+
body = overriddenInit.body;
|
|
180
|
+
}
|
|
181
|
+
const init = {
|
|
182
|
+
...overriddenInit,
|
|
183
|
+
body
|
|
184
|
+
};
|
|
185
|
+
return { url, init };
|
|
186
|
+
}
|
|
187
|
+
fetchApi = async (url, init) => {
|
|
188
|
+
let fetchParams = { url, init };
|
|
189
|
+
for (const middleware of this.middleware) {
|
|
190
|
+
if (middleware.pre) {
|
|
191
|
+
fetchParams = await middleware.pre({
|
|
192
|
+
fetch: this.fetchApi,
|
|
193
|
+
...fetchParams
|
|
194
|
+
}) || fetchParams;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
let response = undefined;
|
|
198
|
+
try {
|
|
199
|
+
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
|
200
|
+
} catch (e) {
|
|
201
|
+
for (const middleware of this.middleware) {
|
|
202
|
+
if (middleware.onError) {
|
|
203
|
+
response = await middleware.onError({
|
|
204
|
+
fetch: this.fetchApi,
|
|
205
|
+
url: fetchParams.url,
|
|
206
|
+
init: fetchParams.init,
|
|
207
|
+
error: e,
|
|
208
|
+
response: response ? response.clone() : undefined
|
|
209
|
+
}) || response;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (response === undefined) {
|
|
213
|
+
if (e instanceof Error) {
|
|
214
|
+
throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
|
|
215
|
+
} else {
|
|
216
|
+
throw e;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
for (const middleware of this.middleware) {
|
|
221
|
+
if (middleware.post) {
|
|
222
|
+
response = await middleware.post({
|
|
223
|
+
fetch: this.fetchApi,
|
|
224
|
+
url: fetchParams.url,
|
|
225
|
+
init: fetchParams.init,
|
|
226
|
+
response: response.clone()
|
|
227
|
+
}) || response;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return response;
|
|
231
|
+
};
|
|
232
|
+
clone() {
|
|
233
|
+
const constructor = this.constructor;
|
|
234
|
+
const next = new constructor(this.configuration);
|
|
235
|
+
next.middleware = this.middleware.slice();
|
|
236
|
+
return next;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function isBlob(value) {
|
|
240
|
+
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
241
|
+
}
|
|
242
|
+
function isFormData(value) {
|
|
243
|
+
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
class ResponseError extends Error {
|
|
247
|
+
response;
|
|
248
|
+
name = "ResponseError";
|
|
249
|
+
constructor(response, msg) {
|
|
250
|
+
super(msg);
|
|
251
|
+
this.response = response;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
class FetchError extends Error {
|
|
256
|
+
cause;
|
|
257
|
+
name = "FetchError";
|
|
258
|
+
constructor(cause, msg) {
|
|
259
|
+
super(msg);
|
|
260
|
+
this.cause = cause;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
class RequiredError extends Error {
|
|
265
|
+
field;
|
|
266
|
+
name = "RequiredError";
|
|
267
|
+
constructor(field, msg) {
|
|
268
|
+
super(msg);
|
|
269
|
+
this.field = field;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function querystring(params, prefix = "") {
|
|
273
|
+
return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
|
|
274
|
+
}
|
|
275
|
+
function querystringSingleKey(key, value, keyPrefix = "") {
|
|
276
|
+
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
|
|
277
|
+
if (value instanceof Array) {
|
|
278
|
+
const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
|
|
279
|
+
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
|
280
|
+
}
|
|
281
|
+
if (value instanceof Set) {
|
|
282
|
+
const valueAsArray = Array.from(value);
|
|
283
|
+
return querystringSingleKey(key, valueAsArray, keyPrefix);
|
|
284
|
+
}
|
|
285
|
+
if (value instanceof Date) {
|
|
286
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
|
|
287
|
+
}
|
|
288
|
+
if (value instanceof Object) {
|
|
289
|
+
return querystring(value, fullKey);
|
|
290
|
+
}
|
|
291
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
|
292
|
+
}
|
|
293
|
+
class JSONApiResponse {
|
|
294
|
+
raw;
|
|
295
|
+
transformer;
|
|
296
|
+
constructor(raw, transformer = (jsonValue) => jsonValue) {
|
|
297
|
+
this.raw = raw;
|
|
298
|
+
this.transformer = transformer;
|
|
299
|
+
}
|
|
300
|
+
async value() {
|
|
301
|
+
return this.transformer(await this.raw.json());
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
class VoidApiResponse {
|
|
306
|
+
raw;
|
|
307
|
+
constructor(raw) {
|
|
308
|
+
this.raw = raw;
|
|
309
|
+
}
|
|
310
|
+
async value() {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// ../apms-sdk/package.json
|
|
315
|
+
var package_default2 = {
|
|
316
|
+
name: "@uipath/apms-sdk",
|
|
317
|
+
author: "UiPath",
|
|
318
|
+
license: "SEE LICENSE IN LICENSE.txt",
|
|
319
|
+
version: "1.204.0",
|
|
320
|
+
description: "SDK for the UiPath Access Policy Management Service API.",
|
|
321
|
+
repository: {
|
|
322
|
+
type: "git",
|
|
323
|
+
url: "https://github.com/UiPath/cli.git",
|
|
324
|
+
directory: "packages/admin/apms-sdk"
|
|
325
|
+
},
|
|
326
|
+
publishConfig: {
|
|
327
|
+
registry: "https://npm.pkg.github.com/@uipath"
|
|
328
|
+
},
|
|
329
|
+
keywords: [
|
|
330
|
+
"uipath",
|
|
331
|
+
"access-policy-management",
|
|
332
|
+
"apms",
|
|
333
|
+
"sdk"
|
|
334
|
+
],
|
|
335
|
+
type: "module",
|
|
336
|
+
main: "./dist/index.js",
|
|
337
|
+
types: "./dist/src/index.d.ts",
|
|
338
|
+
exports: {
|
|
339
|
+
".": {
|
|
340
|
+
types: "./dist/src/index.d.ts",
|
|
341
|
+
default: "./dist/index.js"
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
files: [
|
|
345
|
+
"dist"
|
|
346
|
+
],
|
|
347
|
+
private: true,
|
|
348
|
+
scripts: {
|
|
349
|
+
build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
350
|
+
generate: "bun run src/scripts/generate-sdk.ts",
|
|
351
|
+
lint: "biome check ."
|
|
352
|
+
},
|
|
353
|
+
devDependencies: {
|
|
354
|
+
"@openapitools/openapi-generator-cli": "^2.31.1",
|
|
355
|
+
"@types/node": "^25.5.2",
|
|
356
|
+
"@uipath/auth": "workspace:*",
|
|
357
|
+
"@uipath/common": "workspace:*",
|
|
358
|
+
"@uipath/filesystem": "workspace:*",
|
|
359
|
+
typescript: "^7.0.2"
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
// ../apms-sdk/src/user-agent.ts
|
|
364
|
+
var SDK_USER_AGENT = getSdkUserAgentToken(package_default2);
|
|
365
|
+
installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
|
|
366
|
+
|
|
367
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainDataStatus.ts
|
|
368
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainDataStatusToJSON(value) {
|
|
369
|
+
return value;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainDataType.ts
|
|
373
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainDataTypeFromJSON(json) {
|
|
374
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainDataTypeFromJSONTyped(json, false);
|
|
375
|
+
}
|
|
376
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainDataTypeFromJSONTyped(json, ignoreDiscriminator) {
|
|
377
|
+
return json;
|
|
378
|
+
}
|
|
379
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainDataTypeToJSON(value) {
|
|
380
|
+
return value;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequest.ts
|
|
384
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequestToJSON(json) {
|
|
385
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequestToJSONTyped(json, false);
|
|
386
|
+
}
|
|
387
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
388
|
+
if (value == null) {
|
|
389
|
+
return value;
|
|
390
|
+
}
|
|
391
|
+
return {
|
|
392
|
+
name: value["name"],
|
|
393
|
+
startIp: value["startIp"],
|
|
394
|
+
endIp: value["endIp"],
|
|
395
|
+
ipNetworks: value["ipNetworks"],
|
|
396
|
+
expiresInMinutes: value["expiresInMinutes"],
|
|
397
|
+
type: UiPathPlatformServiceAccessPolicyManagementDomainDataTypeToJSON(value["type"])
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationStatusRequest.ts
|
|
402
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationStatusRequestToJSON(json) {
|
|
403
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationStatusRequestToJSONTyped(json, false);
|
|
404
|
+
}
|
|
405
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationStatusRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
406
|
+
if (value == null) {
|
|
407
|
+
return value;
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
status: UiPathPlatformServiceAccessPolicyManagementDomainDataStatusToJSON(value["status"])
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddRegexBypassRequest.ts
|
|
415
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddRegexBypassRequestToJSON(json) {
|
|
416
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddRegexBypassRequestToJSONTyped(json, false);
|
|
417
|
+
}
|
|
418
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddRegexBypassRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
419
|
+
if (value == null) {
|
|
420
|
+
return value;
|
|
421
|
+
}
|
|
422
|
+
return {
|
|
423
|
+
serviceType: value["serviceType"],
|
|
424
|
+
folderId: value["folderId"],
|
|
425
|
+
appSystemName: value["appSystemName"],
|
|
426
|
+
tenantId: value["tenantId"],
|
|
427
|
+
appId: value["appId"],
|
|
428
|
+
appName: value["appName"],
|
|
429
|
+
appDescription: value["appDescription"]
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainRequestsDeleteIpNetworkRequest.ts
|
|
434
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsDeleteIpNetworkRequestToJSON(json) {
|
|
435
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainRequestsDeleteIpNetworkRequestToJSONTyped(json, false);
|
|
436
|
+
}
|
|
437
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsDeleteIpNetworkRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
438
|
+
if (value == null) {
|
|
439
|
+
return value;
|
|
440
|
+
}
|
|
441
|
+
return {
|
|
442
|
+
ipNetworks: value["ipNetworks"],
|
|
443
|
+
type: UiPathPlatformServiceAccessPolicyManagementDomainDataTypeToJSON(value["type"])
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationRequest.ts
|
|
448
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationRequestToJSON(json) {
|
|
449
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationRequestToJSONTyped(json, false);
|
|
450
|
+
}
|
|
451
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
452
|
+
if (value == null) {
|
|
453
|
+
return value;
|
|
454
|
+
}
|
|
455
|
+
return {
|
|
456
|
+
startIp: value["startIp"],
|
|
457
|
+
endIp: value["endIp"],
|
|
458
|
+
name: value["name"],
|
|
459
|
+
ipNetwork: value["ipNetwork"]
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationStatusRequest.ts
|
|
464
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationStatusRequestToJSON(json) {
|
|
465
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationStatusRequestToJSONTyped(json, false);
|
|
466
|
+
}
|
|
467
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationStatusRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
468
|
+
if (value == null) {
|
|
469
|
+
return value;
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
status: UiPathPlatformServiceAccessPolicyManagementDomainDataStatusToJSON(value["status"]),
|
|
473
|
+
updatedOn: value["updatedOn"] == null ? value["updatedOn"] : value["updatedOn"].toISOString()
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateRegexBypassRequest.ts
|
|
478
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateRegexBypassRequestToJSON(json) {
|
|
479
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateRegexBypassRequestToJSONTyped(json, false);
|
|
480
|
+
}
|
|
481
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateRegexBypassRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
482
|
+
if (value == null) {
|
|
483
|
+
return value;
|
|
484
|
+
}
|
|
485
|
+
return {
|
|
486
|
+
regexEntry: value["regexEntry"],
|
|
487
|
+
tenantId: value["tenantId"],
|
|
488
|
+
appId: value["appId"],
|
|
489
|
+
appName: value["appName"],
|
|
490
|
+
appDescription: value["appDescription"]
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDto.ts
|
|
495
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON(json) {
|
|
496
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSONTyped(json, false);
|
|
497
|
+
}
|
|
498
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSONTyped(json, ignoreDiscriminator) {
|
|
499
|
+
if (json == null) {
|
|
500
|
+
return json;
|
|
501
|
+
}
|
|
502
|
+
return {
|
|
503
|
+
id: json["id"] == null ? undefined : json["id"],
|
|
504
|
+
name: json["name"] == null ? undefined : json["name"],
|
|
505
|
+
ipNetwork: json["ipNetwork"] == null ? undefined : json["ipNetwork"],
|
|
506
|
+
organizationId: json["organizationId"] == null ? undefined : json["organizationId"],
|
|
507
|
+
type: json["type"] == null ? undefined : UiPathPlatformServiceAccessPolicyManagementDomainDataTypeFromJSON(json["type"]),
|
|
508
|
+
expiresAt: json["expiresAt"] == null ? undefined : new Date(json["expiresAt"])
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpRangeConfigurationDto.ts
|
|
513
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpRangeConfigurationDtoFromJSON(json) {
|
|
514
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpRangeConfigurationDtoFromJSONTyped(json, false);
|
|
515
|
+
}
|
|
516
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpRangeConfigurationDtoFromJSONTyped(json, ignoreDiscriminator) {
|
|
517
|
+
if (json == null) {
|
|
518
|
+
return json;
|
|
519
|
+
}
|
|
520
|
+
return {
|
|
521
|
+
id: json["id"] == null ? undefined : json["id"],
|
|
522
|
+
name: json["name"] == null ? undefined : json["name"],
|
|
523
|
+
startIp: json["startIp"] == null ? undefined : json["startIp"],
|
|
524
|
+
endIp: json["endIp"] == null ? undefined : json["endIp"],
|
|
525
|
+
organizationId: json["organizationId"] == null ? undefined : json["organizationId"]
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainResponsesRegexBypassDto.ts
|
|
530
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainResponsesRegexBypassDtoFromJSON(json) {
|
|
531
|
+
return UiPathPlatformServiceAccessPolicyManagementDomainResponsesRegexBypassDtoFromJSONTyped(json, false);
|
|
532
|
+
}
|
|
533
|
+
function UiPathPlatformServiceAccessPolicyManagementDomainResponsesRegexBypassDtoFromJSONTyped(json, ignoreDiscriminator) {
|
|
534
|
+
if (json == null) {
|
|
535
|
+
return json;
|
|
536
|
+
}
|
|
537
|
+
return {
|
|
538
|
+
regexBypassId: json["regexBypassId"] == null ? undefined : json["regexBypassId"],
|
|
539
|
+
serviceType: json["serviceType"] == null ? undefined : json["serviceType"],
|
|
540
|
+
organizationId: json["organizationId"] == null ? undefined : json["organizationId"],
|
|
541
|
+
regexEntry: json["regexEntry"] == null ? undefined : json["regexEntry"],
|
|
542
|
+
tenantId: json["tenantId"] == null ? undefined : json["tenantId"],
|
|
543
|
+
appId: json["appId"] == null ? undefined : json["appId"],
|
|
544
|
+
appName: json["appName"] == null ? undefined : json["appName"],
|
|
545
|
+
appDescription: json["appDescription"] == null ? undefined : json["appDescription"],
|
|
546
|
+
lastUpdated: json["lastUpdated"] == null ? undefined : new Date(json["lastUpdated"])
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// ../apms-sdk/generated/src/apis/IpNetworkConfigurationApi.ts
|
|
551
|
+
class IpNetworkConfigurationApi extends BaseAPI {
|
|
552
|
+
async _deleteRaw(requestParameters, initOverrides) {
|
|
553
|
+
if (requestParameters["organizationId"] == null) {
|
|
554
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling _delete().');
|
|
555
|
+
}
|
|
556
|
+
if (requestParameters["id"] == null) {
|
|
557
|
+
throw new RequiredError("id", 'Required parameter "id" was null or undefined when calling _delete().');
|
|
558
|
+
}
|
|
559
|
+
const queryParameters = {};
|
|
560
|
+
const headerParameters = {};
|
|
561
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
562
|
+
const token = this.configuration.accessToken;
|
|
563
|
+
const tokenString = await token("bearerAuth", []);
|
|
564
|
+
if (tokenString) {
|
|
565
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
let urlPath = `/api/organization/{organizationId}/ipnetworks/{id}`;
|
|
569
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
570
|
+
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
|
|
571
|
+
const response = await this.request({
|
|
572
|
+
path: urlPath,
|
|
573
|
+
method: "DELETE",
|
|
574
|
+
headers: headerParameters,
|
|
575
|
+
query: queryParameters
|
|
576
|
+
}, initOverrides);
|
|
577
|
+
return new VoidApiResponse(response);
|
|
578
|
+
}
|
|
579
|
+
async _delete(requestParameters, initOverrides) {
|
|
580
|
+
await this._deleteRaw(requestParameters, initOverrides);
|
|
581
|
+
}
|
|
582
|
+
async _delete_1Raw(requestParameters, initOverrides) {
|
|
583
|
+
if (requestParameters["organizationId"] == null) {
|
|
584
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling _delete_1().');
|
|
585
|
+
}
|
|
586
|
+
if (requestParameters["id"] == null) {
|
|
587
|
+
throw new RequiredError("id", 'Required parameter "id" was null or undefined when calling _delete_1().');
|
|
588
|
+
}
|
|
589
|
+
const queryParameters = {};
|
|
590
|
+
const headerParameters = {};
|
|
591
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
592
|
+
const token = this.configuration.accessToken;
|
|
593
|
+
const tokenString = await token("bearerAuth", []);
|
|
594
|
+
if (tokenString) {
|
|
595
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipnetworks/{id}`;
|
|
599
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
600
|
+
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
|
|
601
|
+
const response = await this.request({
|
|
602
|
+
path: urlPath,
|
|
603
|
+
method: "DELETE",
|
|
604
|
+
headers: headerParameters,
|
|
605
|
+
query: queryParameters
|
|
606
|
+
}, initOverrides);
|
|
607
|
+
return new VoidApiResponse(response);
|
|
608
|
+
}
|
|
609
|
+
async _delete_1(requestParameters, initOverrides) {
|
|
610
|
+
await this._delete_1Raw(requestParameters, initOverrides);
|
|
611
|
+
}
|
|
612
|
+
async _delete_2Raw(requestParameters, initOverrides) {
|
|
613
|
+
if (requestParameters["organizationId"] == null) {
|
|
614
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling _delete_2().');
|
|
615
|
+
}
|
|
616
|
+
const queryParameters = {};
|
|
617
|
+
const headerParameters = {};
|
|
618
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
619
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
620
|
+
const token = this.configuration.accessToken;
|
|
621
|
+
const tokenString = await token("bearerAuth", []);
|
|
622
|
+
if (tokenString) {
|
|
623
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
let urlPath = `/api/organization/{organizationId}/ipnetworks`;
|
|
627
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
628
|
+
const response = await this.request({
|
|
629
|
+
path: urlPath,
|
|
630
|
+
method: "DELETE",
|
|
631
|
+
headers: headerParameters,
|
|
632
|
+
query: queryParameters,
|
|
633
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsDeleteIpNetworkRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsDeleteIpNetworkRequest"])
|
|
634
|
+
}, initOverrides);
|
|
635
|
+
return new VoidApiResponse(response);
|
|
636
|
+
}
|
|
637
|
+
async _delete_2(requestParameters, initOverrides) {
|
|
638
|
+
await this._delete_2Raw(requestParameters, initOverrides);
|
|
639
|
+
}
|
|
640
|
+
async _delete_3Raw(requestParameters, initOverrides) {
|
|
641
|
+
if (requestParameters["organizationId"] == null) {
|
|
642
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling _delete_3().');
|
|
643
|
+
}
|
|
644
|
+
const queryParameters = {};
|
|
645
|
+
const headerParameters = {};
|
|
646
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
647
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
648
|
+
const token = this.configuration.accessToken;
|
|
649
|
+
const tokenString = await token("bearerAuth", []);
|
|
650
|
+
if (tokenString) {
|
|
651
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipnetworks`;
|
|
655
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
656
|
+
const response = await this.request({
|
|
657
|
+
path: urlPath,
|
|
658
|
+
method: "DELETE",
|
|
659
|
+
headers: headerParameters,
|
|
660
|
+
query: queryParameters,
|
|
661
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsDeleteIpNetworkRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsDeleteIpNetworkRequest"])
|
|
662
|
+
}, initOverrides);
|
|
663
|
+
return new VoidApiResponse(response);
|
|
664
|
+
}
|
|
665
|
+
async _delete_3(requestParameters, initOverrides) {
|
|
666
|
+
await this._delete_3Raw(requestParameters, initOverrides);
|
|
667
|
+
}
|
|
668
|
+
async addRaw(requestParameters, initOverrides) {
|
|
669
|
+
if (requestParameters["organizationId"] == null) {
|
|
670
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling add().');
|
|
671
|
+
}
|
|
672
|
+
const queryParameters = {};
|
|
673
|
+
const headerParameters = {};
|
|
674
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
675
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
676
|
+
const token = this.configuration.accessToken;
|
|
677
|
+
const tokenString = await token("bearerAuth", []);
|
|
678
|
+
if (tokenString) {
|
|
679
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
let urlPath = `/api/organization/{organizationId}/ipnetworks`;
|
|
683
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
684
|
+
const response = await this.request({
|
|
685
|
+
path: urlPath,
|
|
686
|
+
method: "POST",
|
|
687
|
+
headers: headerParameters,
|
|
688
|
+
query: queryParameters,
|
|
689
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequest"])
|
|
690
|
+
}, initOverrides);
|
|
691
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON));
|
|
692
|
+
}
|
|
693
|
+
async add(requestParameters, initOverrides) {
|
|
694
|
+
const response = await this.addRaw(requestParameters, initOverrides);
|
|
695
|
+
return await response.value();
|
|
696
|
+
}
|
|
697
|
+
async add_4Raw(requestParameters, initOverrides) {
|
|
698
|
+
if (requestParameters["organizationId"] == null) {
|
|
699
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling add_4().');
|
|
700
|
+
}
|
|
701
|
+
const queryParameters = {};
|
|
702
|
+
const headerParameters = {};
|
|
703
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
704
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
705
|
+
const token = this.configuration.accessToken;
|
|
706
|
+
const tokenString = await token("bearerAuth", []);
|
|
707
|
+
if (tokenString) {
|
|
708
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipnetworks`;
|
|
712
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
713
|
+
const response = await this.request({
|
|
714
|
+
path: urlPath,
|
|
715
|
+
method: "POST",
|
|
716
|
+
headers: headerParameters,
|
|
717
|
+
query: queryParameters,
|
|
718
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequest"])
|
|
719
|
+
}, initOverrides);
|
|
720
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON));
|
|
721
|
+
}
|
|
722
|
+
async add_4(requestParameters, initOverrides) {
|
|
723
|
+
const response = await this.add_4Raw(requestParameters, initOverrides);
|
|
724
|
+
return await response.value();
|
|
725
|
+
}
|
|
726
|
+
async getRaw(requestParameters, initOverrides) {
|
|
727
|
+
if (requestParameters["id"] == null) {
|
|
728
|
+
throw new RequiredError("id", 'Required parameter "id" was null or undefined when calling get().');
|
|
729
|
+
}
|
|
730
|
+
if (requestParameters["organizationId"] == null) {
|
|
731
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling get().');
|
|
732
|
+
}
|
|
733
|
+
const queryParameters = {};
|
|
734
|
+
const headerParameters = {};
|
|
735
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
736
|
+
const token = this.configuration.accessToken;
|
|
737
|
+
const tokenString = await token("bearerAuth", []);
|
|
738
|
+
if (tokenString) {
|
|
739
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
let urlPath = `/api/organization/{organizationId}/ipnetworks/{id}`;
|
|
743
|
+
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
|
|
744
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
745
|
+
const response = await this.request({
|
|
746
|
+
path: urlPath,
|
|
747
|
+
method: "GET",
|
|
748
|
+
headers: headerParameters,
|
|
749
|
+
query: queryParameters
|
|
750
|
+
}, initOverrides);
|
|
751
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON(jsonValue));
|
|
752
|
+
}
|
|
753
|
+
async get(requestParameters, initOverrides) {
|
|
754
|
+
const response = await this.getRaw(requestParameters, initOverrides);
|
|
755
|
+
return await response.value();
|
|
756
|
+
}
|
|
757
|
+
async getByOrganizationIdRaw(requestParameters, initOverrides) {
|
|
758
|
+
if (requestParameters["organizationId"] == null) {
|
|
759
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling getByOrganizationId().');
|
|
760
|
+
}
|
|
761
|
+
const queryParameters = {};
|
|
762
|
+
const headerParameters = {};
|
|
763
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
764
|
+
const token = this.configuration.accessToken;
|
|
765
|
+
const tokenString = await token("bearerAuth", []);
|
|
766
|
+
if (tokenString) {
|
|
767
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
let urlPath = `/api/organization/{organizationId}/ipnetworks`;
|
|
771
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
772
|
+
const response = await this.request({
|
|
773
|
+
path: urlPath,
|
|
774
|
+
method: "GET",
|
|
775
|
+
headers: headerParameters,
|
|
776
|
+
query: queryParameters
|
|
777
|
+
}, initOverrides);
|
|
778
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON));
|
|
779
|
+
}
|
|
780
|
+
async getByOrganizationId(requestParameters, initOverrides) {
|
|
781
|
+
const response = await this.getByOrganizationIdRaw(requestParameters, initOverrides);
|
|
782
|
+
return await response.value();
|
|
783
|
+
}
|
|
784
|
+
async getByOrganizationId_5Raw(requestParameters, initOverrides) {
|
|
785
|
+
if (requestParameters["organizationId"] == null) {
|
|
786
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling getByOrganizationId_5().');
|
|
787
|
+
}
|
|
788
|
+
const queryParameters = {};
|
|
789
|
+
const headerParameters = {};
|
|
790
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
791
|
+
const token = this.configuration.accessToken;
|
|
792
|
+
const tokenString = await token("bearerAuth", []);
|
|
793
|
+
if (tokenString) {
|
|
794
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipnetworks`;
|
|
798
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
799
|
+
const response = await this.request({
|
|
800
|
+
path: urlPath,
|
|
801
|
+
method: "GET",
|
|
802
|
+
headers: headerParameters,
|
|
803
|
+
query: queryParameters
|
|
804
|
+
}, initOverrides);
|
|
805
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON));
|
|
806
|
+
}
|
|
807
|
+
async getByOrganizationId_5(requestParameters, initOverrides) {
|
|
808
|
+
const response = await this.getByOrganizationId_5Raw(requestParameters, initOverrides);
|
|
809
|
+
return await response.value();
|
|
810
|
+
}
|
|
811
|
+
async get_6Raw(requestParameters, initOverrides) {
|
|
812
|
+
if (requestParameters["id"] == null) {
|
|
813
|
+
throw new RequiredError("id", 'Required parameter "id" was null or undefined when calling get_6().');
|
|
814
|
+
}
|
|
815
|
+
if (requestParameters["organizationId"] == null) {
|
|
816
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling get_6().');
|
|
817
|
+
}
|
|
818
|
+
const queryParameters = {};
|
|
819
|
+
const headerParameters = {};
|
|
820
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
821
|
+
const token = this.configuration.accessToken;
|
|
822
|
+
const tokenString = await token("bearerAuth", []);
|
|
823
|
+
if (tokenString) {
|
|
824
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipnetworks/{id}`;
|
|
828
|
+
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
|
|
829
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
830
|
+
const response = await this.request({
|
|
831
|
+
path: urlPath,
|
|
832
|
+
method: "GET",
|
|
833
|
+
headers: headerParameters,
|
|
834
|
+
query: queryParameters
|
|
835
|
+
}, initOverrides);
|
|
836
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON(jsonValue));
|
|
837
|
+
}
|
|
838
|
+
async get_6(requestParameters, initOverrides) {
|
|
839
|
+
const response = await this.get_6Raw(requestParameters, initOverrides);
|
|
840
|
+
return await response.value();
|
|
841
|
+
}
|
|
842
|
+
async putRaw(requestParameters, initOverrides) {
|
|
843
|
+
if (requestParameters["organizationId"] == null) {
|
|
844
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling put().');
|
|
845
|
+
}
|
|
846
|
+
const queryParameters = {};
|
|
847
|
+
const headerParameters = {};
|
|
848
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
849
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
850
|
+
const token = this.configuration.accessToken;
|
|
851
|
+
const tokenString = await token("bearerAuth", []);
|
|
852
|
+
if (tokenString) {
|
|
853
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
let urlPath = `/api/organization/{organizationId}/ipnetworks`;
|
|
857
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
858
|
+
const response = await this.request({
|
|
859
|
+
path: urlPath,
|
|
860
|
+
method: "PUT",
|
|
861
|
+
headers: headerParameters,
|
|
862
|
+
query: queryParameters,
|
|
863
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequest"])
|
|
864
|
+
}, initOverrides);
|
|
865
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON));
|
|
866
|
+
}
|
|
867
|
+
async put(requestParameters, initOverrides) {
|
|
868
|
+
const response = await this.putRaw(requestParameters, initOverrides);
|
|
869
|
+
return await response.value();
|
|
870
|
+
}
|
|
871
|
+
async put_7Raw(requestParameters, initOverrides) {
|
|
872
|
+
if (requestParameters["organizationId"] == null) {
|
|
873
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling put_7().');
|
|
874
|
+
}
|
|
875
|
+
const queryParameters = {};
|
|
876
|
+
const headerParameters = {};
|
|
877
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
878
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
879
|
+
const token = this.configuration.accessToken;
|
|
880
|
+
const tokenString = await token("bearerAuth", []);
|
|
881
|
+
if (tokenString) {
|
|
882
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipnetworks`;
|
|
886
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
887
|
+
const response = await this.request({
|
|
888
|
+
path: urlPath,
|
|
889
|
+
method: "PUT",
|
|
890
|
+
headers: headerParameters,
|
|
891
|
+
query: queryParameters,
|
|
892
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequest"])
|
|
893
|
+
}, initOverrides);
|
|
894
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON));
|
|
895
|
+
}
|
|
896
|
+
async put_7(requestParameters, initOverrides) {
|
|
897
|
+
const response = await this.put_7Raw(requestParameters, initOverrides);
|
|
898
|
+
return await response.value();
|
|
899
|
+
}
|
|
900
|
+
async updateRaw(requestParameters, initOverrides) {
|
|
901
|
+
if (requestParameters["id"] == null) {
|
|
902
|
+
throw new RequiredError("id", 'Required parameter "id" was null or undefined when calling update().');
|
|
903
|
+
}
|
|
904
|
+
if (requestParameters["organizationId"] == null) {
|
|
905
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling update().');
|
|
906
|
+
}
|
|
907
|
+
const queryParameters = {};
|
|
908
|
+
const headerParameters = {};
|
|
909
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
910
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
911
|
+
const token = this.configuration.accessToken;
|
|
912
|
+
const tokenString = await token("bearerAuth", []);
|
|
913
|
+
if (tokenString) {
|
|
914
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
let urlPath = `/api/organization/{organizationId}/ipnetworks/{id}`;
|
|
918
|
+
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
|
|
919
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
920
|
+
const response = await this.request({
|
|
921
|
+
path: urlPath,
|
|
922
|
+
method: "PATCH",
|
|
923
|
+
headers: headerParameters,
|
|
924
|
+
query: queryParameters,
|
|
925
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationRequest"])
|
|
926
|
+
}, initOverrides);
|
|
927
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON(jsonValue));
|
|
928
|
+
}
|
|
929
|
+
async update(requestParameters, initOverrides) {
|
|
930
|
+
const response = await this.updateRaw(requestParameters, initOverrides);
|
|
931
|
+
return await response.value();
|
|
932
|
+
}
|
|
933
|
+
async update_8Raw(requestParameters, initOverrides) {
|
|
934
|
+
if (requestParameters["id"] == null) {
|
|
935
|
+
throw new RequiredError("id", 'Required parameter "id" was null or undefined when calling update_8().');
|
|
936
|
+
}
|
|
937
|
+
if (requestParameters["organizationId"] == null) {
|
|
938
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling update_8().');
|
|
939
|
+
}
|
|
940
|
+
const queryParameters = {};
|
|
941
|
+
const headerParameters = {};
|
|
942
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
943
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
944
|
+
const token = this.configuration.accessToken;
|
|
945
|
+
const tokenString = await token("bearerAuth", []);
|
|
946
|
+
if (tokenString) {
|
|
947
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipnetworks/{id}`;
|
|
951
|
+
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
|
|
952
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
953
|
+
const response = await this.request({
|
|
954
|
+
path: urlPath,
|
|
955
|
+
method: "PATCH",
|
|
956
|
+
headers: headerParameters,
|
|
957
|
+
query: queryParameters,
|
|
958
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationRequest"])
|
|
959
|
+
}, initOverrides);
|
|
960
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpNetworkConfigurationDtoFromJSON(jsonValue));
|
|
961
|
+
}
|
|
962
|
+
async update_8(requestParameters, initOverrides) {
|
|
963
|
+
const response = await this.update_8Raw(requestParameters, initOverrides);
|
|
964
|
+
return await response.value();
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
// ../apms-sdk/generated/src/apis/IpRangeConfigurationStatusApi.ts
|
|
969
|
+
class IpRangeConfigurationStatusApi extends BaseAPI {
|
|
970
|
+
async _deleteRaw(requestParameters, initOverrides) {
|
|
971
|
+
if (requestParameters["organizationId"] == null) {
|
|
972
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling _delete().');
|
|
973
|
+
}
|
|
974
|
+
const queryParameters = {};
|
|
975
|
+
const headerParameters = {};
|
|
976
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
977
|
+
const token = this.configuration.accessToken;
|
|
978
|
+
const tokenString = await token("bearerAuth", []);
|
|
979
|
+
if (tokenString) {
|
|
980
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
let urlPath = `/api/organization/{organizationId}/ipRangeStatus`;
|
|
984
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
985
|
+
const response = await this.request({
|
|
986
|
+
path: urlPath,
|
|
987
|
+
method: "DELETE",
|
|
988
|
+
headers: headerParameters,
|
|
989
|
+
query: queryParameters
|
|
990
|
+
}, initOverrides);
|
|
991
|
+
return new VoidApiResponse(response);
|
|
992
|
+
}
|
|
993
|
+
async _delete(requestParameters, initOverrides) {
|
|
994
|
+
await this._deleteRaw(requestParameters, initOverrides);
|
|
995
|
+
}
|
|
996
|
+
async _delete_1Raw(requestParameters, initOverrides) {
|
|
997
|
+
if (requestParameters["organizationId"] == null) {
|
|
998
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling _delete_1().');
|
|
999
|
+
}
|
|
1000
|
+
const queryParameters = {};
|
|
1001
|
+
const headerParameters = {};
|
|
1002
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1003
|
+
const token = this.configuration.accessToken;
|
|
1004
|
+
const tokenString = await token("bearerAuth", []);
|
|
1005
|
+
if (tokenString) {
|
|
1006
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipRangeStatus`;
|
|
1010
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1011
|
+
const response = await this.request({
|
|
1012
|
+
path: urlPath,
|
|
1013
|
+
method: "DELETE",
|
|
1014
|
+
headers: headerParameters,
|
|
1015
|
+
query: queryParameters
|
|
1016
|
+
}, initOverrides);
|
|
1017
|
+
return new VoidApiResponse(response);
|
|
1018
|
+
}
|
|
1019
|
+
async _delete_1(requestParameters, initOverrides) {
|
|
1020
|
+
await this._delete_1Raw(requestParameters, initOverrides);
|
|
1021
|
+
}
|
|
1022
|
+
async addRaw(requestParameters, initOverrides) {
|
|
1023
|
+
if (requestParameters["organizationId"] == null) {
|
|
1024
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling add().');
|
|
1025
|
+
}
|
|
1026
|
+
const queryParameters = {};
|
|
1027
|
+
const headerParameters = {};
|
|
1028
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
1029
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1030
|
+
const token = this.configuration.accessToken;
|
|
1031
|
+
const tokenString = await token("bearerAuth", []);
|
|
1032
|
+
if (tokenString) {
|
|
1033
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
let urlPath = `/api/organization/{organizationId}/ipRangeStatus`;
|
|
1037
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1038
|
+
const response = await this.request({
|
|
1039
|
+
path: urlPath,
|
|
1040
|
+
method: "POST",
|
|
1041
|
+
headers: headerParameters,
|
|
1042
|
+
query: queryParameters,
|
|
1043
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationStatusRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationStatusRequest"])
|
|
1044
|
+
}, initOverrides);
|
|
1045
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpRangeConfigurationDtoFromJSON(jsonValue));
|
|
1046
|
+
}
|
|
1047
|
+
async add(requestParameters, initOverrides) {
|
|
1048
|
+
const response = await this.addRaw(requestParameters, initOverrides);
|
|
1049
|
+
return await response.value();
|
|
1050
|
+
}
|
|
1051
|
+
async add_2Raw(requestParameters, initOverrides) {
|
|
1052
|
+
if (requestParameters["organizationId"] == null) {
|
|
1053
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling add_2().');
|
|
1054
|
+
}
|
|
1055
|
+
const queryParameters = {};
|
|
1056
|
+
const headerParameters = {};
|
|
1057
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
1058
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1059
|
+
const token = this.configuration.accessToken;
|
|
1060
|
+
const tokenString = await token("bearerAuth", []);
|
|
1061
|
+
if (tokenString) {
|
|
1062
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipRangeStatus`;
|
|
1066
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1067
|
+
const response = await this.request({
|
|
1068
|
+
path: urlPath,
|
|
1069
|
+
method: "POST",
|
|
1070
|
+
headers: headerParameters,
|
|
1071
|
+
query: queryParameters,
|
|
1072
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationStatusRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationStatusRequest"])
|
|
1073
|
+
}, initOverrides);
|
|
1074
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpRangeConfigurationDtoFromJSON(jsonValue));
|
|
1075
|
+
}
|
|
1076
|
+
async add_2(requestParameters, initOverrides) {
|
|
1077
|
+
const response = await this.add_2Raw(requestParameters, initOverrides);
|
|
1078
|
+
return await response.value();
|
|
1079
|
+
}
|
|
1080
|
+
async getRaw(requestParameters, initOverrides) {
|
|
1081
|
+
if (requestParameters["organizationId"] == null) {
|
|
1082
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling get().');
|
|
1083
|
+
}
|
|
1084
|
+
const queryParameters = {};
|
|
1085
|
+
const headerParameters = {};
|
|
1086
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1087
|
+
const token = this.configuration.accessToken;
|
|
1088
|
+
const tokenString = await token("bearerAuth", []);
|
|
1089
|
+
if (tokenString) {
|
|
1090
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
let urlPath = `/api/organization/{organizationId}/ipRangeStatus`;
|
|
1094
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1095
|
+
const response = await this.request({
|
|
1096
|
+
path: urlPath,
|
|
1097
|
+
method: "GET",
|
|
1098
|
+
headers: headerParameters,
|
|
1099
|
+
query: queryParameters
|
|
1100
|
+
}, initOverrides);
|
|
1101
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpRangeConfigurationDtoFromJSON(jsonValue));
|
|
1102
|
+
}
|
|
1103
|
+
async get(requestParameters, initOverrides) {
|
|
1104
|
+
const response = await this.getRaw(requestParameters, initOverrides);
|
|
1105
|
+
return await response.value();
|
|
1106
|
+
}
|
|
1107
|
+
async get_3Raw(requestParameters, initOverrides) {
|
|
1108
|
+
if (requestParameters["organizationId"] == null) {
|
|
1109
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling get_3().');
|
|
1110
|
+
}
|
|
1111
|
+
const queryParameters = {};
|
|
1112
|
+
const headerParameters = {};
|
|
1113
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1114
|
+
const token = this.configuration.accessToken;
|
|
1115
|
+
const tokenString = await token("bearerAuth", []);
|
|
1116
|
+
if (tokenString) {
|
|
1117
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipRangeStatus`;
|
|
1121
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1122
|
+
const response = await this.request({
|
|
1123
|
+
path: urlPath,
|
|
1124
|
+
method: "GET",
|
|
1125
|
+
headers: headerParameters,
|
|
1126
|
+
query: queryParameters
|
|
1127
|
+
}, initOverrides);
|
|
1128
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesIpRangeConfigurationDtoFromJSON(jsonValue));
|
|
1129
|
+
}
|
|
1130
|
+
async get_3(requestParameters, initOverrides) {
|
|
1131
|
+
const response = await this.get_3Raw(requestParameters, initOverrides);
|
|
1132
|
+
return await response.value();
|
|
1133
|
+
}
|
|
1134
|
+
async updateRaw(requestParameters, initOverrides) {
|
|
1135
|
+
if (requestParameters["organizationId"] == null) {
|
|
1136
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling update().');
|
|
1137
|
+
}
|
|
1138
|
+
const queryParameters = {};
|
|
1139
|
+
const headerParameters = {};
|
|
1140
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
1141
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1142
|
+
const token = this.configuration.accessToken;
|
|
1143
|
+
const tokenString = await token("bearerAuth", []);
|
|
1144
|
+
if (tokenString) {
|
|
1145
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
let urlPath = `/api/organization/{organizationId}/ipRangeStatus`;
|
|
1149
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1150
|
+
const response = await this.request({
|
|
1151
|
+
path: urlPath,
|
|
1152
|
+
method: "PATCH",
|
|
1153
|
+
headers: headerParameters,
|
|
1154
|
+
query: queryParameters,
|
|
1155
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationStatusRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationStatusRequest"])
|
|
1156
|
+
}, initOverrides);
|
|
1157
|
+
return new VoidApiResponse(response);
|
|
1158
|
+
}
|
|
1159
|
+
async update(requestParameters, initOverrides) {
|
|
1160
|
+
await this.updateRaw(requestParameters, initOverrides);
|
|
1161
|
+
}
|
|
1162
|
+
async update_4Raw(requestParameters, initOverrides) {
|
|
1163
|
+
if (requestParameters["organizationId"] == null) {
|
|
1164
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling update_4().');
|
|
1165
|
+
}
|
|
1166
|
+
const queryParameters = {};
|
|
1167
|
+
const headerParameters = {};
|
|
1168
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
1169
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1170
|
+
const token = this.configuration.accessToken;
|
|
1171
|
+
const tokenString = await token("bearerAuth", []);
|
|
1172
|
+
if (tokenString) {
|
|
1173
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
let urlPath = `/api/accessPolicy/organization/{organizationId}/ipRangeStatus`;
|
|
1177
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1178
|
+
const response = await this.request({
|
|
1179
|
+
path: urlPath,
|
|
1180
|
+
method: "PATCH",
|
|
1181
|
+
headers: headerParameters,
|
|
1182
|
+
query: queryParameters,
|
|
1183
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationStatusRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationStatusRequest"])
|
|
1184
|
+
}, initOverrides);
|
|
1185
|
+
return new VoidApiResponse(response);
|
|
1186
|
+
}
|
|
1187
|
+
async update_4(requestParameters, initOverrides) {
|
|
1188
|
+
await this.update_4Raw(requestParameters, initOverrides);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
// ../apms-sdk/generated/src/apis/RegexBypassApi.ts
|
|
1193
|
+
class RegexBypassApi extends BaseAPI {
|
|
1194
|
+
async _deleteRaw(requestParameters, initOverrides) {
|
|
1195
|
+
if (requestParameters["organizationId"] == null) {
|
|
1196
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling _delete().');
|
|
1197
|
+
}
|
|
1198
|
+
if (requestParameters["regexBypassId"] == null) {
|
|
1199
|
+
throw new RequiredError("regexBypassId", 'Required parameter "regexBypassId" was null or undefined when calling _delete().');
|
|
1200
|
+
}
|
|
1201
|
+
const queryParameters = {};
|
|
1202
|
+
const headerParameters = {};
|
|
1203
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1204
|
+
const token = this.configuration.accessToken;
|
|
1205
|
+
const tokenString = await token("bearerAuth", []);
|
|
1206
|
+
if (tokenString) {
|
|
1207
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
let urlPath = `/api/organization/{organizationId}/regexBypass/{regexBypassId}`;
|
|
1211
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1212
|
+
urlPath = urlPath.replace(`{${"regexBypassId"}}`, encodeURIComponent(String(requestParameters["regexBypassId"])));
|
|
1213
|
+
const response = await this.request({
|
|
1214
|
+
path: urlPath,
|
|
1215
|
+
method: "DELETE",
|
|
1216
|
+
headers: headerParameters,
|
|
1217
|
+
query: queryParameters
|
|
1218
|
+
}, initOverrides);
|
|
1219
|
+
return new VoidApiResponse(response);
|
|
1220
|
+
}
|
|
1221
|
+
async _delete(requestParameters, initOverrides) {
|
|
1222
|
+
await this._deleteRaw(requestParameters, initOverrides);
|
|
1223
|
+
}
|
|
1224
|
+
async addRaw(requestParameters, initOverrides) {
|
|
1225
|
+
if (requestParameters["organizationId"] == null) {
|
|
1226
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling add().');
|
|
1227
|
+
}
|
|
1228
|
+
const queryParameters = {};
|
|
1229
|
+
const headerParameters = {};
|
|
1230
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
1231
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1232
|
+
const token = this.configuration.accessToken;
|
|
1233
|
+
const tokenString = await token("bearerAuth", []);
|
|
1234
|
+
if (tokenString) {
|
|
1235
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
let urlPath = `/api/organization/{organizationId}/regexBypass`;
|
|
1239
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1240
|
+
const response = await this.request({
|
|
1241
|
+
path: urlPath,
|
|
1242
|
+
method: "POST",
|
|
1243
|
+
headers: headerParameters,
|
|
1244
|
+
query: queryParameters,
|
|
1245
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddRegexBypassRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsAddRegexBypassRequest"])
|
|
1246
|
+
}, initOverrides);
|
|
1247
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesRegexBypassDtoFromJSON(jsonValue));
|
|
1248
|
+
}
|
|
1249
|
+
async add(requestParameters, initOverrides) {
|
|
1250
|
+
const response = await this.addRaw(requestParameters, initOverrides);
|
|
1251
|
+
return await response.value();
|
|
1252
|
+
}
|
|
1253
|
+
async getRaw(requestParameters, initOverrides) {
|
|
1254
|
+
if (requestParameters["organizationId"] == null) {
|
|
1255
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling get().');
|
|
1256
|
+
}
|
|
1257
|
+
if (requestParameters["regexBypassId"] == null) {
|
|
1258
|
+
throw new RequiredError("regexBypassId", 'Required parameter "regexBypassId" was null or undefined when calling get().');
|
|
1259
|
+
}
|
|
1260
|
+
const queryParameters = {};
|
|
1261
|
+
const headerParameters = {};
|
|
1262
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1263
|
+
const token = this.configuration.accessToken;
|
|
1264
|
+
const tokenString = await token("bearerAuth", []);
|
|
1265
|
+
if (tokenString) {
|
|
1266
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
let urlPath = `/api/organization/{organizationId}/regexBypass/{regexBypassId}`;
|
|
1270
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1271
|
+
urlPath = urlPath.replace(`{${"regexBypassId"}}`, encodeURIComponent(String(requestParameters["regexBypassId"])));
|
|
1272
|
+
const response = await this.request({
|
|
1273
|
+
path: urlPath,
|
|
1274
|
+
method: "GET",
|
|
1275
|
+
headers: headerParameters,
|
|
1276
|
+
query: queryParameters
|
|
1277
|
+
}, initOverrides);
|
|
1278
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesRegexBypassDtoFromJSON(jsonValue));
|
|
1279
|
+
}
|
|
1280
|
+
async get(requestParameters, initOverrides) {
|
|
1281
|
+
const response = await this.getRaw(requestParameters, initOverrides);
|
|
1282
|
+
return await response.value();
|
|
1283
|
+
}
|
|
1284
|
+
async getAllRaw(requestParameters, initOverrides) {
|
|
1285
|
+
if (requestParameters["organizationId"] == null) {
|
|
1286
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling getAll().');
|
|
1287
|
+
}
|
|
1288
|
+
const queryParameters = {};
|
|
1289
|
+
const headerParameters = {};
|
|
1290
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1291
|
+
const token = this.configuration.accessToken;
|
|
1292
|
+
const tokenString = await token("bearerAuth", []);
|
|
1293
|
+
if (tokenString) {
|
|
1294
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
let urlPath = `/api/organization/{organizationId}/regexBypass`;
|
|
1298
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1299
|
+
const response = await this.request({
|
|
1300
|
+
path: urlPath,
|
|
1301
|
+
method: "GET",
|
|
1302
|
+
headers: headerParameters,
|
|
1303
|
+
query: queryParameters
|
|
1304
|
+
}, initOverrides);
|
|
1305
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(UiPathPlatformServiceAccessPolicyManagementDomainResponsesRegexBypassDtoFromJSON));
|
|
1306
|
+
}
|
|
1307
|
+
async getAll(requestParameters, initOverrides) {
|
|
1308
|
+
const response = await this.getAllRaw(requestParameters, initOverrides);
|
|
1309
|
+
return await response.value();
|
|
1310
|
+
}
|
|
1311
|
+
async updateRaw(requestParameters, initOverrides) {
|
|
1312
|
+
if (requestParameters["organizationId"] == null) {
|
|
1313
|
+
throw new RequiredError("organizationId", 'Required parameter "organizationId" was null or undefined when calling update().');
|
|
1314
|
+
}
|
|
1315
|
+
if (requestParameters["regexBypassId"] == null) {
|
|
1316
|
+
throw new RequiredError("regexBypassId", 'Required parameter "regexBypassId" was null or undefined when calling update().');
|
|
1317
|
+
}
|
|
1318
|
+
const queryParameters = {};
|
|
1319
|
+
const headerParameters = {};
|
|
1320
|
+
headerParameters["Content-Type"] = "application/json-patch+json";
|
|
1321
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1322
|
+
const token = this.configuration.accessToken;
|
|
1323
|
+
const tokenString = await token("bearerAuth", []);
|
|
1324
|
+
if (tokenString) {
|
|
1325
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
let urlPath = `/api/organization/{organizationId}/regexBypass/{regexBypassId}`;
|
|
1329
|
+
urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters["organizationId"])));
|
|
1330
|
+
urlPath = urlPath.replace(`{${"regexBypassId"}}`, encodeURIComponent(String(requestParameters["regexBypassId"])));
|
|
1331
|
+
const response = await this.request({
|
|
1332
|
+
path: urlPath,
|
|
1333
|
+
method: "PATCH",
|
|
1334
|
+
headers: headerParameters,
|
|
1335
|
+
query: queryParameters,
|
|
1336
|
+
body: UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateRegexBypassRequestToJSON(requestParameters["uiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateRegexBypassRequest"])
|
|
1337
|
+
}, initOverrides);
|
|
1338
|
+
return new JSONApiResponse(response, (jsonValue) => UiPathPlatformServiceAccessPolicyManagementDomainResponsesRegexBypassDtoFromJSON(jsonValue));
|
|
1339
|
+
}
|
|
1340
|
+
async update(requestParameters, initOverrides) {
|
|
1341
|
+
const response = await this.updateRaw(requestParameters, initOverrides);
|
|
1342
|
+
return await response.value();
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
// ../apms-sdk/src/client-factory.ts
|
|
1346
|
+
var STRIP_PREFIX_RE = /\/accesspolicy_\/api\/(?:accessPolicy\/)?organization\/[^/]+/;
|
|
1347
|
+
function rewriteApmsUrl(url) {
|
|
1348
|
+
return url.replace(STRIP_PREFIX_RE, "/accesspolicy_");
|
|
1349
|
+
}
|
|
1350
|
+
async function resolveConfig(options) {
|
|
1351
|
+
const status = await getLoginStatusAsync({
|
|
1352
|
+
ensureTokenValidityMinutes: options?.loginValidity
|
|
1353
|
+
});
|
|
1354
|
+
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
1355
|
+
throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
|
|
1356
|
+
}
|
|
1357
|
+
if (!status.organizationId) {
|
|
1358
|
+
throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
|
|
1359
|
+
}
|
|
1360
|
+
const basePath = `${status.baseUrl}/${status.organizationId}/accesspolicy_`;
|
|
1361
|
+
const bearerToken = options?.s2sToken ?? status.accessToken;
|
|
1362
|
+
const fetchApi = (input, init) => {
|
|
1363
|
+
if (typeof input === "string") {
|
|
1364
|
+
return fetch(rewriteApmsUrl(input), init);
|
|
1365
|
+
}
|
|
1366
|
+
if (input instanceof URL) {
|
|
1367
|
+
return fetch(rewriteApmsUrl(input.toString()), init);
|
|
1368
|
+
}
|
|
1369
|
+
return fetch(new Request(rewriteApmsUrl(input.url), input), init);
|
|
1370
|
+
};
|
|
1371
|
+
return {
|
|
1372
|
+
config: new Configuration({
|
|
1373
|
+
basePath,
|
|
1374
|
+
accessToken: async () => bearerToken,
|
|
1375
|
+
headers: addSdkUserAgentHeader(undefined, SDK_USER_AGENT),
|
|
1376
|
+
fetchApi
|
|
1377
|
+
}),
|
|
1378
|
+
organizationId: status.organizationId
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
async function createApiClient(ApiClass, options) {
|
|
1382
|
+
const { config, organizationId } = await resolveConfig(options);
|
|
1383
|
+
return {
|
|
1384
|
+
api: new ApiClass(config),
|
|
1385
|
+
organizationId
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
// ../apms-tool/src/commands/_shared.ts
|
|
1389
|
+
var LOGIN_INSTRUCTIONS = "Ensure you are logged in with 'uip login' and have access to the Access Policy Management service.";
|
|
1390
|
+
var NON_NEGATIVE_INTEGER_RE = /^\d+$/;
|
|
1391
|
+
var parseIntOption = (raw) => {
|
|
1392
|
+
const trimmed = raw.trim();
|
|
1393
|
+
if (!NON_NEGATIVE_INTEGER_RE.test(trimmed)) {
|
|
1394
|
+
throw new Error(`Expected a non-negative integer, got '${raw}'.`);
|
|
1395
|
+
}
|
|
1396
|
+
const parsed = Number.parseInt(trimmed, 10);
|
|
1397
|
+
if (!Number.isFinite(parsed)) {
|
|
1398
|
+
throw new Error(`Expected a non-negative integer, got '${raw}'.`);
|
|
1399
|
+
}
|
|
1400
|
+
return parsed;
|
|
1401
|
+
};
|
|
1402
|
+
var withLoginValidity = (cmd) => {
|
|
1403
|
+
cmd.option("--login-validity <minutes>", "Override the interactive-login token lifetime for this call. Rarely needed.", parseIntOption);
|
|
1404
|
+
return cmd;
|
|
1405
|
+
};
|
|
1406
|
+
async function loadJsonFile(file, typeLabel) {
|
|
1407
|
+
const fs = getFileSystem();
|
|
1408
|
+
const [readErr, content] = await catchError(fs.readFile(file, "utf-8"));
|
|
1409
|
+
if (readErr || content === null) {
|
|
1410
|
+
return [
|
|
1411
|
+
{
|
|
1412
|
+
message: readErr?.message ?? `File not found: ${file}`,
|
|
1413
|
+
instructions: `Verify the file exists at '${file}' and is readable.`
|
|
1414
|
+
},
|
|
1415
|
+
null
|
|
1416
|
+
];
|
|
1417
|
+
}
|
|
1418
|
+
const [parseErr, parsed] = catchError(() => JSON.parse(content));
|
|
1419
|
+
if (parseErr) {
|
|
1420
|
+
return [
|
|
1421
|
+
{
|
|
1422
|
+
message: parseErr.message,
|
|
1423
|
+
instructions: `The file must be valid JSON conforming to ${typeLabel}.`
|
|
1424
|
+
},
|
|
1425
|
+
null
|
|
1426
|
+
];
|
|
1427
|
+
}
|
|
1428
|
+
return [null, parsed];
|
|
1429
|
+
}
|
|
1430
|
+
var emitLoadError = (err) => {
|
|
1431
|
+
OutputFormatter.error({
|
|
1432
|
+
Result: RESULTS.Failure,
|
|
1433
|
+
Message: err.message,
|
|
1434
|
+
Instructions: err.instructions
|
|
1435
|
+
});
|
|
1436
|
+
processContext.exit(1);
|
|
1437
|
+
};
|
|
1438
|
+
var emitFailure = async (error, instructions) => {
|
|
1439
|
+
OutputFormatter.error({
|
|
1440
|
+
Result: RESULTS.Failure,
|
|
1441
|
+
Message: await extractErrorMessage(error),
|
|
1442
|
+
Instructions: instructions
|
|
1443
|
+
});
|
|
1444
|
+
processContext.exit(1);
|
|
1445
|
+
};
|
|
1446
|
+
var GUID_RE = /^[0-9a-fA-F-]{36}$/;
|
|
1447
|
+
async function extractResponseData(response) {
|
|
1448
|
+
const [readErr, text] = await catchError(response.raw.clone().text());
|
|
1449
|
+
if (readErr || !text)
|
|
1450
|
+
return;
|
|
1451
|
+
const [, parsed] = catchError(() => JSON.parse(text));
|
|
1452
|
+
if (typeof parsed === "string" && GUID_RE.test(parsed)) {
|
|
1453
|
+
return { operationId: parsed };
|
|
1454
|
+
}
|
|
1455
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1456
|
+
return parsed;
|
|
1457
|
+
}
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
async function fetchCurrentIp(loginValidity) {
|
|
1461
|
+
const status = await getLoginStatusAsync({
|
|
1462
|
+
ensureTokenValidityMinutes: loginValidity
|
|
1463
|
+
});
|
|
1464
|
+
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken || !status.organizationId) {
|
|
1465
|
+
throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
|
|
1466
|
+
}
|
|
1467
|
+
const url = `${status.baseUrl}/${status.organizationId}/portal_/api/accesspolicy/ip`;
|
|
1468
|
+
const res = await fetch(url, {
|
|
1469
|
+
method: "GET",
|
|
1470
|
+
headers: { Authorization: `Bearer ${status.accessToken}` }
|
|
1471
|
+
});
|
|
1472
|
+
const text = (await res.text()).trim();
|
|
1473
|
+
if (!res.ok) {
|
|
1474
|
+
throw new Error(`HTTP ${res.status}${res.statusText ? ` ${res.statusText}` : ""}${text ? `: ${text}` : ""}`);
|
|
1475
|
+
}
|
|
1476
|
+
if (isIPv4(text)) {
|
|
1477
|
+
return { body: { ipAddress: text }, ip: text };
|
|
1478
|
+
}
|
|
1479
|
+
const [, parsed] = catchError(() => JSON.parse(text));
|
|
1480
|
+
if (typeof parsed === "string" && isIPv4(parsed)) {
|
|
1481
|
+
return { body: { ipAddress: parsed }, ip: parsed };
|
|
1482
|
+
}
|
|
1483
|
+
const body = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
1484
|
+
const candidate = body.ipAddress ?? body.ip ?? body.clientIp ?? body.publicIp;
|
|
1485
|
+
const ip = typeof candidate === "string" ? candidate : undefined;
|
|
1486
|
+
return { body, ip };
|
|
1487
|
+
}
|
|
1488
|
+
var IPV4_SEGMENT = "(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])";
|
|
1489
|
+
var IPV4_REGEX = new RegExp(`^(?:${IPV4_SEGMENT}\\.){3}${IPV4_SEGMENT}$`);
|
|
1490
|
+
function isIPv4(value) {
|
|
1491
|
+
return typeof value === "string" && IPV4_REGEX.test(value);
|
|
1492
|
+
}
|
|
1493
|
+
function ipInCidr(ip, cidr) {
|
|
1494
|
+
if (!isIPv4(ip))
|
|
1495
|
+
return false;
|
|
1496
|
+
const [network, prefixRaw] = cidr.split("/");
|
|
1497
|
+
if (!isIPv4(network))
|
|
1498
|
+
return false;
|
|
1499
|
+
const prefix = prefixRaw === undefined ? 32 : Number(prefixRaw);
|
|
1500
|
+
if (!Number.isInteger(prefix) || prefix < 0 || prefix > 32 || Number.isNaN(prefix)) {
|
|
1501
|
+
return false;
|
|
1502
|
+
}
|
|
1503
|
+
const toInt = (addr) => {
|
|
1504
|
+
const octets = addr.split(".").map(Number);
|
|
1505
|
+
return (octets[0] << 24 | octets[1] << 16 | octets[2] << 8 | octets[3]) >>> 0;
|
|
1506
|
+
};
|
|
1507
|
+
const mask = prefix === 0 ? 0 : ~0 << 32 - prefix >>> 0;
|
|
1508
|
+
return (toInt(ip) & mask) === (toInt(network) & mask);
|
|
1509
|
+
}
|
|
1510
|
+
var MINUTES_PER = {
|
|
1511
|
+
m: 1,
|
|
1512
|
+
h: 60,
|
|
1513
|
+
d: 60 * 24,
|
|
1514
|
+
w: 60 * 24 * 7
|
|
1515
|
+
};
|
|
1516
|
+
var MAX_EXPIRES_MINUTES = 60 * 24 * 365 * 10;
|
|
1517
|
+
function parseExpiresMinutes(input) {
|
|
1518
|
+
const trimmed = input.trim();
|
|
1519
|
+
const match = trimmed.match(/^(\d+)([mhdw])$/);
|
|
1520
|
+
if (!match) {
|
|
1521
|
+
throw new Error(`Expected --expires in the form <integer><m|h|d|w> (e.g. 15m, 2h, 30d, 1w), got '${input}'.`);
|
|
1522
|
+
}
|
|
1523
|
+
const n = Number.parseInt(match[1], 10);
|
|
1524
|
+
const minutes = n * MINUTES_PER[match[2]];
|
|
1525
|
+
if (minutes < 1) {
|
|
1526
|
+
throw new Error(`--expires must be at least 1 minute, got '${input}'.`);
|
|
1527
|
+
}
|
|
1528
|
+
if (minutes > MAX_EXPIRES_MINUTES) {
|
|
1529
|
+
throw new Error(`--expires must be at most 10 years (= ${MAX_EXPIRES_MINUTES} minutes), got '${input}'.`);
|
|
1530
|
+
}
|
|
1531
|
+
return minutes;
|
|
1532
|
+
}
|
|
1533
|
+
function findEntryIdByCidr(entries, cidr) {
|
|
1534
|
+
const matches = entries.filter((e) => e.ipNetwork === cidr);
|
|
1535
|
+
if (matches.length === 0)
|
|
1536
|
+
return { error: "none" };
|
|
1537
|
+
if (matches.length > 1)
|
|
1538
|
+
return { error: "ambiguous" };
|
|
1539
|
+
const id = matches[0].id;
|
|
1540
|
+
if (typeof id !== "string" || id.length === 0)
|
|
1541
|
+
return { error: "none" };
|
|
1542
|
+
return { id };
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
// ../apms-tool/src/commands/bypass-rules.ts
|
|
1546
|
+
async function getApi(options) {
|
|
1547
|
+
const [err, client] = await catchError(createApiClient(RegexBypassApi, {
|
|
1548
|
+
loginValidity: options.loginValidity
|
|
1549
|
+
}));
|
|
1550
|
+
if (err) {
|
|
1551
|
+
await emitFailure(err, LOGIN_INSTRUCTIONS);
|
|
1552
|
+
return null;
|
|
1553
|
+
}
|
|
1554
|
+
return client;
|
|
1555
|
+
}
|
|
1556
|
+
var SAMPLE_ID = "b1c2d3e4-0000-0000-0000-000000000001";
|
|
1557
|
+
var LIST_EXAMPLES = [
|
|
1558
|
+
{
|
|
1559
|
+
Description: "List all bypass rules for the organization",
|
|
1560
|
+
Command: "uip admin ip-restriction bypass-rules list",
|
|
1561
|
+
Output: {
|
|
1562
|
+
Code: "ApmsBypassRulesList",
|
|
1563
|
+
Data: [{ id: SAMPLE_ID, regexEntry: "^.*\\.contoso\\.com$" }]
|
|
1564
|
+
}
|
|
1565
|
+
},
|
|
1566
|
+
{
|
|
1567
|
+
Description: "List rules whose regexEntry or appName contains a fragment (case-insensitive)",
|
|
1568
|
+
Command: "uip admin ip-restriction bypass-rules list --filter contoso",
|
|
1569
|
+
Output: {
|
|
1570
|
+
Code: "ApmsBypassRulesList",
|
|
1571
|
+
Data: [{ id: SAMPLE_ID, regexEntry: "^.*\\.contoso\\.com$" }]
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
];
|
|
1575
|
+
var GET_EXAMPLES = [
|
|
1576
|
+
{
|
|
1577
|
+
Description: "Fetch a single bypass rule by id",
|
|
1578
|
+
Command: `uip admin ip-restriction bypass-rules get ${SAMPLE_ID}`,
|
|
1579
|
+
Output: {
|
|
1580
|
+
Code: "ApmsBypassRulesGet",
|
|
1581
|
+
Data: { id: SAMPLE_ID, regexEntry: "^.*\\.contoso\\.com$" }
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
];
|
|
1585
|
+
var CREATE_EXAMPLES = [
|
|
1586
|
+
{
|
|
1587
|
+
Description: "Create a new bypass rule from a JSON file",
|
|
1588
|
+
Command: "uip admin ip-restriction bypass-rules create --file ./bypass-rule.json",
|
|
1589
|
+
Output: {
|
|
1590
|
+
Code: "ApmsBypassRulesCreated",
|
|
1591
|
+
Data: { id: SAMPLE_ID, regexEntry: "^.*\\.contoso\\.com$" }
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
];
|
|
1595
|
+
var UPDATE_EXAMPLES = [
|
|
1596
|
+
{
|
|
1597
|
+
Description: "Patch an existing bypass rule by id",
|
|
1598
|
+
Command: `uip admin ip-restriction bypass-rules update ${SAMPLE_ID} --file ./bypass-rule-update.json`,
|
|
1599
|
+
Output: {
|
|
1600
|
+
Code: "ApmsBypassRulesUpdated",
|
|
1601
|
+
Data: { id: SAMPLE_ID, regexEntry: "^.*\\.contoso\\.com$" }
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
];
|
|
1605
|
+
var DELETE_EXAMPLES = [
|
|
1606
|
+
{
|
|
1607
|
+
Description: "Delete a bypass rule by id",
|
|
1608
|
+
Command: `uip admin ip-restriction bypass-rules delete ${SAMPLE_ID}`,
|
|
1609
|
+
Output: { Code: "ApmsBypassRulesDeleted", Data: {} }
|
|
1610
|
+
}
|
|
1611
|
+
];
|
|
1612
|
+
var registerBypassRulesCommands = (apms) => {
|
|
1613
|
+
const bypassRules = apms.command("bypass-rules").description([
|
|
1614
|
+
"Manage bypass rules that exempt specific URL patterns from IP allowlisting.",
|
|
1615
|
+
"",
|
|
1616
|
+
"Use this when an org has IP allowlisting on but needs a narrowly-scoped",
|
|
1617
|
+
"exception for a specific App / folder / tenant URL pattern. Each rule's",
|
|
1618
|
+
"regex pattern is generated server-side from the supplied entry."
|
|
1619
|
+
].join(`
|
|
1620
|
+
`));
|
|
1621
|
+
withLoginValidity(bypassRules.command("list").description([
|
|
1622
|
+
"List bypass rules configured for the caller's organization.",
|
|
1623
|
+
"",
|
|
1624
|
+
"Pass `--filter <fragment>` to narrow client-side; matches are",
|
|
1625
|
+
"case-insensitive substrings on either `regexEntry` or `appName`."
|
|
1626
|
+
].join(`
|
|
1627
|
+
`)).option("--filter <fragment>", "Case-insensitive substring filter on regexEntry or appName.").examples(LIST_EXAMPLES)).trackedAction(processContext, async (options) => {
|
|
1628
|
+
const client = await getApi(options);
|
|
1629
|
+
if (!client)
|
|
1630
|
+
return;
|
|
1631
|
+
const [error, result] = await catchError(client.api.getAll({ organizationId: client.organizationId }));
|
|
1632
|
+
if (error) {
|
|
1633
|
+
await emitFailure(error, LOGIN_INSTRUCTIONS);
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
const rules = result ?? [];
|
|
1637
|
+
const filterFragment = options.filter?.toLowerCase();
|
|
1638
|
+
const filtered = filterFragment !== undefined ? rules.filter((r) => {
|
|
1639
|
+
const haystack = `${r.regexEntry ?? ""} ${r.appName ?? ""}`.toLowerCase();
|
|
1640
|
+
return haystack.includes(filterFragment);
|
|
1641
|
+
}) : rules;
|
|
1642
|
+
OutputFormatter.success({
|
|
1643
|
+
Result: RESULTS.Success,
|
|
1644
|
+
Code: "ApmsBypassRulesList",
|
|
1645
|
+
Data: filtered
|
|
1646
|
+
});
|
|
1647
|
+
});
|
|
1648
|
+
withLoginValidity(bypassRules.command("get").description("Fetch a single bypass rule by id within the caller's organization.").argument("<id>", "Bypass rule UUID. Obtain from `bypass-rules list`.").examples(GET_EXAMPLES)).trackedAction(processContext, async (id, options) => {
|
|
1649
|
+
const client = await getApi(options);
|
|
1650
|
+
if (!client)
|
|
1651
|
+
return;
|
|
1652
|
+
const [error, result] = await catchError(client.api.get({
|
|
1653
|
+
regexBypassId: id,
|
|
1654
|
+
organizationId: client.organizationId
|
|
1655
|
+
}));
|
|
1656
|
+
if (error) {
|
|
1657
|
+
await emitFailure(error, "Check the bypass rule UUID with 'uip admin ip-restriction bypass-rules list'.");
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
OutputFormatter.success({
|
|
1661
|
+
Result: RESULTS.Success,
|
|
1662
|
+
Code: "ApmsBypassRulesGet",
|
|
1663
|
+
Data: result
|
|
1664
|
+
});
|
|
1665
|
+
});
|
|
1666
|
+
withLoginValidity(bypassRules.command("create").description("Create a new bypass rule from a JSON file (AddRegexBypassRequest schema).").requiredOption("--file <path>", "Path to a JSON file containing the AddRegexBypassRequest body.").examples(CREATE_EXAMPLES)).trackedAction(processContext, async (options) => {
|
|
1667
|
+
const client = await getApi(options);
|
|
1668
|
+
if (!client)
|
|
1669
|
+
return;
|
|
1670
|
+
const [loadErr, body] = await loadJsonFile(options.file, "AddRegexBypassRequest");
|
|
1671
|
+
if (loadErr) {
|
|
1672
|
+
emitLoadError(loadErr);
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
const [error, result] = await catchError(client.api.add({
|
|
1676
|
+
organizationId: client.organizationId,
|
|
1677
|
+
uiPathPlatformServiceAccessPolicyManagementDomainRequestsAddRegexBypassRequest: body
|
|
1678
|
+
}));
|
|
1679
|
+
if (error) {
|
|
1680
|
+
await emitFailure(error, "Verify --file is valid JSON conforming to AddRegexBypassRequest.");
|
|
1681
|
+
return;
|
|
1682
|
+
}
|
|
1683
|
+
OutputFormatter.success({
|
|
1684
|
+
Result: RESULTS.Success,
|
|
1685
|
+
Code: "ApmsBypassRulesCreated",
|
|
1686
|
+
Data: result
|
|
1687
|
+
});
|
|
1688
|
+
});
|
|
1689
|
+
withLoginValidity(bypassRules.command("update").description([
|
|
1690
|
+
"Patch an existing bypass rule by id. The supplied regexEntry replaces",
|
|
1691
|
+
"the stored pattern.",
|
|
1692
|
+
"",
|
|
1693
|
+
"For the typical case, pass `--regex-entry <pattern>` inline. For the",
|
|
1694
|
+
"rarer case where you want to update tenant/app metadata too, pass",
|
|
1695
|
+
"`--file <path>` with the full UpdateRegexBypassRequest body."
|
|
1696
|
+
].join(`
|
|
1697
|
+
`)).argument("<id>", "Bypass rule UUID. Obtain from `bypass-rules list`.").option("--file <path>", "Path to a JSON file containing the UpdateRegexBypassRequest body.").option("--regex-entry <pattern>", "Replacement regex pattern (the only required field on update).").examples(UPDATE_EXAMPLES)).trackedAction(processContext, async (id, options) => {
|
|
1698
|
+
const inlineProvided = options.regexEntry !== undefined;
|
|
1699
|
+
if (options.file !== undefined && inlineProvided) {
|
|
1700
|
+
OutputFormatter.error({
|
|
1701
|
+
Result: RESULTS.Failure,
|
|
1702
|
+
Message: "--file is mutually exclusive with --regex-entry.",
|
|
1703
|
+
Instructions: "Pass either --file for the full body, or --regex-entry for the pattern-only update."
|
|
1704
|
+
});
|
|
1705
|
+
processContext.exit(1);
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
if (options.file === undefined && !inlineProvided) {
|
|
1709
|
+
OutputFormatter.error({
|
|
1710
|
+
Result: RESULTS.Failure,
|
|
1711
|
+
Message: "Provide either --file or --regex-entry.",
|
|
1712
|
+
Instructions: "Inline: --regex-entry <pattern>. File: --file <path> with an UpdateRegexBypassRequest body."
|
|
1713
|
+
});
|
|
1714
|
+
processContext.exit(1);
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1717
|
+
let body;
|
|
1718
|
+
if (options.file !== undefined) {
|
|
1719
|
+
const [loadErr, loaded] = await loadJsonFile(options.file, "UpdateRegexBypassRequest");
|
|
1720
|
+
if (loadErr) {
|
|
1721
|
+
emitLoadError(loadErr);
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
body = loaded;
|
|
1725
|
+
} else {
|
|
1726
|
+
body = { regexEntry: options.regexEntry };
|
|
1727
|
+
}
|
|
1728
|
+
const client = await getApi(options);
|
|
1729
|
+
if (!client)
|
|
1730
|
+
return;
|
|
1731
|
+
const [error, result] = await catchError(client.api.update({
|
|
1732
|
+
regexBypassId: id,
|
|
1733
|
+
organizationId: client.organizationId,
|
|
1734
|
+
uiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateRegexBypassRequest: body
|
|
1735
|
+
}));
|
|
1736
|
+
if (error) {
|
|
1737
|
+
await emitFailure(error, "Verify the rule UUID and that the request matches the UpdateRegexBypassRequest schema.");
|
|
1738
|
+
return;
|
|
1739
|
+
}
|
|
1740
|
+
OutputFormatter.success({
|
|
1741
|
+
Result: RESULTS.Success,
|
|
1742
|
+
Code: "ApmsBypassRulesUpdated",
|
|
1743
|
+
Data: result
|
|
1744
|
+
});
|
|
1745
|
+
});
|
|
1746
|
+
withLoginValidity(bypassRules.command("delete").description("Delete a bypass rule by id within the caller's organization.").argument("<id>", "Bypass rule UUID. Obtain from `bypass-rules list`.").examples(DELETE_EXAMPLES)).trackedAction(processContext, async (id, options) => {
|
|
1747
|
+
const client = await getApi(options);
|
|
1748
|
+
if (!client)
|
|
1749
|
+
return;
|
|
1750
|
+
const [error, response] = await catchError(client.api._deleteRaw({
|
|
1751
|
+
regexBypassId: id,
|
|
1752
|
+
organizationId: client.organizationId
|
|
1753
|
+
}));
|
|
1754
|
+
if (error || !response) {
|
|
1755
|
+
await emitFailure(error ?? new Error("Empty response"), "Check the bypass rule UUID with 'uip admin ip-restriction bypass-rules list'.");
|
|
1756
|
+
return;
|
|
1757
|
+
}
|
|
1758
|
+
const responseBody = await extractResponseData(response);
|
|
1759
|
+
OutputFormatter.success({
|
|
1760
|
+
Result: RESULTS.Success,
|
|
1761
|
+
Code: "ApmsBypassRulesDeleted",
|
|
1762
|
+
Data: responseBody ?? {}
|
|
1763
|
+
});
|
|
1764
|
+
});
|
|
1765
|
+
};
|
|
1766
|
+
|
|
1767
|
+
// ../apms-tool/src/commands/enforcement.ts
|
|
1768
|
+
var ENABLE_WARNING = "You are attempting to enforce IP restriction. Once it is enforced, this organization can not be accessed from any untrusted IP address that belongs to a user or robot.";
|
|
1769
|
+
var PREFLIGHT_REJECT_MESSAGE = "Your IP address must be within the trusted IP ranges before you enforce IP restrictions. Please add your IP address and try again.";
|
|
1770
|
+
var GET_EXAMPLES2 = [
|
|
1771
|
+
{
|
|
1772
|
+
Description: "Fetch the current IP-range enforcement state for the organization",
|
|
1773
|
+
Command: "uip admin ip-restriction enforcement get",
|
|
1774
|
+
Output: {
|
|
1775
|
+
Code: "ApmsEnforcementGet",
|
|
1776
|
+
Data: { organizationId: "<org-guid>" }
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
];
|
|
1780
|
+
var ENABLE_EXAMPLES = [
|
|
1781
|
+
{
|
|
1782
|
+
Description: "Turn on IP-range enforcement. The CLI first calls `my-ip` and `ip-ranges list` to confirm your IP is in the allowlist, then patches the status. `--confirm` is mandatory because the wrong allowlist locks you out instantly.",
|
|
1783
|
+
Command: "uip admin ip-restriction enforcement enable --confirm",
|
|
1784
|
+
Output: { Code: "ApmsEnforcementEnabled", Data: {} }
|
|
1785
|
+
}
|
|
1786
|
+
];
|
|
1787
|
+
var DISABLE_EXAMPLES = [
|
|
1788
|
+
{
|
|
1789
|
+
Description: "Turn off IP-range enforcement (idempotent).",
|
|
1790
|
+
Command: "uip admin ip-restriction enforcement disable",
|
|
1791
|
+
Output: { Code: "ApmsEnforcementDisabled", Data: {} }
|
|
1792
|
+
}
|
|
1793
|
+
];
|
|
1794
|
+
async function getStatusApi(options) {
|
|
1795
|
+
const [err, client] = await catchError(createApiClient(IpRangeConfigurationStatusApi, {
|
|
1796
|
+
loginValidity: options.loginValidity
|
|
1797
|
+
}));
|
|
1798
|
+
if (err) {
|
|
1799
|
+
await emitFailure(err, LOGIN_INSTRUCTIONS);
|
|
1800
|
+
return null;
|
|
1801
|
+
}
|
|
1802
|
+
return client;
|
|
1803
|
+
}
|
|
1804
|
+
async function getNetworksApi(options) {
|
|
1805
|
+
const [err, client] = await catchError(createApiClient(IpNetworkConfigurationApi, {
|
|
1806
|
+
loginValidity: options.loginValidity
|
|
1807
|
+
}));
|
|
1808
|
+
if (err) {
|
|
1809
|
+
await emitFailure(err, LOGIN_INSTRUCTIONS);
|
|
1810
|
+
return null;
|
|
1811
|
+
}
|
|
1812
|
+
return client;
|
|
1813
|
+
}
|
|
1814
|
+
async function setEnforcement(api, organizationId, status) {
|
|
1815
|
+
const [updateErr, updateRes] = await catchError(api.updateRaw({
|
|
1816
|
+
organizationId,
|
|
1817
|
+
uiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationStatusRequest: {
|
|
1818
|
+
status
|
|
1819
|
+
}
|
|
1820
|
+
}));
|
|
1821
|
+
if (!updateErr && updateRes) {
|
|
1822
|
+
return { body: await extractResponseData(updateRes), error: null };
|
|
1823
|
+
}
|
|
1824
|
+
const status404 = (updateErr?.status ?? 0) === 404 || (updateErr?.response?.status ?? 0) === 404;
|
|
1825
|
+
if (!status404) {
|
|
1826
|
+
return { body: undefined, error: updateErr };
|
|
1827
|
+
}
|
|
1828
|
+
const [addErr, addRes] = await catchError(api.addRaw({
|
|
1829
|
+
organizationId,
|
|
1830
|
+
uiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationStatusRequest: {
|
|
1831
|
+
status
|
|
1832
|
+
}
|
|
1833
|
+
}));
|
|
1834
|
+
if (addErr || !addRes) {
|
|
1835
|
+
return {
|
|
1836
|
+
body: undefined,
|
|
1837
|
+
error: addErr ?? new Error("Empty response")
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
return { body: await extractResponseData(addRes), error: null };
|
|
1841
|
+
}
|
|
1842
|
+
var registerEnforcementCommands = (apms) => {
|
|
1843
|
+
const enforcement = apms.command("enforcement").description([
|
|
1844
|
+
"Manage the singleton IP-range enforcement switch for the organization.",
|
|
1845
|
+
"",
|
|
1846
|
+
"When enforcement is on, only the IP networks in `ip-ranges list`",
|
|
1847
|
+
"can reach this org. When off, the platform default applies."
|
|
1848
|
+
].join(`
|
|
1849
|
+
`));
|
|
1850
|
+
withLoginValidity(enforcement.command("get").description("Show the current IP-range enforcement state for the caller's organization.").examples(GET_EXAMPLES2)).trackedAction(processContext, async (options) => {
|
|
1851
|
+
const client = await getStatusApi(options);
|
|
1852
|
+
if (!client)
|
|
1853
|
+
return;
|
|
1854
|
+
const [error, response] = await catchError(client.api.getRaw({ organizationId: client.organizationId }));
|
|
1855
|
+
if (error || !response) {
|
|
1856
|
+
await emitFailure(error ?? new Error("Empty response"), LOGIN_INSTRUCTIONS);
|
|
1857
|
+
return;
|
|
1858
|
+
}
|
|
1859
|
+
const responseBody = await extractResponseData(response);
|
|
1860
|
+
OutputFormatter.success({
|
|
1861
|
+
Result: RESULTS.Success,
|
|
1862
|
+
Code: "ApmsEnforcementGet",
|
|
1863
|
+
Data: responseBody ?? {}
|
|
1864
|
+
});
|
|
1865
|
+
});
|
|
1866
|
+
withLoginValidity(enforcement.command("enable").description([
|
|
1867
|
+
"Enforce IP restrictions for the organization (idempotent).",
|
|
1868
|
+
"",
|
|
1869
|
+
"Pre-flight: the CLI calls `my-ip` and compares it against the",
|
|
1870
|
+
"CIDRs returned by `ip-ranges list`. If your IP isn't in any",
|
|
1871
|
+
"trusted entry the call is rejected before reaching the platform.",
|
|
1872
|
+
"",
|
|
1873
|
+
"**Lockout warning** — wrong allowlist + enabled enforcement",
|
|
1874
|
+
"= your org becomes unreachable from any address outside the",
|
|
1875
|
+
"list. `--confirm` is mandatory."
|
|
1876
|
+
].join(`
|
|
1877
|
+
`)).option("--confirm", "Acknowledge the lockout risk and proceed. Required.").examples(ENABLE_EXAMPLES)).trackedAction(processContext, async (options) => {
|
|
1878
|
+
if (options.confirm !== true) {
|
|
1879
|
+
OutputFormatter.log({ Warning: ENABLE_WARNING });
|
|
1880
|
+
OutputFormatter.error({
|
|
1881
|
+
Result: RESULTS.Failure,
|
|
1882
|
+
Message: "--confirm is required to enforce IP restrictions.",
|
|
1883
|
+
Instructions: "Re-run with --confirm to acknowledge the lockout risk and proceed."
|
|
1884
|
+
});
|
|
1885
|
+
processContext.exit(1);
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1888
|
+
const [ipErr, ipResult] = await catchError(fetchCurrentIp(options.loginValidity));
|
|
1889
|
+
if (ipErr || !ipResult) {
|
|
1890
|
+
await emitFailure(ipErr ?? new Error("Failed to determine current IP"), "Run `uip admin ip-restriction my-ip` to inspect the response from the IP discovery endpoint.");
|
|
1891
|
+
return;
|
|
1892
|
+
}
|
|
1893
|
+
const callerIp = ipResult.ip;
|
|
1894
|
+
if (!callerIp) {
|
|
1895
|
+
OutputFormatter.error({
|
|
1896
|
+
Result: RESULTS.Failure,
|
|
1897
|
+
Message: "Could not determine the caller's IP from the platform response.",
|
|
1898
|
+
Instructions: "The IP-discovery endpoint returned an unexpected shape. Inspect with `uip admin ip-restriction my-ip`."
|
|
1899
|
+
});
|
|
1900
|
+
processContext.exit(1);
|
|
1901
|
+
return;
|
|
1902
|
+
}
|
|
1903
|
+
const networksClient = await getNetworksApi(options);
|
|
1904
|
+
if (!networksClient)
|
|
1905
|
+
return;
|
|
1906
|
+
const [listErr, entries] = await catchError(networksClient.api.getByOrganizationId({
|
|
1907
|
+
organizationId: networksClient.organizationId
|
|
1908
|
+
}));
|
|
1909
|
+
if (listErr) {
|
|
1910
|
+
await emitFailure(listErr, LOGIN_INSTRUCTIONS);
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1913
|
+
const cidrs = (entries ?? []).map((e) => e.ipNetwork).filter((c) => typeof c === "string" && c.length > 0);
|
|
1914
|
+
const inRange = cidrs.some((cidr) => ipInCidr(callerIp, cidr));
|
|
1915
|
+
if (!inRange) {
|
|
1916
|
+
OutputFormatter.error({
|
|
1917
|
+
Result: RESULTS.Failure,
|
|
1918
|
+
Message: PREFLIGHT_REJECT_MESSAGE,
|
|
1919
|
+
Instructions: `Your current IP is ${callerIp}. Add it via 'uip admin ip-restriction ip-ranges create --name <label> --cidr ${callerIp}/32' (or a wider CIDR), then re-run.`
|
|
1920
|
+
});
|
|
1921
|
+
processContext.exit(1);
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
const statusClient = await getStatusApi(options);
|
|
1925
|
+
if (!statusClient)
|
|
1926
|
+
return;
|
|
1927
|
+
const { body, error } = await setEnforcement(statusClient.api, statusClient.organizationId, "Enabled");
|
|
1928
|
+
if (error) {
|
|
1929
|
+
await emitFailure(error, "Verify the request body conforms to UpdateIpConfigurationStatusRequest.");
|
|
1930
|
+
return;
|
|
1931
|
+
}
|
|
1932
|
+
OutputFormatter.success({
|
|
1933
|
+
Result: RESULTS.Success,
|
|
1934
|
+
Code: "ApmsEnforcementEnabled",
|
|
1935
|
+
Data: body ?? {}
|
|
1936
|
+
});
|
|
1937
|
+
});
|
|
1938
|
+
withLoginValidity(enforcement.command("disable").description([
|
|
1939
|
+
"Stop enforcing IP restrictions (idempotent).",
|
|
1940
|
+
"",
|
|
1941
|
+
"Patches the singleton status row to Disabled; lazily creates",
|
|
1942
|
+
"the row first if it doesn't exist yet."
|
|
1943
|
+
].join(`
|
|
1944
|
+
`)).examples(DISABLE_EXAMPLES)).trackedAction(processContext, async (options) => {
|
|
1945
|
+
const client = await getStatusApi(options);
|
|
1946
|
+
if (!client)
|
|
1947
|
+
return;
|
|
1948
|
+
const { body, error } = await setEnforcement(client.api, client.organizationId, "Disabled");
|
|
1949
|
+
if (error) {
|
|
1950
|
+
await emitFailure(error, "Verify the request body conforms to UpdateIpConfigurationStatusRequest.");
|
|
1951
|
+
return;
|
|
1952
|
+
}
|
|
1953
|
+
OutputFormatter.success({
|
|
1954
|
+
Result: RESULTS.Success,
|
|
1955
|
+
Code: "ApmsEnforcementDisabled",
|
|
1956
|
+
Data: body ?? {}
|
|
1957
|
+
});
|
|
1958
|
+
});
|
|
1959
|
+
};
|
|
1960
|
+
|
|
1961
|
+
// ../apms-tool/src/commands/ip-ranges.ts
|
|
1962
|
+
function hasCreateInline(options) {
|
|
1963
|
+
return options.name !== undefined || options.cidr !== undefined && options.cidr.length > 0 || options.startIp !== undefined || options.endIp !== undefined || options.expires !== undefined;
|
|
1964
|
+
}
|
|
1965
|
+
function hasUpdateInline(options) {
|
|
1966
|
+
return options.name !== undefined || options.startIp !== undefined || options.endIp !== undefined || options.cidr !== undefined;
|
|
1967
|
+
}
|
|
1968
|
+
async function getApi2(options) {
|
|
1969
|
+
const [err, client] = await catchError(createApiClient(IpNetworkConfigurationApi, {
|
|
1970
|
+
loginValidity: options.loginValidity
|
|
1971
|
+
}));
|
|
1972
|
+
if (err) {
|
|
1973
|
+
await emitFailure(err, LOGIN_INSTRUCTIONS);
|
|
1974
|
+
return null;
|
|
1975
|
+
}
|
|
1976
|
+
return client;
|
|
1977
|
+
}
|
|
1978
|
+
async function getStatusApi2(options) {
|
|
1979
|
+
const [err, client] = await catchError(createApiClient(IpRangeConfigurationStatusApi, {
|
|
1980
|
+
loginValidity: options.loginValidity
|
|
1981
|
+
}));
|
|
1982
|
+
if (err) {
|
|
1983
|
+
await emitFailure(err, LOGIN_INSTRUCTIONS);
|
|
1984
|
+
return null;
|
|
1985
|
+
}
|
|
1986
|
+
return client;
|
|
1987
|
+
}
|
|
1988
|
+
var SAMPLE_ID2 = "a1b2c3d4-0000-0000-0000-000000000001";
|
|
1989
|
+
var DELETE_WARNING = "You are about to delete an IP range entry. If enforcement is enabled, removing the wrong entry can lock you — or the whole organization — out of UiPath. Verify the target with `ip-ranges list` and `my-ip` before proceeding.";
|
|
1990
|
+
var LIST_EXAMPLES2 = [
|
|
1991
|
+
{
|
|
1992
|
+
Description: "List all IP range entries for the current organization",
|
|
1993
|
+
Command: "uip admin ip-restriction ip-ranges list",
|
|
1994
|
+
Output: {
|
|
1995
|
+
Code: "ApmsIpRangesList",
|
|
1996
|
+
Data: [
|
|
1997
|
+
{
|
|
1998
|
+
id: SAMPLE_ID2,
|
|
1999
|
+
name: "Office VPN",
|
|
2000
|
+
ipNetwork: "10.0.0.0/16"
|
|
2001
|
+
}
|
|
2002
|
+
]
|
|
2003
|
+
}
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
Description: "List entries whose name contains a fragment (case-insensitive)",
|
|
2007
|
+
Command: "uip admin ip-restriction ip-ranges list --filter office",
|
|
2008
|
+
Output: { Code: "ApmsIpRangesList", Data: [] }
|
|
2009
|
+
}
|
|
2010
|
+
];
|
|
2011
|
+
var GET_EXAMPLES3 = [
|
|
2012
|
+
{
|
|
2013
|
+
Description: "Fetch a single IP range entry by id",
|
|
2014
|
+
Command: `uip admin ip-restriction ip-ranges get ${SAMPLE_ID2}`,
|
|
2015
|
+
Output: {
|
|
2016
|
+
Code: "ApmsIpRangeGet",
|
|
2017
|
+
Data: {
|
|
2018
|
+
id: SAMPLE_ID2,
|
|
2019
|
+
name: "Office VPN",
|
|
2020
|
+
ipNetwork: "10.0.0.0/16"
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
Description: "Fetch by CIDR (no need to look up the GUID first)",
|
|
2026
|
+
Command: "uip admin ip-restriction ip-ranges get --cidr 10.0.0.0/16",
|
|
2027
|
+
Output: {
|
|
2028
|
+
Code: "ApmsIpRangeGet",
|
|
2029
|
+
Data: {
|
|
2030
|
+
id: SAMPLE_ID2,
|
|
2031
|
+
name: "Office VPN",
|
|
2032
|
+
ipNetwork: "10.0.0.0/16"
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
];
|
|
2037
|
+
var CREATE_EXAMPLES2 = [
|
|
2038
|
+
{
|
|
2039
|
+
Description: "Add a CIDR entry inline. Idempotent — second call with the same --cidr is a safe no-op.",
|
|
2040
|
+
Command: "uip admin ip-restriction ip-ranges create --name 'Office VPN' --cidr 10.0.0.0/16",
|
|
2041
|
+
Output: {
|
|
2042
|
+
Code: "ApmsIpRangeCreated",
|
|
2043
|
+
Data: [{ id: SAMPLE_ID2, name: "Office VPN" }]
|
|
2044
|
+
}
|
|
2045
|
+
},
|
|
2046
|
+
{
|
|
2047
|
+
Description: "Add multiple CIDRs at once and set an expiry of 30 days",
|
|
2048
|
+
Command: "uip admin ip-restriction ip-ranges create --name 'Datacenter A' --cidr 10.0.0.0/16 --cidr 192.168.0.0/24 --expires 30d",
|
|
2049
|
+
Output: { Code: "ApmsIpRangeCreated", Data: [] }
|
|
2050
|
+
},
|
|
2051
|
+
{
|
|
2052
|
+
Description: "Add an entry as a start/end IP range (legacy shape; still supported)",
|
|
2053
|
+
Command: "uip admin ip-restriction ip-ranges create --name 'Office' --start-ip 10.0.0.1 --end-ip 10.0.0.50",
|
|
2054
|
+
Output: { Code: "ApmsIpRangeCreated", Data: [] }
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
Description: "Full body control via JSON file",
|
|
2058
|
+
Command: "uip admin ip-restriction ip-ranges create --file ./entry.json",
|
|
2059
|
+
Output: { Code: "ApmsIpRangeCreated", Data: [] }
|
|
2060
|
+
}
|
|
2061
|
+
];
|
|
2062
|
+
var UPDATE_EXAMPLES2 = [
|
|
2063
|
+
{
|
|
2064
|
+
Description: "Rename an entry",
|
|
2065
|
+
Command: `uip admin ip-restriction ip-ranges update ${SAMPLE_ID2} --name 'Home VPN'`,
|
|
2066
|
+
Output: {
|
|
2067
|
+
Code: "ApmsIpRangeUpdated",
|
|
2068
|
+
Data: { id: SAMPLE_ID2, name: "Home VPN" }
|
|
2069
|
+
}
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
Description: "Replace the CIDR on an existing entry",
|
|
2073
|
+
Command: `uip admin ip-restriction ip-ranges update ${SAMPLE_ID2} --cidr 10.0.1.0/24`,
|
|
2074
|
+
Output: { Code: "ApmsIpRangeUpdated", Data: { id: SAMPLE_ID2 } }
|
|
2075
|
+
}
|
|
2076
|
+
];
|
|
2077
|
+
var DELETE_EXAMPLES2 = [
|
|
2078
|
+
{
|
|
2079
|
+
Description: "Delete by id (--confirm acknowledges the lockout risk)",
|
|
2080
|
+
Command: `uip admin ip-restriction ip-ranges delete ${SAMPLE_ID2} --confirm`,
|
|
2081
|
+
Output: { Code: "ApmsIpRangeDeleted", Data: {} }
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
Description: "Delete by CIDR (lookup-then-delete)",
|
|
2085
|
+
Command: "uip admin ip-restriction ip-ranges delete --cidr 10.0.0.0/16 --confirm",
|
|
2086
|
+
Output: { Code: "ApmsIpRangeDeleted", Data: {} }
|
|
2087
|
+
}
|
|
2088
|
+
];
|
|
2089
|
+
async function resolveEntryId(api, organizationId, positionalId, cidr) {
|
|
2090
|
+
if (positionalId !== undefined && cidr !== undefined) {
|
|
2091
|
+
OutputFormatter.error({
|
|
2092
|
+
Result: RESULTS.Failure,
|
|
2093
|
+
Message: "Pass either the positional id OR --cidr, not both.",
|
|
2094
|
+
Instructions: "Use the positional UUID or the --cidr <cidr> flag to identify the entry."
|
|
2095
|
+
});
|
|
2096
|
+
processContext.exit(1);
|
|
2097
|
+
return null;
|
|
2098
|
+
}
|
|
2099
|
+
if (positionalId === undefined && cidr === undefined) {
|
|
2100
|
+
OutputFormatter.error({
|
|
2101
|
+
Result: RESULTS.Failure,
|
|
2102
|
+
Message: "Provide an id positionally or --cidr <cidr>.",
|
|
2103
|
+
Instructions: "Look the id up via `uip admin ip-restriction ip-ranges list`, or pass --cidr <cidr>."
|
|
2104
|
+
});
|
|
2105
|
+
processContext.exit(1);
|
|
2106
|
+
return null;
|
|
2107
|
+
}
|
|
2108
|
+
const [listErr, entries] = await catchError(api.getByOrganizationId({ organizationId }));
|
|
2109
|
+
if (listErr) {
|
|
2110
|
+
await emitFailure(listErr, LOGIN_INSTRUCTIONS);
|
|
2111
|
+
return null;
|
|
2112
|
+
}
|
|
2113
|
+
const allEntries = entries ?? [];
|
|
2114
|
+
if (positionalId !== undefined) {
|
|
2115
|
+
return { id: positionalId, entries: allEntries };
|
|
2116
|
+
}
|
|
2117
|
+
const result = findEntryIdByCidr(allEntries, cidr);
|
|
2118
|
+
if (result.error === "none") {
|
|
2119
|
+
OutputFormatter.error({
|
|
2120
|
+
Result: RESULTS.Failure,
|
|
2121
|
+
Message: `No ip-range entry matched CIDR '${cidr}'.`,
|
|
2122
|
+
Instructions: "Run `uip admin ip-restriction ip-ranges list` to see the entries currently configured."
|
|
2123
|
+
});
|
|
2124
|
+
processContext.exit(1);
|
|
2125
|
+
return null;
|
|
2126
|
+
}
|
|
2127
|
+
if (result.error === "ambiguous") {
|
|
2128
|
+
OutputFormatter.error({
|
|
2129
|
+
Result: RESULTS.Failure,
|
|
2130
|
+
Message: `Multiple ip-range entries match CIDR '${cidr}'. Resolve by id instead.`,
|
|
2131
|
+
Instructions: "List entries with `uip admin ip-restriction ip-ranges list` and pass the positional id of the one to operate on."
|
|
2132
|
+
});
|
|
2133
|
+
processContext.exit(1);
|
|
2134
|
+
return null;
|
|
2135
|
+
}
|
|
2136
|
+
return { id: result.id, entries: allEntries };
|
|
2137
|
+
}
|
|
2138
|
+
var registerIpRangesCommands = (apms) => {
|
|
2139
|
+
const ipranges = apms.command("ip-ranges").description([
|
|
2140
|
+
"Manage IP range allowlists for the organization.",
|
|
2141
|
+
"",
|
|
2142
|
+
"Each entry can be a CIDR block, a start/end IP range, or a list of CIDRs.",
|
|
2143
|
+
"Entries gate inbound access to UiPath Cloud — see UiPath docs for the full schema."
|
|
2144
|
+
].join(`
|
|
2145
|
+
`));
|
|
2146
|
+
withLoginValidity(ipranges.command("list").description([
|
|
2147
|
+
"List IP range entries for the caller's organization.",
|
|
2148
|
+
"",
|
|
2149
|
+
"Pass `--filter <fragment>` to narrow client-side by name",
|
|
2150
|
+
"(case-insensitive substring match on the entry's `name` field)."
|
|
2151
|
+
].join(`
|
|
2152
|
+
`)).option("--filter <fragment>", "Case-insensitive substring filter on the entry's name.").examples(LIST_EXAMPLES2)).trackedAction(processContext, async (options) => {
|
|
2153
|
+
const client = await getApi2(options);
|
|
2154
|
+
if (!client)
|
|
2155
|
+
return;
|
|
2156
|
+
const [error, result] = await catchError(client.api.getByOrganizationId({
|
|
2157
|
+
organizationId: client.organizationId
|
|
2158
|
+
}));
|
|
2159
|
+
if (error) {
|
|
2160
|
+
await emitFailure(error, LOGIN_INSTRUCTIONS);
|
|
2161
|
+
return;
|
|
2162
|
+
}
|
|
2163
|
+
const entries = result ?? [];
|
|
2164
|
+
const filterFragment = options.filter?.toLowerCase();
|
|
2165
|
+
const filtered = filterFragment !== undefined ? entries.filter((e) => (e.name ?? "").toLowerCase().includes(filterFragment)) : entries;
|
|
2166
|
+
OutputFormatter.success({
|
|
2167
|
+
Result: RESULTS.Success,
|
|
2168
|
+
Code: "ApmsIpRangesList",
|
|
2169
|
+
Data: filtered
|
|
2170
|
+
});
|
|
2171
|
+
});
|
|
2172
|
+
withLoginValidity(ipranges.command("get").description([
|
|
2173
|
+
"Fetch a single IP range entry by id or by CIDR.",
|
|
2174
|
+
"",
|
|
2175
|
+
"Pass the entry's UUID positionally, or `--cidr <cidr>` to look it up",
|
|
2176
|
+
"by its allowlist value (the CLI lists entries and finds the match)."
|
|
2177
|
+
].join(`
|
|
2178
|
+
`)).argument("[id]", "IP range entry UUID. Obtain from `ip-ranges list`. Optional when --cidr is provided.").option("--cidr <cidr>", "Look up the entry by CIDR instead of id.").examples(GET_EXAMPLES3)).trackedAction(processContext, async (positionalId, options) => {
|
|
2179
|
+
const client = await getApi2(options);
|
|
2180
|
+
if (!client)
|
|
2181
|
+
return;
|
|
2182
|
+
const resolved = await resolveEntryId(client.api, client.organizationId, positionalId, options.cidr);
|
|
2183
|
+
if (!resolved)
|
|
2184
|
+
return;
|
|
2185
|
+
const [error, result] = await catchError(client.api.get({
|
|
2186
|
+
id: resolved.id,
|
|
2187
|
+
organizationId: client.organizationId
|
|
2188
|
+
}));
|
|
2189
|
+
if (error) {
|
|
2190
|
+
await emitFailure(error, "Check the IP range UUID with 'uip admin ip-restriction ip-ranges list'.");
|
|
2191
|
+
return;
|
|
2192
|
+
}
|
|
2193
|
+
OutputFormatter.success({
|
|
2194
|
+
Result: RESULTS.Success,
|
|
2195
|
+
Code: "ApmsIpRangeGet",
|
|
2196
|
+
Data: result
|
|
2197
|
+
});
|
|
2198
|
+
});
|
|
2199
|
+
withLoginValidity(ipranges.command("create").description([
|
|
2200
|
+
"Add an IP range entry to the organization (idempotent).",
|
|
2201
|
+
"",
|
|
2202
|
+
"This call upserts on CIDR — running it twice with the same --cidr is",
|
|
2203
|
+
"a safe no-op. For repeating CIDRs in one call, pass --cidr multiple",
|
|
2204
|
+
"times. For full body control, pass --file <path> with an",
|
|
2205
|
+
"AddIpConfigurationRequest body."
|
|
2206
|
+
].join(`
|
|
2207
|
+
`)).option("--file <path>", "Path to a JSON file containing the AddIpConfigurationRequest body.").option("--name <name>", "Display name for the entry. Required in inline mode.").option("--cidr <cidr>", "CIDR block to allow (e.g. 10.0.0.0/16). Repeatable to add several in one call.", (value, prev) => [
|
|
2208
|
+
...prev ?? [],
|
|
2209
|
+
value
|
|
2210
|
+
]).option("--start-ip <ip>", "Start of an IP range (use with --end-ip).").option("--end-ip <ip>", "End of an IP range (use with --start-ip).").option("--expires <duration>", "Optional expiry. Accepts <integer><m|h|d|w> (e.g. 15m, 2h, 30d, 1w).").examples(CREATE_EXAMPLES2)).trackedAction(processContext, async (options) => {
|
|
2211
|
+
const inlineProvided = hasCreateInline(options);
|
|
2212
|
+
if (options.file !== undefined && inlineProvided) {
|
|
2213
|
+
OutputFormatter.error({
|
|
2214
|
+
Result: RESULTS.Failure,
|
|
2215
|
+
Message: "--file is mutually exclusive with --name / --cidr / --start-ip / --end-ip / --expires.",
|
|
2216
|
+
Instructions: "Pass either --file for the full body, or the inline flags for a simple range."
|
|
2217
|
+
});
|
|
2218
|
+
processContext.exit(1);
|
|
2219
|
+
return;
|
|
2220
|
+
}
|
|
2221
|
+
if (options.file === undefined && !inlineProvided) {
|
|
2222
|
+
OutputFormatter.error({
|
|
2223
|
+
Result: RESULTS.Failure,
|
|
2224
|
+
Message: "Provide either --file or inline flags.",
|
|
2225
|
+
Instructions: "Inline minimum: --name <name> --cidr <cidr>. Or pass --file <path> for the full body."
|
|
2226
|
+
});
|
|
2227
|
+
processContext.exit(1);
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2230
|
+
let body;
|
|
2231
|
+
if (options.file !== undefined) {
|
|
2232
|
+
const [loadErr, loaded] = await loadJsonFile(options.file, "AddIpConfigurationRequest");
|
|
2233
|
+
if (loadErr) {
|
|
2234
|
+
emitLoadError(loadErr);
|
|
2235
|
+
return;
|
|
2236
|
+
}
|
|
2237
|
+
body = loaded;
|
|
2238
|
+
} else {
|
|
2239
|
+
if (options.name === undefined) {
|
|
2240
|
+
OutputFormatter.error({
|
|
2241
|
+
Result: RESULTS.Failure,
|
|
2242
|
+
Message: "--name is required in inline mode.",
|
|
2243
|
+
Instructions: "Pass --name '<label>'. The platform stores the label and `ip-ranges list` shows it; without it the entry is hard to identify later."
|
|
2244
|
+
});
|
|
2245
|
+
processContext.exit(1);
|
|
2246
|
+
return;
|
|
2247
|
+
}
|
|
2248
|
+
const hasCidr = options.cidr !== undefined && options.cidr.length > 0;
|
|
2249
|
+
const hasStart = options.startIp !== undefined;
|
|
2250
|
+
const hasEnd = options.endIp !== undefined;
|
|
2251
|
+
if (hasCidr && (hasStart || hasEnd)) {
|
|
2252
|
+
OutputFormatter.error({
|
|
2253
|
+
Result: RESULTS.Failure,
|
|
2254
|
+
Message: "--cidr is mutually exclusive with --start-ip / --end-ip.",
|
|
2255
|
+
Instructions: "Pick one shape: either --cidr <cidr> (repeatable) for CIDR allowlists, or --start-ip + --end-ip for a contiguous range."
|
|
2256
|
+
});
|
|
2257
|
+
processContext.exit(1);
|
|
2258
|
+
return;
|
|
2259
|
+
}
|
|
2260
|
+
if (hasStart && !hasEnd || !hasStart && hasEnd) {
|
|
2261
|
+
OutputFormatter.error({
|
|
2262
|
+
Result: RESULTS.Failure,
|
|
2263
|
+
Message: "--start-ip and --end-ip must be provided together.",
|
|
2264
|
+
Instructions: "Pass both bounds of the range, or switch to --cidr <cidr>."
|
|
2265
|
+
});
|
|
2266
|
+
processContext.exit(1);
|
|
2267
|
+
return;
|
|
2268
|
+
}
|
|
2269
|
+
if (!hasCidr && !hasStart && !hasEnd) {
|
|
2270
|
+
OutputFormatter.error({
|
|
2271
|
+
Result: RESULTS.Failure,
|
|
2272
|
+
Message: "Provide either --cidr (repeatable) or --start-ip + --end-ip in inline mode.",
|
|
2273
|
+
Instructions: "Inline minimum: --name <name> --cidr <cidr>."
|
|
2274
|
+
});
|
|
2275
|
+
processContext.exit(1);
|
|
2276
|
+
return;
|
|
2277
|
+
}
|
|
2278
|
+
let expiresInMinutes;
|
|
2279
|
+
if (options.expires !== undefined) {
|
|
2280
|
+
const [parseErr, minutes] = catchError(() => parseExpiresMinutes(options.expires));
|
|
2281
|
+
if (parseErr) {
|
|
2282
|
+
OutputFormatter.error({
|
|
2283
|
+
Result: RESULTS.Failure,
|
|
2284
|
+
Message: parseErr.message,
|
|
2285
|
+
Instructions: "--expires accepts <integer><m|h|d|w>: 15m, 2h, 30d, 1w. Omit for no expiry."
|
|
2286
|
+
});
|
|
2287
|
+
processContext.exit(1);
|
|
2288
|
+
return;
|
|
2289
|
+
}
|
|
2290
|
+
expiresInMinutes = minutes;
|
|
2291
|
+
}
|
|
2292
|
+
body = {
|
|
2293
|
+
name: options.name,
|
|
2294
|
+
...hasCidr ? { ipNetworks: options.cidr } : {},
|
|
2295
|
+
...hasStart ? { startIp: options.startIp } : {},
|
|
2296
|
+
...hasEnd ? { endIp: options.endIp } : {},
|
|
2297
|
+
...expiresInMinutes !== undefined ? { expiresInMinutes } : {}
|
|
2298
|
+
};
|
|
2299
|
+
}
|
|
2300
|
+
const client = await getApi2(options);
|
|
2301
|
+
if (!client)
|
|
2302
|
+
return;
|
|
2303
|
+
const [error, result] = await catchError(client.api.put({
|
|
2304
|
+
organizationId: client.organizationId,
|
|
2305
|
+
uiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigurationRequest: body
|
|
2306
|
+
}));
|
|
2307
|
+
if (error) {
|
|
2308
|
+
await emitFailure(error, "Verify the request body and that the IP range fields are well-formed.");
|
|
2309
|
+
return;
|
|
2310
|
+
}
|
|
2311
|
+
OutputFormatter.success({
|
|
2312
|
+
Result: RESULTS.Success,
|
|
2313
|
+
Code: "ApmsIpRangeCreated",
|
|
2314
|
+
Data: result
|
|
2315
|
+
});
|
|
2316
|
+
});
|
|
2317
|
+
withLoginValidity(ipranges.command("update").description([
|
|
2318
|
+
"Patch a single IP range entry by id.",
|
|
2319
|
+
"",
|
|
2320
|
+
"Pass any of `--name`, `--cidr`, `--start-ip`, `--end-ip` inline, or",
|
|
2321
|
+
"`--file <path>` for the full UpdateIpConfigurationRequest body."
|
|
2322
|
+
].join(`
|
|
2323
|
+
`)).argument("<id>", "IP range entry UUID. Obtain from `ip-ranges list`.").option("--file <path>", "Path to a JSON file containing the UpdateIpConfigurationRequest body.").option("--name <name>", "New display name.").option("--cidr <cidr>", "New CIDR to set on the entry.").option("--start-ip <ip>", "New start of the IP range.").option("--end-ip <ip>", "New end of the IP range.").examples(UPDATE_EXAMPLES2)).trackedAction(processContext, async (id, options) => {
|
|
2324
|
+
const inlineProvided = hasUpdateInline(options);
|
|
2325
|
+
if (options.file !== undefined && inlineProvided) {
|
|
2326
|
+
OutputFormatter.error({
|
|
2327
|
+
Result: RESULTS.Failure,
|
|
2328
|
+
Message: "--file is mutually exclusive with --name / --cidr / --start-ip / --end-ip.",
|
|
2329
|
+
Instructions: "Pass either --file for the full body, or the inline flags for the fields you want to change."
|
|
2330
|
+
});
|
|
2331
|
+
processContext.exit(1);
|
|
2332
|
+
return;
|
|
2333
|
+
}
|
|
2334
|
+
if (options.file === undefined && !inlineProvided) {
|
|
2335
|
+
OutputFormatter.error({
|
|
2336
|
+
Result: RESULTS.Failure,
|
|
2337
|
+
Message: "Provide either --file or inline flags.",
|
|
2338
|
+
Instructions: "Inline: at least one of --name / --cidr / --start-ip / --end-ip. File: --file <path>."
|
|
2339
|
+
});
|
|
2340
|
+
processContext.exit(1);
|
|
2341
|
+
return;
|
|
2342
|
+
}
|
|
2343
|
+
let body;
|
|
2344
|
+
if (options.file !== undefined) {
|
|
2345
|
+
const [loadErr, loaded] = await loadJsonFile(options.file, "UpdateIpConfigurationRequest");
|
|
2346
|
+
if (loadErr) {
|
|
2347
|
+
emitLoadError(loadErr);
|
|
2348
|
+
return;
|
|
2349
|
+
}
|
|
2350
|
+
body = loaded;
|
|
2351
|
+
} else {
|
|
2352
|
+
body = {
|
|
2353
|
+
name: options.name,
|
|
2354
|
+
startIp: options.startIp,
|
|
2355
|
+
endIp: options.endIp,
|
|
2356
|
+
ipNetwork: options.cidr
|
|
2357
|
+
};
|
|
2358
|
+
}
|
|
2359
|
+
const client = await getApi2(options);
|
|
2360
|
+
if (!client)
|
|
2361
|
+
return;
|
|
2362
|
+
const [error, result] = await catchError(client.api.update({
|
|
2363
|
+
id,
|
|
2364
|
+
organizationId: client.organizationId,
|
|
2365
|
+
uiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfigurationRequest: body
|
|
2366
|
+
}));
|
|
2367
|
+
if (error) {
|
|
2368
|
+
await emitFailure(error, "Verify the IP range UUID and that --file matches the UpdateIpConfigurationRequest schema.");
|
|
2369
|
+
return;
|
|
2370
|
+
}
|
|
2371
|
+
OutputFormatter.success({
|
|
2372
|
+
Result: RESULTS.Success,
|
|
2373
|
+
Code: "ApmsIpRangeUpdated",
|
|
2374
|
+
Data: result
|
|
2375
|
+
});
|
|
2376
|
+
});
|
|
2377
|
+
withLoginValidity(ipranges.command("delete").description([
|
|
2378
|
+
"Delete a single IP range entry by id or by CIDR.",
|
|
2379
|
+
"",
|
|
2380
|
+
"**Lockout warning** — removing the wrong entry while enforcement",
|
|
2381
|
+
"is enabled can lock you (or the whole org) out of UiPath.",
|
|
2382
|
+
"`--confirm` is mandatory; the CLI also runs a safety pre-flight",
|
|
2383
|
+
"(only-entry / caller-IP-uniquely-covered) when enforcement is on.",
|
|
2384
|
+
"To bypass the safety check, run `enforcement disable` first."
|
|
2385
|
+
].join(`
|
|
2386
|
+
`)).argument("[id]", "IP range entry UUID. Obtain from `ip-ranges list`. Optional when --cidr is provided.").option("--cidr <cidr>", "Look up the entry to delete by CIDR instead of id.").option("--confirm", "Acknowledge the lockout risk and proceed. Required.").examples(DELETE_EXAMPLES2)).trackedAction(processContext, async (positionalId, options) => {
|
|
2387
|
+
if (options.confirm !== true) {
|
|
2388
|
+
OutputFormatter.log({ Warning: DELETE_WARNING });
|
|
2389
|
+
OutputFormatter.error({
|
|
2390
|
+
Result: RESULTS.Failure,
|
|
2391
|
+
Message: "--confirm is required to delete an IP range entry.",
|
|
2392
|
+
Instructions: "Re-run with --confirm to acknowledge the lockout risk and proceed."
|
|
2393
|
+
});
|
|
2394
|
+
processContext.exit(1);
|
|
2395
|
+
return;
|
|
2396
|
+
}
|
|
2397
|
+
const client = await getApi2(options);
|
|
2398
|
+
if (!client)
|
|
2399
|
+
return;
|
|
2400
|
+
const resolved = await resolveEntryId(client.api, client.organizationId, positionalId, options.cidr);
|
|
2401
|
+
if (!resolved)
|
|
2402
|
+
return;
|
|
2403
|
+
const { id, entries } = resolved;
|
|
2404
|
+
const statusClient = await getStatusApi2(options);
|
|
2405
|
+
if (!statusClient)
|
|
2406
|
+
return;
|
|
2407
|
+
const [statusErr, statusResp] = await catchError(statusClient.api.getRaw({
|
|
2408
|
+
organizationId: statusClient.organizationId
|
|
2409
|
+
}));
|
|
2410
|
+
if (statusErr || !statusResp) {
|
|
2411
|
+
await emitFailure(statusErr ?? new Error("Empty response"), "Failed to read enforcement status before delete. Run `uip admin ip-restriction enforcement get` to inspect.");
|
|
2412
|
+
return;
|
|
2413
|
+
}
|
|
2414
|
+
const statusBody = await extractResponseData(statusResp);
|
|
2415
|
+
const enforcementEnabled = statusBody?.status === "Enabled";
|
|
2416
|
+
if (enforcementEnabled) {
|
|
2417
|
+
if (entries.length <= 1) {
|
|
2418
|
+
OutputFormatter.error({
|
|
2419
|
+
Result: RESULTS.Failure,
|
|
2420
|
+
Message: "Refusing to delete the only IP range entry while enforcement is enabled — the organization would become unreachable.",
|
|
2421
|
+
Instructions: "Run `uip admin ip-restriction enforcement disable` first, or add another trusted entry, then retry."
|
|
2422
|
+
});
|
|
2423
|
+
processContext.exit(1);
|
|
2424
|
+
return;
|
|
2425
|
+
}
|
|
2426
|
+
const target = entries.find((e) => e.id === id);
|
|
2427
|
+
const targetCidr = target?.ipNetwork;
|
|
2428
|
+
if (typeof targetCidr === "string" && targetCidr.length > 0) {
|
|
2429
|
+
const [ipErr, ipResult] = await catchError(fetchCurrentIp(options.loginValidity));
|
|
2430
|
+
if (ipErr || !ipResult || !ipResult.ip) {
|
|
2431
|
+
await emitFailure(ipErr ?? new Error("Failed to determine the caller's IP for the lockout-safety pre-flight."), "Run `uip admin ip-restriction my-ip` to inspect; or run `uip admin ip-restriction enforcement disable` first to skip the safety check.");
|
|
2432
|
+
return;
|
|
2433
|
+
}
|
|
2434
|
+
const callerIp = ipResult.ip;
|
|
2435
|
+
if (ipInCidr(callerIp, targetCidr)) {
|
|
2436
|
+
const otherCovers = entries.filter((e) => e.id !== id).some((e) => typeof e.ipNetwork === "string" && e.ipNetwork.length > 0 ? ipInCidr(callerIp, e.ipNetwork) : false);
|
|
2437
|
+
if (!otherCovers) {
|
|
2438
|
+
OutputFormatter.error({
|
|
2439
|
+
Result: RESULTS.Failure,
|
|
2440
|
+
Message: "You are unable to delete your IP address from the trusted IP range while IP restrictions is enabled.",
|
|
2441
|
+
Instructions: `Run \`uip admin ip-restriction enforcement disable\` first, or add another trusted entry that covers ${callerIp}, then retry.`
|
|
2442
|
+
});
|
|
2443
|
+
processContext.exit(1);
|
|
2444
|
+
return;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
const [error, response] = await catchError(client.api._deleteRaw({
|
|
2450
|
+
id,
|
|
2451
|
+
organizationId: client.organizationId
|
|
2452
|
+
}));
|
|
2453
|
+
if (error || !response) {
|
|
2454
|
+
await emitFailure(error ?? new Error("Empty response"), "Check the IP range UUID with 'uip admin ip-restriction ip-ranges list'.");
|
|
2455
|
+
return;
|
|
2456
|
+
}
|
|
2457
|
+
const responseBody = await extractResponseData(response);
|
|
2458
|
+
OutputFormatter.success({
|
|
2459
|
+
Result: RESULTS.Success,
|
|
2460
|
+
Code: "ApmsIpRangeDeleted",
|
|
2461
|
+
Data: responseBody ?? {}
|
|
2462
|
+
});
|
|
2463
|
+
});
|
|
2464
|
+
};
|
|
2465
|
+
|
|
2466
|
+
// ../apms-tool/src/commands/my-ip.ts
|
|
2467
|
+
var MY_IP_EXAMPLES = [
|
|
2468
|
+
{
|
|
2469
|
+
Description: "Show the public IP the platform sees for the current caller (handy for filling in `ip-ranges create` and as a sanity check before enforcing IP restrictions).",
|
|
2470
|
+
Command: "uip admin ip-restriction my-ip",
|
|
2471
|
+
Output: {
|
|
2472
|
+
Code: "ApmsMyIpGet",
|
|
2473
|
+
Data: { ipAddress: "<your-public-ip>" }
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
];
|
|
2477
|
+
var registerMyIpCommand = (apms) => {
|
|
2478
|
+
withLoginValidity(apms.command("my-ip").description([
|
|
2479
|
+
"Show the public IP the UiPath platform sees for the current caller.",
|
|
2480
|
+
"",
|
|
2481
|
+
"Useful before running `enforcement enable` to confirm",
|
|
2482
|
+
"your IP is in the trusted ip-ranges allowlist."
|
|
2483
|
+
].join(`
|
|
2484
|
+
`)).examples(MY_IP_EXAMPLES)).trackedAction(processContext, async (options) => {
|
|
2485
|
+
const [err, result] = await catchError(fetchCurrentIp(options.loginValidity));
|
|
2486
|
+
if (err || !result) {
|
|
2487
|
+
await emitFailure(err ?? new Error("Failed to determine current IP"), LOGIN_INSTRUCTIONS);
|
|
2488
|
+
return;
|
|
2489
|
+
}
|
|
2490
|
+
OutputFormatter.success({
|
|
2491
|
+
Result: RESULTS.Success,
|
|
2492
|
+
Code: "ApmsMyIpGet",
|
|
2493
|
+
Data: result.body
|
|
2494
|
+
});
|
|
2495
|
+
});
|
|
2496
|
+
};
|
|
2497
|
+
|
|
2498
|
+
// ../apms-tool/src/commands/apms.ts
|
|
2499
|
+
var registerIpRestrictionCommand = (program) => {
|
|
2500
|
+
const ipRestriction = program.command("ip-restriction").description([
|
|
2501
|
+
"Manage UiPath IP-restriction policies (Access Policy Management Service).",
|
|
2502
|
+
"",
|
|
2503
|
+
"Subcommand groups:",
|
|
2504
|
+
" ip-ranges — IP range allowlist entries for the organization.",
|
|
2505
|
+
" enforcement — Turn IP-range enforcement on/off (the switch).",
|
|
2506
|
+
" bypass-rules — URL-pattern exceptions to IP allowlisting.",
|
|
2507
|
+
" my-ip — Show the public IP the platform sees for this caller."
|
|
2508
|
+
].join(`
|
|
2509
|
+
`));
|
|
2510
|
+
registerIpRangesCommands(ipRestriction);
|
|
2511
|
+
registerEnforcementCommands(ipRestriction);
|
|
2512
|
+
registerBypassRulesCommands(ipRestriction);
|
|
2513
|
+
registerMyIpCommand(ipRestriction);
|
|
2514
|
+
};
|
|
2515
|
+
|
|
2516
|
+
// ../apms-tool/src/tool.ts
|
|
2517
|
+
var metadata = {
|
|
2518
|
+
name: "apms-tool",
|
|
2519
|
+
version: package_default.version,
|
|
2520
|
+
description: "Manage UiPath IP-restriction policies (Access Policy Management Service).",
|
|
2521
|
+
commandPrefix: "admin"
|
|
2522
|
+
};
|
|
2523
|
+
var registerCommands = async (program) => {
|
|
2524
|
+
registerIpRestrictionCommand(program);
|
|
2525
|
+
};
|
|
2526
|
+
export {
|
|
2527
|
+
metadata,
|
|
2528
|
+
registerCommands
|
|
2529
|
+
};
|
|
2530
|
+
|
|
2531
|
+
//# debugId=046780DE9022A95E64756E2164756E21
|