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.mjs
CHANGED
|
@@ -1180,6 +1180,12 @@ var SKIP_REFRESH = [
|
|
|
1180
1180
|
// regardless of what session state came before it.
|
|
1181
1181
|
"/api/v1/auth/device",
|
|
1182
1182
|
"/oauth2/token",
|
|
1183
|
+
// CONTRACT.md §14.2 rule 5 (contract 1.62): a client that fails to
|
|
1184
|
+
// authenticate at the device endpoints is `401 invalid_client`, which is not
|
|
1185
|
+
// an expired session and which refreshing cannot fix. `/oauth2/token` (the
|
|
1186
|
+
// poll) was already here; the authorization endpoint now authenticates the
|
|
1187
|
+
// client too, so its 401 must not enter the §9 guard either.
|
|
1188
|
+
"/oauth2/device_authorization",
|
|
1183
1189
|
"/oauth2/introspect",
|
|
1184
1190
|
"/oauth2/revoke"
|
|
1185
1191
|
];
|
|
@@ -1188,6 +1194,9 @@ function installCsrfInterceptor(axiosInstance, session) {
|
|
|
1188
1194
|
if (session.isForeignHost(config.url)) {
|
|
1189
1195
|
return config;
|
|
1190
1196
|
}
|
|
1197
|
+
if (isOAuth2Endpoint(config.url, session.baseUrl)) {
|
|
1198
|
+
return config;
|
|
1199
|
+
}
|
|
1191
1200
|
const method = (config.method ?? "get").toLowerCase();
|
|
1192
1201
|
const cookieString = typeof document !== "undefined" ? document.cookie : "";
|
|
1193
1202
|
const csrfToken = typeof document !== "undefined" ? csrfHeaderForMethod(method, cookieString) : csrfHeaderForMethod(method, session.csrfToken ? `axiam_csrf=${session.csrfToken}` : "");
|
|
@@ -1241,15 +1250,35 @@ function installRefreshInterceptor(axiosInstance, session) {
|
|
|
1241
1250
|
}
|
|
1242
1251
|
);
|
|
1243
1252
|
}
|
|
1253
|
+
function isOAuth2Endpoint(url, baseUrl) {
|
|
1254
|
+
if (!url) {
|
|
1255
|
+
return false;
|
|
1256
|
+
}
|
|
1257
|
+
try {
|
|
1258
|
+
const base = new URL(baseUrl);
|
|
1259
|
+
let path = new URL(url, base).pathname;
|
|
1260
|
+
const prefix = base.pathname.replace(/\/+$/, "");
|
|
1261
|
+
if (prefix !== "" && path.startsWith(`${prefix}/`)) {
|
|
1262
|
+
path = path.slice(prefix.length);
|
|
1263
|
+
}
|
|
1264
|
+
return path.startsWith("/oauth2/");
|
|
1265
|
+
} catch {
|
|
1266
|
+
return false;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1244
1269
|
function installDeviceTokenInterceptor(axiosInstance, session) {
|
|
1245
1270
|
axiosInstance.interceptors.request.use((config) => {
|
|
1246
1271
|
const deviceToken = session.deviceAccessToken;
|
|
1247
|
-
|
|
1272
|
+
const oauth2 = isOAuth2Endpoint(config.url, session.baseUrl);
|
|
1273
|
+
if (session.isForeignHost(config.url) || deviceToken === void 0 && !oauth2) {
|
|
1248
1274
|
return config;
|
|
1249
1275
|
}
|
|
1250
1276
|
const noCred = session.noCredentialsConfig();
|
|
1251
1277
|
Object.assign(config, noCred);
|
|
1252
1278
|
config.headers = config.headers ?? {};
|
|
1279
|
+
if (oauth2) {
|
|
1280
|
+
return config;
|
|
1281
|
+
}
|
|
1253
1282
|
config.headers["Authorization"] = `Bearer ${deviceToken.expose()}`;
|
|
1254
1283
|
config.headers["Cookie"] = "";
|
|
1255
1284
|
return config;
|
|
@@ -2208,10 +2237,25 @@ var NotFoundError = class _NotFoundError extends AuthzError {
|
|
|
2208
2237
|
var ConflictError = class _ConflictError extends AuthzError {
|
|
2209
2238
|
/** The registry operation that conflicted. */
|
|
2210
2239
|
operation;
|
|
2211
|
-
|
|
2240
|
+
/**
|
|
2241
|
+
* The body's `reason_code`, as the server spelled it (contract 1.62, §36.4),
|
|
2242
|
+
* or `undefined` when the body carries none (a server that predates it, or a
|
|
2243
|
+
* `409` of an operation that does not name one).
|
|
2244
|
+
*
|
|
2245
|
+
* The `409` of every `network` operation says which conflict it is:
|
|
2246
|
+
* `stale_version`, `strands_profile`, `has_children`, `site_gone`,
|
|
2247
|
+
* `duplicate_name`, `duplicate_vlan`, `duplicate_rank`, `profile_exists` or
|
|
2248
|
+
* `other` (§36.3 rule 2). The vocabulary is **open**: a value this SDK does
|
|
2249
|
+
* not know is surfaced verbatim, and a caller branches on this member —
|
|
2250
|
+
* never on `message`, which an SDK must not parse. It is not the `reason` of
|
|
2251
|
+
* an authorization decision (§3), which is a human string.
|
|
2252
|
+
*/
|
|
2253
|
+
reasonCode;
|
|
2254
|
+
constructor(operation, message, reasonCode) {
|
|
2212
2255
|
super(message);
|
|
2213
2256
|
this.name = "ConflictError";
|
|
2214
2257
|
this.operation = operation;
|
|
2258
|
+
this.reasonCode = reasonCode;
|
|
2215
2259
|
Object.setPrototypeOf(this, _ConflictError.prototype);
|
|
2216
2260
|
}
|
|
2217
2261
|
};
|
|
@@ -2500,6 +2544,14 @@ function omitEmptyTenantScope(body) {
|
|
|
2500
2544
|
}
|
|
2501
2545
|
return body;
|
|
2502
2546
|
}
|
|
2547
|
+
function omitNullMembers(body, members) {
|
|
2548
|
+
if (!body || typeof body !== "object") return body;
|
|
2549
|
+
const record = body;
|
|
2550
|
+
if (!members.some((m) => m in record && record[m] === null)) return body;
|
|
2551
|
+
const copy = { ...record };
|
|
2552
|
+
for (const m of members) if (copy[m] === null) delete copy[m];
|
|
2553
|
+
return copy;
|
|
2554
|
+
}
|
|
2503
2555
|
function roleAssignmentInherits(assignment) {
|
|
2504
2556
|
return assignment.inherit ?? true;
|
|
2505
2557
|
}
|
|
@@ -2972,6 +3024,7 @@ function validate(manifest) {
|
|
|
2972
3024
|
const groups = manifest.groups ?? [];
|
|
2973
3025
|
const users = manifest.users ?? [];
|
|
2974
3026
|
const serviceAccounts = manifest.serviceAccounts ?? [];
|
|
3027
|
+
const network = manifest.network;
|
|
2975
3028
|
const resourceKeys = new Set(resources.map((r) => r.key));
|
|
2976
3029
|
const scopeKeys = new Set(resources.flatMap((r) => (r.scopes ?? []).map((s) => s.key)));
|
|
2977
3030
|
const permissionKeys = new Set(permissions.map((p) => p.key));
|
|
@@ -2985,6 +3038,7 @@ function validate(manifest) {
|
|
|
2985
3038
|
duplicates("group", groups.map((g) => g.key), problems);
|
|
2986
3039
|
duplicates("user", users.map((u) => u.key), problems);
|
|
2987
3040
|
duplicates("service account", serviceAccounts.map((s) => s.key), problems);
|
|
3041
|
+
if (network !== void 0) validateNetwork(network, problems);
|
|
2988
3042
|
for (const resource of resources) {
|
|
2989
3043
|
if (resource.parent && !resourceKeys.has(resource.parent)) {
|
|
2990
3044
|
problems.push(
|
|
@@ -3064,6 +3118,51 @@ function validate(manifest) {
|
|
|
3064
3118
|
}
|
|
3065
3119
|
}
|
|
3066
3120
|
var q = (s) => JSON.stringify(s);
|
|
3121
|
+
function validateNetwork(network, problems) {
|
|
3122
|
+
if (Array.isArray(network.policy)) {
|
|
3123
|
+
problems.push("network declares more than one policy; the tenant has exactly one");
|
|
3124
|
+
}
|
|
3125
|
+
const segments = network.segments ?? [];
|
|
3126
|
+
const profiles = network.profiles ?? [];
|
|
3127
|
+
duplicates("network segment", segments.map((s) => s.key), problems);
|
|
3128
|
+
const naturalKeys = /* @__PURE__ */ new Set();
|
|
3129
|
+
for (const segment of segments) {
|
|
3130
|
+
const natural = `${segment.site}/${segment.kind}/${segment.name}`;
|
|
3131
|
+
if (naturalKeys.has(natural)) {
|
|
3132
|
+
problems.push(
|
|
3133
|
+
`network segment ${q(natural)} (site, kind, name) is declared more than once`
|
|
3134
|
+
);
|
|
3135
|
+
}
|
|
3136
|
+
naturalKeys.add(natural);
|
|
3137
|
+
const seenFilters = /* @__PURE__ */ new Set();
|
|
3138
|
+
for (const filter of segment.filterIds ?? []) {
|
|
3139
|
+
if (seenFilters.has(filter)) {
|
|
3140
|
+
problems.push(
|
|
3141
|
+
`network segment ${q(segment.key)} lists Filter-Id ${q(filter)} more than once in filterIds`
|
|
3142
|
+
);
|
|
3143
|
+
}
|
|
3144
|
+
seenFilters.add(filter);
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
const segmentKeys = new Set(segments.map((s) => s.key));
|
|
3148
|
+
const profiled = /* @__PURE__ */ new Set();
|
|
3149
|
+
for (const profile of profiles) {
|
|
3150
|
+
if (!segmentKeys.has(profile.segment)) {
|
|
3151
|
+
problems.push(
|
|
3152
|
+
`network profile names segment ${q(profile.segment)}, which no network segment declares`
|
|
3153
|
+
);
|
|
3154
|
+
}
|
|
3155
|
+
if (profiled.has(profile.segment)) {
|
|
3156
|
+
problems.push(`network segment ${q(profile.segment)} has more than one profile in the manifest`);
|
|
3157
|
+
}
|
|
3158
|
+
profiled.add(profile.segment);
|
|
3159
|
+
if (profile.terminationAction === null) {
|
|
3160
|
+
problems.push(
|
|
3161
|
+
`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)`
|
|
3162
|
+
);
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3067
3166
|
function duplicates(kind, keys, problems) {
|
|
3068
3167
|
const seen = /* @__PURE__ */ new Set();
|
|
3069
3168
|
for (const key of keys) {
|
|
@@ -3109,7 +3208,9 @@ var emptyResolved = () => ({
|
|
|
3109
3208
|
roles: /* @__PURE__ */ new Map(),
|
|
3110
3209
|
groups: /* @__PURE__ */ new Map(),
|
|
3111
3210
|
users: /* @__PURE__ */ new Map(),
|
|
3112
|
-
serviceAccounts: /* @__PURE__ */ new Map()
|
|
3211
|
+
serviceAccounts: /* @__PURE__ */ new Map(),
|
|
3212
|
+
segments: /* @__PURE__ */ new Map(),
|
|
3213
|
+
segmentVersions: /* @__PURE__ */ new Map()
|
|
3113
3214
|
});
|
|
3114
3215
|
var ManifestApi = class {
|
|
3115
3216
|
#client;
|
|
@@ -3142,6 +3243,23 @@ var ManifestApi = class {
|
|
|
3142
3243
|
async #read(manifest) {
|
|
3143
3244
|
const c = this.#client;
|
|
3144
3245
|
const start = { limit: PLAN_PAGE };
|
|
3246
|
+
if (manifest.network !== void 0 && !hasShapeSections(manifest)) {
|
|
3247
|
+
return {
|
|
3248
|
+
resources: [],
|
|
3249
|
+
scopes: /* @__PURE__ */ new Map(),
|
|
3250
|
+
permissions: [],
|
|
3251
|
+
roles: [],
|
|
3252
|
+
groups: [],
|
|
3253
|
+
users: [],
|
|
3254
|
+
serviceAccounts: [],
|
|
3255
|
+
roleGrants: /* @__PURE__ */ new Map(),
|
|
3256
|
+
roleUserBindings: /* @__PURE__ */ new Map(),
|
|
3257
|
+
roleGroupBindings: /* @__PURE__ */ new Map(),
|
|
3258
|
+
roleServiceAccountBindings: /* @__PURE__ */ new Map(),
|
|
3259
|
+
groupMembers: /* @__PURE__ */ new Map(),
|
|
3260
|
+
network: await this.#readNetwork(manifest.network, start)
|
|
3261
|
+
};
|
|
3262
|
+
}
|
|
3145
3263
|
const resources = await c.resources.listAll(start);
|
|
3146
3264
|
const permissions = await c.permissions.listAll(start);
|
|
3147
3265
|
const roles = await c.roles.listAll(start);
|
|
@@ -3197,9 +3315,29 @@ var ManifestApi = class {
|
|
|
3197
3315
|
roleUserBindings,
|
|
3198
3316
|
roleGroupBindings,
|
|
3199
3317
|
roleServiceAccountBindings,
|
|
3200
|
-
groupMembers
|
|
3318
|
+
groupMembers,
|
|
3319
|
+
network: manifest.network ? await this.#readNetwork(manifest.network, start) : void 0
|
|
3201
3320
|
};
|
|
3202
3321
|
}
|
|
3322
|
+
/**
|
|
3323
|
+
* §27.6.2 item 3: `get_policy`, `list_segments` and `list_profiles`, each
|
|
3324
|
+
* list walked to exhaustion, and nothing else — `plan` issues `GET`s only.
|
|
3325
|
+
* A section that states no policy does not read it; one that states no
|
|
3326
|
+
* profile does not list them.
|
|
3327
|
+
*/
|
|
3328
|
+
async #readNetwork(spec, start) {
|
|
3329
|
+
const c = this.#client;
|
|
3330
|
+
const policy = spec.policy ? await c.network.getPolicy() : void 0;
|
|
3331
|
+
const wantSegments = (spec.segments ?? []).length > 0 || (spec.profiles ?? []).length > 0;
|
|
3332
|
+
const segments = wantSegments ? await c.network.listSegmentsAll(void 0, start) : [];
|
|
3333
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
3334
|
+
if ((spec.profiles ?? []).length) {
|
|
3335
|
+
for (const profile of await c.network.listProfilesAll(start)) {
|
|
3336
|
+
profiles.set(profile.segment_id, profile);
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
return { policy, segments, profiles };
|
|
3340
|
+
}
|
|
3203
3341
|
// -------------------------------------------------------------------
|
|
3204
3342
|
// Plan
|
|
3205
3343
|
// -------------------------------------------------------------------
|
|
@@ -3470,8 +3608,97 @@ var ManifestApi = class {
|
|
|
3470
3608
|
push
|
|
3471
3609
|
);
|
|
3472
3610
|
}
|
|
3611
|
+
if (manifest.network && snapshot.network) {
|
|
3612
|
+
this.#networkSteps(manifest.network, snapshot.network, resolved, push);
|
|
3613
|
+
}
|
|
3473
3614
|
return out;
|
|
3474
3615
|
}
|
|
3616
|
+
/**
|
|
3617
|
+
* §27.6.2 — the `network` section: the policy, then the segments, then the
|
|
3618
|
+
* profiles, a profile after its segment (item 2). Every comparison is with
|
|
3619
|
+
* the value **as the read returns it** (item 3): a profile's effective
|
|
3620
|
+
* (clamped) `session_timeout_secs`, a segment's `filter_ids` as a set.
|
|
3621
|
+
* Silence is not an assertion (rule 3): a member left off never drifts, and
|
|
3622
|
+
* the `Update` body carries the read's value for it (item 4).
|
|
3623
|
+
*/
|
|
3624
|
+
#networkSteps(spec, read, resolved, push) {
|
|
3625
|
+
if (spec.policy) {
|
|
3626
|
+
const current = read.policy;
|
|
3627
|
+
const drifted = current.session_timeout_max_secs !== spec.policy.sessionTimeoutMaxSecs;
|
|
3628
|
+
push(
|
|
3629
|
+
drifted ? "update" : "no-change",
|
|
3630
|
+
"network-policy",
|
|
3631
|
+
"network.policy",
|
|
3632
|
+
"network policy (Session-Timeout cap)",
|
|
3633
|
+
drifted ? {
|
|
3634
|
+
kind: "update-network-policy",
|
|
3635
|
+
body: {
|
|
3636
|
+
session_timeout_max_secs: spec.policy.sessionTimeoutMaxSecs,
|
|
3637
|
+
version: current.version
|
|
3638
|
+
}
|
|
3639
|
+
} : { kind: "noop" }
|
|
3640
|
+
);
|
|
3641
|
+
}
|
|
3642
|
+
const segments = spec.segments ?? [];
|
|
3643
|
+
for (const segment of segments) {
|
|
3644
|
+
const found = read.segments.find(
|
|
3645
|
+
(r) => r.site_key === segment.site && r.kind === segment.kind && r.name === segment.name
|
|
3646
|
+
);
|
|
3647
|
+
const summary = `network segment ${JSON.stringify(`${segment.site}/${segment.kind}/${segment.name}`)}`;
|
|
3648
|
+
if (!found) {
|
|
3649
|
+
push("create", "network-segment", segment.key, summary, {
|
|
3650
|
+
kind: "create-network-segment",
|
|
3651
|
+
key: segment.key,
|
|
3652
|
+
body: segmentCreateBody(segment)
|
|
3653
|
+
});
|
|
3654
|
+
continue;
|
|
3655
|
+
}
|
|
3656
|
+
resolved.segments.set(segment.key, found.id);
|
|
3657
|
+
resolved.segmentVersions.set(segment.key, found.version);
|
|
3658
|
+
const drifted = segmentDrifted(segment, found);
|
|
3659
|
+
push(
|
|
3660
|
+
drifted ? "update" : "no-change",
|
|
3661
|
+
"network-segment",
|
|
3662
|
+
segment.key,
|
|
3663
|
+
summary,
|
|
3664
|
+
drifted ? {
|
|
3665
|
+
kind: "update-network-segment",
|
|
3666
|
+
key: segment.key,
|
|
3667
|
+
id: found.id,
|
|
3668
|
+
body: segmentReplaceBody(segment, found)
|
|
3669
|
+
} : { kind: "noop" }
|
|
3670
|
+
);
|
|
3671
|
+
}
|
|
3672
|
+
const bySegment = new Map((spec.profiles ?? []).map((p) => [p.segment, p]));
|
|
3673
|
+
for (const segment of segments) {
|
|
3674
|
+
const profile = bySegment.get(segment.key);
|
|
3675
|
+
if (!profile) continue;
|
|
3676
|
+
const segmentId = resolved.segments.get(segment.key);
|
|
3677
|
+
const found = segmentId ? read.profiles.get(segmentId) : void 0;
|
|
3678
|
+
const summary = `network profile of ${JSON.stringify(`${segment.site}/${segment.kind}/${segment.name}`)}`;
|
|
3679
|
+
if (!found) {
|
|
3680
|
+
push("create", "network-profile", segment.key, summary, {
|
|
3681
|
+
kind: "create-network-profile",
|
|
3682
|
+
segment: segment.key,
|
|
3683
|
+
profile: profileCreateInput(profile)
|
|
3684
|
+
});
|
|
3685
|
+
continue;
|
|
3686
|
+
}
|
|
3687
|
+
const drifted = profileDrifted(profile, found);
|
|
3688
|
+
push(
|
|
3689
|
+
drifted ? "update" : "no-change",
|
|
3690
|
+
"network-profile",
|
|
3691
|
+
segment.key,
|
|
3692
|
+
summary,
|
|
3693
|
+
drifted ? {
|
|
3694
|
+
kind: "update-network-profile",
|
|
3695
|
+
segment: segment.key,
|
|
3696
|
+
version: found.version,
|
|
3697
|
+
profile: profileReplaceInput(profile, found)
|
|
3698
|
+
} : { kind: "noop" }
|
|
3699
|
+
);
|
|
3700
|
+
}
|
|
3701
|
+
}
|
|
3475
3702
|
/**
|
|
3476
3703
|
* §27.6.1 item 2 — one subject's `roles[]` against the server's existing
|
|
3477
3704
|
* bindings for it. Shared by groups, users and service accounts: the
|
|
@@ -3539,9 +3766,14 @@ var ManifestApi = class {
|
|
|
3539
3766
|
}
|
|
3540
3767
|
} catch (err) {
|
|
3541
3768
|
stopped = true;
|
|
3769
|
+
const reasonCode = err instanceof ConflictError ? err.reasonCode : void 0;
|
|
3542
3770
|
out.push({
|
|
3543
3771
|
action,
|
|
3544
|
-
outcome: {
|
|
3772
|
+
outcome: {
|
|
3773
|
+
status: "failed",
|
|
3774
|
+
message: err instanceof Error ? err.message : String(err),
|
|
3775
|
+
...reasonCode === void 0 ? {} : { reasonCode }
|
|
3776
|
+
}
|
|
3545
3777
|
});
|
|
3546
3778
|
}
|
|
3547
3779
|
}
|
|
@@ -3648,6 +3880,34 @@ var ManifestApi = class {
|
|
|
3648
3880
|
description: step.description
|
|
3649
3881
|
});
|
|
3650
3882
|
return void 0;
|
|
3883
|
+
case "update-network-policy":
|
|
3884
|
+
await c.network.replacePolicy(step.body);
|
|
3885
|
+
return void 0;
|
|
3886
|
+
case "create-network-segment": {
|
|
3887
|
+
const created = await c.network.createSegment(step.body);
|
|
3888
|
+
resolved.segments.set(step.key, created.id);
|
|
3889
|
+
resolved.segmentVersions.set(step.key, created.version);
|
|
3890
|
+
return void 0;
|
|
3891
|
+
}
|
|
3892
|
+
case "update-network-segment": {
|
|
3893
|
+
const replaced = await c.network.replaceSegment(step.id, step.body);
|
|
3894
|
+
resolved.segmentVersions.set(step.key, replaced.version);
|
|
3895
|
+
return void 0;
|
|
3896
|
+
}
|
|
3897
|
+
case "create-network-profile":
|
|
3898
|
+
await c.network.createProfile({
|
|
3899
|
+
segment_id: lookup(resolved.segments, step.segment, "network segment"),
|
|
3900
|
+
segment_version: lookupVersion(resolved.segmentVersions, step.segment),
|
|
3901
|
+
profile: step.profile
|
|
3902
|
+
});
|
|
3903
|
+
return void 0;
|
|
3904
|
+
case "update-network-profile":
|
|
3905
|
+
await c.network.replaceProfile(lookup(resolved.segments, step.segment, "network segment"), {
|
|
3906
|
+
version: step.version,
|
|
3907
|
+
segment_version: lookupVersion(resolved.segmentVersions, step.segment),
|
|
3908
|
+
profile: step.profile
|
|
3909
|
+
});
|
|
3910
|
+
return void 0;
|
|
3651
3911
|
case "assign-role":
|
|
3652
3912
|
await this.#assign(step, resolved);
|
|
3653
3913
|
return void 0;
|
|
@@ -3785,6 +4045,107 @@ function lookup(map, key, kind) {
|
|
|
3785
4045
|
}
|
|
3786
4046
|
return id;
|
|
3787
4047
|
}
|
|
4048
|
+
function hasShapeSections(manifest) {
|
|
4049
|
+
return [
|
|
4050
|
+
manifest.resources,
|
|
4051
|
+
manifest.permissions,
|
|
4052
|
+
manifest.roles,
|
|
4053
|
+
manifest.groups,
|
|
4054
|
+
manifest.users,
|
|
4055
|
+
manifest.serviceAccounts
|
|
4056
|
+
].some((section) => (section ?? []).length > 0);
|
|
4057
|
+
}
|
|
4058
|
+
function lookupVersion(map, key) {
|
|
4059
|
+
const version = map.get(key);
|
|
4060
|
+
if (version === void 0) {
|
|
4061
|
+
throw new NetworkError(
|
|
4062
|
+
`internal: network segment key ${JSON.stringify(key)} has no version; its segment write did not run`
|
|
4063
|
+
);
|
|
4064
|
+
}
|
|
4065
|
+
return version;
|
|
4066
|
+
}
|
|
4067
|
+
function sameSet(a, b) {
|
|
4068
|
+
if (a.length !== b.length) return false;
|
|
4069
|
+
const left = new Set(a);
|
|
4070
|
+
return left.size === new Set(b).size && b.every((name) => left.has(name));
|
|
4071
|
+
}
|
|
4072
|
+
function sameOptional(stated, read) {
|
|
4073
|
+
return (stated ?? null) === (read ?? null);
|
|
4074
|
+
}
|
|
4075
|
+
function segmentCreateBody(spec) {
|
|
4076
|
+
const body = {
|
|
4077
|
+
kind: spec.kind,
|
|
4078
|
+
site_key: spec.site,
|
|
4079
|
+
name: spec.name,
|
|
4080
|
+
vlan_id: spec.vlanId
|
|
4081
|
+
};
|
|
4082
|
+
if (spec.filterIds !== void 0) body.filter_ids = [...spec.filterIds];
|
|
4083
|
+
if (spec.rank !== void 0 && spec.rank !== null) body.rank = spec.rank;
|
|
4084
|
+
if (spec.enabled !== void 0) body.enabled = spec.enabled;
|
|
4085
|
+
return body;
|
|
4086
|
+
}
|
|
4087
|
+
function segmentDrifted(spec, read) {
|
|
4088
|
+
if (spec.vlanId !== read.vlan_id) return true;
|
|
4089
|
+
if (spec.rank !== void 0 && !sameOptional(spec.rank, read.rank)) return true;
|
|
4090
|
+
if (spec.enabled !== void 0 && spec.enabled !== read.enabled) return true;
|
|
4091
|
+
if (spec.filterIds !== void 0 && !sameSet(spec.filterIds, read.filter_ids)) return true;
|
|
4092
|
+
return false;
|
|
4093
|
+
}
|
|
4094
|
+
function segmentReplaceBody(spec, read) {
|
|
4095
|
+
const body = {
|
|
4096
|
+
version: read.version,
|
|
4097
|
+
vlan_id: spec.vlanId,
|
|
4098
|
+
filter_ids: [...spec.filterIds ?? read.filter_ids],
|
|
4099
|
+
enabled: spec.enabled ?? read.enabled
|
|
4100
|
+
};
|
|
4101
|
+
const rank = spec.rank === void 0 ? read.rank : spec.rank;
|
|
4102
|
+
if (rank !== void 0 && rank !== null) body.rank = rank;
|
|
4103
|
+
return body;
|
|
4104
|
+
}
|
|
4105
|
+
function profileCreateInput(spec) {
|
|
4106
|
+
const profile = { session_timeout_secs: spec.sessionTimeoutSecs };
|
|
4107
|
+
if (spec.terminationAction != null) profile.termination_action = spec.terminationAction;
|
|
4108
|
+
if (spec.idleTimeoutSecs != null) profile.idle_timeout_secs = spec.idleTimeoutSecs;
|
|
4109
|
+
if (spec.filterId != null) profile.filter_id = spec.filterId;
|
|
4110
|
+
if (spec.serviceType != null) profile.service_type = spec.serviceType;
|
|
4111
|
+
return profile;
|
|
4112
|
+
}
|
|
4113
|
+
function profileDrifted(spec, read) {
|
|
4114
|
+
if (spec.sessionTimeoutSecs !== read.session_timeout_secs) return true;
|
|
4115
|
+
if (spec.terminationAction !== void 0 && spec.terminationAction !== null && spec.terminationAction !== read.termination_action) return true;
|
|
4116
|
+
if (spec.idleTimeoutSecs !== void 0 && !sameOptional(spec.idleTimeoutSecs, read.idle_timeout_secs)) return true;
|
|
4117
|
+
if (spec.filterId !== void 0 && !sameOptional(spec.filterId, read.filter_id)) return true;
|
|
4118
|
+
if (spec.serviceType !== void 0 && !sameOptional(spec.serviceType, read.service_type)) return true;
|
|
4119
|
+
return false;
|
|
4120
|
+
}
|
|
4121
|
+
var KNOWN_TERMINATION_ACTIONS = ["default", "radius_request"];
|
|
4122
|
+
var KNOWN_SERVICE_TYPES = ["framed_user"];
|
|
4123
|
+
function refuseUnknownCarried(member, stated, read, known) {
|
|
4124
|
+
if (stated !== void 0 || read == null || known.includes(read)) return;
|
|
4125
|
+
throw new ValidationError(
|
|
4126
|
+
"manifest.plan",
|
|
4127
|
+
400,
|
|
4128
|
+
`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)`,
|
|
4129
|
+
[{ field: member, message: `unknown value ${JSON.stringify(read)} on an unstated member` }]
|
|
4130
|
+
);
|
|
4131
|
+
}
|
|
4132
|
+
function profileReplaceInput(spec, read) {
|
|
4133
|
+
const profile = {
|
|
4134
|
+
dictionary: read.dictionary,
|
|
4135
|
+
session_timeout_secs: spec.sessionTimeoutSecs
|
|
4136
|
+
};
|
|
4137
|
+
refuseUnknownCarried("termination_action", spec.terminationAction, read.termination_action, KNOWN_TERMINATION_ACTIONS);
|
|
4138
|
+
refuseUnknownCarried("service_type", spec.serviceType, read.service_type, KNOWN_SERVICE_TYPES);
|
|
4139
|
+
const termination = spec.terminationAction === void 0 ? read.termination_action : spec.terminationAction;
|
|
4140
|
+
if (termination != null) profile.termination_action = termination;
|
|
4141
|
+
const idle = spec.idleTimeoutSecs === void 0 ? read.idle_timeout_secs : spec.idleTimeoutSecs;
|
|
4142
|
+
if (idle != null) profile.idle_timeout_secs = idle;
|
|
4143
|
+
const filter = spec.filterId === void 0 ? read.filter_id : spec.filterId;
|
|
4144
|
+
if (filter != null) profile.filter_id = filter;
|
|
4145
|
+
const serviceType = spec.serviceType === void 0 ? read.service_type : spec.serviceType;
|
|
4146
|
+
if (serviceType != null) profile.service_type = serviceType;
|
|
4147
|
+
return profile;
|
|
4148
|
+
}
|
|
3788
4149
|
function bindingOf(assignment) {
|
|
3789
4150
|
return {
|
|
3790
4151
|
resourceId: assignment.resource_id ?? void 0,
|
|
@@ -3902,7 +4263,12 @@ function mapManagementError(operation, err) {
|
|
|
3902
4263
|
);
|
|
3903
4264
|
}
|
|
3904
4265
|
if (status === 409) {
|
|
3905
|
-
|
|
4266
|
+
const code = body?.reason_code;
|
|
4267
|
+
return new ConflictError(
|
|
4268
|
+
operation,
|
|
4269
|
+
`${operation}: conflict${detail}`,
|
|
4270
|
+
typeof code === "string" ? code : void 0
|
|
4271
|
+
);
|
|
3906
4272
|
}
|
|
3907
4273
|
if (status === 400 || status === 422) {
|
|
3908
4274
|
return new ValidationError(
|
|
@@ -3912,7 +4278,7 @@ function mapManagementError(operation, err) {
|
|
|
3912
4278
|
parseFieldErrors(body)
|
|
3913
4279
|
);
|
|
3914
4280
|
}
|
|
3915
|
-
return mapHttpStatusToError(status, `${operation}${detail}`, { cause: err });
|
|
4281
|
+
return mapHttpStatusToError(status, `${operation}${detail}`, { cause: err, body });
|
|
3916
4282
|
}
|
|
3917
4283
|
function describe(body) {
|
|
3918
4284
|
if (typeof body === "string" && body) return `: ${body}`;
|
|
@@ -5206,7 +5572,7 @@ var CertificatesApi = class {
|
|
|
5206
5572
|
method: "POST",
|
|
5207
5573
|
pathTemplate: "/api/v1/certificates",
|
|
5208
5574
|
path: "/api/v1/certificates",
|
|
5209
|
-
body
|
|
5575
|
+
body: omitNullMembers(body, ["user_id"])
|
|
5210
5576
|
});
|
|
5211
5577
|
return generatedCertificateFromWire(wire);
|
|
5212
5578
|
}
|
|
@@ -5223,7 +5589,7 @@ var CertificatesApi = class {
|
|
|
5223
5589
|
method: "POST",
|
|
5224
5590
|
pathTemplate: "/api/v1/certificates/sign-csr",
|
|
5225
5591
|
path: "/api/v1/certificates/sign-csr",
|
|
5226
|
-
body
|
|
5592
|
+
body: omitNullMembers(body, ["user_id"])
|
|
5227
5593
|
});
|
|
5228
5594
|
return wire;
|
|
5229
5595
|
}
|
|
@@ -6617,7 +6983,7 @@ var SsfApi = class _SsfApi {
|
|
|
6617
6983
|
method: "POST",
|
|
6618
6984
|
pathTemplate: "/api/v1/tenants/{tenant_id}/ssf/streams",
|
|
6619
6985
|
path: `/api/v1/tenants/${tenantId}/ssf/streams`,
|
|
6620
|
-
body: ssfStreamInputToWire(body)
|
|
6986
|
+
body: omitNullMembers(ssfStreamInputToWire(body), ["expected_updated_at"])
|
|
6621
6987
|
});
|
|
6622
6988
|
return scrubSsfStream(wire);
|
|
6623
6989
|
}
|
|
@@ -6640,8 +7006,19 @@ var SsfApi = class _SsfApi {
|
|
|
6640
7006
|
* update moves `endpoint_url` to another scheme, host or port while a header
|
|
6641
7007
|
* is stored: then it must carry `authorization_header` again or
|
|
6642
7008
|
* `clear_authorization_header: true`, else `400` (§32.3 rule 5). Start from
|
|
6643
|
-
* `
|
|
6644
|
-
*
|
|
7009
|
+
* `ssfStreamInputWith(await ssf.getStream(id), changes)`, which sends the
|
|
7010
|
+
* `events_requested` and `expected_updated_at` it read and cuts
|
|
7011
|
+
* `events_requested` to a lowered `events_allowed` (or from the plain
|
|
7012
|
+
* converter `ssfStreamInputFrom`, where the cut is yours). An update
|
|
7013
|
+
* overtaken by the receiver's own write is `409`: read the stream again.
|
|
7014
|
+
* **`events_requested` has three meanings on an update** (§32.2, contract
|
|
7015
|
+
* 1.62): **absent resets** the stream to every event of `events_allowed` —
|
|
7016
|
+
* widening what the receiver narrowed; **`[]` is stored as the receiver's
|
|
7017
|
+
* "none"** and the stream carries nothing; **a list is stored as given** and
|
|
7018
|
+
* refused (`400`) if any entry is outside `events_allowed`. A raw API client
|
|
7019
|
+
* is bound by the same meaning: an `events_requested` left out of the `PUT`
|
|
7020
|
+
* resets the stream. `expected_updated_at` is the `updated_at` you read, as
|
|
7021
|
+
* the server's own string; an assigned `null` is "none" and is not sent.
|
|
6645
7022
|
*
|
|
6646
7023
|
* **This is a replacement, not a patch** (§27.4 rule 5). Only the required
|
|
6647
7024
|
* members must be set, but what you do not carry over from a prior read is
|
|
@@ -6659,7 +7036,7 @@ var SsfApi = class _SsfApi {
|
|
|
6659
7036
|
method: "PUT",
|
|
6660
7037
|
pathTemplate: "/api/v1/tenants/{tenant_id}/ssf/streams/{stream_id}",
|
|
6661
7038
|
path: `/api/v1/tenants/${tenantId}/ssf/streams/${encodeURIComponent(streamId)}`,
|
|
6662
|
-
body: ssfStreamInputToWire(body)
|
|
7039
|
+
body: omitNullMembers(ssfStreamInputToWire(body), ["expected_updated_at"])
|
|
6663
7040
|
});
|
|
6664
7041
|
return scrubSsfStream(wire);
|
|
6665
7042
|
}
|
|
@@ -6727,7 +7104,7 @@ var ScimTargetsApi = class {
|
|
|
6727
7104
|
method: "POST",
|
|
6728
7105
|
pathTemplate: "/api/v1/scim-targets",
|
|
6729
7106
|
path: "/api/v1/scim-targets",
|
|
6730
|
-
body: scimTargetInputToWire(body)
|
|
7107
|
+
body: omitNullMembers(scimTargetInputToWire(body), ["expected_updated_at"])
|
|
6731
7108
|
});
|
|
6732
7109
|
return scrubScimTargetResponse(wire);
|
|
6733
7110
|
}
|
|
@@ -6774,7 +7151,7 @@ var ScimTargetsApi = class {
|
|
|
6774
7151
|
method: "PUT",
|
|
6775
7152
|
pathTemplate: "/api/v1/scim-targets/{id}",
|
|
6776
7153
|
path: `/api/v1/scim-targets/${encodeURIComponent(id)}`,
|
|
6777
|
-
body: scimTargetInputToWire(body)
|
|
7154
|
+
body: omitNullMembers(scimTargetInputToWire(body), ["expected_updated_at"])
|
|
6778
7155
|
});
|
|
6779
7156
|
return scrubScimTargetResponse(wire);
|
|
6780
7157
|
}
|
|
@@ -6818,6 +7195,215 @@ var ScimTargetsApi = class {
|
|
|
6818
7195
|
}
|
|
6819
7196
|
};
|
|
6820
7197
|
|
|
7198
|
+
// src/management/ops/network.ts
|
|
7199
|
+
var NetworkApi = class {
|
|
7200
|
+
#client;
|
|
7201
|
+
#scope;
|
|
7202
|
+
/** @internal — reached through `client.<namespace>`, never constructed directly. */
|
|
7203
|
+
constructor(client, scope = {}) {
|
|
7204
|
+
this.#client = client;
|
|
7205
|
+
this.#scope = scope;
|
|
7206
|
+
}
|
|
7207
|
+
/** `GET /api/v1/network/segments` */
|
|
7208
|
+
async listSegments(site, page = {}) {
|
|
7209
|
+
const wire = await sendManagement(this.#client, {
|
|
7210
|
+
operation: "network.list_segments",
|
|
7211
|
+
method: "GET",
|
|
7212
|
+
pathTemplate: "/api/v1/network/segments",
|
|
7213
|
+
path: "/api/v1/network/segments",
|
|
7214
|
+
query: { ...pageQuery(page), "site": site }
|
|
7215
|
+
});
|
|
7216
|
+
return wire;
|
|
7217
|
+
}
|
|
7218
|
+
/**
|
|
7219
|
+
* Walk `network.list_segments` to exhaustion, concatenating every page.
|
|
7220
|
+
*
|
|
7221
|
+
* The auto-paging form §27.4 rule 4 requires. It stops on an empty page even
|
|
7222
|
+
* if `total` disagrees, so a misreporting server costs one wasted request
|
|
7223
|
+
* rather than an unbounded loop.
|
|
7224
|
+
*/
|
|
7225
|
+
listSegmentsAll(site, start = {}) {
|
|
7226
|
+
return collectPages(start, (p) => this.listSegments(site, p));
|
|
7227
|
+
}
|
|
7228
|
+
/**
|
|
7229
|
+
* `POST /api/v1/network/segments`
|
|
7230
|
+
*
|
|
7231
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7232
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7233
|
+
*/
|
|
7234
|
+
async createSegment(body) {
|
|
7235
|
+
const wire = await sendManagement(this.#client, {
|
|
7236
|
+
operation: "network.create_segment",
|
|
7237
|
+
method: "POST",
|
|
7238
|
+
pathTemplate: "/api/v1/network/segments",
|
|
7239
|
+
path: "/api/v1/network/segments",
|
|
7240
|
+
body
|
|
7241
|
+
});
|
|
7242
|
+
return wire;
|
|
7243
|
+
}
|
|
7244
|
+
/** `GET /api/v1/network/segments/{id}` */
|
|
7245
|
+
async getSegment(id) {
|
|
7246
|
+
const wire = await sendManagement(this.#client, {
|
|
7247
|
+
operation: "network.get_segment",
|
|
7248
|
+
method: "GET",
|
|
7249
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
7250
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`
|
|
7251
|
+
});
|
|
7252
|
+
return wire;
|
|
7253
|
+
}
|
|
7254
|
+
/**
|
|
7255
|
+
* `PUT /api/v1/network/segments/{id}`
|
|
7256
|
+
*
|
|
7257
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Only the required
|
|
7258
|
+
* members must be set, but what you do not carry over from a prior read is
|
|
7259
|
+
* not preserved: an optional member left out is overwritten with its
|
|
7260
|
+
* default, not kept (except where noted above). Read first, change the field
|
|
7261
|
+
* you mean, send the whole thing back.
|
|
7262
|
+
*
|
|
7263
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7264
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7265
|
+
*/
|
|
7266
|
+
async replaceSegment(id, body) {
|
|
7267
|
+
const wire = await sendManagement(this.#client, {
|
|
7268
|
+
operation: "network.replace_segment",
|
|
7269
|
+
method: "PUT",
|
|
7270
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
7271
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`,
|
|
7272
|
+
body
|
|
7273
|
+
});
|
|
7274
|
+
return wire;
|
|
7275
|
+
}
|
|
7276
|
+
/**
|
|
7277
|
+
* `DELETE /api/v1/network/segments/{id}`
|
|
7278
|
+
*
|
|
7279
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7280
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7281
|
+
*/
|
|
7282
|
+
async deleteSegment(id, version) {
|
|
7283
|
+
await sendManagement(this.#client, {
|
|
7284
|
+
operation: "network.delete_segment",
|
|
7285
|
+
method: "DELETE",
|
|
7286
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
7287
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`,
|
|
7288
|
+
query: { "version": String(version) }
|
|
7289
|
+
});
|
|
7290
|
+
}
|
|
7291
|
+
/** `GET /api/v1/network/profiles` */
|
|
7292
|
+
async listProfiles(page = {}) {
|
|
7293
|
+
const wire = await sendManagement(this.#client, {
|
|
7294
|
+
operation: "network.list_profiles",
|
|
7295
|
+
method: "GET",
|
|
7296
|
+
pathTemplate: "/api/v1/network/profiles",
|
|
7297
|
+
path: "/api/v1/network/profiles",
|
|
7298
|
+
query: { ...pageQuery(page) }
|
|
7299
|
+
});
|
|
7300
|
+
return wire;
|
|
7301
|
+
}
|
|
7302
|
+
/**
|
|
7303
|
+
* Walk `network.list_profiles` to exhaustion, concatenating every page.
|
|
7304
|
+
*
|
|
7305
|
+
* The auto-paging form §27.4 rule 4 requires. It stops on an empty page even
|
|
7306
|
+
* if `total` disagrees, so a misreporting server costs one wasted request
|
|
7307
|
+
* rather than an unbounded loop.
|
|
7308
|
+
*/
|
|
7309
|
+
listProfilesAll(start = {}) {
|
|
7310
|
+
return collectPages(start, (p) => this.listProfiles(p));
|
|
7311
|
+
}
|
|
7312
|
+
/**
|
|
7313
|
+
* `POST /api/v1/network/profiles`
|
|
7314
|
+
*
|
|
7315
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7316
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7317
|
+
*/
|
|
7318
|
+
async createProfile(body) {
|
|
7319
|
+
const wire = await sendManagement(this.#client, {
|
|
7320
|
+
operation: "network.create_profile",
|
|
7321
|
+
method: "POST",
|
|
7322
|
+
pathTemplate: "/api/v1/network/profiles",
|
|
7323
|
+
path: "/api/v1/network/profiles",
|
|
7324
|
+
body
|
|
7325
|
+
});
|
|
7326
|
+
return wire;
|
|
7327
|
+
}
|
|
7328
|
+
/** `GET /api/v1/network/profiles/{segment_id}` */
|
|
7329
|
+
async getProfile(segmentId) {
|
|
7330
|
+
const wire = await sendManagement(this.#client, {
|
|
7331
|
+
operation: "network.get_profile",
|
|
7332
|
+
method: "GET",
|
|
7333
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
7334
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`
|
|
7335
|
+
});
|
|
7336
|
+
return wire;
|
|
7337
|
+
}
|
|
7338
|
+
/**
|
|
7339
|
+
* `PUT /api/v1/network/profiles/{segment_id}`
|
|
7340
|
+
*
|
|
7341
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Every field of the
|
|
7342
|
+
* body is required, and what you do not carry over from a prior read is not
|
|
7343
|
+
* preserved — it is overwritten. Read first, change the field you mean, send
|
|
7344
|
+
* the whole thing back.
|
|
7345
|
+
*
|
|
7346
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7347
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7348
|
+
*/
|
|
7349
|
+
async replaceProfile(segmentId, body) {
|
|
7350
|
+
const wire = await sendManagement(this.#client, {
|
|
7351
|
+
operation: "network.replace_profile",
|
|
7352
|
+
method: "PUT",
|
|
7353
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
7354
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`,
|
|
7355
|
+
body
|
|
7356
|
+
});
|
|
7357
|
+
return wire;
|
|
7358
|
+
}
|
|
7359
|
+
/**
|
|
7360
|
+
* `DELETE /api/v1/network/profiles/{segment_id}`
|
|
7361
|
+
*
|
|
7362
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7363
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7364
|
+
*/
|
|
7365
|
+
async deleteProfile(segmentId, version) {
|
|
7366
|
+
await sendManagement(this.#client, {
|
|
7367
|
+
operation: "network.delete_profile",
|
|
7368
|
+
method: "DELETE",
|
|
7369
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
7370
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`,
|
|
7371
|
+
query: { "version": String(version) }
|
|
7372
|
+
});
|
|
7373
|
+
}
|
|
7374
|
+
/** `GET /api/v1/network/policy` */
|
|
7375
|
+
async getPolicy() {
|
|
7376
|
+
const wire = await sendManagement(this.#client, {
|
|
7377
|
+
operation: "network.get_policy",
|
|
7378
|
+
method: "GET",
|
|
7379
|
+
pathTemplate: "/api/v1/network/policy",
|
|
7380
|
+
path: "/api/v1/network/policy"
|
|
7381
|
+
});
|
|
7382
|
+
return wire;
|
|
7383
|
+
}
|
|
7384
|
+
/**
|
|
7385
|
+
* `PUT /api/v1/network/policy`
|
|
7386
|
+
*
|
|
7387
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Every field of the
|
|
7388
|
+
* body is required, and what you do not carry over from a prior read is not
|
|
7389
|
+
* preserved — it is overwritten. Read first, change the field you mean, send
|
|
7390
|
+
* the whole thing back.
|
|
7391
|
+
*
|
|
7392
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7393
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7394
|
+
*/
|
|
7395
|
+
async replacePolicy(body) {
|
|
7396
|
+
const wire = await sendManagement(this.#client, {
|
|
7397
|
+
operation: "network.replace_policy",
|
|
7398
|
+
method: "PUT",
|
|
7399
|
+
pathTemplate: "/api/v1/network/policy",
|
|
7400
|
+
path: "/api/v1/network/policy",
|
|
7401
|
+
body
|
|
7402
|
+
});
|
|
7403
|
+
return wire;
|
|
7404
|
+
}
|
|
7405
|
+
};
|
|
7406
|
+
|
|
6821
7407
|
// src/management/ops/settings.ts
|
|
6822
7408
|
var SettingsApi = class _SettingsApi {
|
|
6823
7409
|
#client;
|
|
@@ -7442,6 +8028,9 @@ function managementNamespaces(client) {
|
|
|
7442
8028
|
get scimTargets() {
|
|
7443
8029
|
return new ScimTargetsApi(client);
|
|
7444
8030
|
},
|
|
8031
|
+
get network() {
|
|
8032
|
+
return new NetworkApi(client);
|
|
8033
|
+
},
|
|
7445
8034
|
get settings() {
|
|
7446
8035
|
return new SettingsApi(client);
|
|
7447
8036
|
},
|