axiam-sdk 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -12
- package/dist/amqp/index.d.cts +3 -2
- package/dist/amqp/index.d.ts +3 -2
- package/dist/{authzCore-BQfX9qxN.d.cts → authzCore-CqXzLNmT.d.cts} +4 -3
- package/dist/{authzCore-BlSHwGnW.d.ts → authzCore-D-hquWSI.d.ts} +4 -3
- package/dist/browser/index.d.cts +8 -7
- package/dist/browser/index.d.ts +8 -7
- package/dist/{client-0WJkblDE.d.ts → client-BMNQi36J.d.ts} +646 -16
- package/dist/{client-yD0eMwHQ.d.cts → client-D34sXV8p.d.cts} +646 -16
- package/dist/{cookieJar-CTD5jOmd.d.cts → cookieJar-C_xPuniu.d.cts} +3 -3
- package/dist/{cookieJar-hWRmZkhe.d.ts → cookieJar-DcrMe93Q.d.ts} +3 -3
- package/dist/{errors-DMIlw2lN.d.ts → errors-DZ3k8a8i.d.cts} +2 -1
- package/dist/{errors-DMIlw2lN.d.cts → errors-DZ3k8a8i.d.ts} +2 -1
- package/dist/{errors-m0Tue_pE.d.cts → errors-RvGlTyUj.d.cts} +18 -3
- package/dist/{errors-CmBvsxV0.d.ts → errors-dlGXAsbh.d.ts} +18 -3
- package/dist/grpc/index.d.cts +10 -9
- package/dist/grpc/index.d.ts +10 -9
- package/dist/grpc/index.js +604 -15
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +604 -15
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +626 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +624 -17
- package/dist/index.mjs.map +1 -1
- package/dist/{jwks-BR55d7-Z.d.cts → jwks-CTVpOWzI.d.cts} +2 -1
- package/dist/{jwks-BR55d7-Z.d.ts → jwks-CTVpOWzI.d.ts} +2 -1
- package/dist/middleware/index.d.cts +13 -12
- package/dist/middleware/index.d.ts +13 -12
- package/dist/middleware/index.js +53 -12
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +53 -12
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/nestjs/index.d.cts +5 -4
- package/dist/nestjs/index.d.ts +5 -4
- package/dist/node/index.d.cts +10 -9
- package/dist/node/index.d.ts +10 -9
- package/dist/node/index.js +631 -19
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +631 -19
- package/dist/node/index.mjs.map +1 -1
- package/dist/{oidcState-mQLVn3-A.d.cts → oidcState-BFIHt7_Y.d.cts} +29 -7
- package/dist/{oidcState-DOSCgnMG.d.ts → oidcState-qoy2vsYG.d.ts} +29 -7
- package/dist/rest/index.d.cts +64 -12
- package/dist/rest/index.d.ts +64 -12
- package/dist/rest/index.js +626 -16
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +624 -17
- package/dist/rest/index.mjs.map +1 -1
- package/dist/{revocationFeed-CDoD7Twr.d.cts → revocationFeed-KQhvMMl8.d.cts} +2 -1
- package/dist/{revocationFeed-CDoD7Twr.d.ts → revocationFeed-KQhvMMl8.d.ts} +2 -1
- package/dist/{session-CeG6P9GO.d.ts → session-BbPFTpMZ.d.ts} +3 -2
- package/dist/{session-BmjEMowX.d.cts → session-C9WlP6DV.d.cts} +3 -2
- package/dist/{telemetry--0DwnNjV.d.cts → telemetry-Du0-zS5f.d.cts} +2 -1
- package/dist/{telemetry--0DwnNjV.d.ts → telemetry-Du0-zS5f.d.ts} +2 -1
- package/dist/{webauthnErrors-fLgfOflO.d.cts → webauthnErrors-m1LZiaRy.d.cts} +2 -1
- package/dist/{webauthnErrors-fLgfOflO.d.ts → webauthnErrors-m1LZiaRy.d.ts} +2 -1
- package/package.json +2 -2
package/dist/grpc/index.js
CHANGED
|
@@ -1205,6 +1205,12 @@ var SKIP_REFRESH = [
|
|
|
1205
1205
|
// regardless of what session state came before it.
|
|
1206
1206
|
"/api/v1/auth/device",
|
|
1207
1207
|
"/oauth2/token",
|
|
1208
|
+
// CONTRACT.md §14.2 rule 5 (contract 1.62): a client that fails to
|
|
1209
|
+
// authenticate at the device endpoints is `401 invalid_client`, which is not
|
|
1210
|
+
// an expired session and which refreshing cannot fix. `/oauth2/token` (the
|
|
1211
|
+
// poll) was already here; the authorization endpoint now authenticates the
|
|
1212
|
+
// client too, so its 401 must not enter the §9 guard either.
|
|
1213
|
+
"/oauth2/device_authorization",
|
|
1208
1214
|
"/oauth2/introspect",
|
|
1209
1215
|
"/oauth2/revoke"
|
|
1210
1216
|
];
|
|
@@ -1213,6 +1219,9 @@ function installCsrfInterceptor(axiosInstance, session) {
|
|
|
1213
1219
|
if (session.isForeignHost(config.url)) {
|
|
1214
1220
|
return config;
|
|
1215
1221
|
}
|
|
1222
|
+
if (isOAuth2Endpoint(config.url, session.baseUrl)) {
|
|
1223
|
+
return config;
|
|
1224
|
+
}
|
|
1216
1225
|
const method = (config.method ?? "get").toLowerCase();
|
|
1217
1226
|
const cookieString = typeof document !== "undefined" ? document.cookie : "";
|
|
1218
1227
|
const csrfToken = typeof document !== "undefined" ? csrfHeaderForMethod(method, cookieString) : csrfHeaderForMethod(method, session.csrfToken ? `axiam_csrf=${session.csrfToken}` : "");
|
|
@@ -1266,15 +1275,35 @@ function installRefreshInterceptor(axiosInstance, session) {
|
|
|
1266
1275
|
}
|
|
1267
1276
|
);
|
|
1268
1277
|
}
|
|
1278
|
+
function isOAuth2Endpoint(url, baseUrl) {
|
|
1279
|
+
if (!url) {
|
|
1280
|
+
return false;
|
|
1281
|
+
}
|
|
1282
|
+
try {
|
|
1283
|
+
const base = new URL(baseUrl);
|
|
1284
|
+
let path = new URL(url, base).pathname;
|
|
1285
|
+
const prefix = base.pathname.replace(/\/+$/, "");
|
|
1286
|
+
if (prefix !== "" && path.startsWith(`${prefix}/`)) {
|
|
1287
|
+
path = path.slice(prefix.length);
|
|
1288
|
+
}
|
|
1289
|
+
return path.startsWith("/oauth2/");
|
|
1290
|
+
} catch {
|
|
1291
|
+
return false;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1269
1294
|
function installDeviceTokenInterceptor(axiosInstance, session) {
|
|
1270
1295
|
axiosInstance.interceptors.request.use((config) => {
|
|
1271
1296
|
const deviceToken = session.deviceAccessToken;
|
|
1272
|
-
|
|
1297
|
+
const oauth2 = isOAuth2Endpoint(config.url, session.baseUrl);
|
|
1298
|
+
if (session.isForeignHost(config.url) || deviceToken === void 0 && !oauth2) {
|
|
1273
1299
|
return config;
|
|
1274
1300
|
}
|
|
1275
1301
|
const noCred = session.noCredentialsConfig();
|
|
1276
1302
|
Object.assign(config, noCred);
|
|
1277
1303
|
config.headers = config.headers ?? {};
|
|
1304
|
+
if (oauth2) {
|
|
1305
|
+
return config;
|
|
1306
|
+
}
|
|
1278
1307
|
config.headers["Authorization"] = `Bearer ${deviceToken.expose()}`;
|
|
1279
1308
|
config.headers["Cookie"] = "";
|
|
1280
1309
|
return config;
|
|
@@ -2233,10 +2262,25 @@ var NotFoundError = class _NotFoundError extends AuthzError {
|
|
|
2233
2262
|
var ConflictError = class _ConflictError extends AuthzError {
|
|
2234
2263
|
/** The registry operation that conflicted. */
|
|
2235
2264
|
operation;
|
|
2236
|
-
|
|
2265
|
+
/**
|
|
2266
|
+
* The body's `reason_code`, as the server spelled it (contract 1.62, §36.4),
|
|
2267
|
+
* or `undefined` when the body carries none (a server that predates it, or a
|
|
2268
|
+
* `409` of an operation that does not name one).
|
|
2269
|
+
*
|
|
2270
|
+
* The `409` of every `network` operation says which conflict it is:
|
|
2271
|
+
* `stale_version`, `strands_profile`, `has_children`, `site_gone`,
|
|
2272
|
+
* `duplicate_name`, `duplicate_vlan`, `duplicate_rank`, `profile_exists` or
|
|
2273
|
+
* `other` (§36.3 rule 2). The vocabulary is **open**: a value this SDK does
|
|
2274
|
+
* not know is surfaced verbatim, and a caller branches on this member —
|
|
2275
|
+
* never on `message`, which an SDK must not parse. It is not the `reason` of
|
|
2276
|
+
* an authorization decision (§3), which is a human string.
|
|
2277
|
+
*/
|
|
2278
|
+
reasonCode;
|
|
2279
|
+
constructor(operation, message, reasonCode) {
|
|
2237
2280
|
super(message);
|
|
2238
2281
|
this.name = "ConflictError";
|
|
2239
2282
|
this.operation = operation;
|
|
2283
|
+
this.reasonCode = reasonCode;
|
|
2240
2284
|
Object.setPrototypeOf(this, _ConflictError.prototype);
|
|
2241
2285
|
}
|
|
2242
2286
|
};
|
|
@@ -2525,6 +2569,14 @@ function omitEmptyTenantScope(body) {
|
|
|
2525
2569
|
}
|
|
2526
2570
|
return body;
|
|
2527
2571
|
}
|
|
2572
|
+
function omitNullMembers(body, members) {
|
|
2573
|
+
if (!body || typeof body !== "object") return body;
|
|
2574
|
+
const record = body;
|
|
2575
|
+
if (!members.some((m) => m in record && record[m] === null)) return body;
|
|
2576
|
+
const copy = { ...record };
|
|
2577
|
+
for (const m of members) if (copy[m] === null) delete copy[m];
|
|
2578
|
+
return copy;
|
|
2579
|
+
}
|
|
2528
2580
|
function roleAssignmentInherits(assignment) {
|
|
2529
2581
|
return assignment.inherit ?? true;
|
|
2530
2582
|
}
|
|
@@ -2997,6 +3049,7 @@ function validate(manifest) {
|
|
|
2997
3049
|
const groups = manifest.groups ?? [];
|
|
2998
3050
|
const users = manifest.users ?? [];
|
|
2999
3051
|
const serviceAccounts = manifest.serviceAccounts ?? [];
|
|
3052
|
+
const network = manifest.network;
|
|
3000
3053
|
const resourceKeys = new Set(resources.map((r) => r.key));
|
|
3001
3054
|
const scopeKeys = new Set(resources.flatMap((r) => (r.scopes ?? []).map((s) => s.key)));
|
|
3002
3055
|
const permissionKeys = new Set(permissions.map((p) => p.key));
|
|
@@ -3010,6 +3063,7 @@ function validate(manifest) {
|
|
|
3010
3063
|
duplicates("group", groups.map((g) => g.key), problems);
|
|
3011
3064
|
duplicates("user", users.map((u) => u.key), problems);
|
|
3012
3065
|
duplicates("service account", serviceAccounts.map((s) => s.key), problems);
|
|
3066
|
+
if (network !== void 0) validateNetwork(network, problems);
|
|
3013
3067
|
for (const resource of resources) {
|
|
3014
3068
|
if (resource.parent && !resourceKeys.has(resource.parent)) {
|
|
3015
3069
|
problems.push(
|
|
@@ -3089,6 +3143,51 @@ function validate(manifest) {
|
|
|
3089
3143
|
}
|
|
3090
3144
|
}
|
|
3091
3145
|
var q = (s) => JSON.stringify(s);
|
|
3146
|
+
function validateNetwork(network, problems) {
|
|
3147
|
+
if (Array.isArray(network.policy)) {
|
|
3148
|
+
problems.push("network declares more than one policy; the tenant has exactly one");
|
|
3149
|
+
}
|
|
3150
|
+
const segments = network.segments ?? [];
|
|
3151
|
+
const profiles = network.profiles ?? [];
|
|
3152
|
+
duplicates("network segment", segments.map((s) => s.key), problems);
|
|
3153
|
+
const naturalKeys = /* @__PURE__ */ new Set();
|
|
3154
|
+
for (const segment of segments) {
|
|
3155
|
+
const natural = `${segment.site}/${segment.kind}/${segment.name}`;
|
|
3156
|
+
if (naturalKeys.has(natural)) {
|
|
3157
|
+
problems.push(
|
|
3158
|
+
`network segment ${q(natural)} (site, kind, name) is declared more than once`
|
|
3159
|
+
);
|
|
3160
|
+
}
|
|
3161
|
+
naturalKeys.add(natural);
|
|
3162
|
+
const seenFilters = /* @__PURE__ */ new Set();
|
|
3163
|
+
for (const filter of segment.filterIds ?? []) {
|
|
3164
|
+
if (seenFilters.has(filter)) {
|
|
3165
|
+
problems.push(
|
|
3166
|
+
`network segment ${q(segment.key)} lists Filter-Id ${q(filter)} more than once in filterIds`
|
|
3167
|
+
);
|
|
3168
|
+
}
|
|
3169
|
+
seenFilters.add(filter);
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
const segmentKeys = new Set(segments.map((s) => s.key));
|
|
3173
|
+
const profiled = /* @__PURE__ */ new Set();
|
|
3174
|
+
for (const profile of profiles) {
|
|
3175
|
+
if (!segmentKeys.has(profile.segment)) {
|
|
3176
|
+
problems.push(
|
|
3177
|
+
`network profile names segment ${q(profile.segment)}, which no network segment declares`
|
|
3178
|
+
);
|
|
3179
|
+
}
|
|
3180
|
+
if (profiled.has(profile.segment)) {
|
|
3181
|
+
problems.push(`network segment ${q(profile.segment)} has more than one profile in the manifest`);
|
|
3182
|
+
}
|
|
3183
|
+
profiled.add(profile.segment);
|
|
3184
|
+
if (profile.terminationAction === null) {
|
|
3185
|
+
problems.push(
|
|
3186
|
+
`network profile of segment ${q(profile.segment)} states terminationAction as null; it has no "none" in a manifest (leave it out to keep the server default)`
|
|
3187
|
+
);
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3092
3191
|
function duplicates(kind, keys, problems) {
|
|
3093
3192
|
const seen = /* @__PURE__ */ new Set();
|
|
3094
3193
|
for (const key of keys) {
|
|
@@ -3134,7 +3233,9 @@ var emptyResolved = () => ({
|
|
|
3134
3233
|
roles: /* @__PURE__ */ new Map(),
|
|
3135
3234
|
groups: /* @__PURE__ */ new Map(),
|
|
3136
3235
|
users: /* @__PURE__ */ new Map(),
|
|
3137
|
-
serviceAccounts: /* @__PURE__ */ new Map()
|
|
3236
|
+
serviceAccounts: /* @__PURE__ */ new Map(),
|
|
3237
|
+
segments: /* @__PURE__ */ new Map(),
|
|
3238
|
+
segmentVersions: /* @__PURE__ */ new Map()
|
|
3138
3239
|
});
|
|
3139
3240
|
var ManifestApi = class {
|
|
3140
3241
|
#client;
|
|
@@ -3167,6 +3268,23 @@ var ManifestApi = class {
|
|
|
3167
3268
|
async #read(manifest) {
|
|
3168
3269
|
const c = this.#client;
|
|
3169
3270
|
const start = { limit: PLAN_PAGE };
|
|
3271
|
+
if (manifest.network !== void 0 && !hasShapeSections(manifest)) {
|
|
3272
|
+
return {
|
|
3273
|
+
resources: [],
|
|
3274
|
+
scopes: /* @__PURE__ */ new Map(),
|
|
3275
|
+
permissions: [],
|
|
3276
|
+
roles: [],
|
|
3277
|
+
groups: [],
|
|
3278
|
+
users: [],
|
|
3279
|
+
serviceAccounts: [],
|
|
3280
|
+
roleGrants: /* @__PURE__ */ new Map(),
|
|
3281
|
+
roleUserBindings: /* @__PURE__ */ new Map(),
|
|
3282
|
+
roleGroupBindings: /* @__PURE__ */ new Map(),
|
|
3283
|
+
roleServiceAccountBindings: /* @__PURE__ */ new Map(),
|
|
3284
|
+
groupMembers: /* @__PURE__ */ new Map(),
|
|
3285
|
+
network: await this.#readNetwork(manifest.network, start)
|
|
3286
|
+
};
|
|
3287
|
+
}
|
|
3170
3288
|
const resources = await c.resources.listAll(start);
|
|
3171
3289
|
const permissions = await c.permissions.listAll(start);
|
|
3172
3290
|
const roles = await c.roles.listAll(start);
|
|
@@ -3222,9 +3340,29 @@ var ManifestApi = class {
|
|
|
3222
3340
|
roleUserBindings,
|
|
3223
3341
|
roleGroupBindings,
|
|
3224
3342
|
roleServiceAccountBindings,
|
|
3225
|
-
groupMembers
|
|
3343
|
+
groupMembers,
|
|
3344
|
+
network: manifest.network ? await this.#readNetwork(manifest.network, start) : void 0
|
|
3226
3345
|
};
|
|
3227
3346
|
}
|
|
3347
|
+
/**
|
|
3348
|
+
* §27.6.2 item 3: `get_policy`, `list_segments` and `list_profiles`, each
|
|
3349
|
+
* list walked to exhaustion, and nothing else — `plan` issues `GET`s only.
|
|
3350
|
+
* A section that states no policy does not read it; one that states no
|
|
3351
|
+
* profile does not list them.
|
|
3352
|
+
*/
|
|
3353
|
+
async #readNetwork(spec, start) {
|
|
3354
|
+
const c = this.#client;
|
|
3355
|
+
const policy = spec.policy ? await c.network.getPolicy() : void 0;
|
|
3356
|
+
const wantSegments = (spec.segments ?? []).length > 0 || (spec.profiles ?? []).length > 0;
|
|
3357
|
+
const segments = wantSegments ? await c.network.listSegmentsAll(void 0, start) : [];
|
|
3358
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
3359
|
+
if ((spec.profiles ?? []).length) {
|
|
3360
|
+
for (const profile of await c.network.listProfilesAll(start)) {
|
|
3361
|
+
profiles.set(profile.segment_id, profile);
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
return { policy, segments, profiles };
|
|
3365
|
+
}
|
|
3228
3366
|
// -------------------------------------------------------------------
|
|
3229
3367
|
// Plan
|
|
3230
3368
|
// -------------------------------------------------------------------
|
|
@@ -3495,8 +3633,97 @@ var ManifestApi = class {
|
|
|
3495
3633
|
push
|
|
3496
3634
|
);
|
|
3497
3635
|
}
|
|
3636
|
+
if (manifest.network && snapshot.network) {
|
|
3637
|
+
this.#networkSteps(manifest.network, snapshot.network, resolved, push);
|
|
3638
|
+
}
|
|
3498
3639
|
return out;
|
|
3499
3640
|
}
|
|
3641
|
+
/**
|
|
3642
|
+
* §27.6.2 — the `network` section: the policy, then the segments, then the
|
|
3643
|
+
* profiles, a profile after its segment (item 2). Every comparison is with
|
|
3644
|
+
* the value **as the read returns it** (item 3): a profile's effective
|
|
3645
|
+
* (clamped) `session_timeout_secs`, a segment's `filter_ids` as a set.
|
|
3646
|
+
* Silence is not an assertion (rule 3): a member left off never drifts, and
|
|
3647
|
+
* the `Update` body carries the read's value for it (item 4).
|
|
3648
|
+
*/
|
|
3649
|
+
#networkSteps(spec, read, resolved, push) {
|
|
3650
|
+
if (spec.policy) {
|
|
3651
|
+
const current = read.policy;
|
|
3652
|
+
const drifted = current.session_timeout_max_secs !== spec.policy.sessionTimeoutMaxSecs;
|
|
3653
|
+
push(
|
|
3654
|
+
drifted ? "update" : "no-change",
|
|
3655
|
+
"network-policy",
|
|
3656
|
+
"network.policy",
|
|
3657
|
+
"network policy (Session-Timeout cap)",
|
|
3658
|
+
drifted ? {
|
|
3659
|
+
kind: "update-network-policy",
|
|
3660
|
+
body: {
|
|
3661
|
+
session_timeout_max_secs: spec.policy.sessionTimeoutMaxSecs,
|
|
3662
|
+
version: current.version
|
|
3663
|
+
}
|
|
3664
|
+
} : { kind: "noop" }
|
|
3665
|
+
);
|
|
3666
|
+
}
|
|
3667
|
+
const segments = spec.segments ?? [];
|
|
3668
|
+
for (const segment of segments) {
|
|
3669
|
+
const found = read.segments.find(
|
|
3670
|
+
(r) => r.site_key === segment.site && r.kind === segment.kind && r.name === segment.name
|
|
3671
|
+
);
|
|
3672
|
+
const summary = `network segment ${JSON.stringify(`${segment.site}/${segment.kind}/${segment.name}`)}`;
|
|
3673
|
+
if (!found) {
|
|
3674
|
+
push("create", "network-segment", segment.key, summary, {
|
|
3675
|
+
kind: "create-network-segment",
|
|
3676
|
+
key: segment.key,
|
|
3677
|
+
body: segmentCreateBody(segment)
|
|
3678
|
+
});
|
|
3679
|
+
continue;
|
|
3680
|
+
}
|
|
3681
|
+
resolved.segments.set(segment.key, found.id);
|
|
3682
|
+
resolved.segmentVersions.set(segment.key, found.version);
|
|
3683
|
+
const drifted = segmentDrifted(segment, found);
|
|
3684
|
+
push(
|
|
3685
|
+
drifted ? "update" : "no-change",
|
|
3686
|
+
"network-segment",
|
|
3687
|
+
segment.key,
|
|
3688
|
+
summary,
|
|
3689
|
+
drifted ? {
|
|
3690
|
+
kind: "update-network-segment",
|
|
3691
|
+
key: segment.key,
|
|
3692
|
+
id: found.id,
|
|
3693
|
+
body: segmentReplaceBody(segment, found)
|
|
3694
|
+
} : { kind: "noop" }
|
|
3695
|
+
);
|
|
3696
|
+
}
|
|
3697
|
+
const bySegment = new Map((spec.profiles ?? []).map((p) => [p.segment, p]));
|
|
3698
|
+
for (const segment of segments) {
|
|
3699
|
+
const profile = bySegment.get(segment.key);
|
|
3700
|
+
if (!profile) continue;
|
|
3701
|
+
const segmentId = resolved.segments.get(segment.key);
|
|
3702
|
+
const found = segmentId ? read.profiles.get(segmentId) : void 0;
|
|
3703
|
+
const summary = `network profile of ${JSON.stringify(`${segment.site}/${segment.kind}/${segment.name}`)}`;
|
|
3704
|
+
if (!found) {
|
|
3705
|
+
push("create", "network-profile", segment.key, summary, {
|
|
3706
|
+
kind: "create-network-profile",
|
|
3707
|
+
segment: segment.key,
|
|
3708
|
+
profile: profileCreateInput(profile)
|
|
3709
|
+
});
|
|
3710
|
+
continue;
|
|
3711
|
+
}
|
|
3712
|
+
const drifted = profileDrifted(profile, found);
|
|
3713
|
+
push(
|
|
3714
|
+
drifted ? "update" : "no-change",
|
|
3715
|
+
"network-profile",
|
|
3716
|
+
segment.key,
|
|
3717
|
+
summary,
|
|
3718
|
+
drifted ? {
|
|
3719
|
+
kind: "update-network-profile",
|
|
3720
|
+
segment: segment.key,
|
|
3721
|
+
version: found.version,
|
|
3722
|
+
profile: profileReplaceInput(profile, found)
|
|
3723
|
+
} : { kind: "noop" }
|
|
3724
|
+
);
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3500
3727
|
/**
|
|
3501
3728
|
* §27.6.1 item 2 — one subject's `roles[]` against the server's existing
|
|
3502
3729
|
* bindings for it. Shared by groups, users and service accounts: the
|
|
@@ -3564,9 +3791,14 @@ var ManifestApi = class {
|
|
|
3564
3791
|
}
|
|
3565
3792
|
} catch (err) {
|
|
3566
3793
|
stopped = true;
|
|
3794
|
+
const reasonCode = err instanceof ConflictError ? err.reasonCode : void 0;
|
|
3567
3795
|
out.push({
|
|
3568
3796
|
action,
|
|
3569
|
-
outcome: {
|
|
3797
|
+
outcome: {
|
|
3798
|
+
status: "failed",
|
|
3799
|
+
message: err instanceof Error ? err.message : String(err),
|
|
3800
|
+
...reasonCode === void 0 ? {} : { reasonCode }
|
|
3801
|
+
}
|
|
3570
3802
|
});
|
|
3571
3803
|
}
|
|
3572
3804
|
}
|
|
@@ -3673,6 +3905,34 @@ var ManifestApi = class {
|
|
|
3673
3905
|
description: step.description
|
|
3674
3906
|
});
|
|
3675
3907
|
return void 0;
|
|
3908
|
+
case "update-network-policy":
|
|
3909
|
+
await c.network.replacePolicy(step.body);
|
|
3910
|
+
return void 0;
|
|
3911
|
+
case "create-network-segment": {
|
|
3912
|
+
const created = await c.network.createSegment(step.body);
|
|
3913
|
+
resolved.segments.set(step.key, created.id);
|
|
3914
|
+
resolved.segmentVersions.set(step.key, created.version);
|
|
3915
|
+
return void 0;
|
|
3916
|
+
}
|
|
3917
|
+
case "update-network-segment": {
|
|
3918
|
+
const replaced = await c.network.replaceSegment(step.id, step.body);
|
|
3919
|
+
resolved.segmentVersions.set(step.key, replaced.version);
|
|
3920
|
+
return void 0;
|
|
3921
|
+
}
|
|
3922
|
+
case "create-network-profile":
|
|
3923
|
+
await c.network.createProfile({
|
|
3924
|
+
segment_id: lookup(resolved.segments, step.segment, "network segment"),
|
|
3925
|
+
segment_version: lookupVersion(resolved.segmentVersions, step.segment),
|
|
3926
|
+
profile: step.profile
|
|
3927
|
+
});
|
|
3928
|
+
return void 0;
|
|
3929
|
+
case "update-network-profile":
|
|
3930
|
+
await c.network.replaceProfile(lookup(resolved.segments, step.segment, "network segment"), {
|
|
3931
|
+
version: step.version,
|
|
3932
|
+
segment_version: lookupVersion(resolved.segmentVersions, step.segment),
|
|
3933
|
+
profile: step.profile
|
|
3934
|
+
});
|
|
3935
|
+
return void 0;
|
|
3676
3936
|
case "assign-role":
|
|
3677
3937
|
await this.#assign(step, resolved);
|
|
3678
3938
|
return void 0;
|
|
@@ -3810,6 +4070,107 @@ function lookup(map, key, kind) {
|
|
|
3810
4070
|
}
|
|
3811
4071
|
return id;
|
|
3812
4072
|
}
|
|
4073
|
+
function hasShapeSections(manifest) {
|
|
4074
|
+
return [
|
|
4075
|
+
manifest.resources,
|
|
4076
|
+
manifest.permissions,
|
|
4077
|
+
manifest.roles,
|
|
4078
|
+
manifest.groups,
|
|
4079
|
+
manifest.users,
|
|
4080
|
+
manifest.serviceAccounts
|
|
4081
|
+
].some((section) => (section ?? []).length > 0);
|
|
4082
|
+
}
|
|
4083
|
+
function lookupVersion(map, key) {
|
|
4084
|
+
const version = map.get(key);
|
|
4085
|
+
if (version === void 0) {
|
|
4086
|
+
throw new NetworkError(
|
|
4087
|
+
`internal: network segment key ${JSON.stringify(key)} has no version; its segment write did not run`
|
|
4088
|
+
);
|
|
4089
|
+
}
|
|
4090
|
+
return version;
|
|
4091
|
+
}
|
|
4092
|
+
function sameSet(a, b) {
|
|
4093
|
+
if (a.length !== b.length) return false;
|
|
4094
|
+
const left = new Set(a);
|
|
4095
|
+
return left.size === new Set(b).size && b.every((name) => left.has(name));
|
|
4096
|
+
}
|
|
4097
|
+
function sameOptional(stated, read) {
|
|
4098
|
+
return (stated ?? null) === (read ?? null);
|
|
4099
|
+
}
|
|
4100
|
+
function segmentCreateBody(spec) {
|
|
4101
|
+
const body = {
|
|
4102
|
+
kind: spec.kind,
|
|
4103
|
+
site_key: spec.site,
|
|
4104
|
+
name: spec.name,
|
|
4105
|
+
vlan_id: spec.vlanId
|
|
4106
|
+
};
|
|
4107
|
+
if (spec.filterIds !== void 0) body.filter_ids = [...spec.filterIds];
|
|
4108
|
+
if (spec.rank !== void 0 && spec.rank !== null) body.rank = spec.rank;
|
|
4109
|
+
if (spec.enabled !== void 0) body.enabled = spec.enabled;
|
|
4110
|
+
return body;
|
|
4111
|
+
}
|
|
4112
|
+
function segmentDrifted(spec, read) {
|
|
4113
|
+
if (spec.vlanId !== read.vlan_id) return true;
|
|
4114
|
+
if (spec.rank !== void 0 && !sameOptional(spec.rank, read.rank)) return true;
|
|
4115
|
+
if (spec.enabled !== void 0 && spec.enabled !== read.enabled) return true;
|
|
4116
|
+
if (spec.filterIds !== void 0 && !sameSet(spec.filterIds, read.filter_ids)) return true;
|
|
4117
|
+
return false;
|
|
4118
|
+
}
|
|
4119
|
+
function segmentReplaceBody(spec, read) {
|
|
4120
|
+
const body = {
|
|
4121
|
+
version: read.version,
|
|
4122
|
+
vlan_id: spec.vlanId,
|
|
4123
|
+
filter_ids: [...spec.filterIds ?? read.filter_ids],
|
|
4124
|
+
enabled: spec.enabled ?? read.enabled
|
|
4125
|
+
};
|
|
4126
|
+
const rank = spec.rank === void 0 ? read.rank : spec.rank;
|
|
4127
|
+
if (rank !== void 0 && rank !== null) body.rank = rank;
|
|
4128
|
+
return body;
|
|
4129
|
+
}
|
|
4130
|
+
function profileCreateInput(spec) {
|
|
4131
|
+
const profile = { session_timeout_secs: spec.sessionTimeoutSecs };
|
|
4132
|
+
if (spec.terminationAction != null) profile.termination_action = spec.terminationAction;
|
|
4133
|
+
if (spec.idleTimeoutSecs != null) profile.idle_timeout_secs = spec.idleTimeoutSecs;
|
|
4134
|
+
if (spec.filterId != null) profile.filter_id = spec.filterId;
|
|
4135
|
+
if (spec.serviceType != null) profile.service_type = spec.serviceType;
|
|
4136
|
+
return profile;
|
|
4137
|
+
}
|
|
4138
|
+
function profileDrifted(spec, read) {
|
|
4139
|
+
if (spec.sessionTimeoutSecs !== read.session_timeout_secs) return true;
|
|
4140
|
+
if (spec.terminationAction !== void 0 && spec.terminationAction !== null && spec.terminationAction !== read.termination_action) return true;
|
|
4141
|
+
if (spec.idleTimeoutSecs !== void 0 && !sameOptional(spec.idleTimeoutSecs, read.idle_timeout_secs)) return true;
|
|
4142
|
+
if (spec.filterId !== void 0 && !sameOptional(spec.filterId, read.filter_id)) return true;
|
|
4143
|
+
if (spec.serviceType !== void 0 && !sameOptional(spec.serviceType, read.service_type)) return true;
|
|
4144
|
+
return false;
|
|
4145
|
+
}
|
|
4146
|
+
var KNOWN_TERMINATION_ACTIONS = ["default", "radius_request"];
|
|
4147
|
+
var KNOWN_SERVICE_TYPES = ["framed_user"];
|
|
4148
|
+
function refuseUnknownCarried(member, stated, read, known) {
|
|
4149
|
+
if (stated !== void 0 || read == null || known.includes(read)) return;
|
|
4150
|
+
throw new ValidationError(
|
|
4151
|
+
"manifest.plan",
|
|
4152
|
+
400,
|
|
4153
|
+
`network profile: ${member} was read as ${JSON.stringify(read)}, a value this SDK does not know, and the manifest does not state it; state ${member} to update this profile (CONTRACT.md \xA727.6.2 item 4)`,
|
|
4154
|
+
[{ field: member, message: `unknown value ${JSON.stringify(read)} on an unstated member` }]
|
|
4155
|
+
);
|
|
4156
|
+
}
|
|
4157
|
+
function profileReplaceInput(spec, read) {
|
|
4158
|
+
const profile = {
|
|
4159
|
+
dictionary: read.dictionary,
|
|
4160
|
+
session_timeout_secs: spec.sessionTimeoutSecs
|
|
4161
|
+
};
|
|
4162
|
+
refuseUnknownCarried("termination_action", spec.terminationAction, read.termination_action, KNOWN_TERMINATION_ACTIONS);
|
|
4163
|
+
refuseUnknownCarried("service_type", spec.serviceType, read.service_type, KNOWN_SERVICE_TYPES);
|
|
4164
|
+
const termination = spec.terminationAction === void 0 ? read.termination_action : spec.terminationAction;
|
|
4165
|
+
if (termination != null) profile.termination_action = termination;
|
|
4166
|
+
const idle = spec.idleTimeoutSecs === void 0 ? read.idle_timeout_secs : spec.idleTimeoutSecs;
|
|
4167
|
+
if (idle != null) profile.idle_timeout_secs = idle;
|
|
4168
|
+
const filter = spec.filterId === void 0 ? read.filter_id : spec.filterId;
|
|
4169
|
+
if (filter != null) profile.filter_id = filter;
|
|
4170
|
+
const serviceType = spec.serviceType === void 0 ? read.service_type : spec.serviceType;
|
|
4171
|
+
if (serviceType != null) profile.service_type = serviceType;
|
|
4172
|
+
return profile;
|
|
4173
|
+
}
|
|
3813
4174
|
function bindingOf(assignment) {
|
|
3814
4175
|
return {
|
|
3815
4176
|
resourceId: assignment.resource_id ?? void 0,
|
|
@@ -3927,7 +4288,12 @@ function mapManagementError(operation, err) {
|
|
|
3927
4288
|
);
|
|
3928
4289
|
}
|
|
3929
4290
|
if (status === 409) {
|
|
3930
|
-
|
|
4291
|
+
const code = body?.reason_code;
|
|
4292
|
+
return new ConflictError(
|
|
4293
|
+
operation,
|
|
4294
|
+
`${operation}: conflict${detail}`,
|
|
4295
|
+
typeof code === "string" ? code : void 0
|
|
4296
|
+
);
|
|
3931
4297
|
}
|
|
3932
4298
|
if (status === 400 || status === 422) {
|
|
3933
4299
|
return new ValidationError(
|
|
@@ -3937,7 +4303,7 @@ function mapManagementError(operation, err) {
|
|
|
3937
4303
|
parseFieldErrors(body)
|
|
3938
4304
|
);
|
|
3939
4305
|
}
|
|
3940
|
-
return mapHttpStatusToError(status, `${operation}${detail}`, { cause: err });
|
|
4306
|
+
return mapHttpStatusToError(status, `${operation}${detail}`, { cause: err, body });
|
|
3941
4307
|
}
|
|
3942
4308
|
function describe(body) {
|
|
3943
4309
|
if (typeof body === "string" && body) return `: ${body}`;
|
|
@@ -5231,7 +5597,7 @@ var CertificatesApi = class {
|
|
|
5231
5597
|
method: "POST",
|
|
5232
5598
|
pathTemplate: "/api/v1/certificates",
|
|
5233
5599
|
path: "/api/v1/certificates",
|
|
5234
|
-
body
|
|
5600
|
+
body: omitNullMembers(body, ["user_id"])
|
|
5235
5601
|
});
|
|
5236
5602
|
return generatedCertificateFromWire(wire);
|
|
5237
5603
|
}
|
|
@@ -5248,7 +5614,7 @@ var CertificatesApi = class {
|
|
|
5248
5614
|
method: "POST",
|
|
5249
5615
|
pathTemplate: "/api/v1/certificates/sign-csr",
|
|
5250
5616
|
path: "/api/v1/certificates/sign-csr",
|
|
5251
|
-
body
|
|
5617
|
+
body: omitNullMembers(body, ["user_id"])
|
|
5252
5618
|
});
|
|
5253
5619
|
return wire;
|
|
5254
5620
|
}
|
|
@@ -6642,7 +7008,7 @@ var SsfApi = class _SsfApi {
|
|
|
6642
7008
|
method: "POST",
|
|
6643
7009
|
pathTemplate: "/api/v1/tenants/{tenant_id}/ssf/streams",
|
|
6644
7010
|
path: `/api/v1/tenants/${tenantId}/ssf/streams`,
|
|
6645
|
-
body: ssfStreamInputToWire(body)
|
|
7011
|
+
body: omitNullMembers(ssfStreamInputToWire(body), ["expected_updated_at"])
|
|
6646
7012
|
});
|
|
6647
7013
|
return scrubSsfStream(wire);
|
|
6648
7014
|
}
|
|
@@ -6665,8 +7031,19 @@ var SsfApi = class _SsfApi {
|
|
|
6665
7031
|
* update moves `endpoint_url` to another scheme, host or port while a header
|
|
6666
7032
|
* is stored: then it must carry `authorization_header` again or
|
|
6667
7033
|
* `clear_authorization_header: true`, else `400` (§32.3 rule 5). Start from
|
|
6668
|
-
* `
|
|
6669
|
-
*
|
|
7034
|
+
* `ssfStreamInputWith(await ssf.getStream(id), changes)`, which sends the
|
|
7035
|
+
* `events_requested` and `expected_updated_at` it read and cuts
|
|
7036
|
+
* `events_requested` to a lowered `events_allowed` (or from the plain
|
|
7037
|
+
* converter `ssfStreamInputFrom`, where the cut is yours). An update
|
|
7038
|
+
* overtaken by the receiver's own write is `409`: read the stream again.
|
|
7039
|
+
* **`events_requested` has three meanings on an update** (§32.2, contract
|
|
7040
|
+
* 1.62): **absent resets** the stream to every event of `events_allowed` —
|
|
7041
|
+
* widening what the receiver narrowed; **`[]` is stored as the receiver's
|
|
7042
|
+
* "none"** and the stream carries nothing; **a list is stored as given** and
|
|
7043
|
+
* refused (`400`) if any entry is outside `events_allowed`. A raw API client
|
|
7044
|
+
* is bound by the same meaning: an `events_requested` left out of the `PUT`
|
|
7045
|
+
* resets the stream. `expected_updated_at` is the `updated_at` you read, as
|
|
7046
|
+
* the server's own string; an assigned `null` is "none" and is not sent.
|
|
6670
7047
|
*
|
|
6671
7048
|
* **This is a replacement, not a patch** (§27.4 rule 5). Only the required
|
|
6672
7049
|
* members must be set, but what you do not carry over from a prior read is
|
|
@@ -6684,7 +7061,7 @@ var SsfApi = class _SsfApi {
|
|
|
6684
7061
|
method: "PUT",
|
|
6685
7062
|
pathTemplate: "/api/v1/tenants/{tenant_id}/ssf/streams/{stream_id}",
|
|
6686
7063
|
path: `/api/v1/tenants/${tenantId}/ssf/streams/${encodeURIComponent(streamId)}`,
|
|
6687
|
-
body: ssfStreamInputToWire(body)
|
|
7064
|
+
body: omitNullMembers(ssfStreamInputToWire(body), ["expected_updated_at"])
|
|
6688
7065
|
});
|
|
6689
7066
|
return scrubSsfStream(wire);
|
|
6690
7067
|
}
|
|
@@ -6752,7 +7129,7 @@ var ScimTargetsApi = class {
|
|
|
6752
7129
|
method: "POST",
|
|
6753
7130
|
pathTemplate: "/api/v1/scim-targets",
|
|
6754
7131
|
path: "/api/v1/scim-targets",
|
|
6755
|
-
body: scimTargetInputToWire(body)
|
|
7132
|
+
body: omitNullMembers(scimTargetInputToWire(body), ["expected_updated_at"])
|
|
6756
7133
|
});
|
|
6757
7134
|
return scrubScimTargetResponse(wire);
|
|
6758
7135
|
}
|
|
@@ -6799,7 +7176,7 @@ var ScimTargetsApi = class {
|
|
|
6799
7176
|
method: "PUT",
|
|
6800
7177
|
pathTemplate: "/api/v1/scim-targets/{id}",
|
|
6801
7178
|
path: `/api/v1/scim-targets/${encodeURIComponent(id)}`,
|
|
6802
|
-
body: scimTargetInputToWire(body)
|
|
7179
|
+
body: omitNullMembers(scimTargetInputToWire(body), ["expected_updated_at"])
|
|
6803
7180
|
});
|
|
6804
7181
|
return scrubScimTargetResponse(wire);
|
|
6805
7182
|
}
|
|
@@ -6843,6 +7220,215 @@ var ScimTargetsApi = class {
|
|
|
6843
7220
|
}
|
|
6844
7221
|
};
|
|
6845
7222
|
|
|
7223
|
+
// src/management/ops/network.ts
|
|
7224
|
+
var NetworkApi = class {
|
|
7225
|
+
#client;
|
|
7226
|
+
#scope;
|
|
7227
|
+
/** @internal — reached through `client.<namespace>`, never constructed directly. */
|
|
7228
|
+
constructor(client, scope = {}) {
|
|
7229
|
+
this.#client = client;
|
|
7230
|
+
this.#scope = scope;
|
|
7231
|
+
}
|
|
7232
|
+
/** `GET /api/v1/network/segments` */
|
|
7233
|
+
async listSegments(site, page = {}) {
|
|
7234
|
+
const wire = await sendManagement(this.#client, {
|
|
7235
|
+
operation: "network.list_segments",
|
|
7236
|
+
method: "GET",
|
|
7237
|
+
pathTemplate: "/api/v1/network/segments",
|
|
7238
|
+
path: "/api/v1/network/segments",
|
|
7239
|
+
query: { ...pageQuery(page), "site": site }
|
|
7240
|
+
});
|
|
7241
|
+
return wire;
|
|
7242
|
+
}
|
|
7243
|
+
/**
|
|
7244
|
+
* Walk `network.list_segments` to exhaustion, concatenating every page.
|
|
7245
|
+
*
|
|
7246
|
+
* The auto-paging form §27.4 rule 4 requires. It stops on an empty page even
|
|
7247
|
+
* if `total` disagrees, so a misreporting server costs one wasted request
|
|
7248
|
+
* rather than an unbounded loop.
|
|
7249
|
+
*/
|
|
7250
|
+
listSegmentsAll(site, start = {}) {
|
|
7251
|
+
return collectPages(start, (p) => this.listSegments(site, p));
|
|
7252
|
+
}
|
|
7253
|
+
/**
|
|
7254
|
+
* `POST /api/v1/network/segments`
|
|
7255
|
+
*
|
|
7256
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7257
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7258
|
+
*/
|
|
7259
|
+
async createSegment(body) {
|
|
7260
|
+
const wire = await sendManagement(this.#client, {
|
|
7261
|
+
operation: "network.create_segment",
|
|
7262
|
+
method: "POST",
|
|
7263
|
+
pathTemplate: "/api/v1/network/segments",
|
|
7264
|
+
path: "/api/v1/network/segments",
|
|
7265
|
+
body
|
|
7266
|
+
});
|
|
7267
|
+
return wire;
|
|
7268
|
+
}
|
|
7269
|
+
/** `GET /api/v1/network/segments/{id}` */
|
|
7270
|
+
async getSegment(id) {
|
|
7271
|
+
const wire = await sendManagement(this.#client, {
|
|
7272
|
+
operation: "network.get_segment",
|
|
7273
|
+
method: "GET",
|
|
7274
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
7275
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`
|
|
7276
|
+
});
|
|
7277
|
+
return wire;
|
|
7278
|
+
}
|
|
7279
|
+
/**
|
|
7280
|
+
* `PUT /api/v1/network/segments/{id}`
|
|
7281
|
+
*
|
|
7282
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Only the required
|
|
7283
|
+
* members must be set, but what you do not carry over from a prior read is
|
|
7284
|
+
* not preserved: an optional member left out is overwritten with its
|
|
7285
|
+
* default, not kept (except where noted above). Read first, change the field
|
|
7286
|
+
* you mean, send the whole thing back.
|
|
7287
|
+
*
|
|
7288
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7289
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7290
|
+
*/
|
|
7291
|
+
async replaceSegment(id, body) {
|
|
7292
|
+
const wire = await sendManagement(this.#client, {
|
|
7293
|
+
operation: "network.replace_segment",
|
|
7294
|
+
method: "PUT",
|
|
7295
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
7296
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`,
|
|
7297
|
+
body
|
|
7298
|
+
});
|
|
7299
|
+
return wire;
|
|
7300
|
+
}
|
|
7301
|
+
/**
|
|
7302
|
+
* `DELETE /api/v1/network/segments/{id}`
|
|
7303
|
+
*
|
|
7304
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7305
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7306
|
+
*/
|
|
7307
|
+
async deleteSegment(id, version) {
|
|
7308
|
+
await sendManagement(this.#client, {
|
|
7309
|
+
operation: "network.delete_segment",
|
|
7310
|
+
method: "DELETE",
|
|
7311
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
7312
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`,
|
|
7313
|
+
query: { "version": String(version) }
|
|
7314
|
+
});
|
|
7315
|
+
}
|
|
7316
|
+
/** `GET /api/v1/network/profiles` */
|
|
7317
|
+
async listProfiles(page = {}) {
|
|
7318
|
+
const wire = await sendManagement(this.#client, {
|
|
7319
|
+
operation: "network.list_profiles",
|
|
7320
|
+
method: "GET",
|
|
7321
|
+
pathTemplate: "/api/v1/network/profiles",
|
|
7322
|
+
path: "/api/v1/network/profiles",
|
|
7323
|
+
query: { ...pageQuery(page) }
|
|
7324
|
+
});
|
|
7325
|
+
return wire;
|
|
7326
|
+
}
|
|
7327
|
+
/**
|
|
7328
|
+
* Walk `network.list_profiles` to exhaustion, concatenating every page.
|
|
7329
|
+
*
|
|
7330
|
+
* The auto-paging form §27.4 rule 4 requires. It stops on an empty page even
|
|
7331
|
+
* if `total` disagrees, so a misreporting server costs one wasted request
|
|
7332
|
+
* rather than an unbounded loop.
|
|
7333
|
+
*/
|
|
7334
|
+
listProfilesAll(start = {}) {
|
|
7335
|
+
return collectPages(start, (p) => this.listProfiles(p));
|
|
7336
|
+
}
|
|
7337
|
+
/**
|
|
7338
|
+
* `POST /api/v1/network/profiles`
|
|
7339
|
+
*
|
|
7340
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7341
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7342
|
+
*/
|
|
7343
|
+
async createProfile(body) {
|
|
7344
|
+
const wire = await sendManagement(this.#client, {
|
|
7345
|
+
operation: "network.create_profile",
|
|
7346
|
+
method: "POST",
|
|
7347
|
+
pathTemplate: "/api/v1/network/profiles",
|
|
7348
|
+
path: "/api/v1/network/profiles",
|
|
7349
|
+
body
|
|
7350
|
+
});
|
|
7351
|
+
return wire;
|
|
7352
|
+
}
|
|
7353
|
+
/** `GET /api/v1/network/profiles/{segment_id}` */
|
|
7354
|
+
async getProfile(segmentId) {
|
|
7355
|
+
const wire = await sendManagement(this.#client, {
|
|
7356
|
+
operation: "network.get_profile",
|
|
7357
|
+
method: "GET",
|
|
7358
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
7359
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`
|
|
7360
|
+
});
|
|
7361
|
+
return wire;
|
|
7362
|
+
}
|
|
7363
|
+
/**
|
|
7364
|
+
* `PUT /api/v1/network/profiles/{segment_id}`
|
|
7365
|
+
*
|
|
7366
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Every field of the
|
|
7367
|
+
* body is required, and what you do not carry over from a prior read is not
|
|
7368
|
+
* preserved — it is overwritten. Read first, change the field you mean, send
|
|
7369
|
+
* the whole thing back.
|
|
7370
|
+
*
|
|
7371
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7372
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7373
|
+
*/
|
|
7374
|
+
async replaceProfile(segmentId, body) {
|
|
7375
|
+
const wire = await sendManagement(this.#client, {
|
|
7376
|
+
operation: "network.replace_profile",
|
|
7377
|
+
method: "PUT",
|
|
7378
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
7379
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`,
|
|
7380
|
+
body
|
|
7381
|
+
});
|
|
7382
|
+
return wire;
|
|
7383
|
+
}
|
|
7384
|
+
/**
|
|
7385
|
+
* `DELETE /api/v1/network/profiles/{segment_id}`
|
|
7386
|
+
*
|
|
7387
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7388
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7389
|
+
*/
|
|
7390
|
+
async deleteProfile(segmentId, version) {
|
|
7391
|
+
await sendManagement(this.#client, {
|
|
7392
|
+
operation: "network.delete_profile",
|
|
7393
|
+
method: "DELETE",
|
|
7394
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
7395
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`,
|
|
7396
|
+
query: { "version": String(version) }
|
|
7397
|
+
});
|
|
7398
|
+
}
|
|
7399
|
+
/** `GET /api/v1/network/policy` */
|
|
7400
|
+
async getPolicy() {
|
|
7401
|
+
const wire = await sendManagement(this.#client, {
|
|
7402
|
+
operation: "network.get_policy",
|
|
7403
|
+
method: "GET",
|
|
7404
|
+
pathTemplate: "/api/v1/network/policy",
|
|
7405
|
+
path: "/api/v1/network/policy"
|
|
7406
|
+
});
|
|
7407
|
+
return wire;
|
|
7408
|
+
}
|
|
7409
|
+
/**
|
|
7410
|
+
* `PUT /api/v1/network/policy`
|
|
7411
|
+
*
|
|
7412
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Every field of the
|
|
7413
|
+
* body is required, and what you do not carry over from a prior read is not
|
|
7414
|
+
* preserved — it is overwritten. Read first, change the field you mean, send
|
|
7415
|
+
* the whole thing back.
|
|
7416
|
+
*
|
|
7417
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7418
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7419
|
+
*/
|
|
7420
|
+
async replacePolicy(body) {
|
|
7421
|
+
const wire = await sendManagement(this.#client, {
|
|
7422
|
+
operation: "network.replace_policy",
|
|
7423
|
+
method: "PUT",
|
|
7424
|
+
pathTemplate: "/api/v1/network/policy",
|
|
7425
|
+
path: "/api/v1/network/policy",
|
|
7426
|
+
body
|
|
7427
|
+
});
|
|
7428
|
+
return wire;
|
|
7429
|
+
}
|
|
7430
|
+
};
|
|
7431
|
+
|
|
6846
7432
|
// src/management/ops/settings.ts
|
|
6847
7433
|
var SettingsApi = class _SettingsApi {
|
|
6848
7434
|
#client;
|
|
@@ -7467,6 +8053,9 @@ function managementNamespaces(client) {
|
|
|
7467
8053
|
get scimTargets() {
|
|
7468
8054
|
return new ScimTargetsApi(client);
|
|
7469
8055
|
},
|
|
8056
|
+
get network() {
|
|
8057
|
+
return new NetworkApi(client);
|
|
8058
|
+
},
|
|
7470
8059
|
get settings() {
|
|
7471
8060
|
return new SettingsApi(client);
|
|
7472
8061
|
},
|